v0.2.1 c0399be

gtkmain.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5	"github.com/ebitengine/purego"
6
7	"github.com/bnema/puregotk/pkg/core"
8	"github.com/bnema/puregotk/v4/pango"
9)
10
11const (
12	// Use this priority for functionality related to size allocation.
13	//
14	// It is used internally by GTK+ to compute the sizes of widgets.
15	// This priority is higher than %GDK_PRIORITY_REDRAW to avoid
16	// resizing a widget which was just redrawn.
17	PRIORITY_RESIZE int = 110
18)
19
20var xDisablePortals func()
21
22// Prevents GTK from using portals.
23//
24// This is equivalent to setting `GDK_DEBUG=no-portals` in the environment.
25//
26// This should only be used in portal implementations, apps must not call it.
27func DisablePortals() {
28
29	xDisablePortals()
30
31}
32
33var xDisableSetlocale func()
34
35// Prevents [func@Gtk.init] and [func@Gtk.init_check] from calling `setlocale()`.
36//
37// You would want to use this function if you wanted to set the locale for
38// your program to something other than the user’s locale, or if you wanted
39// to set different values for different locale categories.
40//
41// Most programs should not need to call this function.
42func DisableSetlocale() {
43
44	xDisableSetlocale()
45
46}
47
48var xGetDefaultLanguage func() *pango.Language
49
50// Returns the `PangoLanguage` for the default language
51// currently in effect.
52//
53// Note that this can change over the life of an
54// application.
55//
56// The default language is derived from the current
57// locale. It determines, for example, whether GTK uses
58// the right-to-left or left-to-right text direction.
59//
60// This function is equivalent to [func@Pango.Language.get_default].
61// See that function for details.
62func GetDefaultLanguage() *pango.Language {
63
64	cret := xGetDefaultLanguage()
65	return cret
66}
67
68var xGetLocaleDirection func() TextDirection
69
70// Gets the direction of the current locale.
71//
72// This is the expected reading direction for text and UI.
73//
74// This function depends on the current locale being set with
75// `setlocale()` and will default to setting the `GTK_TEXT_DIR_LTR`
76// direction otherwise. `GTK_TEXT_DIR_NONE` will never be returned.
77//
78// GTK sets the default text direction according to the locale during
79// [func@Gtk.init], and you should normally use [method@Gtk.Widget.get_direction]
80// or [func@Gtk.Widget.get_default_direction] to obtain the current direction.
81//
82// This function is only needed rare cases when the locale is
83// changed after GTK has already been initialized. In this case,
84// you can use it to update the default text direction as follows:
85//
86// ```c
87// #include <locale.h>
88//
89// static void
90// update_locale (const char *new_locale)
91//
92//	{
93//	  setlocale (LC_ALL, new_locale);
94//	  gtk_widget_set_default_direction (gtk_get_locale_direction ());
95//	}
96//
97// ```
98func GetLocaleDirection() TextDirection {
99
100	cret := xGetLocaleDirection()
101	return cret
102}
103
104var xInit func()
105
106// Initializes GTK.
107//
108// This function must be called before using any other GTK functions
109// in your GUI applications.
110//
111// It will initialize everything needed to operate the toolkit. In particular,
112// it will open the default display (see [func@Gdk.Display.get_default]).
113//
114// If you are using [class@Gtk.Application], you usually don't have to call this
115// function; the [vfunc@Gio.Application.startup] handler does it for you. Though,
116// if you are using `GApplication` methods that will be invoked before `startup`,
117// such as `local_command_line`, you may need to initialize GTK explicitly.
118//
119// This function will terminate your program if it was unable to initialize
120// the windowing system for some reason. If you want your program to fall back
121// to a textual interface, call [func@Gtk.init_check] instead.
122//
123// GTK calls `signal (SIGPIPE, SIG_IGN)` during initialization, to ignore
124// SIGPIPE signals, since these are almost never wanted in graphical
125// applications. If you do need to handle SIGPIPE for some reason, reset
126// the handler after gtk_init(), but notice that other libraries (e.g.
127// libdbus or gvfs) might do similar things.
128func Init() {
129
130	xInit()
131
132}
133
134var xInitCheck func() bool
135
136// Initializes GTK.
137//
138// This function does the same work as [func@Gtk.init] with only a
139// single change: It does not terminate the program if the windowing
140// system can’t be initialized. Instead it returns false on failure.
141//
142// This way the application can fall back to some other means of
143// communication with the user - for example a curses or command line
144// interface.
145func InitCheck() bool {
146
147	cret := xInitCheck()
148	return cret
149}
150
151var xIsInitialized func() bool
152
153// Returns whether GTK has been initialized.
154//
155// See [func@Gtk.init].
156func IsInitialized() bool {
157
158	cret := xIsInitialized()
159	return cret
160}
161
162func init() {
163	core.SetPackageName("GTK", "gtk4")
164	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
165	var libs []uintptr
166	for _, libPath := range core.GetPaths("GTK") {
167		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
168		if err != nil {
169			panic(err)
170		}
171		libs = append(libs, lib)
172	}
173
174	core.PuregoSafeRegister(&xDisablePortals, libs, "gtk_disable_portals")
175	core.PuregoSafeRegister(&xDisableSetlocale, libs, "gtk_disable_setlocale")
176	core.PuregoSafeRegister(&xGetDefaultLanguage, libs, "gtk_get_default_language")
177	core.PuregoSafeRegister(&xGetLocaleDirection, libs, "gtk_get_locale_direction")
178	core.PuregoSafeRegister(&xInit, libs, "gtk_init")
179	core.PuregoSafeRegister(&xInitCheck, libs, "gtk_init_check")
180	core.PuregoSafeRegister(&xIsInitialized, libs, "gtk_is_initialized")
181
182}

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