v0.2.1 c0399be

gtkurilauncher.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11	"github.com/bnema/puregotk/v4/gio"
12	"github.com/bnema/puregotk/v4/glib"
13	"github.com/bnema/puregotk/v4/gobject"
14	"github.com/bnema/puregotk/v4/gobject/types"
15)
16
17type UriLauncherClass struct {
18	_ structs.HostLayout
19
20	ParentClass gobject.ObjectClass
21}
22
23func (x *UriLauncherClass) GoPointer() uintptr {
24	return uintptr(unsafe.Pointer(x))
25}
26
27// Asynchronous API to open a uri with an application.
28//
29// `GtkUriLauncher` collects the arguments that are needed to open the uri.
30//
31// Depending on system configuration, user preferences and available APIs, this
32// may or may not show an app chooser dialog or launch the default application
33// right away.
34//
35// The operation is started with the [method@Gtk.UriLauncher.launch] function.
36//
37// To launch a file, use [class@Gtk.FileLauncher].
38type UriLauncher struct {
39	gobject.Object
40}
41
42var xUriLauncherGLibType func() types.GType
43
44func UriLauncherGLibType() types.GType {
45	return xUriLauncherGLibType()
46}
47
48func UriLauncherNewFromInternalPtr(ptr uintptr) *UriLauncher {
49	cls := &UriLauncher{}
50	cls.Ptr = ptr
51	return cls
52}
53
54var xNewUriLauncher func(uintptr) uintptr
55
56// Creates a new `GtkUriLauncher` object.
57func NewUriLauncher(UriVar *string) *UriLauncher {
58	var cls *UriLauncher
59
60	UriVarPtr := core.GStrdupNullable(UriVar)
61	defer core.GFreeNullable(UriVarPtr)
62
63	cret := xNewUriLauncher(UriVarPtr)
64
65	if cret == 0 {
66		return nil
67	}
68	cls = &UriLauncher{}
69	cls.Ptr = cret
70	return cls
71}
72
73var xUriLauncherCanLaunch func(uintptr, uintptr) bool
74
75// Returns whether the launcher is likely to succeed
76// in launching an application for its uri.
77//
78// This can be used to disable controls that trigger
79// the launcher when they are known not to work.
80func (x *UriLauncher) CanLaunch(ParentVar *Window) bool {
81
82	cret := xUriLauncherCanLaunch(x.GoPointer(), ParentVar.GoPointer())
83	return cret
84}
85
86var xUriLauncherGetUri func(uintptr) string
87
88// Gets the uri that will be opened.
89func (x *UriLauncher) GetUri() string {
90
91	cret := xUriLauncherGetUri(x.GoPointer())
92	return cret
93}
94
95var xUriLauncherLaunch func(uintptr, uintptr, uintptr, uintptr, uintptr)
96
97// Launches an application to open the uri.
98//
99// This may present an app chooser dialog to the user.
100func (x *UriLauncher) Launch(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
101
102	var CallbackVarRef uintptr
103	if CallbackVar != nil {
104		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
105		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
106			CallbackVarRef = cbRefPtr
107		} else {
108			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
109				cbFn := *CallbackVar
110				cbFn(arg0, arg1, arg2)
111			}
112			CallbackVarRef = purego.NewCallback(fcb)
113			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
114		}
115	}
116
117	xUriLauncherLaunch(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
118
119}
120
121var xUriLauncherLaunchFinish func(uintptr, uintptr, **glib.Error) bool
122
123// Finishes the [method@Gtk.UriLauncher.launch] call and
124// returns the result.
125func (x *UriLauncher) LaunchFinish(ResultVar gio.AsyncResult) (bool, error) {
126	var cerr *glib.Error
127
128	cret := xUriLauncherLaunchFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
129	if cerr == nil {
130		return cret, nil
131	}
132	return cret, cerr
133
134}
135
136var xUriLauncherSetUri func(uintptr, uintptr)
137
138// Sets the uri that will be opened.
139func (x *UriLauncher) SetUri(UriVar *string) {
140
141	UriVarPtr := core.GStrdupNullable(UriVar)
142	defer core.GFreeNullable(UriVarPtr)
143
144	xUriLauncherSetUri(x.GoPointer(), UriVarPtr)
145
146}
147
148func (c *UriLauncher) GoPointer() uintptr {
149	if c == nil {
150		return 0
151	}
152	return c.Ptr
153}
154
155func (c *UriLauncher) SetGoPointer(ptr uintptr) {
156	c.Ptr = ptr
157}
158
159// SetPropertyUri sets the "uri" property.
160// The uri to launch.
161func (x *UriLauncher) SetPropertyUri(value string) {
162	var v gobject.Value
163	v.Init(gobject.TypeStringVal)
164	v.SetString(&value)
165	x.SetProperty("uri", &v)
166}
167
168// GetPropertyUri gets the "uri" property.
169// The uri to launch.
170func (x *UriLauncher) GetPropertyUri() string {
171	var v gobject.Value
172	x.GetProperty("uri", &v)
173	return v.GetString()
174}
175
176func init() {
177	core.SetPackageName("GTK", "gtk4")
178	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
179	var libs []uintptr
180	for _, libPath := range core.GetPaths("GTK") {
181		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
182		if err != nil {
183			panic(err)
184		}
185		libs = append(libs, lib)
186	}
187
188	core.PuregoSafeRegister(&xUriLauncherGLibType, libs, "gtk_uri_launcher_get_type")
189
190	core.PuregoSafeRegister(&xNewUriLauncher, libs, "gtk_uri_launcher_new")
191
192	core.PuregoSafeRegister(&xUriLauncherCanLaunch, libs, "gtk_uri_launcher_can_launch")
193	core.PuregoSafeRegister(&xUriLauncherGetUri, libs, "gtk_uri_launcher_get_uri")
194	core.PuregoSafeRegister(&xUriLauncherLaunch, libs, "gtk_uri_launcher_launch")
195	core.PuregoSafeRegister(&xUriLauncherLaunchFinish, libs, "gtk_uri_launcher_launch_finish")
196	core.PuregoSafeRegister(&xUriLauncherSetUri, libs, "gtk_uri_launcher_set_uri")
197
198}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close