v0.2.2 9100209

gnotification.go RawHistoryFolder

1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
3
4import (
5	"github.com/ebitengine/purego"
6
7	"github.com/bnema/puregotk/pkg/core"
8	"github.com/bnema/puregotk/v4/glib"
9	"github.com/bnema/puregotk/v4/gobject"
10	"github.com/bnema/puregotk/v4/gobject/types"
11)
12
13// `GNotification` is a mechanism for creating a notification to be shown
14// to the user — typically as a pop-up notification presented by the
15// desktop environment shell.
16//
17// The key difference between `GNotification` and other similar APIs is
18// that, if supported by the desktop environment, notifications sent
19// with `GNotification` will persist after the application has exited,
20// and even across system reboots.
21//
22// Since the user may click on a notification while the application is
23// not running, applications using `GNotification` should be able to be
24// started as a D-Bus service, using [class@Gio.Application].
25//
26// In order for `GNotification` to work, the application must have installed
27// a `.desktop` file. For example:
28// ```
29// [Desktop Entry]
30// Name=Test Application
31// Comment=Description of what Test Application does
32// Exec=gnome-test-application
33// Icon=org.gnome.TestApplication
34// Terminal=false
35// Type=Application
36// Categories=GNOME;GTK;TestApplication Category;
37// StartupNotify=true
38// DBusActivatable=true
39// X-GNOME-UsesNotifications=true
40// ```
41//
42// The `X-GNOME-UsesNotifications` key indicates to GNOME Control Center
43// that this application uses notifications, so it can be listed in the
44// Control Center’s ‘Notifications’ panel.
45//
46// The `.desktop` file must be named as `org.gnome.TestApplication.desktop`,
47// where `org.gnome.TestApplication` is the ID passed to
48// [ctor@Gio.Application.new].
49//
50// User interaction with a notification (either the default action, or
51// buttons) must be associated with actions on the application (ie:
52// `app.` actions).  It is not possible to route user interaction
53// through the notification itself, because the object will not exist if
54// the application is autostarted as a result of a notification being
55// clicked.
56//
57// A notification can be sent with [method@Gio.Application.send_notification].
58type Notification struct {
59	gobject.Object
60}
61
62var xNotificationGLibType func() types.GType
63
64func NotificationGLibType() types.GType {
65	return xNotificationGLibType()
66}
67
68func NotificationNewFromInternalPtr(ptr uintptr) *Notification {
69	cls := &Notification{}
70	cls.Ptr = ptr
71	return cls
72}
73
74var xNewNotification func(string) uintptr
75
76// Creates a new #GNotification with @title as its title.
77//
78// After populating @notification with more details, it can be sent to
79// the desktop shell with g_application_send_notification(). Changing
80// any properties after this call will not have any effect until
81// resending @notification.
82func NewNotification(TitleVar string) *Notification {
83	var cls *Notification
84
85	cret := xNewNotification(TitleVar)
86
87	if cret == 0 {
88		return nil
89	}
90	cls = &Notification{}
91	cls.Ptr = cret
92	return cls
93}
94
95var xNotificationAddButton func(uintptr, string, string)
96
97// Adds a button to @notification that activates the action in
98// @detailed_action when clicked. That action must be an
99// application-wide action (starting with "app."). If @detailed_action
100// contains a target, the action will be activated with that target as
101// its parameter.
102//
103// See g_action_parse_detailed_name() for a description of the format
104// for @detailed_action.
105func (x *Notification) AddButton(LabelVar string, DetailedActionVar string) {
106
107	xNotificationAddButton(x.GoPointer(), LabelVar, DetailedActionVar)
108
109}
110
111var xNotificationAddButtonWithTarget func(uintptr, string, string, uintptr, ...interface{})
112
113// Adds a button to @notification that activates @action when clicked.
114// @action must be an application-wide action (it must start with "app.").
115//
116// If @target_format is given, it is used to collect remaining
117// positional parameters into a #GVariant instance, similar to
118// g_variant_new(). @action will be activated with that #GVariant as its
119// parameter.
120func (x *Notification) AddButtonWithTarget(LabelVar string, ActionVar string, TargetFormatVar *string, varArgs ...interface{}) {
121
122	TargetFormatVarPtr := core.GStrdupNullable(TargetFormatVar)
123	defer core.GFreeNullable(TargetFormatVarPtr)
124
125	xNotificationAddButtonWithTarget(x.GoPointer(), LabelVar, ActionVar, TargetFormatVarPtr, varArgs...)
126
127}
128
129var xNotificationAddButtonWithTargetValue func(uintptr, string, string, *glib.Variant)
130
131// Adds a button to @notification that activates @action when clicked.
132// @action must be an application-wide action (it must start with "app.").
133//
134// If @target is non-%NULL, @action will be activated with @target as
135// its parameter.
136func (x *Notification) AddButtonWithTargetValue(LabelVar string, ActionVar string, TargetVar *glib.Variant) {
137
138	xNotificationAddButtonWithTargetValue(x.GoPointer(), LabelVar, ActionVar, TargetVar)
139
140}
141
142var xNotificationSetBody func(uintptr, uintptr)
143
144// Sets the body of @notification to @body.
145func (x *Notification) SetBody(BodyVar *string) {
146
147	BodyVarPtr := core.GStrdupNullable(BodyVar)
148	defer core.GFreeNullable(BodyVarPtr)
149
150	xNotificationSetBody(x.GoPointer(), BodyVarPtr)
151
152}
153
154var xNotificationSetCategory func(uintptr, uintptr)
155
156// Sets the type of @notification to @category. Categories have a main
157// type like `email`, `im` or `device` and can have a detail separated
158// by a `.`, e.g. `im.received` or `email.arrived`. Setting the category
159// helps the notification server to select proper feedback to the user.
160//
161// Standard categories are [listed in the specification](https://specifications.freedesktop.org/notification-spec/latest/ar01s06.html).
162func (x *Notification) SetCategory(CategoryVar *string) {
163
164	CategoryVarPtr := core.GStrdupNullable(CategoryVar)
165	defer core.GFreeNullable(CategoryVarPtr)
166
167	xNotificationSetCategory(x.GoPointer(), CategoryVarPtr)
168
169}
170
171var xNotificationSetDefaultAction func(uintptr, string)
172
173// Sets the default action of @notification to @detailed_action. This
174// action is activated when the notification is clicked on.
175//
176// The action in @detailed_action must be an application-wide action (it
177// must start with "app."). If @detailed_action contains a target, the
178// given action will be activated with that target as its parameter.
179// See g_action_parse_detailed_name() for a description of the format
180// for @detailed_action.
181//
182// When no default action is set, the application that the notification
183// was sent on is activated.
184func (x *Notification) SetDefaultAction(DetailedActionVar string) {
185
186	xNotificationSetDefaultAction(x.GoPointer(), DetailedActionVar)
187
188}
189
190var xNotificationSetDefaultActionAndTarget func(uintptr, string, uintptr, ...interface{})
191
192// Sets the default action of @notification to @action. This action is
193// activated when the notification is clicked on. It must be an
194// application-wide action (it must start with "app.").
195//
196// If @target_format is given, it is used to collect remaining
197// positional parameters into a #GVariant instance, similar to
198// g_variant_new(). @action will be activated with that #GVariant as its
199// parameter.
200//
201// When no default action is set, the application that the notification
202// was sent on is activated.
203func (x *Notification) SetDefaultActionAndTarget(ActionVar string, TargetFormatVar *string, varArgs ...interface{}) {
204
205	TargetFormatVarPtr := core.GStrdupNullable(TargetFormatVar)
206	defer core.GFreeNullable(TargetFormatVarPtr)
207
208	xNotificationSetDefaultActionAndTarget(x.GoPointer(), ActionVar, TargetFormatVarPtr, varArgs...)
209
210}
211
212var xNotificationSetDefaultActionAndTargetValue func(uintptr, string, *glib.Variant)
213
214// Sets the default action of @notification to @action. This action is
215// activated when the notification is clicked on. It must be an
216// application-wide action (start with "app.").
217//
218// If @target is non-%NULL, @action will be activated with @target as
219// its parameter. If @target is floating, it will be consumed.
220//
221// When no default action is set, the application that the notification
222// was sent on is activated.
223func (x *Notification) SetDefaultActionAndTargetValue(ActionVar string, TargetVar *glib.Variant) {
224
225	xNotificationSetDefaultActionAndTargetValue(x.GoPointer(), ActionVar, TargetVar)
226
227}
228
229var xNotificationSetIcon func(uintptr, uintptr)
230
231// Sets the icon of @notification to @icon.
232func (x *Notification) SetIcon(IconVar Icon) {
233
234	xNotificationSetIcon(x.GoPointer(), IconVar.GoPointer())
235
236}
237
238var xNotificationSetPriority func(uintptr, NotificationPriority)
239
240// Sets the priority of @notification to @priority. See
241// #GNotificationPriority for possible values.
242func (x *Notification) SetPriority(PriorityVar NotificationPriority) {
243
244	xNotificationSetPriority(x.GoPointer(), PriorityVar)
245
246}
247
248var xNotificationSetTitle func(uintptr, string)
249
250// Sets the title of @notification to @title.
251func (x *Notification) SetTitle(TitleVar string) {
252
253	xNotificationSetTitle(x.GoPointer(), TitleVar)
254
255}
256
257var xNotificationSetUrgent func(uintptr, bool)
258
259// Deprecated in favor of g_notification_set_priority().
260func (x *Notification) SetUrgent(UrgentVar bool) {
261
262	xNotificationSetUrgent(x.GoPointer(), UrgentVar)
263
264}
265
266func (c *Notification) GoPointer() uintptr {
267	if c == nil {
268		return 0
269	}
270	return c.Ptr
271}
272
273func (c *Notification) SetGoPointer(ptr uintptr) {
274	c.Ptr = ptr
275}
276
277func init() {
278	core.SetPackageName("GIO", "gio-2.0")
279	core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
280	var libs []uintptr
281	for _, libPath := range core.GetPaths("GIO") {
282		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
283		if err != nil {
284			panic(err)
285		}
286		libs = append(libs, lib)
287	}
288
289	core.PuregoSafeRegister(&xNotificationGLibType, libs, "g_notification_get_type")
290
291	core.PuregoSafeRegister(&xNewNotification, libs, "g_notification_new")
292
293	core.PuregoSafeRegister(&xNotificationAddButton, libs, "g_notification_add_button")
294	core.PuregoSafeRegister(&xNotificationAddButtonWithTarget, libs, "g_notification_add_button_with_target")
295	core.PuregoSafeRegister(&xNotificationAddButtonWithTargetValue, libs, "g_notification_add_button_with_target_value")
296	core.PuregoSafeRegister(&xNotificationSetBody, libs, "g_notification_set_body")
297	core.PuregoSafeRegister(&xNotificationSetCategory, libs, "g_notification_set_category")
298	core.PuregoSafeRegister(&xNotificationSetDefaultAction, libs, "g_notification_set_default_action")
299	core.PuregoSafeRegister(&xNotificationSetDefaultActionAndTarget, libs, "g_notification_set_default_action_and_target")
300	core.PuregoSafeRegister(&xNotificationSetDefaultActionAndTargetValue, libs, "g_notification_set_default_action_and_target_value")
301	core.PuregoSafeRegister(&xNotificationSetIcon, libs, "g_notification_set_icon")
302	core.PuregoSafeRegister(&xNotificationSetPriority, libs, "g_notification_set_priority")
303	core.PuregoSafeRegister(&xNotificationSetTitle, libs, "g_notification_set_title")
304	core.PuregoSafeRegister(&xNotificationSetUrgent, libs, "g_notification_set_urgent")
305
306}

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