v0.2.1 c0399be

gsettingsschema.go RawHistoryFolder

1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
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/glib"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// The [struct@Gio.SettingsSchemaSource] and `GSettingsSchema` APIs provide a
16// mechanism for advanced control over the loading of schemas and a
17// mechanism for introspecting their content.
18//
19// Plugin loading systems that wish to provide plugins a way to access
20// settings face the problem of how to make the schemas for these
21// settings visible to GSettings.  Typically, a plugin will want to ship
22// the schema along with itself and it won't be installed into the
23// standard system directories for schemas.
24//
25// [struct@Gio.SettingsSchemaSource] provides a mechanism for dealing with this
26// by allowing the creation of a new ‘schema source’ from which schemas can
27// be acquired.  This schema source can then become part of the metadata
28// associated with the plugin and queried whenever the plugin requires
29// access to some settings.
30//
31// Consider the following example:
32//
33// ```c
34// typedef struct
35//
36//	{
37//	   …
38//	   GSettingsSchemaSource *schema_source;
39//	   …
40//	} Plugin;
41//
42// Plugin *
43// initialise_plugin (const gchar *dir)
44//
45//	{
46//	  Plugin *plugin;
47//
48//	  …
49//
50//	  plugin->schema_source =
51//	    g_settings_schema_source_new_from_directory (dir,
52//	      g_settings_schema_source_get_default (), FALSE, NULL);
53//
54//	  …
55//
56//	  return plugin;
57//	}
58//
59// …
60//
61// GSettings *
62// plugin_get_settings (Plugin      *plugin,
63//
64//	const gchar *schema_id)
65//
66//	{
67//	  GSettingsSchema *schema;
68//
69//	  if (schema_id == NULL)
70//	    schema_id = plugin->identifier;
71//
72//	  schema = g_settings_schema_source_lookup (plugin->schema_source,
73//	                                            schema_id, FALSE);
74//
75//	  if (schema == NULL)
76//	    {
77//	      … disable the plugin or abort, etc …
78//	    }
79//
80//	  return g_settings_new_full (schema, NULL, NULL);
81//	}
82//
83// ```
84//
85// The code above shows how hooks should be added to the code that
86// initialises (or enables) the plugin to create the schema source and
87// how an API can be added to the plugin system to provide a convenient
88// way for the plugin to access its settings, using the schemas that it
89// ships.
90//
91// From the standpoint of the plugin, it would need to ensure that it
92// ships a gschemas.compiled file as part of itself, and then simply do
93// the following:
94//
95// ```c
96//
97//	{
98//	  GSettings *settings;
99//	  gint some_value;
100//
101//	  settings = plugin_get_settings (self, NULL);
102//	  some_value = g_settings_get_int (settings, "some-value");
103//	  …
104//	}
105//
106// ```
107//
108// It's also possible that the plugin system expects the schema source
109// files (ie: `.gschema.xml` files) instead of a `gschemas.compiled` file.
110// In that case, the plugin loading system must compile the schemas for
111// itself before attempting to create the settings source.
112type SettingsSchema struct {
113	_ structs.HostLayout
114}
115
116var xSettingsSchemaGLibType func() types.GType
117
118func SettingsSchemaGLibType() types.GType {
119	return xSettingsSchemaGLibType()
120}
121
122func (x *SettingsSchema) GoPointer() uintptr {
123	return uintptr(unsafe.Pointer(x))
124}
125
126var xSettingsSchemaGetId func(uintptr) string
127
128// Get the ID of @schema.
129func (x *SettingsSchema) GetId() string {
130
131	cret := xSettingsSchemaGetId(x.GoPointer())
132	return cret
133}
134
135var xSettingsSchemaGetKey func(uintptr, string) *SettingsSchemaKey
136
137// Gets the key named @name from @schema.
138//
139// It is a programmer error to request a key that does not exist.  See
140// g_settings_schema_list_keys().
141func (x *SettingsSchema) GetKey(NameVar string) *SettingsSchemaKey {
142
143	cret := xSettingsSchemaGetKey(x.GoPointer(), NameVar)
144	return cret
145}
146
147var xSettingsSchemaGetPath func(uintptr) string
148
149// Gets the path associated with @schema, or %NULL.
150//
151// Schemas may be single-instance or relocatable.  Single-instance
152// schemas correspond to exactly one set of keys in the backend
153// database: those located at the path returned by this function.
154//
155// Relocatable schemas can be referenced by other schemas and can
156// therefore describe multiple sets of keys at different locations.  For
157// relocatable schemas, this function will return %NULL.
158func (x *SettingsSchema) GetPath() string {
159
160	cret := xSettingsSchemaGetPath(x.GoPointer())
161	return cret
162}
163
164var xSettingsSchemaHasKey func(uintptr, string) bool
165
166// Checks if @schema has a key named @name.
167func (x *SettingsSchema) HasKey(NameVar string) bool {
168
169	cret := xSettingsSchemaHasKey(x.GoPointer(), NameVar)
170	return cret
171}
172
173var xSettingsSchemaListChildren func(uintptr) []string
174
175// Gets the list of children in @schema.
176//
177// You should free the return value with g_strfreev() when you are done
178// with it.
179func (x *SettingsSchema) ListChildren() []string {
180
181	cret := xSettingsSchemaListChildren(x.GoPointer())
182	return cret
183}
184
185var xSettingsSchemaListKeys func(uintptr) []string
186
187// Introspects the list of keys on @schema.
188//
189// You should probably not be calling this function from "normal" code
190// (since you should already know what keys are in your schema).  This
191// function is intended for introspection reasons.
192func (x *SettingsSchema) ListKeys() []string {
193
194	cret := xSettingsSchemaListKeys(x.GoPointer())
195	return cret
196}
197
198var xSettingsSchemaRef func(uintptr) *SettingsSchema
199
200// Increase the reference count of @schema, returning a new reference.
201func (x *SettingsSchema) Ref() *SettingsSchema {
202
203	cret := xSettingsSchemaRef(x.GoPointer())
204	return cret
205}
206
207var xSettingsSchemaUnref func(uintptr)
208
209// Decrease the reference count of @schema, possibly freeing it.
210func (x *SettingsSchema) Unref() {
211
212	xSettingsSchemaUnref(x.GoPointer())
213
214}
215
216// #GSettingsSchemaKey is an opaque data structure and can only be accessed
217// using the following functions.
218type SettingsSchemaKey struct {
219	_ structs.HostLayout
220}
221
222var xSettingsSchemaKeyGLibType func() types.GType
223
224func SettingsSchemaKeyGLibType() types.GType {
225	return xSettingsSchemaKeyGLibType()
226}
227
228func (x *SettingsSchemaKey) GoPointer() uintptr {
229	return uintptr(unsafe.Pointer(x))
230}
231
232var xSettingsSchemaKeyGetDefaultValue func(uintptr) *glib.Variant
233
234// Gets the default value for @key.
235//
236// Note that this is the default value according to the schema.  System
237// administrator defaults and lockdown are not visible via this API.
238func (x *SettingsSchemaKey) GetDefaultValue() *glib.Variant {
239
240	cret := xSettingsSchemaKeyGetDefaultValue(x.GoPointer())
241	return cret
242}
243
244var xSettingsSchemaKeyGetDescription func(uintptr) string
245
246// Gets the description for @key.
247//
248// If no description has been provided in the schema for @key, returns
249// %NULL.
250//
251// The description can be one sentence to several paragraphs in length.
252// Paragraphs are delimited with a double newline.  Descriptions can be
253// translated and the value returned from this function is is the
254// current locale.
255//
256// This function is slow.  The summary and description information for
257// the schemas is not stored in the compiled schema database so this
258// function has to parse all of the source XML files in the schema
259// directory.
260func (x *SettingsSchemaKey) GetDescription() string {
261
262	cret := xSettingsSchemaKeyGetDescription(x.GoPointer())
263	return cret
264}
265
266var xSettingsSchemaKeyGetName func(uintptr) string
267
268// Gets the name of @key.
269func (x *SettingsSchemaKey) GetName() string {
270
271	cret := xSettingsSchemaKeyGetName(x.GoPointer())
272	return cret
273}
274
275var xSettingsSchemaKeyGetRange func(uintptr) *glib.Variant
276
277// Queries the range of a key.
278//
279// This function will return a #GVariant that fully describes the range
280// of values that are valid for @key.
281//
282// The type of #GVariant returned is `(sv)`. The string describes
283// the type of range restriction in effect. The type and meaning of
284// the value contained in the variant depends on the string.
285//
286// If the string is `'type'` then the variant contains an empty array.
287// The element type of that empty array is the expected type of value
288// and all values of that type are valid.
289//
290// If the string is `'enum'` then the variant contains an array
291// enumerating the possible values. Each item in the array is
292// a possible valid value and no other values are valid.
293//
294// If the string is `'flags'` then the variant contains an array. Each
295// item in the array is a value that may appear zero or one times in an
296// array to be used as the value for this key. For example, if the
297// variant contained the array `['x', 'y']` then the valid values for
298// the key would be `[]`, `['x']`, `['y']`, `['x', 'y']` and
299// `['y', 'x']`.
300//
301// Finally, if the string is `'range'` then the variant contains a pair
302// of like-typed values -- the minimum and maximum permissible values
303// for this key.
304//
305// This information should not be used by normal programs.  It is
306// considered to be a hint for introspection purposes.  Normal programs
307// should already know what is permitted by their own schema.  The
308// format may change in any way in the future -- but particularly, new
309// forms may be added to the possibilities described above.
310//
311// You should free the returned value with g_variant_unref() when it is
312// no longer needed.
313func (x *SettingsSchemaKey) GetRange() *glib.Variant {
314
315	cret := xSettingsSchemaKeyGetRange(x.GoPointer())
316	return cret
317}
318
319var xSettingsSchemaKeyGetSummary func(uintptr) string
320
321// Gets the summary for @key.
322//
323// If no summary has been provided in the schema for @key, returns
324// %NULL.
325//
326// The summary is a short description of the purpose of the key; usually
327// one short sentence.  Summaries can be translated and the value
328// returned from this function is is the current locale.
329//
330// This function is slow.  The summary and description information for
331// the schemas is not stored in the compiled schema database so this
332// function has to parse all of the source XML files in the schema
333// directory.
334func (x *SettingsSchemaKey) GetSummary() string {
335
336	cret := xSettingsSchemaKeyGetSummary(x.GoPointer())
337	return cret
338}
339
340var xSettingsSchemaKeyGetValueType func(uintptr) *glib.VariantType
341
342// Gets the #GVariantType of @key.
343func (x *SettingsSchemaKey) GetValueType() *glib.VariantType {
344
345	cret := xSettingsSchemaKeyGetValueType(x.GoPointer())
346	return cret
347}
348
349var xSettingsSchemaKeyRangeCheck func(uintptr, *glib.Variant) bool
350
351// Checks if the given @value is within the
352// permitted range for @key.
353//
354// It is a programmer error if @value is not of the correct type — you
355// must check for this first.
356func (x *SettingsSchemaKey) RangeCheck(ValueVar *glib.Variant) bool {
357
358	cret := xSettingsSchemaKeyRangeCheck(x.GoPointer(), ValueVar)
359	return cret
360}
361
362var xSettingsSchemaKeyRef func(uintptr) *SettingsSchemaKey
363
364// Increase the reference count of @key, returning a new reference.
365func (x *SettingsSchemaKey) Ref() *SettingsSchemaKey {
366
367	cret := xSettingsSchemaKeyRef(x.GoPointer())
368	return cret
369}
370
371var xSettingsSchemaKeyUnref func(uintptr)
372
373// Decrease the reference count of @key, possibly freeing it.
374func (x *SettingsSchemaKey) Unref() {
375
376	xSettingsSchemaKeyUnref(x.GoPointer())
377
378}
379
380// This is an opaque structure type.  You may not access it directly.
381type SettingsSchemaSource struct {
382	_ structs.HostLayout
383}
384
385var xSettingsSchemaSourceGLibType func() types.GType
386
387func SettingsSchemaSourceGLibType() types.GType {
388	return xSettingsSchemaSourceGLibType()
389}
390
391func (x *SettingsSchemaSource) GoPointer() uintptr {
392	return uintptr(unsafe.Pointer(x))
393}
394
395var xNewSettingsSchemaSourceFromDirectory func(string, *SettingsSchemaSource, bool, **glib.Error) *SettingsSchemaSource
396
397// Attempts to create a new schema source corresponding to the contents
398// of the given directory.
399//
400// This function is not required for normal uses of #GSettings but it
401// may be useful to authors of plugin management systems.
402//
403// The directory should contain a file called `gschemas.compiled` as
404// produced by the [glib-compile-schemas][glib-compile-schemas] tool.
405//
406// If @trusted is %TRUE then `gschemas.compiled` is trusted not to be
407// corrupted. This assumption has a performance advantage, but can result
408// in crashes or inconsistent behaviour in the case of a corrupted file.
409// Generally, you should set @trusted to %TRUE for files installed by the
410// system and to %FALSE for files in the home directory.
411//
412// In either case, an empty file or some types of corruption in the file will
413// result in %G_FILE_ERROR_INVAL being returned.
414//
415// If @parent is non-%NULL then there are two effects.
416//
417// First, if g_settings_schema_source_lookup() is called with the
418// @recursive flag set to %TRUE and the schema can not be found in the
419// source, the lookup will recurse to the parent.
420//
421// Second, any references to other schemas specified within this
422// source (ie: `child` or `extends`) references may be resolved
423// from the @parent.
424//
425// For this second reason, except in very unusual situations, the
426// @parent should probably be given as the default schema source, as
427// returned by g_settings_schema_source_get_default().
428func NewSettingsSchemaSourceFromDirectory(DirectoryVar string, ParentVar *SettingsSchemaSource, TrustedVar bool) (*SettingsSchemaSource, error) {
429	var cerr *glib.Error
430
431	cret := xNewSettingsSchemaSourceFromDirectory(DirectoryVar, ParentVar, TrustedVar, &cerr)
432	if cerr == nil {
433		return cret, nil
434	}
435	return cret, cerr
436
437}
438
439var xSettingsSchemaSourceListSchemas func(uintptr, bool, *[]string, *[]string)
440
441// Lists the schemas in a given source.
442//
443// If @recursive is %TRUE then include parent sources.  If %FALSE then
444// only include the schemas from one source (ie: one directory).  You
445// probably want %TRUE.
446//
447// Non-relocatable schemas are those for which you can call
448// g_settings_new().  Relocatable schemas are those for which you must
449// use g_settings_new_with_path().
450//
451// Do not call this function from normal programs.  This is designed for
452// use by database editors, commandline tools, etc.
453func (x *SettingsSchemaSource) ListSchemas(RecursiveVar bool, NonRelocatableVar *[]string, RelocatableVar *[]string) {
454
455	xSettingsSchemaSourceListSchemas(x.GoPointer(), RecursiveVar, NonRelocatableVar, RelocatableVar)
456
457}
458
459var xSettingsSchemaSourceLookup func(uintptr, string, bool) *SettingsSchema
460
461// Looks up a schema with the identifier @schema_id in @source.
462//
463// This function is not required for normal uses of #GSettings but it
464// may be useful to authors of plugin management systems or to those who
465// want to introspect the content of schemas.
466//
467// If the schema isn't found directly in @source and @recursive is %TRUE
468// then the parent sources will also be checked.
469//
470// If the schema isn't found, %NULL is returned.
471func (x *SettingsSchemaSource) Lookup(SchemaIdVar string, RecursiveVar bool) *SettingsSchema {
472
473	cret := xSettingsSchemaSourceLookup(x.GoPointer(), SchemaIdVar, RecursiveVar)
474	return cret
475}
476
477var xSettingsSchemaSourceRef func(uintptr) *SettingsSchemaSource
478
479// Increase the reference count of @source, returning a new reference.
480func (x *SettingsSchemaSource) Ref() *SettingsSchemaSource {
481
482	cret := xSettingsSchemaSourceRef(x.GoPointer())
483	return cret
484}
485
486var xSettingsSchemaSourceUnref func(uintptr)
487
488// Decrease the reference count of @source, possibly freeing it.
489func (x *SettingsSchemaSource) Unref() {
490
491	xSettingsSchemaSourceUnref(x.GoPointer())
492
493}
494
495var xSettingsSchemaSourceGetDefault func() *SettingsSchemaSource
496
497// Gets the default system schema source.
498//
499// This function is not required for normal uses of #GSettings but it
500// may be useful to authors of plugin management systems or to those who
501// want to introspect the content of schemas.
502//
503// If no schemas are installed, %NULL will be returned.
504//
505// The returned source may actually consist of multiple schema sources
506// from different directories, depending on which directories were given
507// in `XDG_DATA_DIRS` and `GSETTINGS_SCHEMA_DIR`. For this reason, all
508// lookups performed against the default source should probably be done
509// recursively.
510func SettingsSchemaSourceGetDefault() *SettingsSchemaSource {
511
512	cret := xSettingsSchemaSourceGetDefault()
513	return cret
514}
515
516func init() {
517	core.SetPackageName("GIO", "gio-2.0")
518	core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
519	var libs []uintptr
520	for _, libPath := range core.GetPaths("GIO") {
521		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
522		if err != nil {
523			panic(err)
524		}
525		libs = append(libs, lib)
526	}
527
528	core.PuregoSafeRegister(&xSettingsSchemaSourceGetDefault, libs, "g_settings_schema_source_get_default")
529
530	core.PuregoSafeRegister(&xSettingsSchemaGLibType, libs, "g_settings_schema_get_type")
531
532	core.PuregoSafeRegister(&xSettingsSchemaGetId, libs, "g_settings_schema_get_id")
533	core.PuregoSafeRegister(&xSettingsSchemaGetKey, libs, "g_settings_schema_get_key")
534	core.PuregoSafeRegister(&xSettingsSchemaGetPath, libs, "g_settings_schema_get_path")
535	core.PuregoSafeRegister(&xSettingsSchemaHasKey, libs, "g_settings_schema_has_key")
536	core.PuregoSafeRegister(&xSettingsSchemaListChildren, libs, "g_settings_schema_list_children")
537	core.PuregoSafeRegister(&xSettingsSchemaListKeys, libs, "g_settings_schema_list_keys")
538	core.PuregoSafeRegister(&xSettingsSchemaRef, libs, "g_settings_schema_ref")
539	core.PuregoSafeRegister(&xSettingsSchemaUnref, libs, "g_settings_schema_unref")
540
541	core.PuregoSafeRegister(&xSettingsSchemaKeyGLibType, libs, "g_settings_schema_key_get_type")
542
543	core.PuregoSafeRegister(&xSettingsSchemaKeyGetDefaultValue, libs, "g_settings_schema_key_get_default_value")
544	core.PuregoSafeRegister(&xSettingsSchemaKeyGetDescription, libs, "g_settings_schema_key_get_description")
545	core.PuregoSafeRegister(&xSettingsSchemaKeyGetName, libs, "g_settings_schema_key_get_name")
546	core.PuregoSafeRegister(&xSettingsSchemaKeyGetRange, libs, "g_settings_schema_key_get_range")
547	core.PuregoSafeRegister(&xSettingsSchemaKeyGetSummary, libs, "g_settings_schema_key_get_summary")
548	core.PuregoSafeRegister(&xSettingsSchemaKeyGetValueType, libs, "g_settings_schema_key_get_value_type")
549	core.PuregoSafeRegister(&xSettingsSchemaKeyRangeCheck, libs, "g_settings_schema_key_range_check")
550	core.PuregoSafeRegister(&xSettingsSchemaKeyRef, libs, "g_settings_schema_key_ref")
551	core.PuregoSafeRegister(&xSettingsSchemaKeyUnref, libs, "g_settings_schema_key_unref")
552
553	core.PuregoSafeRegister(&xSettingsSchemaSourceGLibType, libs, "g_settings_schema_source_get_type")
554
555	core.PuregoSafeRegister(&xNewSettingsSchemaSourceFromDirectory, libs, "g_settings_schema_source_new_from_directory")
556
557	core.PuregoSafeRegister(&xSettingsSchemaSourceListSchemas, libs, "g_settings_schema_source_list_schemas")
558	core.PuregoSafeRegister(&xSettingsSchemaSourceLookup, libs, "g_settings_schema_source_lookup")
559	core.PuregoSafeRegister(&xSettingsSchemaSourceRef, libs, "g_settings_schema_source_ref")
560	core.PuregoSafeRegister(&xSettingsSchemaSourceUnref, libs, "g_settings_schema_source_unref")
561
562}

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