object-introspection-1.30.0 support.
[girtod.git] / gtk2 / gio2.d
blob32df4a5834fc0b4d159aa5d8fca07d58951eee19
1 // *** DO NOT EDIT ***
2 // Automatically generated from "/usr/share/gir-1.0/Gio-2.0.gir"
4 module Gio2;
5 public import gtk2.glib2;
6 alias gtk2.glib2 GLib2;
7 public import gtk2.gobject2;
8 alias gtk2.gobject2 GObject2;
10 // package: "gio-2.0";
12 // package: "gio-unix-2.0";
13 // C header: "/sw/x86/gtk2/glib-2.30.2/include/gio-unix-2.0/gio/gdesktopappinfo.h";
14 // C header: "/sw/x86/gtk2/glib-2.30.2/include/gio-unix-2.0/gio/gfiledescriptorbased.h";
15 // C header: "/sw/x86/gtk2/glib-2.30.2/include/gio-unix-2.0/gio/gunixconnection.h";
16 // C header: "/sw/x86/gtk2/glib-2.30.2/include/gio-unix-2.0/gio/gunixcredentialsmessage.h";
17 // C header: "/sw/x86/gtk2/glib-2.30.2/include/gio-unix-2.0/gio/gunixfdlist.h";
18 // C header: "/sw/x86/gtk2/glib-2.30.2/include/gio-unix-2.0/gio/gunixfdmessage.h";
19 // C header: "/sw/x86/gtk2/glib-2.30.2/include/gio-unix-2.0/gio/gunixinputstream.h";
20 // C header: "/sw/x86/gtk2/glib-2.30.2/include/gio-unix-2.0/gio/gunixmounts.h";
21 // C header: "/sw/x86/gtk2/glib-2.30.2/include/gio-unix-2.0/gio/gunixoutputstream.h";
22 // C header: "/sw/x86/gtk2/glib-2.30.2/include/gio-unix-2.0/gio/gunixsocketaddress.h";
23 // C header: "gio/gio.h";
25 // c:symbol-prefixes: ["g"]
26 // c:identifier-prefixes: ["G"]
28 // module Gio2;
31 // #GAction represents a single named action.
32 //
33 // The main interface to an action is that it can be activated with
34 // g_action_activate(). This results in the 'activate' signal being
35 // emitted. An activation has a #GVariant parameter (which may be
36 // %NULL). The correct type for the parameter is determined by a static
37 // parameter type (which is given at construction time).
38 //
39 // An action may optionally have a state, in which case the state may be
40 // set with g_action_change_state(). This call takes a #GVariant. The
41 // correct type for the state is determined by a static state type
42 // (which is given at construction time).
43 //
44 // The state may have a hint associated with it, specifying its valid
45 // range.
46 //
47 // #GAction is merely the interface to the concept of an action, as
48 // described above. Various implementations of actions exist, including
49 // #GSimpleAction and #GtkAction.
50 //
51 // In all cases, the implementing class is responsible for storing the
52 // name of the action, the parameter type, the enabled state, the
53 // optional state type and the state and emitting the appropriate
54 // signals when these change. The implementor responsible for filtering
55 // calls to g_action_activate() and g_action_change_state() for type
56 // safety and for the state being enabled.
57 //
58 // Probably the only useful thing to do with a #GAction is to put it
59 // inside of a #GSimpleActionGroup.
60 struct Action {
62 // Activates the action.
63 //
64 // @parameter must be the correct type of parameter for the action (ie:
65 // the parameter type given at construction time). If the parameter
66 // type was %NULL then @parameter must also be %NULL.
67 // <parameter>: the parameter to the activation
68 void activate(GLib2.Variant* parameter=null) {
69 g_action_activate(&this, parameter);
72 // Request for the state of @action to be changed to @value.
73 //
74 // The action must be stateful and @value must be of the correct type.
75 // See g_action_get_state_type().
76 //
77 // This call merely requests a change. The action may refuse to change
78 // its state or may change its state to something other than @value.
79 // See g_action_get_state_hint().
80 //
81 // If the @value GVariant is floating, it is consumed.
82 // <value>: the new state
83 void change_state(GLib2.Variant* value) {
84 g_action_change_state(&this, value);
87 // Checks if @action is currently enabled.
88 //
89 // An action must be enabled in order to be activated or in order to
90 // have its state changed from outside callers.
91 // RETURNS: whether the action is enabled
92 int get_enabled() {
93 return g_action_get_enabled(&this);
96 // Queries the name of @action.
97 // RETURNS: the name of the action
98 char* get_name() {
99 return g_action_get_name(&this);
102 // Queries the type of the parameter that must be given when activating
103 // @action.
105 // When activating the action using g_action_activate(), the #GVariant
106 // given to that function must be of the type returned by this function.
108 // In the case that this function returns %NULL, you must not give any
109 // #GVariant, but %NULL instead.
110 // RETURNS: the parameter type
111 GLib2.VariantType* get_parameter_type() {
112 return g_action_get_parameter_type(&this);
115 // Queries the current state of @action.
117 // If the action is not stateful then %NULL will be returned. If the
118 // action is stateful then the type of the return value is the type
119 // given by g_action_get_state_type().
121 // The return value (if non-%NULL) should be freed with
122 // g_variant_unref() when it is no longer required.
123 // RETURNS: the current state of the action
124 GLib2.Variant* /*new*/ get_state() {
125 return g_action_get_state(&this);
128 // Requests a hint about the valid range of values for the state of
129 // @action.
131 // If %NULL is returned it either means that the action is not stateful
132 // or that there is no hint about the valid range of values for the
133 // state of the action.
135 // If a #GVariant array is returned then each item in the array is a
136 // possible value for the state. If a #GVariant pair (ie: two-tuple) is
137 // returned then the tuple specifies the inclusive lower and upper bound
138 // of valid values for the state.
140 // In any case, the information is merely a hint. It may be possible to
141 // have a state value outside of the hinted range and setting a value
142 // within the range may fail.
144 // The return value (if non-%NULL) should be freed with
145 // g_variant_unref() when it is no longer required.
146 // RETURNS: the state range hint
147 GLib2.Variant* /*new*/ get_state_hint() {
148 return g_action_get_state_hint(&this);
151 // Queries the type of the state of @action.
153 // If the action is stateful (e.g. created with
154 // g_simple_action_new_stateful()) then this function returns the
155 // #GVariantType of the state. This is the type of the initial value
156 // given as the state. All calls to g_action_change_state() must give a
157 // #GVariant of this type and g_action_get_state() will return a
158 // #GVariant of the same type.
160 // If the action is not stateful (e.g. created with g_simple_action_new())
161 // then this function will return %NULL. In that case, g_action_get_state()
162 // will return %NULL and you must not call g_action_change_state().
163 // RETURNS: the state type, if the action is stateful
164 GLib2.VariantType* get_state_type() {
165 return g_action_get_state_type(&this);
170 // This struct defines a single action. It is for use with
171 // g_simple_action_group_add_entries().
173 // The order of the items in the structure are intended to reflect
174 // frequency of use. It is permissible to use an incomplete initialiser
175 // in order to leave some of the later values as %NULL. All values
176 // after @name are optional. Additional optional fields may be added in
177 // the future.
179 // See g_simple_action_group_add_entries() for an example.
180 struct ActionEntry {
181 char* name;
182 extern (C) void function (SimpleAction* action, GLib2.Variant* parameter, void* user_data) activate;
183 char* parameter_type, state;
184 extern (C) void function (SimpleAction* action, GLib2.Variant* value, void* user_data) change_state;
185 private size_t[3] padding;
189 // #GActionGroup represents a group of actions.
191 // Each action in the group has a unique name (which is a string). All
192 // method calls, except g_action_group_list_actions() take the name of
193 // an action as an argument.
195 // The #GActionGroup API is meant to be the 'public' API to the action
196 // group. The calls here are exactly the interaction that 'external
197 // forces' (eg: UI, incoming D-Bus messages, etc.) are supposed to have
198 // with actions. 'Internal' APIs (ie: ones meant only to be accessed by
199 // the action group implementation) are found on subclasses. This is
200 // why you will find -- for example -- g_action_group_get_action_enabled()
201 // but not an equivalent <function>set()</function> call.
203 // Signals are emitted on the action group in response to state changes
204 // on individual actions.
205 struct ActionGroup {
207 // Emits the #GActionGroup::action-added signal on @action_group.
209 // This function should only be called by #GActionGroup implementations.
210 // <action_name>: the name of an action in the group
211 void action_added(char* action_name) {
212 g_action_group_action_added(&this, action_name);
215 // Emits the #GActionGroup::action-enabled-changed signal on @action_group.
217 // This function should only be called by #GActionGroup implementations.
218 // <action_name>: the name of an action in the group
219 // <enabled>: whether or not the action is now enabled
220 void action_enabled_changed(char* action_name, int enabled) {
221 g_action_group_action_enabled_changed(&this, action_name, enabled);
224 // Emits the #GActionGroup::action-removed signal on @action_group.
226 // This function should only be called by #GActionGroup implementations.
227 // <action_name>: the name of an action in the group
228 void action_removed(char* action_name) {
229 g_action_group_action_removed(&this, action_name);
232 // Emits the #GActionGroup::action-state-changed signal on @action_group.
234 // This function should only be called by #GActionGroup implementations.
235 // <action_name>: the name of an action in the group
236 // <state>: the new state of the named action
237 void action_state_changed(char* action_name, GLib2.Variant* state) {
238 g_action_group_action_state_changed(&this, action_name, state);
241 // Activate the named action within @action_group.
243 // If the action is expecting a parameter, then the correct type of
244 // parameter must be given as @parameter. If the action is expecting no
245 // parameters then @parameter must be %NULL. See
246 // g_action_group_get_action_parameter_type().
247 // <action_name>: the name of the action to activate
248 // <parameter>: parameters to the activation
249 void activate_action(char* action_name, GLib2.Variant* parameter=null) {
250 g_action_group_activate_action(&this, action_name, parameter);
253 // Request for the state of the named action within @action_group to be
254 // changed to @value.
256 // The action must be stateful and @value must be of the correct type.
257 // See g_action_group_get_action_state_type().
259 // This call merely requests a change. The action may refuse to change
260 // its state or may change its state to something other than @value.
261 // See g_action_group_get_action_state_hint().
263 // If the @value GVariant is floating, it is consumed.
264 // <action_name>: the name of the action to request the change on
265 // <value>: the new state
266 void change_action_state(char* action_name, GLib2.Variant* value) {
267 g_action_group_change_action_state(&this, action_name, value);
270 // Checks if the named action within @action_group is currently enabled.
272 // An action must be enabled in order to be activated or in order to
273 // have its state changed from outside callers.
274 // RETURNS: whether or not the action is currently enabled
275 // <action_name>: the name of the action to query
276 int get_action_enabled(char* action_name) {
277 return g_action_group_get_action_enabled(&this, action_name);
280 // Queries the type of the parameter that must be given when activating
281 // the named action within @action_group.
283 // When activating the action using g_action_group_activate_action(),
284 // the #GVariant given to that function must be of the type returned
285 // by this function.
287 // In the case that this function returns %NULL, you must not give any
288 // #GVariant, but %NULL instead.
290 // The parameter type of a particular action will never change but it is
291 // possible for an action to be removed and for a new action to be added
292 // with the same name but a different parameter type.
293 // RETURNS: the parameter type
294 // <action_name>: the name of the action to query
295 GLib2.VariantType* get_action_parameter_type(char* action_name) {
296 return g_action_group_get_action_parameter_type(&this, action_name);
299 // Queries the current state of the named action within @action_group.
301 // If the action is not stateful then %NULL will be returned. If the
302 // action is stateful then the type of the return value is the type
303 // given by g_action_group_get_action_state_type().
305 // The return value (if non-%NULL) should be freed with
306 // g_variant_unref() when it is no longer required.
307 // RETURNS: the current state of the action
308 // <action_name>: the name of the action to query
309 GLib2.Variant* /*new*/ get_action_state(char* action_name) {
310 return g_action_group_get_action_state(&this, action_name);
313 // Requests a hint about the valid range of values for the state of the
314 // named action within @action_group.
316 // If %NULL is returned it either means that the action is not stateful
317 // or that there is no hint about the valid range of values for the
318 // state of the action.
320 // If a #GVariant array is returned then each item in the array is a
321 // possible value for the state. If a #GVariant pair (ie: two-tuple) is
322 // returned then the tuple specifies the inclusive lower and upper bound
323 // of valid values for the state.
325 // In any case, the information is merely a hint. It may be possible to
326 // have a state value outside of the hinted range and setting a value
327 // within the range may fail.
329 // The return value (if non-%NULL) should be freed with
330 // g_variant_unref() when it is no longer required.
331 // RETURNS: the state range hint
332 // <action_name>: the name of the action to query
333 GLib2.Variant* /*new*/ get_action_state_hint(char* action_name) {
334 return g_action_group_get_action_state_hint(&this, action_name);
337 // Queries the type of the state of the named action within
338 // @action_group.
340 // If the action is stateful then this function returns the
341 // #GVariantType of the state. All calls to
342 // g_action_group_change_action_state() must give a #GVariant of this
343 // type and g_action_group_get_action_state() will return a #GVariant
344 // of the same type.
346 // If the action is not stateful then this function will return %NULL.
347 // In that case, g_action_group_get_action_state() will return %NULL
348 // and you must not call g_action_group_change_action_state().
350 // The state type of a particular action will never change but it is
351 // possible for an action to be removed and for a new action to be added
352 // with the same name but a different state type.
353 // RETURNS: the state type, if the action is stateful
354 // <action_name>: the name of the action to query
355 GLib2.VariantType* /*new*/ get_action_state_type(char* action_name) {
356 return g_action_group_get_action_state_type(&this, action_name);
359 // Checks if the named action exists within @action_group.
360 // RETURNS: whether the named action exists
361 // <action_name>: the name of the action to check for
362 int has_action(char* action_name) {
363 return g_action_group_has_action(&this, action_name);
366 // Lists the actions contained within @action_group.
368 // The caller is responsible for freeing the list with g_strfreev() when
369 // it is no longer required.
371 // actions in the groupb
372 // RETURNS: a %NULL-terminated array of the names of the
373 char** /*new*/ list_actions() {
374 return g_action_group_list_actions(&this);
377 // Signals that a new action was just added to the group.
378 // This signal is emitted after the action has been added
379 // and is now visible.
380 // <action_name>: the name of the action in @action_group
381 extern (C) alias static void function (ActionGroup* this_, char* action_name, void* user_data=null) signal_action_added;
383 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
384 return super_.signal_connect!name(cb, data, cf);
387 ulong signal_connect(string name:"action-added", CB:signal_action_added)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
388 return signal_connect_data(&this, cast(char*)"action-added",
389 cast(GObject2.Callback)cb, data, null, cf);
392 // Signals that the enabled status of the named action has changed.
393 // <action_name>: the name of the action in @action_group
394 // <enabled>: whether the action is enabled or not
395 extern (C) alias static void function (ActionGroup* this_, char* action_name, c_int enabled, void* user_data=null) signal_action_enabled_changed;
396 ulong signal_connect(string name:"action-enabled-changed", CB:signal_action_enabled_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
397 return signal_connect_data(&this, cast(char*)"action-enabled-changed",
398 cast(GObject2.Callback)cb, data, null, cf);
401 // Signals that an action is just about to be removed from the group.
402 // This signal is emitted before the action is removed, so the action
403 // is still visible and can be queried from the signal handler.
404 // <action_name>: the name of the action in @action_group
405 extern (C) alias static void function (ActionGroup* this_, char* action_name, void* user_data=null) signal_action_removed;
406 ulong signal_connect(string name:"action-removed", CB:signal_action_removed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
407 return signal_connect_data(&this, cast(char*)"action-removed",
408 cast(GObject2.Callback)cb, data, null, cf);
411 // Signals that the state of the named action has changed.
412 // <action_name>: the name of the action in @action_group
413 // <value>: the new value of the state
414 extern (C) alias static void function (ActionGroup* this_, char* action_name, GLib2.Variant* value, void* user_data=null) signal_action_state_changed;
415 ulong signal_connect(string name:"action-state-changed", CB:signal_action_state_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
416 return signal_connect_data(&this, cast(char*)"action-state-changed",
417 cast(GObject2.Callback)cb, data, null, cf);
421 // The virtual function table for #GActionGroup.
422 struct ActionGroupInterface /* Version 2.28 */ {
423 GObject2.TypeInterface g_iface;
425 // RETURNS: whether the named action exists
426 // <action_name>: the name of the action to check for
427 extern (C) int function (ActionGroup* action_group, char* action_name) has_action;
428 // RETURNS: a %NULL-terminated array of the names of the
429 extern (C) char** /*new*/ function (ActionGroup* action_group) list_actions;
431 // RETURNS: whether or not the action is currently enabled
432 // <action_name>: the name of the action to query
433 extern (C) int function (ActionGroup* action_group, char* action_name) get_action_enabled;
435 // RETURNS: the parameter type
436 // <action_name>: the name of the action to query
437 extern (C) GLib2.VariantType* function (ActionGroup* action_group, char* action_name) get_action_parameter_type;
439 // RETURNS: the state type, if the action is stateful
440 // <action_name>: the name of the action to query
441 extern (C) GLib2.VariantType* /*new*/ function (ActionGroup* action_group, char* action_name) get_action_state_type;
443 // RETURNS: the state range hint
444 // <action_name>: the name of the action to query
445 extern (C) GLib2.Variant* /*new*/ function (ActionGroup* action_group, char* action_name) get_action_state_hint;
447 // RETURNS: the current state of the action
448 // <action_name>: the name of the action to query
449 extern (C) GLib2.Variant* /*new*/ function (ActionGroup* action_group, char* action_name) get_action_state;
451 // <action_name>: the name of the action to request the change on
452 // <value>: the new state
453 extern (C) void function (ActionGroup* action_group, char* action_name, GLib2.Variant* value) change_action_state;
455 // <action_name>: the name of the action to activate
456 // <parameter>: parameters to the activation
457 extern (C) void function (ActionGroup* action_group, char* action_name, GLib2.Variant* parameter=null) activate_action;
458 // <action_name>: the name of an action in the group
459 extern (C) void function (ActionGroup* action_group, char* action_name) action_added;
460 // <action_name>: the name of an action in the group
461 extern (C) void function (ActionGroup* action_group, char* action_name) action_removed;
463 // <action_name>: the name of an action in the group
464 // <enabled>: whether or not the action is now enabled
465 extern (C) void function (ActionGroup* action_group, char* action_name, int enabled) action_enabled_changed;
467 // <action_name>: the name of an action in the group
468 // <state>: the new state of the named action
469 extern (C) void function (ActionGroup* action_group, char* action_name, GLib2.Variant* state) action_state_changed;
472 struct ActionInterface /* Version 2.28 */ {
473 GObject2.TypeInterface g_iface;
474 // RETURNS: the name of the action
475 extern (C) char* function (Action* action) get_name;
476 // RETURNS: the parameter type
477 extern (C) GLib2.VariantType* function (Action* action) get_parameter_type;
478 // RETURNS: the state type, if the action is stateful
479 extern (C) GLib2.VariantType* function (Action* action) get_state_type;
480 // RETURNS: the state range hint
481 extern (C) GLib2.Variant* /*new*/ function (Action* action) get_state_hint;
482 // RETURNS: whether the action is enabled
483 extern (C) int function (Action* action) get_enabled;
484 // RETURNS: the current state of the action
485 extern (C) GLib2.Variant* /*new*/ function (Action* action) get_state;
486 // <value>: the new state
487 extern (C) void function (Action* action, GLib2.Variant* value) change_state;
488 // <parameter>: the parameter to the activation
489 extern (C) void function (Action* action, GLib2.Variant* parameter=null) activate;
493 // #GAppInfo and #GAppLaunchContext are used for describing and launching
494 // applications installed on the system.
496 // As of GLib 2.20, URIs will always be converted to POSIX paths
497 // (using g_file_get_path()) when using g_app_info_launch() even if
498 // the application requested an URI and not a POSIX path. For example
499 // for an desktop-file based application with Exec key <literal>totem
500 // &percnt;U</literal> and a single URI,
501 // <literal>sftp://foo/file.avi</literal>, then
502 // <literal>/home/user/.gvfs/sftp on foo/file.avi</literal> will be
503 // passed. This will only work if a set of suitable GIO extensions
504 // (such as gvfs 2.26 compiled with FUSE support), is available and
505 // operational; if this is not the case, the URI will be passed
506 // unmodified to the application. Some URIs, such as
507 // <literal>mailto:</literal>, of course cannot be mapped to a POSIX
508 // path (in gvfs there's no FUSE mount for it); such URIs will be
509 // passed unmodified to the application.
511 // Specifically for gvfs 2.26 and later, the POSIX URI will be mapped
512 // back to the GIO URI in the #GFile constructors (since gvfs
513 // implements the #GVfs extension point). As such, if the application
514 // needs to examine the URI, it needs to use g_file_get_uri() or
515 // similar on #GFile. In other words, an application cannot assume
516 // that the URI passed to e.g. g_file_new_for_commandline_arg() is
517 // equal to the result of g_file_get_uri(). The following snippet
518 // illustrates this:
520 // <programlisting>
521 // GFile *f;
522 // char *uri;
524 // file = g_file_new_for_commandline_arg (uri_from_commandline);
526 // uri = g_file_get_uri (file);
527 // strcmp (uri, uri_from_commandline) == 0; // FALSE
528 // g_free (uri);
530 // if (g_file_has_uri_scheme (file, "cdda"))
531 // {
532 // // do something special with uri
533 // }
534 // g_object_unref (file);
535 // </programlisting>
537 // This code will work when both <literal>cdda://sr0/Track
538 // 1.wav</literal> and <literal>/home/user/.gvfs/cdda on sr0/Track
539 // 1.wav</literal> is passed to the application. It should be noted
540 // that it's generally not safe for applications to rely on the format
541 // of a particular URIs. Different launcher applications (e.g. file
542 // managers) may have different ideas of what a given URI means.
543 struct AppInfo {
545 // Creates a new #GAppInfo from the given information.
546 // RETURNS: new #GAppInfo for given command.
547 // <commandline>: the commandline to use
548 // <application_name>: the application name, or %NULL to use @commandline
549 // <flags>: flags that can specify details of the created #GAppInfo
550 static AppInfo* /*new*/ create_from_commandline(char* commandline, char* application_name, AppInfoCreateFlags flags, GLib2.Error** error=null) {
551 return g_app_info_create_from_commandline(commandline, application_name, flags, error);
554 // Gets a list of all of the applications currently registered
555 // on this system.
557 // For desktop files, this includes applications that have
558 // <literal>NoDisplay=true</literal> set or are excluded from
559 // display by means of <literal>OnlyShowIn</literal> or
560 // <literal>NotShowIn</literal>. See g_app_info_should_show().
561 // The returned list does not include applications which have
562 // the <literal>Hidden</literal> key set.
563 // RETURNS: a newly allocated #GList of references to #GAppInfo<!---->s.
564 static GLib2.List* /*new*/ get_all() {
565 return g_app_info_get_all();
568 // Gets a list of all #GAppInfos for a given content type.
570 // for given @content_type or %NULL on error.
571 // RETURNS: #GList of #GAppInfos
572 // <content_type>: the content type to find a #GAppInfo for
573 static GLib2.List* /*new*/ get_all_for_type(char* content_type) {
574 return g_app_info_get_all_for_type(content_type);
577 // Gets the #GAppInfo that corresponds to a given content type.
579 // %NULL on error.
580 // RETURNS: #GAppInfo for given @content_type or
581 // <content_type>: the content type to find a #GAppInfo for
582 // <must_support_uris>: if %TRUE, the #GAppInfo is expected to support URIs
583 static AppInfo* /*new*/ get_default_for_type(char* content_type, int must_support_uris) {
584 return g_app_info_get_default_for_type(content_type, must_support_uris);
587 // Gets the default application for launching applications
588 // using this URI scheme. A URI scheme is the initial part
589 // of the URI, up to but not including the ':', e.g. "http",
590 // "ftp" or "sip".
591 // RETURNS: #GAppInfo for given @uri_scheme or %NULL on error.
592 // <uri_scheme>: a string containing a URI scheme.
593 static AppInfo* /*new*/ get_default_for_uri_scheme(char* uri_scheme) {
594 return g_app_info_get_default_for_uri_scheme(uri_scheme);
597 // Gets a list of fallback #GAppInfos for a given content type, i.e.
598 // those applications which claim to support the given content type
599 // by MIME type subclassing and not directly.
601 // for given @content_type or %NULL on error.
602 // RETURNS: #GList of #GAppInfos
603 // <content_type>: the content type to find a #GAppInfo for
604 static GLib2.List* /*new*/ get_fallback_for_type(char* content_type) {
605 return g_app_info_get_fallback_for_type(content_type);
608 // Gets a list of recommended #GAppInfos for a given content type, i.e.
609 // those applications which claim to support the given content type exactly,
610 // and not by MIME type subclassing.
611 // Note that the first application of the list is the last used one, i.e.
612 // the last one for which #g_app_info_set_as_last_used_for_type has been
613 // called.
615 // for given @content_type or %NULL on error.
616 // RETURNS: #GList of #GAppInfos
617 // <content_type>: the content type to find a #GAppInfo for
618 static GLib2.List* /*new*/ get_recommended_for_type(char* content_type) {
619 return g_app_info_get_recommended_for_type(content_type);
622 // Utility function that launches the default application
623 // registered to handle the specified uri. Synchronous I/O
624 // is done on the uri to detect the type of the file if
625 // required.
626 // RETURNS: %TRUE on success, %FALSE on error.
627 // <uri>: the uri to show
628 // <launch_context>: an optional #GAppLaunchContext.
629 static int launch_default_for_uri(char* uri, AppLaunchContext* launch_context, GLib2.Error** error=null) {
630 return g_app_info_launch_default_for_uri(uri, launch_context, error);
633 // Removes all changes to the type associations done by
634 // g_app_info_set_as_default_for_type(),
635 // g_app_info_set_as_default_for_extension(),
636 // g_app_info_add_supports_type() or g_app_info_remove_supports_type().
637 // <content_type>: a content type
638 static void reset_type_associations(char* content_type) {
639 g_app_info_reset_type_associations(content_type);
642 // Adds a content type to the application information to indicate the
643 // application is capable of opening files with the given content type.
644 // RETURNS: %TRUE on success, %FALSE on error.
645 // <content_type>: a string.
646 int add_supports_type(char* content_type, GLib2.Error** error=null) {
647 return g_app_info_add_supports_type(&this, content_type, error);
650 // Obtains the information whether the #GAppInfo can be deleted.
651 // See g_app_info_delete().
652 // RETURNS: %TRUE if @appinfo can be deleted
653 int can_delete() {
654 return g_app_info_can_delete(&this);
657 // Checks if a supported content type can be removed from an application.
659 // content types from a given @appinfo, %FALSE if not.
660 // RETURNS: %TRUE if it is possible to remove supported
661 int can_remove_supports_type() {
662 return g_app_info_can_remove_supports_type(&this);
665 // Tries to delete a #GAppInfo.
667 // On some platforms, there may be a difference between user-defined
668 // #GAppInfo<!-- -->s which can be deleted, and system-wide ones which
669 // cannot. See g_app_info_can_delete().
670 // RETURNS: %TRUE if @appinfo has been deleted
671 int delete_() {
672 return g_app_info_delete(&this);
675 // Creates a duplicate of a #GAppInfo.
676 // RETURNS: a duplicate of @appinfo.
677 AppInfo* /*new*/ dup() {
678 return g_app_info_dup(&this);
681 // Checks if two #GAppInfo<!-- -->s are equal.
682 // RETURNS: %TRUE if @appinfo1 is equal to @appinfo2. %FALSE otherwise.
683 // <appinfo2>: the second #GAppInfo.
684 int equal(AppInfo* appinfo2) {
685 return g_app_info_equal(&this, appinfo2);
688 // Gets the commandline with which the application will be
689 // started.
691 // or %NULL if this information is not available
692 // RETURNS: a string containing the @appinfo's commandline,
693 char* get_commandline() {
694 return g_app_info_get_commandline(&this);
697 // Gets a human-readable description of an installed application.
699 // application @appinfo, or %NULL if none.
700 // RETURNS: a string containing a description of the
701 char* get_description() {
702 return g_app_info_get_description(&this);
705 // Gets the display name of the application. The display name is often more
706 // descriptive to the user than the name itself.
708 // no display name is available.
709 // RETURNS: the display name of the application for @appinfo, or the name if
710 char* get_display_name() {
711 return g_app_info_get_display_name(&this);
714 // Gets the executable's name for the installed application.
716 // binaries name
717 // RETURNS: a string containing the @appinfo's application
718 char* get_executable() {
719 return g_app_info_get_executable(&this);
722 // Gets the icon for the application.
723 // RETURNS: the default #GIcon for @appinfo.
724 Icon* get_icon() {
725 return g_app_info_get_icon(&this);
728 // Gets the ID of an application. An id is a string that
729 // identifies the application. The exact format of the id is
730 // platform dependent. For instance, on Unix this is the
731 // desktop file id from the xdg menu specification.
733 // Note that the returned ID may be %NULL, depending on how
734 // the @appinfo has been constructed.
735 // RETURNS: a string containing the application's ID.
736 char* get_id() {
737 return g_app_info_get_id(&this);
740 // Gets the installed name of the application.
741 // RETURNS: the name of the application for @appinfo.
742 char* get_name() {
743 return g_app_info_get_name(&this);
746 // Launches the application. Passes @files to the launched application
747 // as arguments, using the optional @launch_context to get information
748 // about the details of the launcher (like what screen it is on).
749 // On error, @error will be set accordingly.
751 // To launch the application without arguments pass a %NULL @files list.
753 // Note that even if the launch is successful the application launched
754 // can fail to start if it runs into problems during startup. There is
755 // no way to detect this.
757 // Some URIs can be changed when passed through a GFile (for instance
758 // unsupported uris with strange formats like mailto:), so if you have
759 // a textual uri you want to pass in as argument, consider using
760 // g_app_info_launch_uris() instead.
762 // On UNIX, this function sets the <envar>GIO_LAUNCHED_DESKTOP_FILE</envar>
763 // environment variable with the path of the launched desktop file and
764 // <envar>GIO_LAUNCHED_DESKTOP_FILE_PID</envar> to the process
765 // id of the launched process. This can be used to ignore
766 // <envar>GIO_LAUNCHED_DESKTOP_FILE</envar>, should it be inherited
767 // by further processes. The <envar>DISPLAY</envar> and
768 // <envar>DESKTOP_STARTUP_ID</envar> environment variables are also
769 // set, based on information provided in @launch_context.
770 // RETURNS: %TRUE on successful launch, %FALSE otherwise.
771 // <files>: a #GList of #GFile objects
772 // <launch_context>: a #GAppLaunchContext or %NULL
773 int launch(GLib2.List* files, AppLaunchContext* launch_context, GLib2.Error** error=null) {
774 return g_app_info_launch(&this, files, launch_context, error);
777 // Launches the application. This passes the @uris to the launched application
778 // as arguments, using the optional @launch_context to get information
779 // about the details of the launcher (like what screen it is on).
780 // On error, @error will be set accordingly.
782 // To launch the application without arguments pass a %NULL @uris list.
784 // Note that even if the launch is successful the application launched
785 // can fail to start if it runs into problems during startup. There is
786 // no way to detect this.
787 // RETURNS: %TRUE on successful launch, %FALSE otherwise.
788 // <uris>: a #GList containing URIs to launch.
789 // <launch_context>: a #GAppLaunchContext or %NULL
790 int launch_uris(GLib2.List* uris, AppLaunchContext* launch_context, GLib2.Error** error=null) {
791 return g_app_info_launch_uris(&this, uris, launch_context, error);
794 // Removes a supported type from an application, if possible.
795 // RETURNS: %TRUE on success, %FALSE on error.
796 // <content_type>: a string.
797 int remove_supports_type(char* content_type, GLib2.Error** error=null) {
798 return g_app_info_remove_supports_type(&this, content_type, error);
801 // Sets the application as the default handler for the given file extension.
802 // RETURNS: %TRUE on success, %FALSE on error.
803 // <extension>: a string containing the file extension (without the dot).
804 int set_as_default_for_extension(char* extension, GLib2.Error** error=null) {
805 return g_app_info_set_as_default_for_extension(&this, extension, error);
808 // Sets the application as the default handler for a given type.
809 // RETURNS: %TRUE on success, %FALSE on error.
810 // <content_type>: the content type.
811 int set_as_default_for_type(char* content_type, GLib2.Error** error=null) {
812 return g_app_info_set_as_default_for_type(&this, content_type, error);
815 // Sets the application as the last used application for a given type.
816 // This will make the application appear as first in the list returned
817 // by g_app_info_get_recommended_for_type(), regardless of the default
818 // application for that content type.
819 // RETURNS: %TRUE on success, %FALSE on error.
820 // <content_type>: the content type.
821 int set_as_last_used_for_type(char* content_type, GLib2.Error** error=null) {
822 return g_app_info_set_as_last_used_for_type(&this, content_type, error);
825 // Checks if the application info should be shown in menus that
826 // list available applications.
827 // RETURNS: %TRUE if the @appinfo should be shown, %FALSE otherwise.
828 int should_show() {
829 return g_app_info_should_show(&this);
832 // Checks if the application accepts files as arguments.
833 // RETURNS: %TRUE if the @appinfo supports files.
834 int supports_files() {
835 return g_app_info_supports_files(&this);
838 // Checks if the application supports reading files and directories from URIs.
839 // RETURNS: %TRUE if the @appinfo supports URIs.
840 int supports_uris() {
841 return g_app_info_supports_uris(&this);
845 // Flags used when creating a #GAppInfo.
846 enum AppInfoCreateFlags {
847 NONE = 0,
848 NEEDS_TERMINAL = 1,
849 SUPPORTS_URIS = 2,
850 SUPPORTS_STARTUP_NOTIFICATION = 4
852 // Application Information interface, for operating system portability.
853 struct AppInfoIface {
854 GObject2.TypeInterface g_iface;
855 // RETURNS: a duplicate of @appinfo.
856 extern (C) AppInfo* /*new*/ function (AppInfo* appinfo) dup;
858 // RETURNS: %TRUE if @appinfo1 is equal to @appinfo2. %FALSE otherwise.
859 // <appinfo2>: the second #GAppInfo.
860 extern (C) int function (AppInfo* appinfo1, AppInfo* appinfo2) equal;
861 // RETURNS: a string containing the application's ID.
862 extern (C) char* function (AppInfo* appinfo) get_id;
863 // RETURNS: the name of the application for @appinfo.
864 extern (C) char* function (AppInfo* appinfo) get_name;
865 // RETURNS: a string containing a description of the
866 extern (C) char* function (AppInfo* appinfo) get_description;
867 // RETURNS: a string containing the @appinfo's application
868 extern (C) char* function (AppInfo* appinfo) get_executable;
869 // RETURNS: the default #GIcon for @appinfo.
870 extern (C) Icon* function (AppInfo* appinfo) get_icon;
872 // RETURNS: %TRUE on successful launch, %FALSE otherwise.
873 // <files>: a #GList of #GFile objects
874 // <launch_context>: a #GAppLaunchContext or %NULL
875 extern (C) int function (AppInfo* appinfo, GLib2.List* files, AppLaunchContext* launch_context, GLib2.Error** error=null) launch;
876 // RETURNS: %TRUE if the @appinfo supports URIs.
877 extern (C) int function (AppInfo* appinfo) supports_uris;
878 // RETURNS: %TRUE if the @appinfo supports files.
879 extern (C) int function (AppInfo* appinfo) supports_files;
881 // RETURNS: %TRUE on successful launch, %FALSE otherwise.
882 // <uris>: a #GList containing URIs to launch.
883 // <launch_context>: a #GAppLaunchContext or %NULL
884 extern (C) int function (AppInfo* appinfo, GLib2.List* uris, AppLaunchContext* launch_context, GLib2.Error** error=null) launch_uris;
885 // RETURNS: %TRUE if the @appinfo should be shown, %FALSE otherwise.
886 extern (C) int function (AppInfo* appinfo) should_show;
888 // RETURNS: %TRUE on success, %FALSE on error.
889 // <content_type>: the content type.
890 extern (C) int function (AppInfo* appinfo, char* content_type, GLib2.Error** error=null) set_as_default_for_type;
892 // RETURNS: %TRUE on success, %FALSE on error.
893 // <extension>: a string containing the file extension (without the dot).
894 extern (C) int function (AppInfo* appinfo, char* extension, GLib2.Error** error=null) set_as_default_for_extension;
896 // RETURNS: %TRUE on success, %FALSE on error.
897 // <content_type>: a string.
898 extern (C) int function (AppInfo* appinfo, char* content_type, GLib2.Error** error=null) add_supports_type;
899 // RETURNS: %TRUE if it is possible to remove supported
900 extern (C) int function (AppInfo* appinfo) can_remove_supports_type;
902 // RETURNS: %TRUE on success, %FALSE on error.
903 // <content_type>: a string.
904 extern (C) int function (AppInfo* appinfo, char* content_type, GLib2.Error** error=null) remove_supports_type;
905 // RETURNS: %TRUE if @appinfo can be deleted
906 extern (C) int function (AppInfo* appinfo) can_delete;
907 // RETURNS: %TRUE if @appinfo has been deleted
908 extern (C) int function (AppInfo* appinfo) do_delete;
909 // RETURNS: a string containing the @appinfo's commandline,
910 extern (C) char* function (AppInfo* appinfo) get_commandline;
911 // RETURNS: the display name of the application for @appinfo, or the name if
912 extern (C) char* function (AppInfo* appinfo) get_display_name;
914 // RETURNS: %TRUE on success, %FALSE on error.
915 // <content_type>: the content type.
916 extern (C) int function (AppInfo* appinfo, char* content_type, GLib2.Error** error=null) set_as_last_used_for_type;
920 // Integrating the launch with the launching application. This is used to
921 // handle for instance startup notification and launching the new application
922 // on the same screen as the launching window.
923 struct AppLaunchContext /* : GObject.Object */ {
924 alias parent_instance this;
925 alias parent_instance super_;
926 alias parent_instance object;
927 GObject2.Object parent_instance;
928 private AppLaunchContextPrivate* priv;
931 // Creates a new application launch context. This is not normally used,
932 // instead you instantiate a subclass of this, such as #GdkAppLaunchContext.
933 // RETURNS: a #GAppLaunchContext.
934 static AppLaunchContext* /*new*/ new_() {
935 return g_app_launch_context_new();
938 // Gets the display string for the @context. This is used to ensure new
939 // applications are started on the same display as the launching
940 // application, by setting the <envar>DISPLAY</envar> environment variable.
941 // RETURNS: a display string for the display.
942 // <info>: a #GAppInfo
943 // <files>: a #GList of #GFile objects
944 char* /*new*/ get_display(AppInfo* info, GLib2.List* files) {
945 return g_app_launch_context_get_display(&this, info, files);
948 // Initiates startup notification for the application and returns the
949 // <envar>DESKTOP_STARTUP_ID</envar> for the launched operation,
950 // if supported.
952 // Startup notification IDs are defined in the <ulink
953 // url="http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt">
954 // FreeDesktop.Org Startup Notifications standard</ulink>.
956 // not supported.
957 // RETURNS: a startup notification ID for the application, or %NULL if
958 // <info>: a #GAppInfo
959 // <files>: a #GList of of #GFile objects
960 char* /*new*/ get_startup_notify_id(AppInfo* info, GLib2.List* files) {
961 return g_app_launch_context_get_startup_notify_id(&this, info, files);
964 // Called when an application has failed to launch, so that it can cancel
965 // the application startup notification started in g_app_launch_context_get_startup_notify_id().
966 // <startup_notify_id>: the startup notification id that was returned by g_app_launch_context_get_startup_notify_id().
967 void launch_failed(char* startup_notify_id) {
968 g_app_launch_context_launch_failed(&this, startup_notify_id);
972 struct AppLaunchContextClass {
973 GObject2.ObjectClass parent_class;
975 // RETURNS: a display string for the display.
976 // <info>: a #GAppInfo
977 // <files>: a #GList of #GFile objects
978 extern (C) char* /*new*/ function (AppLaunchContext* context, AppInfo* info, GLib2.List* files) get_display;
980 // RETURNS: a startup notification ID for the application, or %NULL if
981 // <info>: a #GAppInfo
982 // <files>: a #GList of of #GFile objects
983 extern (C) char* /*new*/ function (AppLaunchContext* context, AppInfo* info, GLib2.List* files) get_startup_notify_id;
984 // <startup_notify_id>: the startup notification id that was returned by g_app_launch_context_get_startup_notify_id().
985 extern (C) void function (AppLaunchContext* context, char* startup_notify_id) launch_failed;
986 extern (C) void function () _g_reserved1;
987 extern (C) void function () _g_reserved2;
988 extern (C) void function () _g_reserved3;
989 extern (C) void function () _g_reserved4;
990 extern (C) void function () _g_reserved5;
993 struct AppLaunchContextPrivate {
997 // A #GApplication is the foundation of an application, unique for a
998 // given application identifier. The GApplication class wraps some
999 // low-level platform-specific services and is intended to act as the
1000 // foundation for higher-level application classes such as
1001 // #GtkApplication or #MxApplication. In general, you should not use
1002 // this class outside of a higher level framework.
1004 // One of the core features that GApplication provides is process
1005 // uniqueness, in the context of a "session". The session concept is
1006 // platform-dependent, but corresponds roughly to a graphical desktop
1007 // login. When your application is launched again, its arguments
1008 // are passed through platform communication to the already running
1009 // program. The already running instance of the program is called the
1010 // <firstterm>primary instance</firstterm>.
1012 // Before using GApplication, you must choose an "application identifier".
1013 // The expected form of an application identifier is very close to that of
1014 // of a <ulink url="http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-interface">DBus bus name</ulink>.
1015 // Examples include: "com.example.MyApp", "org.example.internal-apps.Calculator".
1016 // For details on valid application identifiers, see
1017 // g_application_id_is_valid().
1019 // The application identifier is claimed by the application as a
1020 // well-known bus name on the user's session bus. This means that the
1021 // uniqueness of your application is scoped to the current session. It
1022 // also means that your application may provide additional services
1023 // (through registration of other object paths) at that bus name.
1025 // The registration of these object paths should be done with the shared
1026 // GDBus session bus. Note that due to the internal architecture of
1027 // GDBus, method calls can be dispatched at any time (even if a main
1028 // loop is not running). For this reason, you must ensure that any
1029 // object paths that you wish to register are registered before
1030 // #GApplication attempts to acquire the bus name of your application
1031 // (which happens in g_application_register()). Unfortunately, this
1032 // means that you cannot use g_application_get_is_remote() to decide if
1033 // you want to register object paths.
1035 // GApplication provides convenient life cycle management by maintaining
1036 // a <firstterm>use count</firstterm> for the primary application instance.
1037 // The use count can be changed using g_application_hold() and
1038 // g_application_release(). If it drops to zero, the application exits.
1040 // GApplication also implements the #GActionGroup interface and lets you
1041 // easily export actions by adding them with g_application_set_action_group().
1042 // When invoking an action by calling g_action_group_activate_action() on
1043 // the application, it is always invoked in the primary instance.
1045 // There is a number of different entry points into a #GApplication:
1046 // <itemizedlist>
1047 // <listitem>via 'Activate' (i.e. just starting the application)</listitem>
1048 // <listitem>via 'Open' (i.e. opening some files)</listitem>
1049 // <listitem>by handling a command-line</listitem>
1050 // <listitem>via activating an action</listitem>
1051 // </itemizedlist>
1052 // The #GApplication::startup signal lets you handle the application
1053 // initialization for all of these in a single place.
1055 // Regardless of which of these entry points is used to start the application,
1056 // GApplication passes some <firstterm id="platform-data">platform
1057 // data</firstterm> from the launching instance to the primary instance,
1058 // in the form of a #GVariant dictionary mapping strings to variants.
1059 // To use platform data, override the @before_emit or @after_emit virtual
1060 // functions in your #GApplication subclass. When dealing with
1061 // #GApplicationCommandline objects, the platform data is directly
1062 // available via g_application_command_line_get_cwd(),
1063 // g_application_command_line_get_environ() and
1064 // g_application_command_line_get_platform_data().
1066 // As the name indicates, the platform data may vary depending on the
1067 // operating system, but it always includes the current directory (key
1068 // "cwd"), and optionally the environment (ie the set of environment
1069 // variables and their values) of the calling process (key "environ").
1070 // The environment is only added to the platform data if the
1071 // #G_APPLICATION_SEND_ENVIONMENT flag is set. GApplication subclasses
1072 // can add their own platform data by overriding the @add_platform_data
1073 // virtual function. For instance, #GtkApplication adds startup notification
1074 // data in this way.
1076 // To parse commandline arguments you may handle the
1077 // #GApplication::command-line signal or override the local_command_line()
1078 // vfunc, to parse them in either the primary instance or the local instance,
1079 // respectively.
1081 // <example id="gapplication-example-open"><title>Opening files with a GApplication</title>
1082 // <programlisting>
1083 // <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gapplication-example-open.c">
1084 // <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback>
1085 // </xi:include>
1086 // </programlisting>
1087 // </example>
1089 // <example id="gapplication-example-actions"><title>A GApplication with actions</title>
1090 // <programlisting>
1091 // <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gapplication-example-actions.c">
1092 // <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback>
1093 // </xi:include>
1094 // </programlisting>
1095 // </example>
1096 struct Application /* : GObject.Object */ /* Version 2.28 */ {
1097 alias parent_instance this;
1098 alias parent_instance super_;
1099 alias parent_instance object;
1100 GObject2.Object parent_instance;
1101 private ApplicationPrivate* priv;
1104 // Creates a new #GApplication instance.
1106 // This function calls g_type_init() for you.
1108 // The application id must be valid. See g_application_id_is_valid().
1109 // RETURNS: a new #GApplication instance
1110 // <application_id>: the application id
1111 // <flags>: the application flags
1112 static Application* /*new*/ new_(char* application_id, ApplicationFlags flags) {
1113 return g_application_new(application_id, flags);
1116 // Checks if @application_id is a valid application identifier.
1118 // A valid ID is required for calls to g_application_new() and
1119 // g_application_set_application_id().
1121 // For convenience, the restrictions on application identifiers are
1122 // reproduced here:
1123 // <itemizedlist>
1124 // <listitem>Application identifiers must contain only the ASCII characters "[A-Z][a-z][0-9]_-." and must not begin with a digit.</listitem>
1125 // <listitem>Application identifiers must contain at least one '.' (period) character (and thus at least three elements).</listitem>
1126 // <listitem>Application identifiers must not begin or end with a '.' (period) character.</listitem>
1127 // <listitem>Application identifiers must not contain consecutive '.' (period) characters.</listitem>
1128 // <listitem>Application identifiers must not exceed 255 characters.</listitem>
1129 // </itemizedlist>
1130 // RETURNS: %TRUE if @application_id is valid
1131 // <application_id>: a potential application identifier
1132 static int id_is_valid(char* application_id) {
1133 return g_application_id_is_valid(application_id);
1136 // Activates the application.
1138 // In essence, this results in the #GApplication::activate() signal being
1139 // emitted in the primary instance.
1141 // The application must be registered before calling this function.
1142 void activate() {
1143 g_application_activate(&this);
1146 // Gets the unique identifier for @application.
1147 // RETURNS: the identifier for @application, owned by @application
1148 char* get_application_id() {
1149 return g_application_get_application_id(&this);
1152 // Gets the flags for @application.
1154 // See #GApplicationFlags.
1155 // RETURNS: the flags for @application
1156 ApplicationFlags get_flags() {
1157 return g_application_get_flags(&this);
1160 // Gets the current inactivity timeout for the application.
1162 // This is the amount of time (in milliseconds) after the last call to
1163 // g_application_release() before the application stops running.
1164 // RETURNS: the timeout, in milliseconds
1165 uint get_inactivity_timeout() {
1166 return g_application_get_inactivity_timeout(&this);
1169 // Checks if @application is registered.
1171 // An application is registered if g_application_register() has been
1172 // successfully called.
1173 // RETURNS: %TRUE if @application is registered
1174 int get_is_registered() {
1175 return g_application_get_is_registered(&this);
1178 // Checks if @application is remote.
1180 // If @application is remote then it means that another instance of
1181 // application already exists (the 'primary' instance). Calls to
1182 // perform actions on @application will result in the actions being
1183 // performed by the primary instance.
1185 // The value of this property cannot be accessed before
1186 // g_application_register() has been called. See
1187 // g_application_get_is_registered().
1188 // RETURNS: %TRUE if @application is remote
1189 int get_is_remote() {
1190 return g_application_get_is_remote(&this);
1193 // Increases the use count of @application.
1195 // Use this function to indicate that the application has a reason to
1196 // continue to run. For example, g_application_hold() is called by GTK+
1197 // when a toplevel window is on the screen.
1199 // To cancel the hold, call g_application_release().
1200 void hold() {
1201 g_application_hold(&this);
1204 // Opens the given files.
1206 // In essence, this results in the #GApplication::open signal being emitted
1207 // in the primary instance.
1209 // @n_files must be greater than zero.
1211 // @hint is simply passed through to the ::open signal. It is
1212 // intended to be used by applications that have multiple modes for
1213 // opening files (eg: "view" vs "edit", etc). Unless you have a need
1214 // for this functionality, you should use "".
1216 // The application must be registered before calling this function
1217 // and it must have the %G_APPLICATION_HANDLES_OPEN flag set.
1218 // <files>: an array of #GFiles to open
1219 // <n_files>: the length of the @files array
1220 // <hint>: a hint (or ""), but never %NULL
1221 void open(File** files, int n_files, char* hint) {
1222 g_application_open(&this, files, n_files, hint);
1225 // Attempts registration of the application.
1227 // This is the point at which the application discovers if it is the
1228 // primary instance or merely acting as a remote for an already-existing
1229 // primary instance. This is implemented by attempting to acquire the
1230 // application identifier as a unique bus name on the session bus using
1231 // GDBus.
1233 // Due to the internal architecture of GDBus, method calls can be
1234 // dispatched at any time (even if a main loop is not running). For
1235 // this reason, you must ensure that any object paths that you wish to
1236 // register are registered before calling this function.
1238 // If the application has already been registered then %TRUE is
1239 // returned with no work performed.
1241 // The #GApplication::startup signal is emitted if registration succeeds
1242 // and @application is the primary instance.
1244 // In the event of an error (such as @cancellable being cancelled, or a
1245 // failure to connect to the session bus), %FALSE is returned and @error
1246 // is set appropriately.
1248 // Note: the return value of this function is not an indicator that this
1249 // instance is or is not the primary instance of the application. See
1250 // g_application_get_is_remote() for that.
1251 // RETURNS: %TRUE if registration succeeded
1252 // <cancellable>: a #GCancellable, or %NULL
1253 int register(Cancellable* cancellable, GLib2.Error** error=null) {
1254 return g_application_register(&this, cancellable, error);
1257 // Decrease the use count of @application.
1259 // When the use count reaches zero, the application will stop running.
1261 // Never call this function except to cancel the effect of a previous
1262 // call to g_application_hold().
1263 void release() {
1264 g_application_release(&this);
1267 // Runs the application.
1269 // This function is intended to be run from main() and its return value
1270 // is intended to be returned by main(). Although you are expected to pass
1271 // the @argc, @argv parameters from main() to this function, it is possible
1272 // to pass %NULL if @argv is not available or commandline handling is not
1273 // required.
1275 // First, the local_command_line() virtual function is invoked.
1276 // This function always runs on the local instance. It gets passed a pointer
1277 // to a %NULL-terminated copy of @argv and is expected to remove the arguments
1278 // that it handled (shifting up remaining arguments). See
1279 // <xref linkend="gapplication-example-cmdline2"/> for an example of
1280 // parsing @argv manually. Alternatively, you may use the #GOptionContext API,
1281 // after setting <literal>argc = g_strv_length (argv);</literal>.
1283 // The last argument to local_command_line() is a pointer to the @status
1284 // variable which can used to set the exit status that is returned from
1285 // g_application_run().
1287 // If local_command_line() returns %TRUE, the command line is expected
1288 // to be completely handled, including possibly registering as the primary
1289 // instance, calling g_application_activate() or g_application_open(), etc.
1291 // If local_command_line() returns %FALSE then the application is registered
1292 // and the #GApplication::command-line signal is emitted in the primary
1293 // instance (which may or may not be this instance). The signal handler
1294 // gets passed a #GApplicationCommandline object that (among other things)
1295 // contains the remaining commandline arguments that have not been handled
1296 // by local_command_line().
1298 // If the application has the %G_APPLICATION_HANDLES_COMMAND_LINE
1299 // flag set then the default implementation of local_command_line()
1300 // always returns %FALSE immediately, resulting in the commandline
1301 // always being handled in the primary instance.
1303 // Otherwise, the default implementation of local_command_line() tries
1304 // to do a couple of things that are probably reasonable for most
1305 // applications. First, g_application_register() is called to attempt
1306 // to register the application. If that works, then the command line
1307 // arguments are inspected. If no commandline arguments are given, then
1308 // g_application_activate() is called. If commandline arguments are
1309 // given and the %G_APPLICATION_HANDLES_OPEN flag is set then they
1310 // are assumed to be filenames and g_application_open() is called.
1312 // If you need to handle commandline arguments that are not filenames,
1313 // and you don't mind commandline handling to happen in the primary
1314 // instance, you should set %G_APPLICATION_HANDLED_COMMAND_LINE and
1315 // process the commandline arguments in your #GApplication::command-line
1316 // signal handler, either manually or using the #GOptionContext API.
1318 // If you are interested in doing more complicated local handling of the
1319 // commandline then you should implement your own #GApplication subclass
1320 // and override local_command_line(). In this case, you most likely want
1321 // to return %TRUE from your local_command_line() implementation to
1322 // suppress the default handling. See
1323 // <xref linkend="gapplication-example-cmdline2"/> for an example.
1325 // If, after the above is done, the use count of the application is zero
1326 // then the exit status is returned immediately. If the use count is
1327 // non-zero then the mainloop is run until the use count falls to zero,
1328 // at which point 0 is returned.
1330 // If the %G_APPLICATION_IS_SERVICE flag is set, then the exiting at
1331 // use count of zero is delayed for a while (ie: the instance stays
1332 // around to provide its <emphasis>service</emphasis> to others).
1333 // RETURNS: the exit status
1334 // <argc>: the argc from main() (or 0 if @argv is %NULL)
1335 // <argv>: the argv from main(), or %NULL
1336 int run(int argc, char** argv=null) {
1337 return g_application_run(&this, argc, argv);
1340 // Sets or unsets the group of actions associated with the application.
1342 // These actions are the actions that can be remotely invoked.
1344 // It is an error to call this function after the application has been
1345 // registered.
1346 // <action_group>: a #GActionGroup, or %NULL
1347 void set_action_group(ActionGroup* action_group=null) {
1348 g_application_set_action_group(&this, action_group);
1351 // Sets the unique identifier for @application.
1353 // The application id can only be modified if @application has not yet
1354 // been registered.
1356 // The application id must be valid. See g_application_id_is_valid().
1357 // <application_id>: the identifier for @application
1358 void set_application_id(char* application_id) {
1359 g_application_set_application_id(&this, application_id);
1362 // Sets the flags for @application.
1364 // The flags can only be modified if @application has not yet been
1365 // registered.
1367 // See #GApplicationFlags.
1368 // <flags>: the flags for @application
1369 void set_flags(ApplicationFlags flags) {
1370 g_application_set_flags(&this, flags);
1373 // Sets the current inactivity timeout for the application.
1375 // This is the amount of time (in milliseconds) after the last call to
1376 // g_application_release() before the application stops running.
1378 // This call has no side effects of its own. The value set here is only
1379 // used for next time g_application_release() drops the use count to
1380 // zero. Any timeouts currently in progress are not impacted.
1381 // RETURNS: the timeout, in milliseconds
1382 // <inactivity_timeout>: the timeout, in milliseconds
1383 void set_inactivity_timeout(uint inactivity_timeout) {
1384 g_application_set_inactivity_timeout(&this, inactivity_timeout);
1387 // The ::activate signal is emitted on the primary instance when an
1388 // activation occurs. See g_application_activate().
1389 extern (C) alias static void function (Application* this_, void* user_data=null) signal_activate;
1391 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
1392 return super_.signal_connect!name(cb, data, cf);
1395 ulong signal_connect(string name:"activate", CB:signal_activate)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
1396 return signal_connect_data(&this, cast(char*)"activate",
1397 cast(GObject2.Callback)cb, data, null, cf);
1400 // The ::command-line signal is emitted on the primary instance when
1401 // a commandline is not handled locally. See g_application_run() and
1402 // the #GApplicationCommandline documentation for more information.
1404 // process. See g_application_command_line_set_exit_status().
1405 // RETURNS: An integer that is set as the exit status for the calling
1406 // <command_line>: a #GApplicationCommandLine representing the passed commandline
1407 extern (C) alias static int function (Application* this_, ApplicationCommandLine* command_line, void* user_data=null) signal_command_line;
1408 ulong signal_connect(string name:"command-line", CB:signal_command_line)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
1409 return signal_connect_data(&this, cast(char*)"command-line",
1410 cast(GObject2.Callback)cb, data, null, cf);
1413 // The ::open signal is emitted on the primary instance when there are
1414 // files to open. See g_application_open() for more information.
1415 // <files>: an array of #GFiles
1416 // <n_files>: the length of @files
1417 // <hint>: a hint provided by the calling instance
1418 extern (C) alias static void function (Application* this_, File* files, int n_files, char* hint, void* user_data=null) signal_open;
1419 ulong signal_connect(string name:"open", CB:signal_open)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
1420 return signal_connect_data(&this, cast(char*)"open",
1421 cast(GObject2.Callback)cb, data, null, cf);
1424 // The ::startup signal is emitted on the primary instance immediately
1425 // after registration. See g_application_register().
1426 extern (C) alias static void function (Application* this_, void* user_data=null) signal_startup;
1427 ulong signal_connect(string name:"startup", CB:signal_startup)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
1428 return signal_connect_data(&this, cast(char*)"startup",
1429 cast(GObject2.Callback)cb, data, null, cf);
1433 struct ApplicationClass /* Version 2.28 */ {
1434 private GObject2.ObjectClass parent_class;
1435 extern (C) void function (Application* application) startup;
1436 extern (C) void function (Application* application) activate;
1438 // <files>: an array of #GFiles to open
1439 // <n_files>: the length of the @files array
1440 // <hint>: a hint (or ""), but never %NULL
1441 extern (C) void function (Application* application, File** files, int n_files, char* hint) open;
1442 extern (C) int function (Application* application, ApplicationCommandLine* command_line) command_line;
1443 extern (C) int function (Application* application, char*** arguments, int* exit_status) local_command_line;
1444 extern (C) void function (Application* application, GLib2.Variant* platform_data) before_emit;
1445 extern (C) void function (Application* application, GLib2.Variant* platform_data) after_emit;
1446 extern (C) void function (Application* application, GLib2.VariantBuilder* builder) add_platform_data;
1447 extern (C) void function (Application* application) quit_mainloop;
1448 extern (C) void function (Application* application) run_mainloop;
1449 private void*[12] padding;
1453 // #GApplicationCommandLine represents a command-line invocation of
1454 // an application. It is created by #GApplication and emitted
1455 // in the #GApplication::command-line signal and virtual function.
1457 // The class contains the list of arguments that the program was invoked
1458 // with. It is also possible to query if the commandline invocation was
1459 // local (ie: the current process is running in direct response to the
1460 // invocation) or remote (ie: some other process forwarded the
1461 // commandline to this process).
1463 // The GApplicationCommandLine object can provide the @argc and @argv
1464 // parameters for use with the #GOptionContext command-line parsing API,
1465 // with the g_application_command_line_get_arguments() function. See
1466 // <xref linkend="gapplication-example-cmdline3"/> for an example.
1468 // The exit status of the originally-invoked process may be set and
1469 // messages can be printed to stdout or stderr of that process. The
1470 // lifecycle of the originally-invoked process is tied to the lifecycle
1471 // of this object (ie: the process exits when the last reference is
1472 // dropped).
1474 // The main use for #GApplicationCommandline (and the
1475 // #GApplication::command-line signal) is 'Emacs server' like use cases:
1476 // You can set the <envar>EDITOR</envar> environment variable to have
1477 // e.g. git use your favourite editor to edit commit messages, and if you
1478 // already have an instance of the editor running, the editing will happen
1479 // in the running instance, instead of opening a new one. An important
1480 // aspect of this use case is that the process that gets started by git
1481 // does not return until the editing is done.
1483 // <example id="gapplication-example-cmdline"><title>Handling commandline arguments with GApplication</title>
1484 // <para>
1485 // A simple example where the commandline is completely handled
1486 // in the #GApplication::command-line handler. The launching instance exits
1487 // once the signal handler in the primary instance has returned, and the
1488 // return value of the signal handler becomes the exit status of the launching
1489 // instance.
1490 // </para>
1491 // <programlisting>
1492 // <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gapplication-example-cmdline.c">
1493 // <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback>
1494 // </xi:include>
1495 // </programlisting>
1496 // </example>
1498 // <example id="gapplication-example-cmdline2"><title>Split commandline handling</title>
1499 // <para>
1500 // An example of split commandline handling. Options that start with
1501 // <literal>--local-</literal> are handled locally, all other options are
1502 // passed to the #GApplication::command-line handler which runs in the primary
1503 // instance.
1504 // </para>
1505 // <programlisting>
1506 // <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gapplication-example-cmdline2.c">
1507 // <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback>
1508 // </xi:include>
1509 // </programlisting>
1510 // </example>
1512 // <example id="gapplication-example-cmdline3"><title>Deferred commandline handling</title>
1513 // <para>
1514 // An example of deferred commandline handling. Here, the commandline is
1515 // not completely handled before the #GApplication::command-line handler
1516 // returns. Instead, we keep a reference to the GApplicationCommandline
1517 // object and handle it later(in this example, in an idle). Note that it
1518 // is necessary to hold the application until you are done with the
1519 // commandline.
1520 // </para>
1521 // <para>
1522 // This example also shows how to use #GOptionContext for parsing the
1523 // commandline arguments. Note that it is necessary to disable the
1524 // built-in help-handling of #GOptionContext, since it calls exit()
1525 // after printing help, which is not what you want to happen in
1526 // the primary instance.
1527 // </para>
1528 // <programlisting>
1529 // <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gapplication-example-cmdline3.c">
1530 // <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback>
1531 // </xi:include>
1532 // </programlisting>
1533 // </example>
1534 struct ApplicationCommandLine /* : GObject.Object */ /* Version 2.28 */ {
1535 alias parent_instance this;
1536 alias parent_instance super_;
1537 alias parent_instance object;
1538 GObject2.Object parent_instance;
1539 private ApplicationCommandLinePrivate* priv;
1542 // Gets the list of arguments that was passed on the command line.
1544 // The strings in the array may contain non-utf8 data.
1546 // The return value is %NULL-terminated and should be freed using
1547 // g_strfreev().
1549 // containing the arguments (the argv)
1550 // RETURNS: the string array
1551 // <argc>: the length of the arguments array, or %NULL
1552 char** /*new*/ get_arguments(/*out*/ int* argc) {
1553 return g_application_command_line_get_arguments(&this, argc);
1556 // Gets the working directory of the command line invocation.
1557 // The string may contain non-utf8 data.
1559 // It is possible that the remote application did not send a working
1560 // directory, so this may be %NULL.
1562 // The return value should not be modified or freed and is valid for as
1563 // long as @cmdline exists.
1564 // RETURNS: the current directory, or %NULL
1565 char* get_cwd() {
1566 return g_application_command_line_get_cwd(&this);
1569 // Gets the contents of the 'environ' variable of the command line
1570 // invocation, as would be returned by g_get_environ(), ie as a
1571 // %NULL-terminated list of strings in the form 'NAME=VALUE'.
1572 // The strings may contain non-utf8 data.
1574 // The remote application usually does not send an environment. Use
1575 // %G_APPLICATION_SEND_ENVIRONMENT to affect that. Even with this flag
1576 // set it is possible that the environment is still not available (due
1577 // to invocation messages from other applications).
1579 // The return value should not be modified or freed and is valid for as
1580 // long as @cmdline exists.
1582 // See g_application_command_line_getenv() if you are only interested
1583 // in the value of a single environment variable.
1585 // strings, or %NULL if they were not sent
1586 // RETURNS: the environment
1587 char** get_environ() {
1588 return g_application_command_line_get_environ(&this);
1591 // Gets the exit status of @cmdline. See
1592 // g_application_command_line_set_exit_status() for more information.
1593 // RETURNS: the exit status
1594 int get_exit_status() {
1595 return g_application_command_line_get_exit_status(&this);
1598 // Determines if @cmdline represents a remote invocation.
1599 // RETURNS: %TRUE if the invocation was remote
1600 int get_is_remote() {
1601 return g_application_command_line_get_is_remote(&this);
1604 // Gets the platform data associated with the invocation of @cmdline.
1606 // This is a #GVariant dictionary containing information about the
1607 // context in which the invocation occurred. It typically contains
1608 // information like the current working directory and the startup
1609 // notification ID.
1611 // For local invocation, it will be %NULL.
1612 // RETURNS: the platform data, or %NULL
1613 GLib2.Variant* /*new*/ get_platform_data() {
1614 return g_application_command_line_get_platform_data(&this);
1617 // Gets the value of a particular environment variable of the command
1618 // line invocation, as would be returned by g_getenv(). The strings may
1619 // contain non-utf8 data.
1621 // The remote application usually does not send an environment. Use
1622 // %G_APPLICATION_SEND_ENVIRONMENT to affect that. Even with this flag
1623 // set it is possible that the environment is still not available (due
1624 // to invocation messages from other applications).
1626 // The return value should not be modified or freed and is valid for as
1627 // long as @cmdline exists.
1628 // RETURNS: the value of the variable, or %NULL if unset or unsent
1629 // <name>: the environment variable to get
1630 char* getenv(char* name) {
1631 return g_application_command_line_getenv(&this, name);
1634 // Unintrospectable method: print() / g_application_command_line_print()
1635 // Formats a message and prints it using the stdout print handler in the
1636 // invoking process.
1638 // If @cmdline is a local invocation then this is exactly equivalent to
1639 // g_print(). If @cmdline is remote then this is equivalent to calling
1640 // g_print() in the invoking process.
1641 // <format>: a printf-style format string
1642 /+ Not available -- variadic methods unsupported - use the C function directly.
1643 alias g_application_command_line_print print; // Variadic
1646 // Unintrospectable method: printerr() / g_application_command_line_printerr()
1647 // Formats a message and prints it using the stderr print handler in the
1648 // invoking process.
1650 // If @cmdline is a local invocation then this is exactly equivalent to
1651 // g_printerr(). If @cmdline is remote then this is equivalent to
1652 // calling g_printerr() in the invoking process.
1653 // <format>: a printf-style format string
1654 /+ Not available -- variadic methods unsupported - use the C function directly.
1655 alias g_application_command_line_printerr printerr; // Variadic
1658 // Sets the exit status that will be used when the invoking process
1659 // exits.
1661 // The return value of the #GApplication::command-line signal is
1662 // passed to this function when the handler returns. This is the usual
1663 // way of setting the exit status.
1665 // In the event that you want the remote invocation to continue running
1666 // and want to decide on the exit status in the future, you can use this
1667 // call. For the case of a remote invocation, the remote process will
1668 // typically exit when the last reference is dropped on @cmdline. The
1669 // exit status of the remote process will be equal to the last value
1670 // that was set with this function.
1672 // In the case that the commandline invocation is local, the situation
1673 // is slightly more complicated. If the commandline invocation results
1674 // in the mainloop running (ie: because the use-count of the application
1675 // increased to a non-zero value) then the application is considered to
1676 // have been 'successful' in a certain sense, and the exit status is
1677 // always zero. If the application use count is zero, though, the exit
1678 // status of the local #GApplicationCommandLine is used.
1679 // <exit_status>: the exit status
1680 void set_exit_status(int exit_status) {
1681 g_application_command_line_set_exit_status(&this, exit_status);
1686 // The <structname>GApplicationCommandLineClass</structname> structure contains
1687 // private data only
1688 struct ApplicationCommandLineClass /* Version 2.28 */ {
1689 private GObject2.ObjectClass parent_class;
1690 extern (C) void function (ApplicationCommandLine* cmdline, char* message) print_literal;
1691 extern (C) void function (ApplicationCommandLine* cmdline, char* message) printerr_literal;
1692 private void*[12] padding;
1695 struct ApplicationCommandLinePrivate {
1698 // Flags used to define the behaviour of a #GApplication.
1699 enum ApplicationFlags /* Version 2.28 */ {
1700 FLAGS_NONE = 0,
1701 IS_SERVICE = 1,
1702 IS_LAUNCHER = 2,
1703 HANDLES_OPEN = 4,
1704 HANDLES_COMMAND_LINE = 8,
1705 SEND_ENVIRONMENT = 16,
1706 NON_UNIQUE = 32
1708 struct ApplicationPrivate {
1712 // #GAskPasswordFlags are used to request specific information from the
1713 // user, or to notify the user of their choices in an authentication
1714 // situation.
1715 enum AskPasswordFlags {
1716 NEED_PASSWORD = 1,
1717 NEED_USERNAME = 2,
1718 NEED_DOMAIN = 4,
1719 SAVING_SUPPORTED = 8,
1720 ANONYMOUS_SUPPORTED = 16
1723 // This is the asynchronous version of #GInitable; it behaves the same
1724 // in all ways except that initialization is asynchronous. For more details
1725 // see the descriptions on #GInitable.
1727 // A class may implement both the #GInitable and #GAsyncInitable interfaces.
1729 // Users of objects implementing this are not intended to use the interface
1730 // method directly; instead it will be used automatically in various ways.
1731 // For C applications you generally just call g_async_initable_new_async()
1732 // directly, or indirectly via a foo_thing_new_async() wrapper. This will call
1733 // g_async_initable_init_async() under the cover, calling back with %NULL and
1734 // a set %GError on failure.
1736 // A typical implementation might look something like this:
1738 // |[
1739 // enum {
1740 // NOT_INITIALIZED,
1741 // INITIALIZING,
1742 // INITIALIZED
1743 // };
1745 // static void
1746 // _foo_ready_cb (Foo *self)
1747 // {
1748 // GList *l;
1750 // self->priv->state = INITIALIZED;
1752 // for (l = self->priv->init_results; l != NULL; l = l->next)
1753 // {
1754 // GSimpleAsyncResult *simple = l->data;
1756 // if (!self->priv->success)
1757 // g_simple_async_result_set_error (simple, ...);
1759 // g_simple_async_result_complete (simple);
1760 // g_object_unref (simple);
1761 // }
1763 // g_list_free (self->priv->init_results);
1764 // self->priv->init_results = NULL;
1765 // }
1767 // static void
1768 // foo_init_async (GAsyncInitable *initable,
1769 // int io_priority,
1770 // GCancellable *cancellable,
1771 // GAsyncReadyCallback callback,
1772 // gpointer user_data)
1773 // {
1774 // Foo *self = FOO (initable);
1775 // GSimpleAsyncResult *simple;
1777 // simple = g_simple_async_result_new (G_OBJECT (initable)
1778 // callback,
1779 // user_data,
1780 // foo_init_async);
1782 // switch (self->priv->state)
1783 // {
1784 // case NOT_INITIALIZED:
1785 // _foo_get_ready (self);
1786 // self->priv->init_results = g_list_append (self->priv->init_results,
1787 // simple);
1788 // self->priv->state = INITIALIZING;
1789 // break;
1790 // case INITIALIZING:
1791 // self->priv->init_results = g_list_append (self->priv->init_results,
1792 // simple);
1793 // break;
1794 // case INITIALIZED:
1795 // if (!self->priv->success)
1796 // g_simple_async_result_set_error (simple, ...);
1798 // g_simple_async_result_complete_in_idle (simple);
1799 // g_object_unref (simple);
1800 // break;
1801 // }
1802 // }
1804 // static gboolean
1805 // foo_init_finish (GAsyncInitable *initable,
1806 // GAsyncResult *result,
1807 // GError **error)
1808 // {
1809 // g_return_val_if_fail (g_simple_async_result_is_valid (result,
1810 // G_OBJECT (initable), foo_init_async), FALSE);
1812 // if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result),
1813 // error))
1814 // return FALSE;
1816 // return TRUE;
1817 // }
1819 // static void
1820 // foo_async_initable_iface_init (gpointer g_iface,
1821 // gpointer data)
1822 // {
1823 // GAsyncInitableIface *iface = g_iface;
1825 // iface->init_async = foo_init_async;
1826 // iface->init_finish = foo_init_finish;
1827 // }
1828 // ]|
1829 struct AsyncInitable /* Version 2.22 */ {
1831 // Unintrospectable function: new_async() / g_async_initable_new_async()
1832 // Helper function for constructing #GAsyncInitable object. This is
1833 // similar to g_object_new() but also initializes the object asynchronously.
1835 // When the initialization is finished, @callback will be called. You can
1836 // then call g_async_initable_new_finish() to get the new object and check
1837 // for any errors.
1838 // <object_type>: a #GType supporting #GAsyncInitable.
1839 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the operation.
1840 // <cancellable>: optional #GCancellable object, %NULL to ignore.
1841 // <callback>: a #GAsyncReadyCallback to call when the initialization is finished
1842 // <user_data>: the data to pass to callback function
1843 // <first_property_name>: the name of the first property, or %NULL if no properties
1844 alias g_async_initable_new_async new_async; // Variadic
1846 // Unintrospectable function: new_valist_async() / g_async_initable_new_valist_async()
1847 // Helper function for constructing #GAsyncInitable object. This is
1848 // similar to g_object_new_valist() but also initializes the object
1849 // asynchronously.
1851 // When the initialization is finished, @callback will be called. You can
1852 // then call g_async_initable_new_finish() to get the new object and check
1853 // for any errors.
1854 // <object_type>: a #GType supporting #GAsyncInitable.
1855 // <first_property_name>: the name of the first property, followed by the value, and other property value pairs, and ended by %NULL.
1856 // <var_args>: The var args list generated from @first_property_name.
1857 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the operation.
1858 // <cancellable>: optional #GCancellable object, %NULL to ignore.
1859 // <callback>: a #GAsyncReadyCallback to call when the initialization is finished
1860 // <user_data>: the data to pass to callback function
1861 static void new_valist_async(Type object_type, char* first_property_name, va_list var_args, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
1862 g_async_initable_new_valist_async(object_type, first_property_name, var_args, io_priority, cancellable, callback, user_data);
1865 // Helper function for constructing #GAsyncInitable object. This is
1866 // similar to g_object_newv() but also initializes the object asynchronously.
1868 // When the initialization is finished, @callback will be called. You can
1869 // then call g_async_initable_new_finish() to get the new object and check
1870 // for any errors.
1871 // <object_type>: a #GType supporting #GAsyncInitable.
1872 // <n_parameters>: the number of parameters in @parameters
1873 // <parameters>: the parameters to use to construct the object
1874 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the operation.
1875 // <cancellable>: optional #GCancellable object, %NULL to ignore.
1876 // <callback>: a #GAsyncReadyCallback to call when the initialization is finished
1877 // <user_data>: the data to pass to callback function
1878 static void newv_async(Type object_type, uint n_parameters, GObject2.Parameter* parameters, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
1879 g_async_initable_newv_async(object_type, n_parameters, parameters, io_priority, cancellable, callback, user_data);
1882 // Starts asynchronous initialization of the object implementing the
1883 // interface. This must be done before any real use of the object after
1884 // initial construction. If the object also implements #GInitable you can
1885 // optionally call g_initable_init() instead.
1887 // When the initialization is finished, @callback will be called. You can
1888 // then call g_async_initable_init_finish() to get the result of the
1889 // initialization.
1891 // Implementations may also support cancellation. If @cancellable is not
1892 // %NULL, then initialization can be cancelled by triggering the cancellable
1893 // object from another thread. If the operation was cancelled, the error
1894 // %G_IO_ERROR_CANCELLED will be returned. If @cancellable is not %NULL, and
1895 // the object doesn't support cancellable initialization, the error
1896 // %G_IO_ERROR_NOT_SUPPORTED will be returned.
1898 // If this function is not called, or returns with an error, then all
1899 // operations on the object should fail, generally returning the
1900 // error %G_IO_ERROR_NOT_INITIALIZED.
1902 // Implementations of this method must be idempotent: i.e. multiple calls
1903 // to this function with the same argument should return the same results.
1904 // Only the first call initializes the object; further calls return the result
1905 // of the first call. This is so that it's safe to implement the singleton
1906 // pattern in the GObject constructor function.
1908 // For classes that also support the #GInitable interface, the default
1909 // implementation of this method will run the g_initable_init() function
1910 // in a thread, so if you want to support asynchronous initialization via
1911 // threads, just implement the #GAsyncInitable interface without overriding
1912 // any interface methods.
1913 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the operation.
1914 // <cancellable>: optional #GCancellable object, %NULL to ignore.
1915 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
1916 // <user_data>: the data to pass to callback function
1917 void init_async(int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
1918 g_async_initable_init_async(&this, io_priority, cancellable, callback, user_data);
1921 // Finishes asynchronous initialization and returns the result.
1922 // See g_async_initable_init_async().
1924 // will return %FALSE and set @error appropriately if present.
1925 // RETURNS: %TRUE if successful. If an error has occurred, this function
1926 // <res>: a #GAsyncResult.
1927 int init_finish(AsyncResult* res, GLib2.Error** error=null) {
1928 return g_async_initable_init_finish(&this, res, error);
1931 // Finishes the async construction for the various g_async_initable_new
1932 // calls, returning the created object or %NULL on error.
1934 // Free with g_object_unref().
1935 // RETURNS: a newly created #GObject, or %NULL on error.
1936 // <res>: the #GAsyncResult from the callback
1937 GObject2.Object* /*new*/ new_finish(AsyncResult* res, GLib2.Error** error=null) {
1938 return g_async_initable_new_finish(&this, res, error);
1943 // Provides an interface for asynchronous initializing object such that
1944 // initialization may fail.
1945 struct AsyncInitableIface /* Version 2.22 */ {
1946 GObject2.TypeInterface g_iface;
1948 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the operation.
1949 // <cancellable>: optional #GCancellable object, %NULL to ignore.
1950 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
1951 // <user_data>: the data to pass to callback function
1952 extern (C) void function (AsyncInitable* initable, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) init_async;
1954 // RETURNS: %TRUE if successful. If an error has occurred, this function
1955 // <res>: a #GAsyncResult.
1956 extern (C) int function (AsyncInitable* initable, AsyncResult* res, GLib2.Error** error=null) init_finish;
1960 // Type definition for a function that will be called back when an asynchronous
1961 // operation within GIO has been completed.
1962 // <source_object>: the object the asynchronous operation was started with.
1963 // <res>: a #GAsyncResult.
1964 // <user_data>: user data passed to the callback.
1965 extern (C) alias void function (GObject2.Object* source_object, AsyncResult* res, void* user_data) AsyncReadyCallback;
1968 // Provides a base class for implementing asynchronous function results.
1970 // Asynchronous operations are broken up into two separate operations
1971 // which are chained together by a #GAsyncReadyCallback. To begin
1972 // an asynchronous operation, provide a #GAsyncReadyCallback to the
1973 // asynchronous function. This callback will be triggered when the
1974 // operation has completed, and will be passed a #GAsyncResult instance
1975 // filled with the details of the operation's success or failure, the
1976 // object the asynchronous function was started for and any error codes
1977 // returned. The asynchronous callback function is then expected to call
1978 // the corresponding "_finish()" function, passing the object the
1979 // function was called for, the #GAsyncResult instance, and (optionally)
1980 // an @error to grab any error conditions that may have occurred.
1982 // The "_finish()" function for an operation takes the generic result
1983 // (of type #GAsyncResult) and returns the specific result that the
1984 // operation in question yields (e.g. a #GFileEnumerator for a
1985 // "enumerate children" operation). If the result or error status of the
1986 // operation is not needed, there is no need to call the "_finish()"
1987 // function; GIO will take care of cleaning up the result and error
1988 // information after the #GAsyncReadyCallback returns. You can pass
1989 // %NULL for the #GAsyncReadyCallback if you don't need to take any
1990 // action at all after the operation completes. Applications may also
1991 // take a reference to the #GAsyncResult and call "_finish()" later;
1992 // however, the "_finish()" function may be called at most once.
1994 // Example of a typical asynchronous operation flow:
1995 // |[
1996 // void _theoretical_frobnitz_async (Theoretical *t,
1997 // GCancellable *c,
1998 // GAsyncReadyCallback *cb,
1999 // gpointer u);
2001 // gboolean _theoretical_frobnitz_finish (Theoretical *t,
2002 // GAsyncResult *res,
2003 // GError **e);
2005 // static void
2006 // frobnitz_result_func (GObject *source_object,
2007 // GAsyncResult *res,
2008 // gpointer user_data)
2009 // {
2010 // gboolean success = FALSE;
2012 // success = _theoretical_frobnitz_finish (source_object, res, NULL);
2014 // if (success)
2015 // g_printf ("Hurray!\n");
2016 // else
2017 // g_printf ("Uh oh!\n");
2019 // /<!-- -->* ... *<!-- -->/
2021 // }
2023 // int main (int argc, void *argv[])
2024 // {
2025 // /<!-- -->* ... *<!-- -->/
2027 // _theoretical_frobnitz_async (theoretical_data,
2028 // NULL,
2029 // frobnitz_result_func,
2030 // NULL);
2032 // /<!-- -->* ... *<!-- -->/
2033 // }
2034 // ]|
2036 // The callback for an asynchronous operation is called only once, and is
2037 // always called, even in the case of a cancelled operation. On cancellation
2038 // the result is a %G_IO_ERROR_CANCELLED error.
2040 // Some asynchronous operations are implemented using synchronous calls.
2041 // These are run in a separate thread, if #GThread has been initialized, but
2042 // otherwise they are sent to the Main Event Loop and processed in an idle
2043 // function. So, if you truly need asynchronous operations, make sure to
2044 // initialize #GThread.
2045 struct AsyncResult {
2047 // Gets the source object from a #GAsyncResult.
2049 // or %NULL if there is none.
2050 // RETURNS: a new reference to the source object for the @res,
2051 GObject2.Object* /*new*/ get_source_object() {
2052 return g_async_result_get_source_object(&this);
2055 // Gets the user data from a #GAsyncResult.
2056 // RETURNS: the user data for @res.
2057 void* /*new*/ get_user_data() {
2058 return g_async_result_get_user_data(&this);
2062 // Interface definition for #GAsyncResult.
2063 struct AsyncResultIface {
2064 GObject2.TypeInterface g_iface;
2065 // RETURNS: the user data for @res.
2066 extern (C) void* /*new*/ function (AsyncResult* res) get_user_data;
2067 // RETURNS: a new reference to the source object for the @res,
2068 extern (C) GObject2.Object* /*new*/ function (AsyncResult* res) get_source_object;
2072 // Buffered input stream implements #GFilterInputStream and provides
2073 // for buffered reads.
2075 // By default, #GBufferedInputStream's buffer size is set at 4 kilobytes.
2077 // To create a buffered input stream, use g_buffered_input_stream_new(),
2078 // or g_buffered_input_stream_new_sized() to specify the buffer's size at
2079 // construction.
2081 // To get the size of a buffer within a buffered input stream, use
2082 // g_buffered_input_stream_get_buffer_size(). To change the size of a
2083 // buffered input stream's buffer, use
2084 // g_buffered_input_stream_set_buffer_size(). Note that the buffer's size
2085 // cannot be reduced below the size of the data within the buffer.
2086 struct BufferedInputStream /* : FilterInputStream */ {
2087 alias parent_instance this;
2088 alias parent_instance super_;
2089 alias parent_instance filterinputstream;
2090 FilterInputStream parent_instance;
2091 private BufferedInputStreamPrivate* priv;
2094 // Creates a new #GInputStream from the given @base_stream, with
2095 // a buffer set to the default size (4 kilobytes).
2096 // RETURNS: a #GInputStream for the given @base_stream.
2097 // <base_stream>: a #GInputStream
2098 static BufferedInputStream* /*new*/ new_(InputStream* base_stream) {
2099 return g_buffered_input_stream_new(base_stream);
2102 // Creates a new #GBufferedInputStream from the given @base_stream,
2103 // with a buffer set to @size.
2104 // RETURNS: a #GInputStream.
2105 // <base_stream>: a #GInputStream
2106 // <size>: a #gsize
2107 static BufferedInputStream* /*new*/ new_sized(InputStream* base_stream, size_t size) {
2108 return g_buffered_input_stream_new_sized(base_stream, size);
2111 // Tries to read @count bytes from the stream into the buffer.
2112 // Will block during this read.
2114 // If @count is zero, returns zero and does nothing. A value of @count
2115 // larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
2117 // On success, the number of bytes read into the buffer is returned.
2118 // It is not an error if this is not the same as the requested size, as it
2119 // can happen e.g. near the end of a file. Zero is returned on end of file
2120 // (or if @count is zero), but never otherwise.
2122 // If @count is -1 then the attempted read size is equal to the number of
2123 // bytes that are required to fill the buffer.
2125 // If @cancellable is not %NULL, then the operation can be cancelled by
2126 // triggering the cancellable object from another thread. If the operation
2127 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
2128 // operation was partially finished when the operation was cancelled the
2129 // partial result will be returned, without an error.
2131 // On error -1 is returned and @error is set accordingly.
2133 // For the asynchronous, non-blocking, version of this function, see
2134 // g_buffered_input_stream_fill_async().
2136 // or -1 on error.
2137 // RETURNS: the number of bytes read into @stream's buffer, up to @count,
2138 // <count>: the number of bytes that will be read from the stream
2139 // <cancellable>: optional #GCancellable object, %NULL to ignore
2140 ssize_t fill(ssize_t count, Cancellable* cancellable, GLib2.Error** error=null) {
2141 return g_buffered_input_stream_fill(&this, count, cancellable, error);
2144 // Reads data into @stream's buffer asynchronously, up to @count size.
2145 // @io_priority can be used to prioritize reads. For the synchronous
2146 // version of this function, see g_buffered_input_stream_fill().
2148 // If @count is -1 then the attempted read size is equal to the number
2149 // of bytes that are required to fill the buffer.
2150 // <count>: the number of bytes that will be read from the stream
2151 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request
2152 // <cancellable>: optional #GCancellable object
2153 // <callback>: a #GAsyncReadyCallback
2154 // <user_data>: a #gpointer
2155 void fill_async(ssize_t count, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
2156 g_buffered_input_stream_fill_async(&this, count, io_priority, cancellable, callback, user_data);
2159 // Finishes an asynchronous read.
2160 // RETURNS: a #gssize of the read stream, or %-1 on an error.
2161 // <result>: a #GAsyncResult
2162 ssize_t fill_finish(AsyncResult* result, GLib2.Error** error=null) {
2163 return g_buffered_input_stream_fill_finish(&this, result, error);
2166 // Gets the size of the available data within the stream.
2167 // RETURNS: size of the available stream.
2168 size_t get_available() {
2169 return g_buffered_input_stream_get_available(&this);
2172 // Gets the size of the input buffer.
2173 // RETURNS: the current buffer size.
2174 size_t get_buffer_size() {
2175 return g_buffered_input_stream_get_buffer_size(&this);
2178 // Peeks in the buffer, copying data of size @count into @buffer,
2179 // offset @offset bytes.
2180 // RETURNS: a #gsize of the number of bytes peeked, or -1 on error.
2181 // <buffer>: a pointer to an allocated chunk of memory
2182 // <offset>: a #gsize
2183 // <count>: a #gsize
2184 size_t peek(void* buffer, size_t offset, size_t count) {
2185 return g_buffered_input_stream_peek(&this, buffer, offset, count);
2188 // Returns the buffer with the currently available bytes. The returned
2189 // buffer must not be modified and will become invalid when reading from
2190 // the stream or filling the buffer.
2192 // read-only buffer
2193 // <count>: a #gsize to get the number of bytes available in the buffer
2194 ubyte* peek_buffer(/*out*/ size_t* count) {
2195 return g_buffered_input_stream_peek_buffer(&this, count);
2198 // Tries to read a single byte from the stream or the buffer. Will block
2199 // during this read.
2201 // On success, the byte read from the stream is returned. On end of stream
2202 // -1 is returned but it's not an exceptional error and @error is not set.
2204 // If @cancellable is not %NULL, then the operation can be cancelled by
2205 // triggering the cancellable object from another thread. If the operation
2206 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
2207 // operation was partially finished when the operation was cancelled the
2208 // partial result will be returned, without an error.
2210 // On error -1 is returned and @error is set accordingly.
2211 // RETURNS: the byte read from the @stream, or -1 on end of stream or error.
2212 // <cancellable>: optional #GCancellable object, %NULL to ignore
2213 int read_byte(Cancellable* cancellable, GLib2.Error** error=null) {
2214 return g_buffered_input_stream_read_byte(&this, cancellable, error);
2217 // Sets the size of the internal buffer of @stream to @size, or to the
2218 // size of the contents of the buffer. The buffer can never be resized
2219 // smaller than its current contents.
2220 // <size>: a #gsize
2221 void set_buffer_size(size_t size) {
2222 g_buffered_input_stream_set_buffer_size(&this, size);
2226 struct BufferedInputStreamClass {
2227 FilterInputStreamClass parent_class;
2229 // RETURNS: the number of bytes read into @stream's buffer, up to @count,
2230 // <count>: the number of bytes that will be read from the stream
2231 // <cancellable>: optional #GCancellable object, %NULL to ignore
2232 extern (C) ssize_t function (BufferedInputStream* stream, ssize_t count, Cancellable* cancellable, GLib2.Error** error=null) fill;
2234 // <count>: the number of bytes that will be read from the stream
2235 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request
2236 // <cancellable>: optional #GCancellable object
2237 // <callback>: a #GAsyncReadyCallback
2238 // <user_data>: a #gpointer
2239 extern (C) void function (BufferedInputStream* stream, ssize_t count, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) fill_async;
2241 // RETURNS: a #gssize of the read stream, or %-1 on an error.
2242 // <result>: a #GAsyncResult
2243 extern (C) ssize_t function (BufferedInputStream* stream, AsyncResult* result, GLib2.Error** error=null) fill_finish;
2244 extern (C) void function () _g_reserved1;
2245 extern (C) void function () _g_reserved2;
2246 extern (C) void function () _g_reserved3;
2247 extern (C) void function () _g_reserved4;
2248 extern (C) void function () _g_reserved5;
2251 struct BufferedInputStreamPrivate {
2255 // Buffered output stream implements #GFilterOutputStream and provides
2256 // for buffered writes.
2258 // By default, #GBufferedOutputStream's buffer size is set at 4 kilobytes.
2260 // To create a buffered output stream, use g_buffered_output_stream_new(),
2261 // or g_buffered_output_stream_new_sized() to specify the buffer's size
2262 // at construction.
2264 // To get the size of a buffer within a buffered input stream, use
2265 // g_buffered_output_stream_get_buffer_size(). To change the size of a
2266 // buffered output stream's buffer, use
2267 // g_buffered_output_stream_set_buffer_size(). Note that the buffer's
2268 // size cannot be reduced below the size of the data within the buffer.
2269 struct BufferedOutputStream /* : FilterOutputStream */ {
2270 alias parent_instance this;
2271 alias parent_instance super_;
2272 alias parent_instance filteroutputstream;
2273 FilterOutputStream parent_instance;
2274 BufferedOutputStreamPrivate* priv;
2277 // Creates a new buffered output stream for a base stream.
2278 // RETURNS: a #GOutputStream for the given @base_stream.
2279 // <base_stream>: a #GOutputStream.
2280 static BufferedOutputStream* /*new*/ new_(OutputStream* base_stream) {
2281 return g_buffered_output_stream_new(base_stream);
2284 // Creates a new buffered output stream with a given buffer size.
2285 // RETURNS: a #GOutputStream with an internal buffer set to @size.
2286 // <base_stream>: a #GOutputStream.
2287 // <size>: a #gsize.
2288 static BufferedOutputStream* /*new*/ new_sized(OutputStream* base_stream, size_t size) {
2289 return g_buffered_output_stream_new_sized(base_stream, size);
2292 // Checks if the buffer automatically grows as data is added.
2294 // %FALSE otherwise.
2295 // RETURNS: %TRUE if the @stream's buffer automatically grows,
2296 int get_auto_grow() {
2297 return g_buffered_output_stream_get_auto_grow(&this);
2300 // Gets the size of the buffer in the @stream.
2301 // RETURNS: the current size of the buffer.
2302 size_t get_buffer_size() {
2303 return g_buffered_output_stream_get_buffer_size(&this);
2306 // Sets whether or not the @stream's buffer should automatically grow.
2307 // If @auto_grow is true, then each write will just make the buffer
2308 // larger, and you must manually flush the buffer to actually write out
2309 // the data to the underlying stream.
2310 // <auto_grow>: a #gboolean.
2311 void set_auto_grow(int auto_grow) {
2312 g_buffered_output_stream_set_auto_grow(&this, auto_grow);
2315 // Sets the size of the internal buffer to @size.
2316 // <size>: a #gsize.
2317 void set_buffer_size(size_t size) {
2318 g_buffered_output_stream_set_buffer_size(&this, size);
2322 struct BufferedOutputStreamClass {
2323 FilterOutputStreamClass parent_class;
2324 extern (C) void function () _g_reserved1;
2325 extern (C) void function () _g_reserved2;
2328 struct BufferedOutputStreamPrivate {
2332 // Invoked when a connection to a message bus has been obtained.
2333 // <connection>: The #GDBusConnection to a message bus.
2334 // <name>: The name that is requested to be owned.
2335 // <user_data>: User data passed to g_bus_own_name().
2336 extern (C) alias void function (DBusConnection* connection, char* name, void* user_data) BusAcquiredCallback;
2339 // Invoked when the name is acquired.
2340 // <connection>: The #GDBusConnection on which to acquired the name.
2341 // <name>: The name being owned.
2342 // <user_data>: User data passed to g_bus_own_name() or g_bus_own_name_on_connection().
2343 extern (C) alias void function (DBusConnection* connection, char* name, void* user_data) BusNameAcquiredCallback;
2346 // Invoked when the name being watched is known to have to have a owner.
2347 // <connection>: The #GDBusConnection the name is being watched on.
2348 // <name>: The name being watched.
2349 // <name_owner>: Unique name of the owner of the name being watched.
2350 // <user_data>: User data passed to g_bus_watch_name().
2351 extern (C) alias void function (DBusConnection* connection, char* name, char* name_owner, void* user_data) BusNameAppearedCallback;
2354 // Invoked when the name is lost or @connection has been closed.
2355 // <connection>: The #GDBusConnection on which to acquire the name or %NULL if the connection was disconnected.
2356 // <name>: The name being owned.
2357 // <user_data>: User data passed to g_bus_own_name() or g_bus_own_name_on_connection().
2358 extern (C) alias void function (DBusConnection* connection, char* name, void* user_data) BusNameLostCallback;
2360 // Flags used in g_bus_own_name().
2361 enum BusNameOwnerFlags /* Version 2.26 */ {
2362 NONE = 0,
2363 ALLOW_REPLACEMENT = 1,
2364 REPLACE = 2
2367 // Invoked when the name being watched is known not to have to have a owner.
2368 // <connection>: The #GDBusConnection the name is being watched on.
2369 // <name>: The name being watched.
2370 // <user_data>: User data passed to g_bus_watch_name().
2371 extern (C) alias void function (DBusConnection* connection, char* name, void* user_data) BusNameVanishedCallback;
2373 // Flags used in g_bus_watch_name().
2374 enum BusNameWatcherFlags /* Version 2.26 */ {
2375 NONE = 0,
2376 AUTO_START = 1
2378 // An enumeration for well-known message buses.
2379 enum BusType /* Version 2.26 */ {
2380 STARTER = -1,
2381 NONE = 0,
2382 SYSTEM = 1,
2383 SESSION = 2
2386 // GCancellable is a thread-safe operation cancellation stack used
2387 // throughout GIO to allow for cancellation of synchronous and
2388 // asynchronous operations.
2389 struct Cancellable /* : GObject.Object */ {
2390 alias parent_instance this;
2391 alias parent_instance super_;
2392 alias parent_instance object;
2393 GObject2.Object parent_instance;
2394 private CancellablePrivate* priv;
2397 // Creates a new #GCancellable object.
2399 // Applications that want to start one or more operations
2400 // that should be cancellable should create a #GCancellable
2401 // and pass it to the operations.
2403 // One #GCancellable can be used in multiple consecutive
2404 // operations or in multiple concurrent operations.
2405 // RETURNS: a #GCancellable.
2406 static Cancellable* /*new*/ new_() {
2407 return g_cancellable_new();
2410 // Gets the top cancellable from the stack.
2412 // if the stack is empty.
2413 // RETURNS: a #GCancellable from the top of the stack, or %NULL
2414 static Cancellable* get_current() {
2415 return g_cancellable_get_current();
2418 // Will set @cancellable to cancelled, and will emit the
2419 // #GCancellable::cancelled signal. (However, see the warning about
2420 // race conditions in the documentation for that signal if you are
2421 // planning to connect to it.)
2423 // This function is thread-safe. In other words, you can safely call
2424 // it from a thread other than the one running the operation that was
2425 // passed the @cancellable.
2427 // The convention within gio is that cancelling an asynchronous
2428 // operation causes it to complete asynchronously. That is, if you
2429 // cancel the operation from the same thread in which it is running,
2430 // then the operation's #GAsyncReadyCallback will not be invoked until
2431 // the application returns to the main loop.
2432 void cancel() {
2433 g_cancellable_cancel(&this);
2436 // Convenience function to connect to the #GCancellable::cancelled
2437 // signal. Also handles the race condition that may happen
2438 // if the cancellable is cancelled right before connecting.
2440 // @callback is called at most once, either directly at the
2441 // time of the connect if @cancellable is already cancelled,
2442 // or when @cancellable is cancelled in some thread.
2444 // @data_destroy_func will be called when the handler is
2445 // disconnected, or immediately if the cancellable is already
2446 // cancelled.
2448 // See #GCancellable::cancelled for details on how to use this.
2450 // been cancelled.
2451 // RETURNS: The id of the signal handler or 0 if @cancellable has already
2452 // <callback>: The #GCallback to connect.
2453 // <data>: Data to pass to @callback.
2454 // <data_destroy_func>: Free function for @data or %NULL.
2455 c_ulong connect(GObject2.Callback callback, void* data, GLib2.DestroyNotify data_destroy_func) {
2456 return g_cancellable_connect(&this, callback, data, data_destroy_func);
2459 // Disconnects a handler from a cancellable instance similar to
2460 // g_signal_handler_disconnect(). Additionally, in the event that a
2461 // signal handler is currently running, this call will block until the
2462 // handler has finished. Calling this function from a
2463 // #GCancellable::cancelled signal handler will therefore result in a
2464 // deadlock.
2466 // This avoids a race condition where a thread cancels at the
2467 // same time as the cancellable operation is finished and the
2468 // signal handler is removed. See #GCancellable::cancelled for
2469 // details on how to use this.
2471 // If @cancellable is %NULL or @handler_id is %0 this function does
2472 // nothing.
2473 // <handler_id>: Handler id of the handler to be disconnected, or %0.
2474 void disconnect(c_ulong handler_id) {
2475 g_cancellable_disconnect(&this, handler_id);
2478 // Gets the file descriptor for a cancellable job. This can be used to
2479 // implement cancellable operations on Unix systems. The returned fd will
2480 // turn readable when @cancellable is cancelled.
2482 // You are not supposed to read from the fd yourself, just check for
2483 // readable status. Reading to unset the readable status is done
2484 // with g_cancellable_reset().
2486 // After a successful return from this function, you should use
2487 // g_cancellable_release_fd() to free up resources allocated for
2488 // the returned file descriptor.
2490 // See also g_cancellable_make_pollfd().
2492 // is not supported, or on errors.
2493 // RETURNS: A valid file descriptor. %-1 if the file descriptor
2494 int get_fd() {
2495 return g_cancellable_get_fd(&this);
2498 // Checks if a cancellable job has been cancelled.
2500 // FALSE if called with %NULL or if item is not cancelled.
2501 // RETURNS: %TRUE if @cancellable is cancelled,
2502 int is_cancelled() {
2503 return g_cancellable_is_cancelled(&this);
2506 // Creates a #GPollFD corresponding to @cancellable; this can be passed
2507 // to g_poll() and used to poll for cancellation. This is useful both
2508 // for unix systems without a native poll and for portability to
2509 // windows.
2511 // When this function returns %TRUE, you should use
2512 // g_cancellable_release_fd() to free up resources allocated for the
2513 // @pollfd. After a %FALSE return, do not call g_cancellable_release_fd().
2515 // If this function returns %FALSE, either no @cancellable was given or
2516 // resource limits prevent this function from allocating the necessary
2517 // structures for polling. (On Linux, you will likely have reached
2518 // the maximum number of file descriptors.) The suggested way to handle
2519 // these cases is to ignore the @cancellable.
2521 // You are not supposed to read from the fd yourself, just check for
2522 // readable status. Reading to unset the readable status is done
2523 // with g_cancellable_reset().
2525 // failure to prepare the cancellable.
2526 // RETURNS: %TRUE if @pollfd was successfully initialized, %FALSE on
2527 // <pollfd>: a pointer to a #GPollFD
2528 int make_pollfd(GLib2.PollFD* pollfd) {
2529 return g_cancellable_make_pollfd(&this, pollfd);
2532 // Pops @cancellable off the cancellable stack (verifying that @cancellable
2533 // is on the top of the stack).
2534 void pop_current() {
2535 g_cancellable_pop_current(&this);
2538 // Pushes @cancellable onto the cancellable stack. The current
2539 // cancellable can then be received using g_cancellable_get_current().
2541 // This is useful when implementing cancellable operations in
2542 // code that does not allow you to pass down the cancellable object.
2544 // This is typically called automatically by e.g. #GFile operations,
2545 // so you rarely have to call this yourself.
2546 void push_current() {
2547 g_cancellable_push_current(&this);
2550 // Releases a resources previously allocated by g_cancellable_get_fd()
2551 // or g_cancellable_make_pollfd().
2553 // For compatibility reasons with older releases, calling this function
2554 // is not strictly required, the resources will be automatically freed
2555 // when the @cancellable is finalized. However, the @cancellable will
2556 // block scarce file descriptors until it is finalized if this function
2557 // is not called. This can cause the application to run out of file
2558 // descriptors when many #GCancellables are used at the same time.
2559 void release_fd() {
2560 g_cancellable_release_fd(&this);
2563 // Resets @cancellable to its uncancelled state.
2565 // If cancellable is currently in use by any cancellable operation
2566 // then the behavior of this function is undefined.
2567 void reset() {
2568 g_cancellable_reset(&this);
2571 // If the @cancellable is cancelled, sets the error to notify
2572 // that the operation was cancelled.
2573 // RETURNS: %TRUE if @cancellable was cancelled, %FALSE if it was not
2574 int set_error_if_cancelled(GLib2.Error** error=null) {
2575 return g_cancellable_set_error_if_cancelled(&this, error);
2578 // Unintrospectable method: source_new() / g_cancellable_source_new()
2579 // Creates a source that triggers if @cancellable is cancelled and
2580 // calls its callback of type #GCancellableSourceFunc. This is
2581 // primarily useful for attaching to another (non-cancellable) source
2582 // with g_source_add_child_source() to add cancellability to it.
2584 // For convenience, you can call this with a %NULL #GCancellable,
2585 // in which case the source will never trigger.
2586 // RETURNS: the new #GSource.
2587 GLib2.Source* /*new*/ source_new() {
2588 return g_cancellable_source_new(&this);
2591 // Emitted when the operation has been cancelled.
2593 // Can be used by implementations of cancellable operations. If the
2594 // operation is cancelled from another thread, the signal will be
2595 // emitted in the thread that cancelled the operation, not the
2596 // thread that is running the operation.
2598 // Note that disconnecting from this signal (or any signal) in a
2599 // multi-threaded program is prone to race conditions. For instance
2600 // it is possible that a signal handler may be invoked even
2601 // <emphasis>after</emphasis> a call to
2602 // g_signal_handler_disconnect() for that handler has already
2603 // returned.
2605 // There is also a problem when cancellation happen
2606 // right before connecting to the signal. If this happens the
2607 // signal will unexpectedly not be emitted, and checking before
2608 // connecting to the signal leaves a race condition where this is
2609 // still happening.
2611 // In order to make it safe and easy to connect handlers there
2612 // are two helper functions: g_cancellable_connect() and
2613 // g_cancellable_disconnect() which protect against problems
2614 // like this.
2616 // An example of how to us this:
2617 // |[
2618 // /<!-- -->* Make sure we don't do any unnecessary work if already cancelled *<!-- -->/
2619 // if (g_cancellable_set_error_if_cancelled (cancellable))
2620 // return;
2622 // /<!-- -->* Set up all the data needed to be able to
2623 // * handle cancellation of the operation *<!-- -->/
2624 // my_data = my_data_new (...);
2626 // id = 0;
2627 // if (cancellable)
2628 // id = g_cancellable_connect (cancellable,
2629 // G_CALLBACK (cancelled_handler)
2630 // data, NULL);
2632 // /<!-- -->* cancellable operation here... *<!-- -->/
2634 // g_cancellable_disconnect (cancellable, id);
2636 // /<!-- -->* cancelled_handler is never called after this, it
2637 // * is now safe to free the data *<!-- -->/
2638 // my_data_free (my_data);
2639 // ]|
2641 // Note that the cancelled signal is emitted in the thread that
2642 // the user cancelled from, which may be the main thread. So, the
2643 // cancellable signal should not do something that can block.
2644 extern (C) alias static void function (Cancellable* this_, void* user_data=null) signal_cancelled;
2646 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
2647 return super_.signal_connect!name(cb, data, cf);
2650 ulong signal_connect(string name:"cancelled", CB:signal_cancelled)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
2651 return signal_connect_data(&this, cast(char*)"cancelled",
2652 cast(GObject2.Callback)cb, data, null, cf);
2656 struct CancellableClass {
2657 GObject2.ObjectClass parent_class;
2658 extern (C) void function (Cancellable* cancellable) cancelled;
2659 extern (C) void function () _g_reserved1;
2660 extern (C) void function () _g_reserved2;
2661 extern (C) void function () _g_reserved3;
2662 extern (C) void function () _g_reserved4;
2663 extern (C) void function () _g_reserved5;
2666 struct CancellablePrivate {
2670 // This is the function type of the callback used for the #GSource
2671 // returned by g_cancellable_source_new().
2672 // RETURNS: it should return %FALSE if the source should be removed.
2673 // <cancellable>: the #GCancellable
2674 // <user_data>: data passed in by the user.
2675 extern (C) alias int function (Cancellable* cancellable, void* user_data) CancellableSourceFunc;
2678 // #GCharsetConverter is an implementation of #GConverter based on
2679 // GIConv.
2680 struct CharsetConverter /* : GObject.Object */ {
2681 alias method_parent this;
2682 alias method_parent super_;
2683 alias method_parent object;
2684 GObject2.Object method_parent;
2687 // Creates a new #GCharsetConverter.
2688 // RETURNS: a new #GCharsetConverter or %NULL on error.
2689 // <to_charset>: destination charset
2690 // <from_charset>: source charset
2691 static CharsetConverter* /*new*/ new_(char* to_charset, char* from_charset, GLib2.Error** error=null) {
2692 return g_charset_converter_new(to_charset, from_charset, error);
2695 // Gets the number of fallbacks that @converter has applied so far.
2696 // RETURNS: the number of fallbacks that @converter has applied
2697 uint get_num_fallbacks() {
2698 return g_charset_converter_get_num_fallbacks(&this);
2701 // Gets the #GCharsetConverter:use-fallback property.
2702 // RETURNS: %TRUE if fallbacks are used by @converter
2703 int get_use_fallback() {
2704 return g_charset_converter_get_use_fallback(&this);
2707 // Sets the #GCharsetConverter:use-fallback property.
2708 // <use_fallback>: %TRUE to use fallbacks
2709 void set_use_fallback(int use_fallback) {
2710 g_charset_converter_set_use_fallback(&this, use_fallback);
2714 struct CharsetConverterClass {
2715 GObject2.ObjectClass parent_class;
2719 // #GConverter is implemented by objects that convert
2720 // binary data in various ways. The conversion can be
2721 // stateful and may fail at any place.
2723 // Some example conversions are: character set conversion,
2724 // compression, decompression and regular expression
2725 // replace.
2726 struct Converter /* Version 2.24 */ {
2728 // This is the main operation used when converting data. It is to be called
2729 // multiple times in a loop, and each time it will do some work, i.e.
2730 // producing some output (in @outbuf) or consuming some input (from @inbuf) or
2731 // both. If its not possible to do any work an error is returned.
2733 // Note that a single call may not consume all input (or any input at all).
2734 // Also a call may produce output even if given no input, due to state stored
2735 // in the converter producing output.
2737 // If any data was either produced or consumed, and then an error happens, then
2738 // only the successful conversion is reported and the error is returned on the
2739 // next call.
2741 // A full conversion loop involves calling this method repeatedly, each time
2742 // giving it new input and space output space. When there is no more input
2743 // data after the data in @inbuf, the flag %G_CONVERTER_INPUT_AT_END must be set.
2744 // The loop will be (unless some error happens) returning %G_CONVERTER_CONVERTED
2745 // each time until all data is consumed and all output is produced, then
2746 // %G_CONVERTER_FINISHED is returned instead. Note, that %G_CONVERTER_FINISHED
2747 // may be returned even if %G_CONVERTER_INPUT_AT_END is not set, for instance
2748 // in a decompression converter where the end of data is detectable from the
2749 // data (and there might even be other data after the end of the compressed data).
2751 // When some data has successfully been converted @bytes_read and is set to
2752 // the number of bytes read from @inbuf, and @bytes_written is set to indicate
2753 // how many bytes was written to @outbuf. If there are more data to output
2754 // or consume (i.e. unless the %G_CONVERTER_INPUT_AT_END is specified) then
2755 // %G_CONVERTER_CONVERTED is returned, and if no more data is to be output
2756 // then %G_CONVERTER_FINISHED is returned.
2758 // On error %G_CONVERTER_ERROR is returned and @error is set accordingly.
2759 // Some errors need special handling:
2761 // %G_IO_ERROR_NO_SPACE is returned if there is not enough space
2762 // to write the resulting converted data, the application should
2763 // call the function again with a larger @outbuf to continue.
2765 // %G_IO_ERROR_PARTIAL_INPUT is returned if there is not enough
2766 // input to fully determine what the conversion should produce,
2767 // and the %G_CONVERTER_INPUT_AT_END flag is not set. This happens for
2768 // example with an incomplete multibyte sequence when converting text,
2769 // or when a regexp matches up to the end of the input (and may match
2770 // further input). It may also happen when @inbuf_size is zero and
2771 // there is no more data to produce.
2773 // When this happens the application should read more input and then
2774 // call the function again. If further input shows that there is no
2775 // more data call the function again with the same data but with
2776 // the %G_CONVERTER_INPUT_AT_END flag set. This may cause the conversion
2777 // to finish as e.g. in the regexp match case (or, to fail again with
2778 // %G_IO_ERROR_PARTIAL_INPUT in e.g. a charset conversion where the
2779 // input is actually partial).
2781 // After g_converter_convert() has returned %G_CONVERTER_FINISHED the
2782 // converter object is in an invalid state where its not allowed
2783 // to call g_converter_convert() anymore. At this time you can only
2784 // free the object or call g_converter_reset() to reset it to the
2785 // initial state.
2787 // If the flag %G_CONVERTER_FLUSH is set then conversion is modified
2788 // to try to write out all internal state to the output. The application
2789 // has to call the function multiple times with the flag set, and when
2790 // the available input has been consumed and all internal state has
2791 // been produced then %G_CONVERTER_FLUSHED (or %G_CONVERTER_FINISHED if
2792 // really at the end) is returned instead of %G_CONVERTER_CONVERTED.
2793 // This is somewhat similar to what happens at the end of the input stream,
2794 // but done in the middle of the data.
2796 // This has different meanings for different conversions. For instance
2797 // in a compression converter it would mean that we flush all the
2798 // compression state into output such that if you uncompress the
2799 // compressed data you get back all the input data. Doing this may
2800 // make the final file larger due to padding though. Another example
2801 // is a regexp conversion, where if you at the end of the flushed data
2802 // have a match, but there is also a potential longer match. In the
2803 // non-flushed case we would ask for more input, but when flushing we
2804 // treat this as the end of input and do the match.
2806 // Flushing is not always possible (like if a charset converter flushes
2807 // at a partial multibyte sequence). Converters are supposed to try
2808 // to produce as much output as possible and then return an error
2809 // (typically %G_IO_ERROR_PARTIAL_INPUT).
2810 // RETURNS: a #GConverterResult, %G_CONVERTER_ERROR on error.
2811 // <inbuf>: the buffer containing the data to convert.
2812 // <inbuf_size>: the number of bytes in @inbuf
2813 // <outbuf>: a buffer to write converted data in.
2814 // <outbuf_size>: the number of bytes in @outbuf, must be at least one
2815 // <flags>: a #GConvertFlags controlling the conversion details
2816 // <bytes_read>: will be set to the number of bytes read from @inbuf on success
2817 // <bytes_written>: will be set to the number of bytes written to @outbuf on success
2818 ConverterResult convert(ubyte* inbuf, size_t inbuf_size, void* outbuf, size_t outbuf_size, ConverterFlags flags, /*out*/ size_t* bytes_read, /*out*/ size_t* bytes_written, GLib2.Error** error=null) {
2819 return g_converter_convert(&this, inbuf, inbuf_size, outbuf, outbuf_size, flags, bytes_read, bytes_written, error);
2822 // Resets all internal state in the converter, making it behave
2823 // as if it was just created. If the converter has any internal
2824 // state that would produce output then that output is lost.
2825 void reset() {
2826 g_converter_reset(&this);
2830 // Flags used when calling a g_converter_convert().
2831 enum ConverterFlags /* Version 2.24 */ {
2832 G_CONVERTER_NO_FLAGS = 0,
2833 INPUT_AT_END = 1,
2834 FLUSH = 2
2837 // Provides an interface for converting data from one type
2838 // to another type. The conversion can be stateful
2839 // and may fail at any place.
2840 struct ConverterIface /* Version 2.24 */ {
2841 GObject2.TypeInterface g_iface;
2843 // RETURNS: a #GConverterResult, %G_CONVERTER_ERROR on error.
2844 // <inbuf>: the buffer containing the data to convert.
2845 // <inbuf_size>: the number of bytes in @inbuf
2846 // <outbuf>: a buffer to write converted data in.
2847 // <outbuf_size>: the number of bytes in @outbuf, must be at least one
2848 // <flags>: a #GConvertFlags controlling the conversion details
2849 // <bytes_read>: will be set to the number of bytes read from @inbuf on success
2850 // <bytes_written>: will be set to the number of bytes written to @outbuf on success
2851 extern (C) ConverterResult function (Converter* converter, ubyte* inbuf, size_t inbuf_size, void* outbuf, size_t outbuf_size, ConverterFlags flags, /*out*/ size_t* bytes_read, /*out*/ size_t* bytes_written, GLib2.Error** error=null) convert;
2852 extern (C) void function (Converter* converter) reset;
2856 // Converter input stream implements #GInputStream and allows
2857 // conversion of data of various types during reading.
2858 struct ConverterInputStream /* : FilterInputStream */ {
2859 alias parent_instance this;
2860 alias parent_instance super_;
2861 alias parent_instance filterinputstream;
2862 FilterInputStream parent_instance;
2863 private ConverterInputStreamPrivate* priv;
2866 // Creates a new converter input stream for the @base_stream.
2867 // RETURNS: a new #GInputStream.
2868 // <base_stream>: a #GInputStream
2869 // <converter>: a #GConverter
2870 static ConverterInputStream* /*new*/ new_(InputStream* base_stream, Converter* converter) {
2871 return g_converter_input_stream_new(base_stream, converter);
2874 // Gets the #GConverter that is used by @converter_stream.
2875 // RETURNS: the converter of the converter input stream
2876 Converter* get_converter() {
2877 return g_converter_input_stream_get_converter(&this);
2881 struct ConverterInputStreamClass {
2882 FilterInputStreamClass parent_class;
2883 extern (C) void function () _g_reserved1;
2884 extern (C) void function () _g_reserved2;
2885 extern (C) void function () _g_reserved3;
2886 extern (C) void function () _g_reserved4;
2887 extern (C) void function () _g_reserved5;
2890 struct ConverterInputStreamPrivate {
2894 // Converter output stream implements #GOutputStream and allows
2895 // conversion of data of various types during reading.
2896 struct ConverterOutputStream /* : FilterOutputStream */ {
2897 alias parent_instance this;
2898 alias parent_instance super_;
2899 alias parent_instance filteroutputstream;
2900 FilterOutputStream parent_instance;
2901 private ConverterOutputStreamPrivate* priv;
2904 // Creates a new converter output stream for the @base_stream.
2905 // RETURNS: a new #GOutputStream.
2906 // <base_stream>: a #GOutputStream
2907 // <converter>: a #GConverter
2908 static ConverterOutputStream* /*new*/ new_(OutputStream* base_stream, Converter* converter) {
2909 return g_converter_output_stream_new(base_stream, converter);
2912 // Gets the #GConverter that is used by @converter_stream.
2913 // RETURNS: the converter of the converter output stream
2914 Converter* get_converter() {
2915 return g_converter_output_stream_get_converter(&this);
2919 struct ConverterOutputStreamClass {
2920 FilterOutputStreamClass parent_class;
2921 extern (C) void function () _g_reserved1;
2922 extern (C) void function () _g_reserved2;
2923 extern (C) void function () _g_reserved3;
2924 extern (C) void function () _g_reserved4;
2925 extern (C) void function () _g_reserved5;
2928 struct ConverterOutputStreamPrivate {
2931 // Results returned from g_converter_convert().
2932 enum ConverterResult /* Version 2.24 */ {
2933 ERROR = 0,
2934 CONVERTED = 1,
2935 FINISHED = 2,
2936 FLUSHED = 3
2939 // The #GCredentials type is a reference-counted wrapper for native
2940 // credentials. This information is typically used for identifying,
2941 // authenticating and authorizing other processes.
2943 // Some operating systems supports looking up the credentials of the
2944 // remote peer of a communication endpoint - see e.g.
2945 // g_socket_get_credentials().
2947 // Some operating systems supports securely sending and receiving
2948 // credentials over a Unix Domain Socket, see
2949 // #GUnixCredentialsMessage, g_unix_connection_send_credentials() and
2950 // g_unix_connection_receive_credentials() for details.
2952 // On Linux, the native credential type is a <type>struct ucred</type>
2953 // - see the
2954 // <citerefentry><refentrytitle>unix</refentrytitle><manvolnum>7</manvolnum></citerefentry>
2955 // man page for details. This corresponds to
2956 // %G_CREDENTIALS_TYPE_LINUX_UCRED.
2958 // On FreeBSD, the native credential type is a <type>struct cmsgcred</type>.
2959 // This corresponds to %G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED.
2961 // On OpenBSD, the native credential type is a <type>struct sockpeercred</type>.
2962 // This corresponds to %G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED.
2963 struct Credentials /* : GObject.Object */ /* Version 2.26 */ {
2964 alias method_parent this;
2965 alias method_parent super_;
2966 alias method_parent object;
2967 GObject2.Object method_parent;
2970 // Creates a new #GCredentials object with credentials matching the
2971 // the current process.
2972 // RETURNS: A #GCredentials. Free with g_object_unref().
2973 static Credentials* /*new*/ new_() {
2974 return g_credentials_new();
2977 // Unintrospectable method: get_native() / g_credentials_get_native()
2978 // Gets a pointer to native credentials of type @native_type from
2979 // @credentials.
2981 // It is a programming error (which will cause an warning to be
2982 // logged) to use this method if there is no #GCredentials support for
2983 // the OS or if @native_type isn't supported by the OS.
2985 // operation there is no #GCredentials support for the OS or if
2986 // @native_type isn't supported by the OS. Do not free the returned
2987 // data, it is owned by @credentials.
2988 // RETURNS: The pointer to native credentials or %NULL if the
2989 // <native_type>: The type of native credentials to get.
2990 void* get_native(CredentialsType native_type) {
2991 return g_credentials_get_native(&this, native_type);
2994 // Tries to get the UNIX user identifier from @credentials. This
2995 // method is only available on UNIX platforms.
2997 // This operation can fail if #GCredentials is not supported on the
2998 // OS or if the native credentials type does not contain information
2999 // about the UNIX user.
3000 // RETURNS: The UNIX user identifier or -1 if @error is set.
3001 uint get_unix_user(GLib2.Error** error=null) {
3002 return g_credentials_get_unix_user(&this, error);
3005 // Checks if @credentials and @other_credentials is the same user.
3007 // This operation can fail if #GCredentials is not supported on the
3008 // the OS.
3010 // user, %FALSE otherwise or if @error is set.
3011 // RETURNS: %TRUE if @credentials and @other_credentials has the same
3012 // <other_credentials>: A #GCredentials.
3013 int is_same_user(Credentials* other_credentials, GLib2.Error** error=null) {
3014 return g_credentials_is_same_user(&this, other_credentials, error);
3017 // Copies the native credentials of type @native_type from @native
3018 // into @credentials.
3020 // It is a programming error (which will cause an warning to be
3021 // logged) to use this method if there is no #GCredentials support for
3022 // the OS or if @native_type isn't supported by the OS.
3023 // <native_type>: The type of native credentials to set.
3024 // <native>: A pointer to native credentials.
3025 void set_native(CredentialsType native_type, void* native) {
3026 g_credentials_set_native(&this, native_type, native);
3029 // Tries to set the UNIX user identifier on @credentials. This method
3030 // is only available on UNIX platforms.
3032 // This operation can fail if #GCredentials is not supported on the
3033 // OS or if the native credentials type does not contain information
3034 // about the UNIX user.
3035 // RETURNS: %TRUE if @uid was set, %FALSE if error is set.
3036 // <uid>: The UNIX user identifier to set.
3037 int set_unix_user(uint uid, GLib2.Error** error=null) {
3038 return g_credentials_set_unix_user(&this, uid, error);
3041 // Creates a human-readable textual representation of @credentials
3042 // that can be used in logging and debug messages. The format of the
3043 // returned string may change in future GLib release.
3044 // RETURNS: A string that should be freed with g_free().
3045 char* /*new*/ to_string() {
3046 return g_credentials_to_string(&this);
3050 // Class structure for #GCredentials.
3051 struct CredentialsClass /* Version 2.26 */ {
3054 // Enumeration describing different kinds of native credential types.
3055 enum CredentialsType /* Version 2.26 */ {
3056 INVALID = 0,
3057 LINUX_UCRED = 1,
3058 FREEBSD_CMSGCRED = 2,
3059 OPENBSD_SOCKPEERCRED = 3
3061 // Information about an annotation.
3062 struct DBusAnnotationInfo /* Version 2.26 */ {
3063 int ref_count;
3064 char* key, value;
3065 DBusAnnotationInfo*[666] annotations;
3068 // If @info is statically allocated does nothing. Otherwise increases
3069 // the reference count.
3070 // RETURNS: The same @info.
3071 DBusAnnotationInfo* /*new*/ ref_() {
3072 return g_dbus_annotation_info_ref(&this);
3075 // If @info is statically allocated, does nothing. Otherwise decreases
3076 // the reference count of @info. When its reference count drops to 0,
3077 // the memory used is freed.
3078 void unref() {
3079 g_dbus_annotation_info_unref(&this);
3082 // Looks up the value of an annotation.
3084 // This cost of this function is O(n) in number of annotations.
3085 // RETURNS: The value or %NULL if not found. Do not free, it is owned by @annotations.
3086 // <annotations>: A %NULL-terminated array of annotations or %NULL.
3087 // <name>: The name of the annotation to look up.
3088 static char* lookup(DBusAnnotationInfo** annotations, char* name) {
3089 return g_dbus_annotation_info_lookup(annotations, name);
3093 // Information about an argument for a method or a signal.
3094 struct DBusArgInfo /* Version 2.26 */ {
3095 int ref_count;
3096 char* name, signature;
3097 DBusAnnotationInfo*[666] annotations;
3100 // If @info is statically allocated does nothing. Otherwise increases
3101 // the reference count.
3102 // RETURNS: The same @info.
3103 DBusArgInfo* /*new*/ ref_() {
3104 return g_dbus_arg_info_ref(&this);
3107 // If @info is statically allocated, does nothing. Otherwise decreases
3108 // the reference count of @info. When its reference count drops to 0,
3109 // the memory used is freed.
3110 void unref() {
3111 g_dbus_arg_info_unref(&this);
3116 // The #GDBusAuthObserver type provides a mechanism for participating
3117 // in how a #GDBusServer (or a #GDBusConnection) authenticates remote
3118 // peers. Simply instantiate a #GDBusAuthObserver and connect to the
3119 // signals you are interested in. Note that new signals may be added
3120 // in the future
3122 // For example, if you only want to allow D-Bus connections from
3123 // processes owned by the same uid as the server, you would use a
3124 // signal handler like the following:
3125 // <example id="auth-observer"><title>Controlling Authentication</title><programlisting>
3126 // static gboolean
3127 // on_authorize_authenticated_peer (GDBusAuthObserver *observer,
3128 // GIOStream *stream,
3129 // GCredentials *credentials,
3130 // gpointer user_data)
3131 // {
3132 // gboolean authorized;
3134 // authorized = FALSE;
3135 // if (credentials != NULL)
3136 // {
3137 // GCredentials *own_credentials;
3138 // own_credentials = g_credentials_new ();
3139 // if (g_credentials_is_same_user (credentials, own_credentials, NULL))
3140 // authorized = TRUE;
3141 // g_object_unref (own_credentials);
3142 // }
3144 // return authorized;
3145 // }
3146 // </programlisting></example>
3147 struct DBusAuthObserver /* : GObject.Object */ /* Version 2.26 */ {
3148 alias method_parent this;
3149 alias method_parent super_;
3150 alias method_parent object;
3151 GObject2.Object method_parent;
3154 // Creates a new #GDBusAuthObserver object.
3155 // RETURNS: A #GDBusAuthObserver. Free with g_object_unref().
3156 static DBusAuthObserver* /*new*/ new_() {
3157 return g_dbus_auth_observer_new();
3160 // Emits the #GDBusAuthObserver::authorize-authenticated-peer signal on @observer.
3161 // RETURNS: %TRUE if the peer is authorized, %FALSE if not.
3162 // <stream>: A #GIOStream for the #GDBusConnection.
3163 // <credentials>: Credentials received from the peer or %NULL.
3164 int authorize_authenticated_peer(IOStream* stream, Credentials* credentials) {
3165 return g_dbus_auth_observer_authorize_authenticated_peer(&this, stream, credentials);
3168 // Emitted to check if a peer that is successfully authenticated
3169 // is authorized.
3170 // RETURNS: %TRUE if the peer is authorized, %FALSE if not.
3171 // <stream>: A #GIOStream for the #GDBusConnection.
3172 // <credentials>: Credentials received from the peer or %NULL.
3173 extern (C) alias static c_int function (DBusAuthObserver* this_, IOStream* stream, Credentials* credentials, void* user_data=null) signal_authorize_authenticated_peer;
3175 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
3176 return super_.signal_connect!name(cb, data, cf);
3179 ulong signal_connect(string name:"authorize-authenticated-peer", CB:signal_authorize_authenticated_peer)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
3180 return signal_connect_data(&this, cast(char*)"authorize-authenticated-peer",
3181 cast(GObject2.Callback)cb, data, null, cf);
3185 // Flags used in g_dbus_connection_call() and similar APIs.
3186 enum DBusCallFlags /* Version 2.26 */ {
3187 NONE = 0,
3188 NO_AUTO_START = 1
3190 // Capabilities negotiated with the remote peer.
3191 enum DBusCapabilityFlags /* Version 2.26 */ {
3192 NONE = 0,
3193 UNIX_FD_PASSING = 1
3196 // The #GDBusConnection type is used for D-Bus connections to remote
3197 // peers such as a message buses. It is a low-level API that offers a
3198 // lot of flexibility. For instance, it lets you establish a connection
3199 // over any transport that can by represented as an #GIOStream.
3201 // This class is rarely used directly in D-Bus clients. If you are writing
3202 // an D-Bus client, it is often easier to use the g_bus_own_name(),
3203 // g_bus_watch_name() or g_dbus_proxy_new_for_bus() APIs.
3205 // <example id="gdbus-server"><title>D-Bus server example</title><programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gdbus-example-server.c"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting></example>
3207 // <example id="gdbus-subtree-server"><title>D-Bus subtree example</title><programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gdbus-example-subtree.c"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting></example>
3209 // <example id="gdbus-unix-fd-client"><title>D-Bus UNIX File Descriptor example</title><programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gdbus-example-unix-fd-client.c"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting></example>
3211 // <example id="gdbus-export"><title>Exporting a GObject</title><programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gdbus-example-export.c"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting></example>
3212 struct DBusConnection /* : GObject.Object */ /* Version 2.26 */ {
3213 alias method_parent this;
3214 alias method_parent super_;
3215 alias method_parent object;
3216 GObject2.Object method_parent;
3219 // Finishes an operation started with g_dbus_connection_new().
3220 // RETURNS: A #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
3221 // <res>: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_new().
3222 static DBusConnection* /*new*/ new_finish(AsyncResult* res, GLib2.Error** error=null) {
3223 return g_dbus_connection_new_finish(res, error);
3226 // Finishes an operation started with g_dbus_connection_new_for_address().
3227 // RETURNS: A #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
3228 // <res>: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_new().
3229 static DBusConnection* /*new*/ new_for_address_finish(AsyncResult* res, GLib2.Error** error=null) {
3230 return g_dbus_connection_new_for_address_finish(res, error);
3233 // Synchronously connects and sets up a D-Bus client connection for
3234 // exchanging D-Bus messages with an endpoint specified by @address
3235 // which must be in the D-Bus address format.
3237 // This constructor can only be used to initiate client-side
3238 // connections - use g_dbus_connection_new_sync() if you need to act
3239 // as the server. In particular, @flags cannot contain the
3240 // %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER or
3241 // %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags.
3243 // This is a synchronous failable constructor. See
3244 // g_dbus_connection_new_for_address() for the asynchronous version.
3246 // If @observer is not %NULL it may be used to control the
3247 // authentication process.
3248 // RETURNS: A #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
3249 // <address>: A D-Bus address.
3250 // <flags>: Flags describing how to make the connection.
3251 // <observer>: A #GDBusAuthObserver or %NULL.
3252 // <cancellable>: A #GCancellable or %NULL.
3253 static DBusConnection* /*new*/ new_for_address_sync(char* address, DBusConnectionFlags flags, DBusAuthObserver* observer, Cancellable* cancellable, GLib2.Error** error=null) {
3254 return g_dbus_connection_new_for_address_sync(address, flags, observer, cancellable, error);
3257 // Synchronously sets up a D-Bus connection for exchanging D-Bus messages
3258 // with the end represented by @stream.
3260 // If @stream is a #GSocketConnection, then the corresponding #GSocket
3261 // will be put into non-blocking mode.
3263 // If @observer is not %NULL it may be used to control the
3264 // authentication process.
3266 // This is a synchronous failable constructor. See
3267 // g_dbus_connection_new() for the asynchronous version.
3268 // RETURNS: A #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
3269 // <stream>: A #GIOStream.
3270 // <guid>: The GUID to use if a authenticating as a server or %NULL.
3271 // <flags>: Flags describing how to make the connection.
3272 // <observer>: A #GDBusAuthObserver or %NULL.
3273 // <cancellable>: A #GCancellable or %NULL.
3274 static DBusConnection* /*new*/ new_sync(IOStream* stream, char* guid, DBusConnectionFlags flags, DBusAuthObserver* observer, Cancellable* cancellable, GLib2.Error** error=null) {
3275 return g_dbus_connection_new_sync(stream, guid, flags, observer, cancellable, error);
3278 // Asynchronously sets up a D-Bus connection for exchanging D-Bus messages
3279 // with the end represented by @stream.
3281 // If @stream is a #GSocketConnection, then the corresponding #GSocket
3282 // will be put into non-blocking mode.
3284 // If @observer is not %NULL it may be used to control the
3285 // authentication process.
3287 // When the operation is finished, @callback will be invoked. You can
3288 // then call g_dbus_connection_new_finish() to get the result of the
3289 // operation.
3291 // This is a asynchronous failable constructor. See
3292 // g_dbus_connection_new_sync() for the synchronous
3293 // version.
3294 // <stream>: A #GIOStream.
3295 // <guid>: The GUID to use if a authenticating as a server or %NULL.
3296 // <flags>: Flags describing how to make the connection.
3297 // <observer>: A #GDBusAuthObserver or %NULL.
3298 // <cancellable>: A #GCancellable or %NULL.
3299 // <callback>: A #GAsyncReadyCallback to call when the request is satisfied.
3300 // <user_data>: The data to pass to @callback.
3301 static void new_(IOStream* stream, char* guid, DBusConnectionFlags flags, DBusAuthObserver* observer, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
3302 g_dbus_connection_new(stream, guid, flags, observer, cancellable, callback, user_data);
3305 // Asynchronously connects and sets up a D-Bus client connection for
3306 // exchanging D-Bus messages with an endpoint specified by @address
3307 // which must be in the D-Bus address format.
3309 // This constructor can only be used to initiate client-side
3310 // connections - use g_dbus_connection_new() if you need to act as the
3311 // server. In particular, @flags cannot contain the
3312 // %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER or
3313 // %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags.
3315 // When the operation is finished, @callback will be invoked. You can
3316 // then call g_dbus_connection_new_finish() to get the result of the
3317 // operation.
3319 // If @observer is not %NULL it may be used to control the
3320 // authentication process.
3322 // This is a asynchronous failable constructor. See
3323 // g_dbus_connection_new_for_address_sync() for the synchronous
3324 // version.
3325 // <address>: A D-Bus address.
3326 // <flags>: Flags describing how to make the connection.
3327 // <observer>: A #GDBusAuthObserver or %NULL.
3328 // <cancellable>: A #GCancellable or %NULL.
3329 // <callback>: A #GAsyncReadyCallback to call when the request is satisfied.
3330 // <user_data>: The data to pass to @callback.
3331 static void new_for_address(char* address, DBusConnectionFlags flags, DBusAuthObserver* observer, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
3332 g_dbus_connection_new_for_address(address, flags, observer, cancellable, callback, user_data);
3335 // Adds a message filter. Filters are handlers that are run on all
3336 // incoming and outgoing messages, prior to standard dispatch. Filters
3337 // are run in the order that they were added. The same handler can be
3338 // added as a filter more than once, in which case it will be run more
3339 // than once. Filters added during a filter callback won't be run on
3340 // the message being processed. Filter functions are allowed to modify
3341 // and even drop messages.
3343 // Note that filters are run in a dedicated message handling thread so
3344 // they can't block and, generally, can't do anything but signal a
3345 // worker thread. Also note that filters are rarely needed - use API
3346 // such as g_dbus_connection_send_message_with_reply(),
3347 // g_dbus_connection_signal_subscribe() or g_dbus_connection_call() instead.
3349 // If a filter consumes an incoming message the message is not
3350 // dispatched anywhere else - not even the standard dispatch machinery
3351 // (that API such as g_dbus_connection_signal_subscribe() and
3352 // g_dbus_connection_send_message_with_reply() relies on) will see the
3353 // message. Similary, if a filter consumes an outgoing message, the
3354 // message will not be sent to the other peer.
3356 // g_dbus_connection_remove_filter().
3357 // RETURNS: A filter identifier that can be used with
3358 // <filter_function>: A filter function.
3359 // <user_data>: User data to pass to @filter_function.
3360 // <user_data_free_func>: Function to free @user_data with when filter is removed or %NULL.
3361 uint add_filter(DBusMessageFilterFunction filter_function, void* user_data, GLib2.DestroyNotify user_data_free_func) {
3362 return g_dbus_connection_add_filter(&this, filter_function, user_data, user_data_free_func);
3365 // Asynchronously invokes the @method_name method on the
3366 // @interface_name D-Bus interface on the remote object at
3367 // @object_path owned by @bus_name.
3369 // If @connection is closed then the operation will fail with
3370 // %G_IO_ERROR_CLOSED. If @cancellable is canceled, the operation will
3371 // fail with %G_IO_ERROR_CANCELLED. If @parameters contains a value
3372 // not compatible with the D-Bus protocol, the operation fails with
3373 // %G_IO_ERROR_INVALID_ARGUMENT.
3375 // If @reply_type is non-%NULL then the reply will be checked for having this type and an
3376 // error will be raised if it does not match. Said another way, if you give a @reply_type
3377 // then any non-%NULL return value will be of this type.
3379 // If the @parameters #GVariant is floating, it is consumed. This allows
3380 // convenient 'inline' use of g_variant_new(), e.g.:
3381 // |[
3382 // g_dbus_connection_call (connection,
3383 // "org.freedesktop.StringThings",
3384 // "/org/freedesktop/StringThings",
3385 // "org.freedesktop.StringThings",
3386 // "TwoStrings",
3387 // g_variant_new ("(ss)",
3388 // "Thing One",
3389 // "Thing Two"),
3390 // NULL,
3391 // G_DBUS_CALL_FLAGS_NONE,
3392 // -1,
3393 // NULL,
3394 // (GAsyncReadyCallback) two_strings_done,
3395 // NULL);
3396 // ]|
3398 // This is an asynchronous method. When the operation is finished, @callback will be invoked
3399 // in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
3400 // of the thread you are calling this method from. You can then call
3401 // g_dbus_connection_call_finish() to get the result of the operation.
3402 // See g_dbus_connection_call_sync() for the synchronous version of this
3403 // function.
3404 // <bus_name>: A unique or well-known bus name or %NULL if @connection is not a message bus connection.
3405 // <object_path>: Path of remote object.
3406 // <interface_name>: D-Bus interface to invoke method on.
3407 // <method_name>: The name of the method to invoke.
3408 // <parameters>: A #GVariant tuple with parameters for the method or %NULL if not passing parameters.
3409 // <reply_type>: The expected type of the reply, or %NULL.
3410 // <flags>: Flags from the #GDBusCallFlags enumeration.
3411 // <timeout_msec>: The timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout.
3412 // <cancellable>: A #GCancellable or %NULL.
3413 // <callback>: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't * care about the result of the method invocation.
3414 // <user_data>: The data to pass to @callback.
3415 void call(char* bus_name, char* object_path, char* interface_name, char* method_name, GLib2.Variant* parameters, GLib2.VariantType* reply_type, DBusCallFlags flags, int timeout_msec, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
3416 g_dbus_connection_call(&this, bus_name, object_path, interface_name, method_name, parameters, reply_type, flags, timeout_msec, cancellable, callback, user_data);
3419 // Finishes an operation started with g_dbus_connection_call().
3421 // return values. Free with g_variant_unref().
3422 // RETURNS: %NULL if @error is set. Otherwise a #GVariant tuple with
3423 // <res>: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_call().
3424 GLib2.Variant* /*new*/ call_finish(AsyncResult* res, GLib2.Error** error=null) {
3425 return g_dbus_connection_call_finish(&this, res, error);
3428 // Synchronously invokes the @method_name method on the
3429 // @interface_name D-Bus interface on the remote object at
3430 // @object_path owned by @bus_name.
3432 // If @connection is closed then the operation will fail with
3433 // %G_IO_ERROR_CLOSED. If @cancellable is canceled, the
3434 // operation will fail with %G_IO_ERROR_CANCELLED. If @parameters
3435 // contains a value not compatible with the D-Bus protocol, the operation
3436 // fails with %G_IO_ERROR_INVALID_ARGUMENT.
3437 // If @reply_type is non-%NULL then the reply will be checked for having
3438 // this type and an error will be raised if it does not match. Said
3439 // another way, if you give a @reply_type then any non-%NULL return
3440 // value will be of this type.
3442 // If the @parameters #GVariant is floating, it is consumed.
3443 // This allows convenient 'inline' use of g_variant_new(), e.g.:
3444 // |[
3445 // g_dbus_connection_call_sync (connection,
3446 // "org.freedesktop.StringThings",
3447 // "/org/freedesktop/StringThings",
3448 // "org.freedesktop.StringThings",
3449 // "TwoStrings",
3450 // g_variant_new ("(ss)",
3451 // "Thing One",
3452 // "Thing Two"),
3453 // NULL,
3454 // G_DBUS_CALL_FLAGS_NONE,
3455 // -1,
3456 // NULL,
3457 // &amp;error);
3458 // ]|
3460 // The calling thread is blocked until a reply is received. See
3461 // g_dbus_connection_call() for the asynchronous version of
3462 // this method.
3464 // return values. Free with g_variant_unref().
3465 // RETURNS: %NULL if @error is set. Otherwise a #GVariant tuple with
3466 // <bus_name>: A unique or well-known bus name.
3467 // <object_path>: Path of remote object.
3468 // <interface_name>: D-Bus interface to invoke method on.
3469 // <method_name>: The name of the method to invoke.
3470 // <parameters>: A #GVariant tuple with parameters for the method or %NULL if not passing parameters.
3471 // <reply_type>: The expected type of the reply, or %NULL.
3472 // <flags>: Flags from the #GDBusCallFlags enumeration.
3473 // <timeout_msec>: The timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout.
3474 // <cancellable>: A #GCancellable or %NULL.
3475 GLib2.Variant* /*new*/ call_sync(char* bus_name, char* object_path, char* interface_name, char* method_name, GLib2.Variant* parameters, GLib2.VariantType* reply_type, DBusCallFlags flags, int timeout_msec, Cancellable* cancellable, GLib2.Error** error=null) {
3476 return g_dbus_connection_call_sync(&this, bus_name, object_path, interface_name, method_name, parameters, reply_type, flags, timeout_msec, cancellable, error);
3479 // Like g_dbus_connection_call() but also takes a #GUnixFDList object.
3481 // This method is only available on UNIX.
3482 // <bus_name>: A unique or well-known bus name or %NULL if @connection is not a message bus connection.
3483 // <object_path>: Path of remote object.
3484 // <interface_name>: D-Bus interface to invoke method on.
3485 // <method_name>: The name of the method to invoke.
3486 // <parameters>: A #GVariant tuple with parameters for the method or %NULL if not passing parameters.
3487 // <reply_type>: The expected type of the reply, or %NULL.
3488 // <flags>: Flags from the #GDBusCallFlags enumeration.
3489 // <timeout_msec>: The timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout.
3490 // <fd_list>: A #GUnixFDList or %NULL.
3491 // <cancellable>: A #GCancellable or %NULL.
3492 // <callback>: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't * care about the result of the method invocation.
3493 // <user_data>: The data to pass to @callback.
3494 void call_with_unix_fd_list(char* bus_name, char* object_path, char* interface_name, char* method_name, GLib2.Variant* parameters, GLib2.VariantType* reply_type, DBusCallFlags flags, int timeout_msec, UnixFDList* fd_list, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
3495 g_dbus_connection_call_with_unix_fd_list(&this, bus_name, object_path, interface_name, method_name, parameters, reply_type, flags, timeout_msec, fd_list, cancellable, callback, user_data);
3498 // Finishes an operation started with g_dbus_connection_call_with_unix_fd_list().
3500 // return values. Free with g_variant_unref().
3501 // RETURNS: %NULL if @error is set. Otherwise a #GVariant tuple with
3502 // <out_fd_list>: Return location for a #GUnixFDList or %NULL.
3503 // <res>: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_call_with_unix_fd_list().
3504 GLib2.Variant* /*new*/ call_with_unix_fd_list_finish(/*out*/ UnixFDList** out_fd_list, AsyncResult* res, GLib2.Error** error=null) {
3505 return g_dbus_connection_call_with_unix_fd_list_finish(&this, out_fd_list, res, error);
3508 // Like g_dbus_connection_call_sync() but also takes and returns #GUnixFDList objects.
3510 // This method is only available on UNIX.
3512 // return values. Free with g_variant_unref().
3513 // RETURNS: %NULL if @error is set. Otherwise a #GVariant tuple with
3514 // <bus_name>: A unique or well-known bus name.
3515 // <object_path>: Path of remote object.
3516 // <interface_name>: D-Bus interface to invoke method on.
3517 // <method_name>: The name of the method to invoke.
3518 // <parameters>: A #GVariant tuple with parameters for the method or %NULL if not passing parameters.
3519 // <reply_type>: The expected type of the reply, or %NULL.
3520 // <flags>: Flags from the #GDBusCallFlags enumeration.
3521 // <timeout_msec>: The timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout.
3522 // <fd_list>: A #GUnixFDList or %NULL.
3523 // <out_fd_list>: Return location for a #GUnixFDList or %NULL.
3524 // <cancellable>: A #GCancellable or %NULL.
3525 GLib2.Variant* /*new*/ call_with_unix_fd_list_sync(char* bus_name, char* object_path, char* interface_name, char* method_name, GLib2.Variant* parameters, GLib2.VariantType* reply_type, DBusCallFlags flags, int timeout_msec, UnixFDList* fd_list, /*out*/ UnixFDList** out_fd_list, Cancellable* cancellable, GLib2.Error** error=null) {
3526 return g_dbus_connection_call_with_unix_fd_list_sync(&this, bus_name, object_path, interface_name, method_name, parameters, reply_type, flags, timeout_msec, fd_list, out_fd_list, cancellable, error);
3529 // Closes @connection. Note that this never causes the process to
3530 // exit (this might only happen if the other end of a shared message
3531 // bus connection disconnects, see #GDBusConnection:exit-on-close).
3533 // Once the connection is closed, operations such as sending a message
3534 // will return with the error %G_IO_ERROR_CLOSED. Closing a connection
3535 // will not automatically flush the connection so queued messages may
3536 // be lost. Use g_dbus_connection_flush() if you need such guarantees.
3538 // If @connection is already closed, this method fails with
3539 // %G_IO_ERROR_CLOSED.
3541 // When @connection has been closed, the #GDBusConnection::closed
3542 // signal is emitted in the <link
3543 // linkend="g-main-context-push-thread-default">thread-default main
3544 // loop</link> of the thread that @connection was constructed in.
3546 // This is an asynchronous method. When the operation is finished,
3547 // @callback will be invoked in the <link
3548 // linkend="g-main-context-push-thread-default">thread-default main
3549 // loop</link> of the thread you are calling this method from. You can
3550 // then call g_dbus_connection_close_finish() to get the result of the
3551 // operation. See g_dbus_connection_close_sync() for the synchronous
3552 // version.
3553 // <cancellable>: A #GCancellable or %NULL.
3554 // <callback>: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't care about the result.
3555 // <user_data>: The data to pass to @callback.
3556 void close(Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
3557 g_dbus_connection_close(&this, cancellable, callback, user_data);
3560 // Finishes an operation started with g_dbus_connection_close().
3561 // RETURNS: %TRUE if the operation succeeded, %FALSE if @error is set.
3562 // <res>: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_close().
3563 int close_finish(AsyncResult* res, GLib2.Error** error=null) {
3564 return g_dbus_connection_close_finish(&this, res, error);
3567 // Synchronously closees @connection. The calling thread is blocked
3568 // until this is done. See g_dbus_connection_close() for the
3569 // asynchronous version of this method and more details about what it
3570 // does.
3571 // RETURNS: %TRUE if the operation succeeded, %FALSE if @error is set.
3572 // <cancellable>: A #GCancellable or %NULL.
3573 int close_sync(Cancellable* cancellable, GLib2.Error** error=null) {
3574 return g_dbus_connection_close_sync(&this, cancellable, error);
3577 // Emits a signal.
3579 // If the parameters GVariant is floating, it is consumed.
3581 // This can only fail if @parameters is not compatible with the D-Bus protocol.
3582 // RETURNS: %TRUE unless @error is set.
3583 // <destination_bus_name>: The unique bus name for the destination for the signal or %NULL to emit to all listeners.
3584 // <object_path>: Path of remote object.
3585 // <interface_name>: D-Bus interface to emit a signal on.
3586 // <signal_name>: The name of the signal to emit.
3587 // <parameters>: A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
3588 int emit_signal(char* destination_bus_name, char* object_path, char* interface_name, char* signal_name, GLib2.Variant* parameters, GLib2.Error** error=null) {
3589 return g_dbus_connection_emit_signal(&this, destination_bus_name, object_path, interface_name, signal_name, parameters, error);
3592 // Asynchronously flushes @connection, that is, writes all queued
3593 // outgoing message to the transport and then flushes the transport
3594 // (using g_output_stream_flush_async()). This is useful in programs
3595 // that wants to emit a D-Bus signal and then exit
3596 // immediately. Without flushing the connection, there is no guarantee
3597 // that the message has been sent to the networking buffers in the OS
3598 // kernel.
3600 // This is an asynchronous method. When the operation is finished,
3601 // @callback will be invoked in the <link
3602 // linkend="g-main-context-push-thread-default">thread-default main
3603 // loop</link> of the thread you are calling this method from. You can
3604 // then call g_dbus_connection_flush_finish() to get the result of the
3605 // operation. See g_dbus_connection_flush_sync() for the synchronous
3606 // version.
3607 // <cancellable>: A #GCancellable or %NULL.
3608 // <callback>: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't care about the result.
3609 // <user_data>: The data to pass to @callback.
3610 void flush(Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
3611 g_dbus_connection_flush(&this, cancellable, callback, user_data);
3614 // Finishes an operation started with g_dbus_connection_flush().
3615 // RETURNS: %TRUE if the operation succeeded, %FALSE if @error is set.
3616 // <res>: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_flush().
3617 int flush_finish(AsyncResult* res, GLib2.Error** error=null) {
3618 return g_dbus_connection_flush_finish(&this, res, error);
3621 // Synchronously flushes @connection. The calling thread is blocked
3622 // until this is done. See g_dbus_connection_flush() for the
3623 // asynchronous version of this method and more details about what it
3624 // does.
3625 // RETURNS: %TRUE if the operation succeeded, %FALSE if @error is set.
3626 // <cancellable>: A #GCancellable or %NULL.
3627 int flush_sync(Cancellable* cancellable, GLib2.Error** error=null) {
3628 return g_dbus_connection_flush_sync(&this, cancellable, error);
3631 // Gets the capabilities negotiated with the remote peer
3632 // RETURNS: Zero or more flags from the #GDBusCapabilityFlags enumeration.
3633 DBusCapabilityFlags get_capabilities() {
3634 return g_dbus_connection_get_capabilities(&this);
3637 // Gets whether the process is terminated when @connection is
3638 // closed by the remote peer. See
3639 // #GDBusConnection:exit-on-close for more details.
3641 // closed by the remote peer.
3642 // RETURNS: Whether the process is terminated when @connection is
3643 int get_exit_on_close() {
3644 return g_dbus_connection_get_exit_on_close(&this);
3647 // The GUID of the peer performing the role of server when
3648 // authenticating. See #GDBusConnection:guid for more details.
3650 // @connection.
3651 // RETURNS: The GUID. Do not free this string, it is owned by
3652 char* get_guid() {
3653 return g_dbus_connection_get_guid(&this);
3656 // Gets the credentials of the authenticated peer. This will always
3657 // return %NULL unless @connection acted as a server
3658 // (e.g. %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER was passed)
3659 // when set up and the client passed credentials as part of the
3660 // authentication process.
3662 // In a message bus setup, the message bus is always the server and
3663 // each application is a client. So this method will always return
3664 // %NULL for message bus clients.
3666 // this object, it is owned by @connection.
3667 // RETURNS: A #GCredentials or %NULL if not available. Do not free
3668 Credentials* get_peer_credentials() {
3669 return g_dbus_connection_get_peer_credentials(&this);
3672 // Gets the underlying stream used for IO.
3673 // RETURNS: the stream used for IO
3674 IOStream* get_stream() {
3675 return g_dbus_connection_get_stream(&this);
3678 // Gets the unique name of @connection as assigned by the message
3679 // bus. This can also be used to figure out if @connection is a
3680 // message bus connection.
3682 // bus connection. Do not free this string, it is owned by
3683 // @connection.
3684 // RETURNS: The unique name or %NULL if @connection is not a message
3685 char* get_unique_name() {
3686 return g_dbus_connection_get_unique_name(&this);
3689 // Gets whether @connection is closed.
3690 // RETURNS: %TRUE if the connection is closed, %FALSE otherwise.
3691 int is_closed() {
3692 return g_dbus_connection_is_closed(&this);
3695 // Registers callbacks for exported objects at @object_path with the
3696 // D-Bus interface that is described in @interface_info.
3698 // Calls to functions in @vtable (and @user_data_free_func) will
3699 // happen in the <link linkend="g-main-context-push-thread-default">thread-default main
3700 // loop</link> of the thread you are calling this method from.
3702 // Note that all #GVariant values passed to functions in @vtable will match
3703 // the signature given in @interface_info - if a remote caller passes
3704 // incorrect values, the <literal>org.freedesktop.DBus.Error.InvalidArgs</literal>
3705 // is returned to the remote caller.
3707 // Additionally, if the remote caller attempts to invoke methods or
3708 // access properties not mentioned in @interface_info the
3709 // <literal>org.freedesktop.DBus.Error.UnknownMethod</literal> resp.
3710 // <literal>org.freedesktop.DBus.Error.InvalidArgs</literal> errors
3711 // are returned to the caller.
3713 // It is considered a programming error if the
3714 // #GDBusInterfaceGetPropertyFunc function in @vtable returns a
3715 // #GVariant of incorrect type.
3717 // If an existing callback is already registered at @object_path and
3718 // @interface_name, then @error is set to #G_IO_ERROR_EXISTS.
3720 // GDBus automatically implements the standard D-Bus interfaces
3721 // org.freedesktop.DBus.Properties, org.freedesktop.DBus.Introspectable
3722 // and org.freedesktop.Peer, so you don't have to implement those for
3723 // the objects you export. You <emphasis>can</emphasis> implement
3724 // org.freedesktop.DBus.Properties yourself, e.g. to handle getting
3725 // and setting of properties asynchronously.
3727 // Note that the reference count on @interface_info will be
3728 // incremented by 1 (unless allocated statically, e.g. if the
3729 // reference count is -1, see g_dbus_interface_info_ref()) for as long
3730 // as the object is exported. Also note that @vtable will be copied.
3732 // See <xref linkend="gdbus-server"/> for an example of how to use this method.
3734 // that can be used with g_dbus_connection_unregister_object() .
3735 // RETURNS: 0 if @error is set, otherwise a registration id (never 0)
3736 // <object_path>: The object path to register at.
3737 // <interface_info>: Introspection data for the interface.
3738 // <vtable>: A #GDBusInterfaceVTable to call into or %NULL.
3739 // <user_data>: Data to pass to functions in @vtable.
3740 // <user_data_free_func>: Function to call when the object path is unregistered.
3741 uint register_object(char* object_path, DBusInterfaceInfo* interface_info, DBusInterfaceVTable* vtable, void* user_data, GLib2.DestroyNotify user_data_free_func, GLib2.Error** error=null) {
3742 return g_dbus_connection_register_object(&this, object_path, interface_info, vtable, user_data, user_data_free_func, error);
3745 // Registers a whole subtree of <quote>dynamic</quote> objects.
3747 // The @enumerate and @introspection functions in @vtable are used to
3748 // convey, to remote callers, what nodes exist in the subtree rooted
3749 // by @object_path.
3751 // When handling remote calls into any node in the subtree, first the
3752 // @enumerate function is used to check if the node exists. If the node exists
3753 // or the #G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is set
3754 // the @introspection function is used to check if the node supports the
3755 // requested method. If so, the @dispatch function is used to determine
3756 // where to dispatch the call. The collected #GDBusInterfaceVTable and
3757 // #gpointer will be used to call into the interface vtable for processing
3758 // the request.
3760 // All calls into user-provided code will be invoked in the <link
3761 // linkend="g-main-context-push-thread-default">thread-default main
3762 // loop</link> of the thread you are calling this method from.
3764 // If an existing subtree is already registered at @object_path or
3765 // then @error is set to #G_IO_ERROR_EXISTS.
3767 // Note that it is valid to register regular objects (using
3768 // g_dbus_connection_register_object()) in a subtree registered with
3769 // g_dbus_connection_register_subtree() - if so, the subtree handler
3770 // is tried as the last resort. One way to think about a subtree
3771 // handler is to consider it a <quote>fallback handler</quote>
3772 // for object paths not registered via g_dbus_connection_register_object()
3773 // or other bindings.
3775 // Note that @vtable will be copied so you cannot change it after
3776 // registration.
3778 // See <xref linkend="gdbus-subtree-server"/> for an example of how to use this method.
3780 // that can be used with g_dbus_connection_unregister_subtree() .
3781 // RETURNS: 0 if @error is set, otherwise a subtree registration id (never 0)
3782 // <object_path>: The object path to register the subtree at.
3783 // <vtable>: A #GDBusSubtreeVTable to enumerate, introspect and dispatch nodes in the subtree.
3784 // <flags>: Flags used to fine tune the behavior of the subtree.
3785 // <user_data>: Data to pass to functions in @vtable.
3786 // <user_data_free_func>: Function to call when the subtree is unregistered.
3787 uint register_subtree(char* object_path, DBusSubtreeVTable* vtable, DBusSubtreeFlags flags, void* user_data, GLib2.DestroyNotify user_data_free_func, GLib2.Error** error=null) {
3788 return g_dbus_connection_register_subtree(&this, object_path, vtable, flags, user_data, user_data_free_func, error);
3791 // Removes a filter.
3792 // <filter_id>: an identifier obtained from g_dbus_connection_add_filter()
3793 void remove_filter(uint filter_id) {
3794 g_dbus_connection_remove_filter(&this, filter_id);
3797 // Asynchronously sends @message to the peer represented by @connection.
3799 // Unless @flags contain the
3800 // %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number
3801 // will be assigned by @connection and set on @message via
3802 // g_dbus_message_set_serial(). If @out_serial is not %NULL, then the
3803 // serial number used will be written to this location prior to
3804 // submitting the message to the underlying transport.
3806 // If @connection is closed then the operation will fail with
3807 // %G_IO_ERROR_CLOSED. If @message is not well-formed,
3808 // the operation fails with %G_IO_ERROR_INVALID_ARGUMENT.
3810 // See <xref linkend="gdbus-server"/> and <xref
3811 // linkend="gdbus-unix-fd-client"/> for an example of how to use this
3812 // low-level API to send and receive UNIX file descriptors.
3814 // Note that @message must be unlocked, unless @flags contain the
3815 // %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.
3817 // transmission, %FALSE if @error is set.
3818 // RETURNS: %TRUE if the message was well-formed and queued for
3819 // <message>: A #GDBusMessage
3820 // <flags>: Flags affecting how the message is sent.
3821 // <out_serial>: Return location for serial number assigned to @message when sending it or %NULL.
3822 int send_message(DBusMessage* message, DBusSendMessageFlags flags, /*out*/ uint* out_serial, GLib2.Error** error=null) {
3823 return g_dbus_connection_send_message(&this, message, flags, out_serial, error);
3826 // Asynchronously sends @message to the peer represented by @connection.
3828 // Unless @flags contain the
3829 // %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number
3830 // will be assigned by @connection and set on @message via
3831 // g_dbus_message_set_serial(). If @out_serial is not %NULL, then the
3832 // serial number used will be written to this location prior to
3833 // submitting the message to the underlying transport.
3835 // If @connection is closed then the operation will fail with
3836 // %G_IO_ERROR_CLOSED. If @cancellable is canceled, the operation will
3837 // fail with %G_IO_ERROR_CANCELLED. If @message is not well-formed,
3838 // the operation fails with %G_IO_ERROR_INVALID_ARGUMENT.
3840 // This is an asynchronous method. When the operation is finished, @callback will be invoked
3841 // in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
3842 // of the thread you are calling this method from. You can then call
3843 // g_dbus_connection_send_message_with_reply_finish() to get the result of the operation.
3844 // See g_dbus_connection_send_message_with_reply_sync() for the synchronous version.
3846 // Note that @message must be unlocked, unless @flags contain the
3847 // %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.
3849 // See <xref linkend="gdbus-server"/> and <xref
3850 // linkend="gdbus-unix-fd-client"/> for an example of how to use this
3851 // low-level API to send and receive UNIX file descriptors.
3852 // <message>: A #GDBusMessage.
3853 // <flags>: Flags affecting how the message is sent.
3854 // <timeout_msec>: The timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout.
3855 // <out_serial>: Return location for serial number assigned to @message when sending it or %NULL.
3856 // <cancellable>: A #GCancellable or %NULL.
3857 // <callback>: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't care about the result.
3858 // <user_data>: The data to pass to @callback.
3859 void send_message_with_reply(DBusMessage* message, DBusSendMessageFlags flags, int timeout_msec, /*out*/ uint* out_serial, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
3860 g_dbus_connection_send_message_with_reply(&this, message, flags, timeout_msec, out_serial, cancellable, callback, user_data);
3863 // Finishes an operation started with g_dbus_connection_send_message_with_reply().
3865 // Note that @error is only set if a local in-process error
3866 // occurred. That is to say that the returned #GDBusMessage object may
3867 // be of type %G_DBUS_MESSAGE_TYPE_ERROR. Use
3868 // g_dbus_message_to_gerror() to transcode this to a #GError.
3870 // See <xref linkend="gdbus-server"/> and <xref
3871 // linkend="gdbus-unix-fd-client"/> for an example of how to use this
3872 // low-level API to send and receive UNIX file descriptors.
3873 // RETURNS: A locked #GDBusMessage or %NULL if @error is set.
3874 // <res>: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_send_message_with_reply().
3875 DBusMessage* /*new*/ send_message_with_reply_finish(AsyncResult* res, GLib2.Error** error=null) {
3876 return g_dbus_connection_send_message_with_reply_finish(&this, res, error);
3879 // Synchronously sends @message to the peer represented by @connection
3880 // and blocks the calling thread until a reply is received or the
3881 // timeout is reached. See g_dbus_connection_send_message_with_reply()
3882 // for the asynchronous version of this method.
3884 // Unless @flags contain the
3885 // %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number
3886 // will be assigned by @connection and set on @message via
3887 // g_dbus_message_set_serial(). If @out_serial is not %NULL, then the
3888 // serial number used will be written to this location prior to
3889 // submitting the message to the underlying transport.
3891 // If @connection is closed then the operation will fail with
3892 // %G_IO_ERROR_CLOSED. If @cancellable is canceled, the operation will
3893 // fail with %G_IO_ERROR_CANCELLED. If @message is not well-formed,
3894 // the operation fails with %G_IO_ERROR_INVALID_ARGUMENT.
3896 // Note that @error is only set if a local in-process error
3897 // occurred. That is to say that the returned #GDBusMessage object may
3898 // be of type %G_DBUS_MESSAGE_TYPE_ERROR. Use
3899 // g_dbus_message_to_gerror() to transcode this to a #GError.
3901 // See <xref linkend="gdbus-server"/> and <xref
3902 // linkend="gdbus-unix-fd-client"/> for an example of how to use this
3903 // low-level API to send and receive UNIX file descriptors.
3905 // Note that @message must be unlocked, unless @flags contain the
3906 // %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.
3907 // RETURNS: A locked #GDBusMessage that is the reply to @message or %NULL if @error is set.
3908 // <message>: A #GDBusMessage.
3909 // <flags>: Flags affecting how the message is sent.
3910 // <timeout_msec>: The timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout.
3911 // <out_serial>: Return location for serial number assigned to @message when sending it or %NULL.
3912 // <cancellable>: A #GCancellable or %NULL.
3913 DBusMessage* /*new*/ send_message_with_reply_sync(DBusMessage* message, DBusSendMessageFlags flags, int timeout_msec, /*out*/ uint* out_serial, Cancellable* cancellable, GLib2.Error** error=null) {
3914 return g_dbus_connection_send_message_with_reply_sync(&this, message, flags, timeout_msec, out_serial, cancellable, error);
3917 // Sets whether the process should be terminated when @connection is
3918 // closed by the remote peer. See #GDBusConnection:exit-on-close for
3919 // more details.
3921 // Note that this function should be used with care. Most modern UNIX
3922 // desktops tie the notion of a user session the session bus, and expect
3923 // all of a users applications to quit when their bus connection goes away.
3924 // If you are setting @exit_on_close to %FALSE for the shared session
3925 // bus connection, you should make sure that your application exits
3926 // when the user session ends.
3927 // <exit_on_close>: Whether the process should be terminated when @connection is closed by the remote peer.
3928 void set_exit_on_close(int exit_on_close) {
3929 g_dbus_connection_set_exit_on_close(&this, exit_on_close);
3932 // Subscribes to signals on @connection and invokes @callback with a
3933 // whenever the signal is received. Note that @callback
3934 // will be invoked in the <link
3935 // linkend="g-main-context-push-thread-default">thread-default main
3936 // loop</link> of the thread you are calling this method from.
3938 // If @connection is not a message bus connection, @sender must be
3939 // %NULL.
3941 // If @sender is a well-known name note that @callback is invoked with
3942 // the unique name for the owner of @sender, not the well-known name
3943 // as one would expect. This is because the message bus rewrites the
3944 // name. As such, to avoid certain race conditions, users should be
3945 // tracking the name owner of the well-known name and use that when
3946 // processing the received signal.
3947 // RETURNS: A subscription identifier that can be used with g_dbus_connection_signal_unsubscribe().
3948 // <sender>: Sender name to match on (unique or well-known name) or %NULL to listen from all senders.
3949 // <interface_name>: D-Bus interface name to match on or %NULL to match on all interfaces.
3950 // <member>: D-Bus signal name to match on or %NULL to match on all signals.
3951 // <object_path>: Object path to match on or %NULL to match on all object paths.
3952 // <arg0>: Contents of first string argument to match on or %NULL to match on all kinds of arguments.
3953 // <flags>: Flags describing how to subscribe to the signal (currently unused).
3954 // <callback>: Callback to invoke when there is a signal matching the requested data.
3955 // <user_data>: User data to pass to @callback.
3956 // <user_data_free_func>: Function to free @user_data with when subscription is removed or %NULL.
3957 uint signal_subscribe(char* sender, char* interface_name, char* member, char* object_path, char* arg0, DBusSignalFlags flags, DBusSignalCallback callback, void* user_data, GLib2.DestroyNotify user_data_free_func=null) {
3958 return g_dbus_connection_signal_subscribe(&this, sender, interface_name, member, object_path, arg0, flags, callback, user_data, user_data_free_func);
3961 // Unsubscribes from signals.
3962 // <subscription_id>: A subscription id obtained from g_dbus_connection_signal_subscribe().
3963 void signal_unsubscribe(uint subscription_id) {
3964 g_dbus_connection_signal_unsubscribe(&this, subscription_id);
3967 // If @connection was created with
3968 // %G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING, this method
3969 // starts processing messages. Does nothing on if @connection wasn't
3970 // created with this flag or if the method has already been called.
3971 void start_message_processing() {
3972 g_dbus_connection_start_message_processing(&this);
3975 // Unregisters an object.
3976 // RETURNS: %TRUE if the object was unregistered, %FALSE otherwise.
3977 // <registration_id>: A registration id obtained from g_dbus_connection_register_object().
3978 int unregister_object(uint registration_id) {
3979 return g_dbus_connection_unregister_object(&this, registration_id);
3982 // Unregisters a subtree.
3983 // RETURNS: %TRUE if the subtree was unregistered, %FALSE otherwise.
3984 // <registration_id>: A subtree registration id obtained from g_dbus_connection_register_subtree().
3985 int unregister_subtree(uint registration_id) {
3986 return g_dbus_connection_unregister_subtree(&this, registration_id);
3989 // Emitted when the connection is closed.
3991 // The cause of this event can be
3992 // <itemizedlist>
3993 // <listitem><para>
3994 // If g_dbus_connection_close() is called. In this case
3995 // @remote_peer_vanished is set to %FALSE and @error is %NULL.
3996 // </para></listitem>
3997 // <listitem><para>
3998 // If the remote peer closes the connection. In this case
3999 // @remote_peer_vanished is set to %TRUE and @error is set.
4000 // </para></listitem>
4001 // <listitem><para>
4002 // If the remote peer sends invalid or malformed data. In this
4003 // case @remote_peer_vanished is set to %FALSE and @error
4004 // is set.
4005 // </para></listitem>
4006 // </itemizedlist>
4008 // Upon receiving this signal, you should give up your reference to
4009 // @connection. You are guaranteed that this signal is emitted only
4010 // once.
4011 // <remote_peer_vanished>: %TRUE if @connection is closed because the remote peer closed its end of the connection.
4012 // <error>: A #GError with more details about the event or %NULL.
4013 extern (C) alias static void function (DBusConnection* this_, c_int remote_peer_vanished, GLib2.Error* error, void* user_data=null) signal_closed;
4015 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
4016 return super_.signal_connect!name(cb, data, cf);
4019 ulong signal_connect(string name:"closed", CB:signal_closed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
4020 return signal_connect_data(&this, cast(char*)"closed",
4021 cast(GObject2.Callback)cb, data, null, cf);
4025 // Flags used when creating a new #GDBusConnection.
4026 enum DBusConnectionFlags /* Version 2.26 */ {
4027 NONE = 0,
4028 AUTHENTICATION_CLIENT = 1,
4029 AUTHENTICATION_SERVER = 2,
4030 AUTHENTICATION_ALLOW_ANONYMOUS = 4,
4031 MESSAGE_BUS_CONNECTION = 8,
4032 DELAY_MESSAGE_PROCESSING = 16
4035 // Certain timeout errors, e.g. while starting a service. Warning: this is
4036 // Error codes for the %G_DBUS_ERROR error domain.
4037 enum DBusError /* Version 2.26 */ {
4038 FAILED = 0,
4039 NO_MEMORY = 1,
4040 SERVICE_UNKNOWN = 2,
4041 NAME_HAS_NO_OWNER = 3,
4042 NO_REPLY = 4,
4043 IO_ERROR = 5,
4044 BAD_ADDRESS = 6,
4045 NOT_SUPPORTED = 7,
4046 LIMITS_EXCEEDED = 8,
4047 ACCESS_DENIED = 9,
4048 AUTH_FAILED = 10,
4049 NO_SERVER = 11,
4050 TIMEOUT = 12,
4051 NO_NETWORK = 13,
4052 ADDRESS_IN_USE = 14,
4053 DISCONNECTED = 15,
4054 INVALID_ARGS = 16,
4055 FILE_NOT_FOUND = 17,
4056 FILE_EXISTS = 18,
4057 UNKNOWN_METHOD = 19,
4058 TIMED_OUT = 20,
4059 MATCH_RULE_NOT_FOUND = 21,
4060 MATCH_RULE_INVALID = 22,
4061 SPAWN_EXEC_FAILED = 23,
4062 SPAWN_FORK_FAILED = 24,
4063 SPAWN_CHILD_EXITED = 25,
4064 SPAWN_CHILD_SIGNALED = 26,
4065 SPAWN_FAILED = 27,
4066 SPAWN_SETUP_FAILED = 28,
4067 SPAWN_CONFIG_INVALID = 29,
4068 SPAWN_SERVICE_INVALID = 30,
4069 SPAWN_SERVICE_NOT_FOUND = 31,
4070 SPAWN_PERMISSIONS_INVALID = 32,
4071 SPAWN_FILE_INVALID = 33,
4072 SPAWN_NO_MEMORY = 34,
4073 UNIX_PROCESS_ID_UNKNOWN = 35,
4074 INVALID_SIGNATURE = 36,
4075 INVALID_FILE_CONTENT = 37,
4076 SELINUX_SECURITY_CONTEXT_UNKNOWN = 38,
4077 ADT_AUDIT_DATA_UNKNOWN = 39,
4078 OBJECT_PATH_IN_USE = 40
4080 // Struct used in g_dbus_error_register_error_domain().
4081 struct DBusErrorEntry /* Version 2.26 */ {
4082 int error_code;
4083 char* dbus_error_name;
4087 // The #GDBusInterface type is the base type for D-Bus interfaces both
4088 // on the service side (see #GDBusInterfaceSkeleton) and client side
4089 // (see #GDBusProxy).
4090 struct DBusInterface /* Version 2.30 */ {
4092 // Gets D-Bus introspection information for the D-Bus interface
4093 // implemented by @interface_.
4094 // RETURNS: A #GDBusInterfaceInfo. Do not free.
4095 DBusInterfaceInfo* get_info() {
4096 return g_dbus_interface_get_info(&this);
4099 // Gets the #GDBusObject that @interface_ belongs to, if any.
4101 // reference belongs to @interface_ and should not be freed.
4102 // RETURNS: A #GDBusObject or %NULL. The returned
4103 DBusObject* get_object() {
4104 return g_dbus_interface_get_object(&this);
4107 // Sets the #GDBusObject for @interface_ to @object.
4109 // Note that @interface_ will hold a weak reference to @object.
4110 // <object>: A #GDBusObject or %NULL.
4111 void set_object(DBusObject* object) {
4112 g_dbus_interface_set_object(&this, object);
4117 // The type of the @get_property function in #GDBusInterfaceVTable.
4119 // @error is set. If the returned #GVariant is floating, it is
4120 // consumed - otherwise its reference count is decreased by one.
4121 // RETURNS: A #GVariant with the value for @property_name or %NULL if
4122 // <connection>: A #GDBusConnection.
4123 // <sender>: The unique bus name of the remote caller.
4124 // <object_path>: The object path that the method was invoked on.
4125 // <interface_name>: The D-Bus interface name for the property.
4126 // <property_name>: The name of the property to get the value of.
4127 // <error>: Return location for error.
4128 // <user_data>: The @user_data #gpointer passed to g_dbus_connection_register_object().
4129 extern (C) alias GLib2.Variant* /*new*/ function (DBusConnection* connection, char* sender, char* object_path, char* interface_name, char* property_name, GLib2.Error** error, void* user_data) DBusInterfaceGetPropertyFunc;
4131 // Base type for D-Bus interfaces.
4132 struct DBusInterfaceIface /* Version 2.30 */ {
4133 GObject2.TypeInterface parent_iface;
4134 // RETURNS: A #GDBusInterfaceInfo. Do not free.
4135 extern (C) DBusInterfaceInfo* function (DBusInterface* interface_) get_info;
4136 // RETURNS: A #GDBusObject or %NULL. The returned
4137 extern (C) DBusObject* function (DBusInterface* interface_) get_object;
4138 // <object>: A #GDBusObject or %NULL.
4139 extern (C) void function (DBusInterface* interface_, DBusObject* object) set_object;
4142 // Information about a D-Bus interface.
4143 struct DBusInterfaceInfo /* Version 2.26 */ {
4144 int ref_count;
4145 char* name;
4146 DBusMethodInfo*[666] methods;
4147 DBusSignalInfo*[666] signals;
4148 DBusPropertyInfo*[666] properties;
4149 DBusAnnotationInfo*[666] annotations;
4152 // Builds a lookup-cache to speed up
4153 // g_dbus_interface_info_lookup_method(),
4154 // g_dbus_interface_info_lookup_signal() and
4155 // g_dbus_interface_info_lookup_property().
4157 // If this has already been called with @info, the existing cache is
4158 // used and its use count is increased.
4160 // Note that @info cannot be modified until
4161 // g_dbus_interface_info_cache_release() is called.
4162 void cache_build() {
4163 g_dbus_interface_info_cache_build(&this);
4166 // Decrements the usage count for the cache for @info built by
4167 // g_dbus_interface_info_cache_build() (if any) and frees the
4168 // resources used by the cache if the usage count drops to zero.
4169 void cache_release() {
4170 g_dbus_interface_info_cache_release(&this);
4173 // Appends an XML representation of @info (and its children) to @string_builder.
4175 // This function is typically used for generating introspection XML
4176 // documents at run-time for handling the
4177 // <literal>org.freedesktop.DBus.Introspectable.Introspect</literal>
4178 // method.
4179 // <indent>: Indentation level.
4180 // <string_builder>: A #GString to to append XML data to.
4181 void generate_xml(uint indent, /*out*/ GLib2.String* string_builder) {
4182 g_dbus_interface_info_generate_xml(&this, indent, string_builder);
4185 // Looks up information about a method.
4187 // This cost of this function is O(n) in number of methods unless
4188 // g_dbus_interface_info_cache_build() has been used on @info.
4189 // RETURNS: A #GDBusMethodInfo or %NULL if not found. Do not free, it is owned by @info.
4190 // <name>: A D-Bus method name (typically in CamelCase)
4191 DBusMethodInfo* lookup_method(char* name) {
4192 return g_dbus_interface_info_lookup_method(&this, name);
4195 // Looks up information about a property.
4197 // This cost of this function is O(n) in number of properties unless
4198 // g_dbus_interface_info_cache_build() has been used on @info.
4199 // RETURNS: A #GDBusPropertyInfo or %NULL if not found. Do not free, it is owned by @info.
4200 // <name>: A D-Bus property name (typically in CamelCase).
4201 DBusPropertyInfo* lookup_property(char* name) {
4202 return g_dbus_interface_info_lookup_property(&this, name);
4205 // Looks up information about a signal.
4207 // This cost of this function is O(n) in number of signals unless
4208 // g_dbus_interface_info_cache_build() has been used on @info.
4209 // RETURNS: A #GDBusSignalInfo or %NULL if not found. Do not free, it is owned by @info.
4210 // <name>: A D-Bus signal name (typically in CamelCase)
4211 DBusSignalInfo* lookup_signal(char* name) {
4212 return g_dbus_interface_info_lookup_signal(&this, name);
4215 // If @info is statically allocated does nothing. Otherwise increases
4216 // the reference count.
4217 // RETURNS: The same @info.
4218 DBusInterfaceInfo* /*new*/ ref_() {
4219 return g_dbus_interface_info_ref(&this);
4222 // If @info is statically allocated, does nothing. Otherwise decreases
4223 // the reference count of @info. When its reference count drops to 0,
4224 // the memory used is freed.
4225 void unref() {
4226 g_dbus_interface_info_unref(&this);
4231 // The type of the @method_call function in #GDBusInterfaceVTable.
4232 // <connection>: A #GDBusConnection.
4233 // <sender>: The unique bus name of the remote caller.
4234 // <object_path>: The object path that the method was invoked on.
4235 // <interface_name>: The D-Bus interface name the method was invoked on.
4236 // <method_name>: The name of the method that was invoked.
4237 // <parameters>: A #GVariant tuple with parameters.
4238 // <invocation>: A #GDBusMethodInvocation object that can be used to return a value or error.
4239 // <user_data>: The @user_data #gpointer passed to g_dbus_connection_register_object().
4240 extern (C) alias void function (DBusConnection* connection, char* sender, char* object_path, char* interface_name, char* method_name, GLib2.Variant* parameters, DBusMethodInvocation* invocation, void* user_data) DBusInterfaceMethodCallFunc;
4243 // The type of the @set_property function in #GDBusInterfaceVTable.
4244 // RETURNS: %TRUE if the property was set to @value, %FALSE if @error is set.
4245 // <connection>: A #GDBusConnection.
4246 // <sender>: The unique bus name of the remote caller.
4247 // <object_path>: The object path that the method was invoked on.
4248 // <interface_name>: The D-Bus interface name for the property.
4249 // <property_name>: The name of the property to get the value of.
4250 // <value>: The value to set the property to.
4251 // <error>: Return location for error.
4252 // <user_data>: The @user_data #gpointer passed to g_dbus_connection_register_object().
4253 extern (C) alias int function (DBusConnection* connection, char* sender, char* object_path, char* interface_name, char* property_name, GLib2.Variant* value, GLib2.Error** error, void* user_data) DBusInterfaceSetPropertyFunc;
4255 // Abstract base class for D-Bus interfaces on the service side.
4256 struct DBusInterfaceSkeleton /* : GObject.Object */ /* Version 2.30 */ {
4257 alias parent_instance this;
4258 alias parent_instance super_;
4259 alias parent_instance object;
4260 GObject2.Object parent_instance;
4261 private DBusInterfaceSkeletonPrivate* priv;
4264 // Exports @interface_ at @object_path on @connection.
4266 // Use g_dbus_interface_skeleton_unexport() to unexport the object.
4268 // @error set.
4269 // RETURNS: %TRUE if the interface was exported, other %FALSE with
4270 // <connection>: A #GDBusConnection to export @interface_ on.
4271 // <object_path>: The path to export the interface at.
4272 int export_(DBusConnection* connection, char* object_path, GLib2.Error** error=null) {
4273 return g_dbus_interface_skeleton_export(&this, connection, object_path, error);
4276 // If @interface_ has outstanding changes, request for these changes to be
4277 // emitted immediately.
4279 // For example, an exported D-Bus interface may queue up property
4280 // changes and emit the
4281 // <literal>org.freedesktop.DBus.Properties::PropertiesChanged</literal>
4282 // signal later (e.g. in an idle handler). This technique is useful
4283 // for collapsing multiple property changes into one.
4284 void flush() {
4285 g_dbus_interface_skeleton_flush(&this);
4288 // Gets the connection that @interface_ is exported on, if any.
4290 // not exported anywhere. Do not free, the object belongs to @interface_.
4291 // RETURNS: A #GDBusConnection or %NULL if @interface_ is
4292 DBusConnection* get_connection() {
4293 return g_dbus_interface_skeleton_get_connection(&this);
4296 // Gets the #GDBusInterfaceSkeletonFlags that describes what the behavior
4297 // of @interface_
4298 // RETURNS: One or more flags from the #GDBusInterfaceSkeletonFlags enumeration.
4299 DBusInterfaceSkeletonFlags get_flags() {
4300 return g_dbus_interface_skeleton_get_flags(&this);
4303 // Gets D-Bus introspection information for the D-Bus interface
4304 // implemented by @interface_.
4305 // RETURNS: A #GDBusInterfaceInfo (never %NULL). Do not free.
4306 DBusInterfaceInfo* get_info() {
4307 return g_dbus_interface_skeleton_get_info(&this);
4310 // Gets the object path that @interface_ is exported on, if any.
4312 // anywhere. Do not free, the string belongs to @interface_.
4313 // RETURNS: A string owned by @interface_ or %NULL if @interface_ is not exported
4314 char* get_object_path() {
4315 return g_dbus_interface_skeleton_get_object_path(&this);
4318 // Gets all D-Bus properties for @interface_.
4319 // RETURNS: A #GVariant of type <link linkend="G-VARIANT-TYPE-VARDICT:CAPS">'a{sv}'</link>. Free with g_variant_unref().
4320 GLib2.Variant* /*new*/ get_properties() {
4321 return g_dbus_interface_skeleton_get_properties(&this);
4324 // Unintrospectable method: get_vtable() / g_dbus_interface_skeleton_get_vtable()
4325 // Gets the interface vtable for the D-Bus interface implemented by
4326 // @interface_. The returned function pointers should expect @interface_
4327 // itself to be passed as @user_data.
4328 // RETURNS: A #GDBusInterfaceVTable (never %NULL).
4329 DBusInterfaceVTable* get_vtable() {
4330 return g_dbus_interface_skeleton_get_vtable(&this);
4333 // Sets flags describing what the behavior of @skeleton should be.
4334 // <flags>: Flags from the #GDBusInterfaceSkeletonFlags enumeration.
4335 void set_flags(DBusInterfaceSkeletonFlags flags) {
4336 g_dbus_interface_skeleton_set_flags(&this, flags);
4339 // Stops exporting an interface previously exported with
4340 // g_dbus_interface_skeleton_export().
4341 void unexport() {
4342 g_dbus_interface_skeleton_unexport(&this);
4345 // Emitted when a method is invoked by a remote caller and used to
4346 // determine if the method call is authorized.
4348 // Note that this signal is emitted in a thread dedicated to
4349 // handling the method call so handlers are allowed to perform
4350 // blocking IO. This means that it is appropriate to call
4351 // e.g. <ulink
4352 // url="http://hal.freedesktop.org/docs/polkit/PolkitAuthority.html#polkit-authority-check-authorization-sync">polkit_authority_check_authorization_sync()</ulink>
4353 // with the <ulink
4354 // url="http://hal.freedesktop.org/docs/polkit/PolkitAuthority.html#POLKIT-CHECK-AUTHORIZATION-FLAGS-ALLOW-USER-INTERACTION:CAPS">POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION</ulink> flag set.
4356 // If %FALSE is returned then no further handlers are run and the
4357 // signal handler must take a reference to @invocation and finish
4358 // handling the call (e.g. return an error via
4359 // g_dbus_method_invocation_return_error()).
4361 // Otherwise, if %TRUE is returned, signal emission continues. If no
4362 // handlers return %FALSE, then the method is dispatched. If
4363 // @interface has an enclosing #GDBusObjectSkeleton, then the
4364 // #GDBusObjectSkeleton::authorize-method signal handlers run before
4365 // the handlers for this signal.
4367 // The default class handler just returns %TRUE.
4369 // Please note that the common case is optimized: if no signals
4370 // handlers are connected and the default class handler isn't
4371 // overridden (for both @interface and the enclosing
4372 // #GDBusObjectSkeleton, if any) and #GDBusInterfaceSkeleton:g-flags does
4373 // not have the
4374 // %G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD
4375 // flags set, no dedicated thread is ever used and the call will be
4376 // handled in the same thread as the object that @interface belongs
4377 // to was exported in.
4378 // RETURNS: %TRUE if the call is authorized, %FALSE otherwise.
4379 // <invocation>: A #GDBusMethodInvocation.
4380 extern (C) alias static c_int function (DBusInterfaceSkeleton* this_, DBusMethodInvocation* invocation, void* user_data=null) signal_g_authorize_method;
4382 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
4383 return super_.signal_connect!name(cb, data, cf);
4386 ulong signal_connect(string name:"g-authorize-method", CB:signal_g_authorize_method)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
4387 return signal_connect_data(&this, cast(char*)"g-authorize-method",
4388 cast(GObject2.Callback)cb, data, null, cf);
4392 // Class structure for #GDBusInterfaceSkeleton.
4393 struct DBusInterfaceSkeletonClass /* Version 2.30 */ {
4394 GObject2.ObjectClass parent_class;
4395 // RETURNS: A #GDBusInterfaceInfo (never %NULL). Do not free.
4396 extern (C) DBusInterfaceInfo* function (DBusInterfaceSkeleton* interface_) get_info;
4398 // Unintrospectable functionp: get_vtable() / ()
4400 // RETURNS: A #GDBusInterfaceVTable (never %NULL).
4401 extern (C) DBusInterfaceVTable* function (DBusInterfaceSkeleton* interface_) get_vtable;
4402 // RETURNS: A #GVariant of type <link linkend="G-VARIANT-TYPE-VARDICT:CAPS">'a{sv}'</link>. Free with g_variant_unref().
4403 extern (C) GLib2.Variant* /*new*/ function (DBusInterfaceSkeleton* interface_) get_properties;
4404 extern (C) void function (DBusInterfaceSkeleton* interface_) flush;
4405 private void*[8] vfunc_padding;
4406 extern (C) int function (DBusInterfaceSkeleton* interface_, DBusMethodInvocation* invocation) g_authorize_method;
4407 private void*[8] signal_padding;
4410 // Flags describing the behavior of a #GDBusInterfaceSkeleton instance.
4411 enum DBusInterfaceSkeletonFlags /* Version 2.30 */ {
4412 NONE = 0,
4413 HANDLE_METHOD_INVOCATIONS_IN_THREAD = 1
4415 struct DBusInterfaceSkeletonPrivate {
4419 // Virtual table for handling properties and method calls for a D-Bus
4420 // interface.
4422 // If you want to handle getting/setting D-Bus properties asynchronously, simply
4423 // register an object with the <literal>org.freedesktop.DBus.Properties</literal>
4424 // D-Bus interface using g_dbus_connection_register_object().
4425 struct DBusInterfaceVTable /* Version 2.26 */ {
4426 DBusInterfaceMethodCallFunc method_call;
4427 DBusInterfaceGetPropertyFunc get_property;
4428 DBusInterfaceSetPropertyFunc set_property;
4429 private void*[8] padding;
4433 // A type for representing D-Bus messages that can be sent or received
4434 // on a #GDBusConnection.
4435 struct DBusMessage /* : GObject.Object */ /* Version 2.26 */ {
4436 alias method_parent this;
4437 alias method_parent super_;
4438 alias method_parent object;
4439 GObject2.Object method_parent;
4442 // Creates a new empty #GDBusMessage.
4443 // RETURNS: A #GDBusMessage. Free with g_object_unref().
4444 static DBusMessage* /*new*/ new_() {
4445 return g_dbus_message_new();
4448 // Creates a new #GDBusMessage from the data stored at @blob. The byte
4449 // order that the message was in can be retrieved using
4450 // g_dbus_message_get_byte_order().
4452 // g_object_unref().
4453 // RETURNS: A new #GDBusMessage or %NULL if @error is set. Free with
4454 // <blob>: A blob represent a binary D-Bus message.
4455 // <blob_len>: The length of @blob.
4456 // <capabilities>: A #GDBusCapabilityFlags describing what protocol features are supported.
4457 static DBusMessage* /*new*/ new_from_blob(ubyte* blob, size_t blob_len, DBusCapabilityFlags capabilities, GLib2.Error** error=null) {
4458 return g_dbus_message_new_from_blob(blob, blob_len, capabilities, error);
4461 // Creates a new #GDBusMessage for a method call.
4462 // RETURNS: A #GDBusMessage. Free with g_object_unref().
4463 // <name>: A valid D-Bus name or %NULL.
4464 // <path>: A valid object path.
4465 // <interface_>: A valid D-Bus interface name or %NULL.
4466 // <method>: A valid method name.
4467 static DBusMessage* /*new*/ new_method_call(char* name, char* path, char* interface_, char* method) {
4468 return g_dbus_message_new_method_call(name, path, interface_, method);
4471 // Creates a new #GDBusMessage for a signal emission.
4472 // RETURNS: A #GDBusMessage. Free with g_object_unref().
4473 // <path>: A valid object path.
4474 // <interface_>: A valid D-Bus interface name.
4475 // <signal>: A valid signal name.
4476 static DBusMessage* /*new*/ new_signal(char* path, char* interface_, char* signal) {
4477 return g_dbus_message_new_signal(path, interface_, signal);
4480 // Utility function to calculate how many bytes are needed to
4481 // completely deserialize the D-Bus message stored at @blob.
4483 // @blob contains invalid data or not enough data is available to
4484 // determine the size).
4485 // RETURNS: Number of bytes needed or -1 if @error is set (e.g. if
4486 // <blob>: A blob represent a binary D-Bus message.
4487 // <blob_len>: The length of @blob (must be at least 16).
4488 static ssize_t bytes_needed(ubyte* blob, size_t blob_len, GLib2.Error** error=null) {
4489 return g_dbus_message_bytes_needed(blob, blob_len, error);
4492 // Copies @message. The copy is a deep copy and the returned
4493 // #GDBusMessage is completely identical except that it is guaranteed
4494 // to not be locked.
4496 // This operation can fail if e.g. @message contains file descriptors
4497 // and the per-process or system-wide open files limit is reached.
4499 // Free with g_object_unref().
4500 // RETURNS: A new #GDBusMessage or %NULL if @error is set.
4501 DBusMessage* /*new*/ copy(GLib2.Error** error=null) {
4502 return g_dbus_message_copy(&this, error);
4505 // Convenience to get the first item in the body of @message.
4507 // @message is not a string.
4508 // RETURNS: The string item or %NULL if the first item in the body of
4509 char* get_arg0() {
4510 return g_dbus_message_get_arg0(&this);
4513 // Gets the body of a message.
4514 // RETURNS: A #GVariant or %NULL if the body is empty. Do not free, it is owned by @message.
4515 GLib2.Variant* /*new*/ get_body() {
4516 return g_dbus_message_get_body(&this);
4519 // Gets the byte order of @message.
4520 // RETURNS: The byte order.
4521 DBusMessageByteOrder get_byte_order() {
4522 return g_dbus_message_get_byte_order(&this);
4525 // Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.
4526 // RETURNS: The value.
4527 char* get_destination() {
4528 return g_dbus_message_get_destination(&this);
4531 // Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.
4532 // RETURNS: The value.
4533 char* get_error_name() {
4534 return g_dbus_message_get_error_name(&this);
4537 // Gets the flags for @message.
4538 // RETURNS: Flags that are set (typically values from the #GDBusMessageFlags enumeration bitwise ORed together).
4539 DBusMessageFlags get_flags() {
4540 return g_dbus_message_get_flags(&this);
4543 // Gets a header field on @message.
4545 // otherwise. Do not free, it is owned by @message.
4546 // RETURNS: A #GVariant with the value if the header was found, %NULL
4547 // <header_field>: A 8-bit unsigned integer (typically a value from the #GDBusMessageHeaderField enumeration)
4548 GLib2.Variant* /*new*/ get_header(DBusMessageHeaderField header_field) {
4549 return g_dbus_message_get_header(&this, header_field);
4552 // Gets an array of all header fields on @message that are set.
4554 // %G_DBUS_MESSAGE_HEADER_FIELD_INVALID. Each element is a
4555 // #guchar. Free with g_free().
4556 // RETURNS: An array of header fields terminated by
4557 ubyte* get_header_fields() {
4558 return g_dbus_message_get_header_fields(&this);
4561 // Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.
4562 // RETURNS: The value.
4563 char* get_interface() {
4564 return g_dbus_message_get_interface(&this);
4567 // Checks whether @message is locked. To monitor changes to this
4568 // value, conncet to the #GObject::notify signal to listen for changes
4569 // on the #GDBusMessage:locked property.
4570 // RETURNS: %TRUE if @message is locked, %FALSE otherwise.
4571 int get_locked() {
4572 return g_dbus_message_get_locked(&this);
4575 // Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.
4576 // RETURNS: The value.
4577 char* get_member() {
4578 return g_dbus_message_get_member(&this);
4581 // Gets the type of @message.
4582 // RETURNS: A 8-bit unsigned integer (typically a value from the #GDBusMessageType enumeration).
4583 DBusMessageType get_message_type() {
4584 return g_dbus_message_get_message_type(&this);
4587 // Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.
4588 // RETURNS: The value.
4589 uint get_num_unix_fds() {
4590 return g_dbus_message_get_num_unix_fds(&this);
4593 // Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.
4594 // RETURNS: The value.
4595 char* get_path() {
4596 return g_dbus_message_get_path(&this);
4599 // Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.
4600 // RETURNS: The value.
4601 uint get_reply_serial() {
4602 return g_dbus_message_get_reply_serial(&this);
4605 // Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.
4606 // RETURNS: The value.
4607 char* get_sender() {
4608 return g_dbus_message_get_sender(&this);
4611 // Gets the serial for @message.
4612 // RETURNS: A #guint32.
4613 uint get_serial() {
4614 return g_dbus_message_get_serial(&this);
4617 // Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.
4618 // RETURNS: The value.
4619 char* get_signature() {
4620 return g_dbus_message_get_signature(&this);
4623 // Gets the UNIX file descriptors associated with @message, if any.
4625 // This method is only available on UNIX.
4627 // associated. Do not free, this object is owned by @message.
4628 // RETURNS: A #GUnixFDList or %NULL if no file descriptors are
4629 UnixFDList* get_unix_fd_list() {
4630 return g_dbus_message_get_unix_fd_list(&this);
4632 // If @message is locked, does nothing. Otherwise locks the message.
4633 void lock() {
4634 g_dbus_message_lock(&this);
4637 // Unintrospectable method: new_method_error() / g_dbus_message_new_method_error()
4638 // Creates a new #GDBusMessage that is an error reply to @method_call_message.
4639 // RETURNS: A #GDBusMessage. Free with g_object_unref().
4640 // <error_name>: A valid D-Bus error name.
4641 // <error_message_format>: The D-Bus error message in a printf() format.
4642 /+ Not available -- variadic methods unsupported - use the C function directly.
4643 alias g_dbus_message_new_method_error new_method_error; // Variadic
4646 // Creates a new #GDBusMessage that is an error reply to @method_call_message.
4647 // RETURNS: A #GDBusMessage. Free with g_object_unref().
4648 // <error_name>: A valid D-Bus error name.
4649 // <error_message>: The D-Bus error message.
4650 DBusMessage* /*new*/ new_method_error_literal(char* error_name, char* error_message) {
4651 return g_dbus_message_new_method_error_literal(&this, error_name, error_message);
4654 // Unintrospectable method: new_method_error_valist() / g_dbus_message_new_method_error_valist()
4655 // Like g_dbus_message_new_method_error() but intended for language bindings.
4656 // RETURNS: A #GDBusMessage. Free with g_object_unref().
4657 // <error_name>: A valid D-Bus error name.
4658 // <error_message_format>: The D-Bus error message in a printf() format.
4659 // <var_args>: Arguments for @error_message_format.
4660 DBusMessage* /*new*/ new_method_error_valist(char* error_name, char* error_message_format, va_list var_args) {
4661 return g_dbus_message_new_method_error_valist(&this, error_name, error_message_format, var_args);
4664 // Creates a new #GDBusMessage that is a reply to @method_call_message.
4665 // RETURNS: #GDBusMessage. Free with g_object_unref().
4666 DBusMessage* /*new*/ new_method_reply() {
4667 return g_dbus_message_new_method_reply(&this);
4670 // Produces a human-readable multi-line description of @message.
4672 // The contents of the description has no ABI guarantees, the contents
4673 // and formatting is subject to change at any time. Typical output
4674 // looks something like this:
4675 // <programlisting>
4676 // Flags: none
4677 // Version: 0
4678 // Serial: 4
4679 // Headers:
4680 // path -> objectpath '/org/gtk/GDBus/TestObject'
4681 // interface -> 'org.gtk.GDBus.TestInterface'
4682 // member -> 'GimmeStdout'
4683 // destination -> ':1.146'
4684 // Body: ()
4685 // UNIX File Descriptors:
4686 // (none)
4687 // </programlisting>
4688 // or
4689 // <programlisting>
4690 // Flags: no-reply-expected
4691 // Version: 0
4692 // Serial: 477
4693 // Headers:
4694 // reply-serial -> uint32 4
4695 // destination -> ':1.159'
4696 // sender -> ':1.146'
4697 // num-unix-fds -> uint32 1
4698 // Body: ()
4699 // UNIX File Descriptors:
4700 // fd 12: dev=0:10,mode=020620,ino=5,uid=500,gid=5,rdev=136:2,size=0,atime=1273085037,mtime=1273085851,ctime=1272982635
4701 // </programlisting>
4702 // RETURNS: A string that should be freed with g_free().
4703 // <indent>: Indentation level.
4704 char* /*new*/ print(uint indent) {
4705 return g_dbus_message_print(&this, indent);
4708 // Sets the body @message. As a side-effect the
4709 // %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field is set to the
4710 // type string of @body (or cleared if @body is %NULL).
4712 // If @body is floating, @message assumes ownership of @body.
4713 // <body>: Either %NULL or a #GVariant that is a tuple.
4714 void set_body(GLib2.Variant* body_) {
4715 g_dbus_message_set_body(&this, body_);
4718 // Sets the byte order of @message.
4719 // <byte_order>: The byte order.
4720 void set_byte_order(DBusMessageByteOrder byte_order) {
4721 g_dbus_message_set_byte_order(&this, byte_order);
4724 // Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.
4725 // <value>: The value to set.
4726 void set_destination(char* value) {
4727 g_dbus_message_set_destination(&this, value);
4730 // Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.
4731 // <value>: The value to set.
4732 void set_error_name(char* value) {
4733 g_dbus_message_set_error_name(&this, value);
4736 // Sets the flags to set on @message.
4737 // <flags>: Flags for @message that are set (typically values from the #GDBusMessageFlags enumeration bitwise ORed together).
4738 void set_flags(DBusMessageFlags flags) {
4739 g_dbus_message_set_flags(&this, flags);
4742 // Sets a header field on @message.
4744 // If @value is floating, @message assumes ownership of @value.
4745 // <header_field>: A 8-bit unsigned integer (typically a value from the #GDBusMessageHeaderField enumeration)
4746 // <value>: A #GVariant to set the header field or %NULL to clear the header field.
4747 void set_header(DBusMessageHeaderField header_field, GLib2.Variant* value) {
4748 g_dbus_message_set_header(&this, header_field, value);
4751 // Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.
4752 // <value>: The value to set.
4753 void set_interface(char* value) {
4754 g_dbus_message_set_interface(&this, value);
4757 // Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.
4758 // <value>: The value to set.
4759 void set_member(char* value) {
4760 g_dbus_message_set_member(&this, value);
4763 // Sets @message to be of @type.
4764 // <type>: A 8-bit unsigned integer (typically a value from the #GDBusMessageType enumeration).
4765 void set_message_type(DBusMessageType type) {
4766 g_dbus_message_set_message_type(&this, type);
4769 // Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.
4770 // <value>: The value to set.
4771 void set_num_unix_fds(uint value) {
4772 g_dbus_message_set_num_unix_fds(&this, value);
4775 // Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.
4776 // <value>: The value to set.
4777 void set_path(char* value) {
4778 g_dbus_message_set_path(&this, value);
4781 // Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.
4782 // <value>: The value to set.
4783 void set_reply_serial(uint value) {
4784 g_dbus_message_set_reply_serial(&this, value);
4787 // Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.
4788 // <value>: The value to set.
4789 void set_sender(char* value) {
4790 g_dbus_message_set_sender(&this, value);
4793 // Sets the serial for @message.
4794 // <serial>: A #guint32.
4795 void set_serial(uint serial) {
4796 g_dbus_message_set_serial(&this, serial);
4799 // Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.
4800 // <value>: The value to set.
4801 void set_signature(char* value) {
4802 g_dbus_message_set_signature(&this, value);
4805 // Sets the UNIX file descriptors associated with @message. As a
4806 // side-effect the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header
4807 // field is set to the number of fds in @fd_list (or cleared if
4808 // @fd_list is %NULL).
4810 // This method is only available on UNIX.
4811 // <fd_list>: A #GUnixFDList or %NULL.
4812 void set_unix_fd_list(UnixFDList* fd_list=null) {
4813 g_dbus_message_set_unix_fd_list(&this, fd_list);
4816 // Serializes @message to a blob. The byte order returned by
4817 // g_dbus_message_get_byte_order() will be used.
4819 // generated by @message or %NULL if @error is set. Free with g_free().
4820 // RETURNS: A pointer to a valid binary D-Bus message of @out_size bytes
4821 // <out_size>: Return location for size of generated blob.
4822 // <capabilities>: A #GDBusCapabilityFlags describing what protocol features are supported.
4823 ubyte* to_blob(size_t* out_size, DBusCapabilityFlags capabilities, GLib2.Error** error=null) {
4824 return g_dbus_message_to_blob(&this, out_size, capabilities, error);
4827 // If @message is not of type %G_DBUS_MESSAGE_TYPE_ERROR does
4828 // nothing and returns %FALSE.
4830 // Otherwise this method encodes the error in @message as a #GError
4831 // using g_dbus_error_set_dbus_error() using the information in the
4832 // %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field of @message as
4833 // well as the first string item in @message's body.
4834 // RETURNS: %TRUE if @error was set, %FALSE otherwise.
4835 int to_gerror(GLib2.Error** error=null) {
4836 return g_dbus_message_to_gerror(&this, error);
4840 // Enumeration used to describe the byte order of a D-Bus message.
4841 enum DBusMessageByteOrder /* Version 2.26 */ {
4842 BIG_ENDIAN = 66,
4843 LITTLE_ENDIAN = 108
4846 // Signature for function used in g_dbus_connection_add_filter().
4848 // A filter function is passed a #GDBusMessage and expected to return
4849 // a #GDBusMessage too. Passive filter functions that don't modify the
4850 // message can simply return the @message object:
4851 // |[
4852 // static GDBusMessage *
4853 // passive_filter (GDBusConnection *connection
4854 // GDBusMessage *message,
4855 // gboolean incoming,
4856 // gpointer user_data)
4857 // {
4858 // /<!-- -->* inspect @message *<!-- -->/
4859 // return message;
4860 // }
4861 // ]|
4862 // Filter functions that wants to drop a message can simply return %NULL:
4863 // |[
4864 // static GDBusMessage *
4865 // drop_filter (GDBusConnection *connection
4866 // GDBusMessage *message,
4867 // gboolean incoming,
4868 // gpointer user_data)
4869 // {
4870 // if (should_drop_message)
4871 // {
4872 // g_object_unref (message);
4873 // message = NULL;
4874 // }
4875 // return message;
4876 // }
4877 // ]|
4878 // Finally, a filter function may modify a message by copying it:
4879 // |[
4880 // static GDBusMessage *
4881 // modifying_filter (GDBusConnection *connection
4882 // GDBusMessage *message,
4883 // gboolean incoming,
4884 // gpointer user_data)
4885 // {
4886 // GDBusMessage *copy;
4887 // GError *error;
4889 // error = NULL;
4890 // copy = g_dbus_message_copy (message, &error);
4891 // /<!-- -->* handle @error being is set *<!-- -->/
4892 // g_object_unref (message);
4894 // /<!-- -->* modify @copy *<!-- -->/
4896 // return copy;
4897 // }
4898 // ]|
4899 // If the returned #GDBusMessage is different from @message and cannot
4900 // be sent on @connection (it could use features, such as file
4901 // descriptors, not compatible with @connection), then a warning is
4902 // logged to <emphasis>standard error</emphasis>. Applications can
4903 // check this ahead of time using g_dbus_message_to_blob() passing a
4904 // #GDBusCapabilityFlags value obtained from @connection.
4906 // g_object_unref() or %NULL to drop the message. Passive filter
4907 // functions can simply return the passed @message object.
4908 // RETURNS: A #GDBusMessage that will be freed with
4909 // <connection>: A #GDBusConnection.
4910 // <message>: A locked #GDBusMessage that the filter function takes ownership of.
4911 // <incoming>: %TRUE if it is a message received from the other peer, %FALSE if it is a message to be sent to the other peer.
4912 // <user_data>: User data passed when adding the filter.
4913 extern (C) alias DBusMessage* /*new*/ function (DBusConnection* connection, DBusMessage* message, int incoming, void* user_data) DBusMessageFilterFunction;
4915 // Message flags used in #GDBusMessage.
4916 enum DBusMessageFlags /* Version 2.26 */ {
4917 NONE = 0,
4918 NO_REPLY_EXPECTED = 1,
4919 NO_AUTO_START = 2
4921 // Header fields used in #GDBusMessage.
4922 enum DBusMessageHeaderField /* Version 2.26 */ {
4923 INVALID = 0,
4924 PATH = 1,
4925 INTERFACE = 2,
4926 MEMBER = 3,
4927 ERROR_NAME = 4,
4928 REPLY_SERIAL = 5,
4929 DESTINATION = 6,
4930 SENDER = 7,
4931 SIGNATURE = 8,
4932 NUM_UNIX_FDS = 9
4934 // Message types used in #GDBusMessage.
4935 enum DBusMessageType /* Version 2.26 */ {
4936 INVALID = 0,
4937 METHOD_CALL = 1,
4938 METHOD_RETURN = 2,
4939 ERROR = 3,
4940 SIGNAL = 4
4942 // Information about a method on an D-Bus interface.
4943 struct DBusMethodInfo /* Version 2.26 */ {
4944 int ref_count;
4945 char* name;
4946 DBusArgInfo*[666] in_args, out_args;
4947 DBusAnnotationInfo*[666] annotations;
4950 // If @info is statically allocated does nothing. Otherwise increases
4951 // the reference count.
4952 // RETURNS: The same @info.
4953 DBusMethodInfo* /*new*/ ref_() {
4954 return g_dbus_method_info_ref(&this);
4957 // If @info is statically allocated, does nothing. Otherwise decreases
4958 // the reference count of @info. When its reference count drops to 0,
4959 // the memory used is freed.
4960 void unref() {
4961 g_dbus_method_info_unref(&this);
4966 // Instances of the #GDBusMethodInvocation class are used when
4967 // handling D-Bus method calls. It provides a way to asynchronously
4968 // return results and errors.
4970 // The normal way to obtain a #GDBusMethodInvocation object is to receive
4971 // it as an argument to the handle_method_call() function in a
4972 // #GDBusInterfaceVTable that was passed to g_dbus_connection_register_object().
4973 struct DBusMethodInvocation /* : GObject.Object */ /* Version 2.26 */ {
4974 alias method_parent this;
4975 alias method_parent super_;
4976 alias method_parent object;
4977 GObject2.Object method_parent;
4980 // Gets the #GDBusConnection the method was invoked on.
4981 // RETURNS: A #GDBusConnection. Do not free, it is owned by @invocation.
4982 DBusConnection* get_connection() {
4983 return g_dbus_method_invocation_get_connection(&this);
4986 // Gets the name of the D-Bus interface the method was invoked on.
4987 // RETURNS: A string. Do not free, it is owned by @invocation.
4988 char* get_interface_name() {
4989 return g_dbus_method_invocation_get_interface_name(&this);
4992 // Gets the #GDBusMessage for the method invocation. This is useful if
4993 // you need to use low-level protocol features, such as UNIX file
4994 // descriptor passing, that cannot be properly expressed in the
4995 // #GVariant API.
4997 // See <xref linkend="gdbus-server"/> and <xref
4998 // linkend="gdbus-unix-fd-client"/> for an example of how to use this
4999 // low-level API to send and receive UNIX file descriptors.
5000 // RETURNS: #GDBusMessage. Do not free, it is owned by @invocation.
5001 DBusMessage* get_message() {
5002 return g_dbus_method_invocation_get_message(&this);
5005 // Gets information about the method call, if any.
5006 // RETURNS: A #GDBusMethodInfo or %NULL. Do not free, it is owned by @invocation.
5007 DBusMethodInfo* get_method_info() {
5008 return g_dbus_method_invocation_get_method_info(&this);
5011 // Gets the name of the method that was invoked.
5012 // RETURNS: A string. Do not free, it is owned by @invocation.
5013 char* get_method_name() {
5014 return g_dbus_method_invocation_get_method_name(&this);
5017 // Gets the object path the method was invoked on.
5018 // RETURNS: A string. Do not free, it is owned by @invocation.
5019 char* get_object_path() {
5020 return g_dbus_method_invocation_get_object_path(&this);
5023 // Gets the parameters of the method invocation. If there are no input
5024 // parameters then this will return a GVariant with 0 children rather than NULL.
5025 // RETURNS: A #GVariant tuple. Do not unref this because it is owned by @invocation.
5026 GLib2.Variant* get_parameters() {
5027 return g_dbus_method_invocation_get_parameters(&this);
5030 // Gets the bus name that invoked the method.
5031 // RETURNS: A string. Do not free, it is owned by @invocation.
5032 char* get_sender() {
5033 return g_dbus_method_invocation_get_sender(&this);
5036 // Unintrospectable method: get_user_data() / g_dbus_method_invocation_get_user_data()
5037 // Gets the @user_data #gpointer passed to g_dbus_connection_register_object().
5038 // RETURNS: A #gpointer.
5039 void* get_user_data() {
5040 return g_dbus_method_invocation_get_user_data(&this);
5043 // Finishes handling a D-Bus method call by returning an error.
5045 // This method will free @invocation, you cannot use it afterwards.
5046 // <error_name>: A valid D-Bus error name.
5047 // <error_message>: A valid D-Bus error message.
5048 void return_dbus_error(char* error_name, char* error_message) {
5049 g_dbus_method_invocation_return_dbus_error(&this, error_name, error_message);
5052 // Unintrospectable method: return_error() / g_dbus_method_invocation_return_error()
5053 // Finishes handling a D-Bus method call by returning an error.
5055 // See g_dbus_error_encode_gerror() for details about what error name
5056 // will be returned on the wire. In a nutshell, if the given error is
5057 // registered using g_dbus_error_register_error() the name given
5058 // during registration is used. Otherwise, a name of the form
5059 // <literal>org.gtk.GDBus.UnmappedGError.Quark...</literal> is
5060 // used. This provides transparent mapping of #GError between
5061 // applications using GDBus.
5063 // If you are writing an application intended to be portable,
5064 // <emphasis>always</emphasis> register errors with g_dbus_error_register_error()
5065 // or use g_dbus_method_invocation_return_dbus_error().
5067 // This method will free @invocation, you cannot use it afterwards.
5068 // <domain>: A #GQuark for the #GError error domain.
5069 // <code>: The error code.
5070 // <format>: printf()-style format.
5071 /+ Not available -- variadic methods unsupported - use the C function directly.
5072 alias g_dbus_method_invocation_return_error return_error; // Variadic
5075 // Like g_dbus_method_invocation_return_error() but without printf()-style formatting.
5077 // This method will free @invocation, you cannot use it afterwards.
5078 // <domain>: A #GQuark for the #GError error domain.
5079 // <code>: The error code.
5080 // <message>: The error message.
5081 void return_error_literal(GLib2.Quark domain, int code, char* message) {
5082 g_dbus_method_invocation_return_error_literal(&this, domain, code, message);
5085 // Unintrospectable method: return_error_valist() / g_dbus_method_invocation_return_error_valist()
5086 // Like g_dbus_method_invocation_return_error() but intended for
5087 // language bindings.
5089 // This method will free @invocation, you cannot use it afterwards.
5090 // <domain>: A #GQuark for the #GError error domain.
5091 // <code>: The error code.
5092 // <format>: printf()-style format.
5093 // <var_args>: #va_list of parameters for @format.
5094 void return_error_valist(GLib2.Quark domain, int code, char* format, va_list var_args) {
5095 g_dbus_method_invocation_return_error_valist(&this, domain, code, format, var_args);
5098 // Like g_dbus_method_invocation_return_error() but takes a #GError
5099 // instead of the error domain, error code and message.
5101 // This method will free @invocation, you cannot use it afterwards.
5102 // <error>: A #GError.
5103 void return_gerror(GLib2.Error* error) {
5104 g_dbus_method_invocation_return_gerror(&this, error);
5107 // Finishes handling a D-Bus method call by returning @parameters.
5108 // If the @parameters GVariant is floating, it is consumed.
5110 // It is an error if @parameters is not of the right format.
5112 // This method will free @invocation, you cannot use it afterwards.
5113 // <parameters>: A #GVariant tuple with out parameters for the method or %NULL if not passing any parameters.
5114 void return_value(GLib2.Variant* parameters=null) {
5115 g_dbus_method_invocation_return_value(&this, parameters);
5118 // Like g_dbus_method_invocation_return_value() but also takes a #GUnixFDList.
5120 // This method is only available on UNIX.
5122 // This method will free @invocation, you cannot use it afterwards.
5123 // <parameters>: A #GVariant tuple with out parameters for the method or %NULL if not passing any parameters.
5124 // <fd_list>: A #GUnixFDList or %NULL.
5125 void return_value_with_unix_fd_list(GLib2.Variant* parameters=null, UnixFDList* fd_list=null) {
5126 g_dbus_method_invocation_return_value_with_unix_fd_list(&this, parameters, fd_list);
5129 // Unintrospectable method: take_error() / g_dbus_method_invocation_take_error()
5130 // Like g_dbus_method_invocation_return_gerror() but takes ownership
5131 // of @error so the caller does not need to free it.
5133 // This method will free @invocation, you cannot use it afterwards.
5134 // <error>: A #GError.
5135 void take_error(GLib2.Error* error) {
5136 g_dbus_method_invocation_take_error(&this, error);
5140 // Information about nodes in a remote object hierarchy.
5141 struct DBusNodeInfo /* Version 2.26 */ {
5142 int ref_count;
5143 char* path;
5144 DBusInterfaceInfo*[666] interfaces;
5145 DBusNodeInfo*[666] nodes;
5146 DBusAnnotationInfo*[666] annotations;
5149 // Parses @xml_data and returns a #GDBusNodeInfo representing the data.
5151 // with g_dbus_node_info_unref().
5152 // RETURNS: A #GDBusNodeInfo structure or %NULL if @error is set. Free
5153 // <xml_data>: Valid D-Bus introspection XML.
5154 static DBusNodeInfo* /*new*/ new_for_xml(char* xml_data, GLib2.Error** error=null) {
5155 return g_dbus_node_info_new_for_xml(xml_data, error);
5158 // Appends an XML representation of @info (and its children) to @string_builder.
5160 // This function is typically used for generating introspection XML documents at run-time for
5161 // handling the <literal>org.freedesktop.DBus.Introspectable.Introspect</literal> method.
5162 // <indent>: Indentation level.
5163 // <string_builder>: A #GString to to append XML data to.
5164 void generate_xml(uint indent, /*out*/ GLib2.String* string_builder) {
5165 g_dbus_node_info_generate_xml(&this, indent, string_builder);
5168 // Looks up information about an interface.
5170 // This cost of this function is O(n) in number of interfaces.
5171 // RETURNS: A #GDBusInterfaceInfo or %NULL if not found. Do not free, it is owned by @info.
5172 // <name>: A D-Bus interface name.
5173 DBusInterfaceInfo* lookup_interface(char* name) {
5174 return g_dbus_node_info_lookup_interface(&this, name);
5177 // If @info is statically allocated does nothing. Otherwise increases
5178 // the reference count.
5179 // RETURNS: The same @info.
5180 DBusNodeInfo* /*new*/ ref_() {
5181 return g_dbus_node_info_ref(&this);
5184 // If @info is statically allocated, does nothing. Otherwise decreases
5185 // the reference count of @info. When its reference count drops to 0,
5186 // the memory used is freed.
5187 void unref() {
5188 g_dbus_node_info_unref(&this);
5193 // The #GDBusObject type is the base type for D-Bus objects on both
5194 // the service side (see #GDBusObjectSkeleton) and the client side
5195 // (see #GDBusObjectProxy). It is essentially just a container of
5196 // interfaces.
5197 struct DBusObject {
5199 // Gets the D-Bus interface with name @interface_name associated with
5200 // @object, if any.
5202 // #GDBusInterface that must be freed with g_object_unref().
5203 // RETURNS: %NULL if not found, otherwise a
5204 // <interface_name>: A D-Bus interface name.
5205 DBusInterface* /*new*/ get_interface(char* interface_name) {
5206 return g_dbus_object_get_interface(&this, interface_name);
5209 // Gets the D-Bus interfaces associated with @object.
5211 // The returned list must be freed by g_list_free() after each element has been freed
5212 // with g_object_unref().
5213 // RETURNS: A list of #GDBusInterface instances.
5214 GLib2.List* /*new*/ get_interfaces() {
5215 return g_dbus_object_get_interfaces(&this);
5218 // Gets the object path for @object.
5219 // RETURNS: A string owned by @object. Do not free.
5220 char* get_object_path() {
5221 return g_dbus_object_get_object_path(&this);
5224 // Emitted when @interface is added to @object.
5225 // <interface>: The #GDBusInterface that was added.
5226 extern (C) alias static void function (DBusObject* this_, DBusInterface* interface_, void* user_data=null) signal_interface_added;
5228 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
5229 return super_.signal_connect!name(cb, data, cf);
5232 ulong signal_connect(string name:"interface-added", CB:signal_interface_added)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
5233 return signal_connect_data(&this, cast(char*)"interface-added",
5234 cast(GObject2.Callback)cb, data, null, cf);
5237 // Emitted when @interface is removed from @object.
5238 // <interface>: The #GDBusInterface that was removed.
5239 extern (C) alias static void function (DBusObject* this_, DBusInterface* interface_, void* user_data=null) signal_interface_removed;
5240 ulong signal_connect(string name:"interface-removed", CB:signal_interface_removed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
5241 return signal_connect_data(&this, cast(char*)"interface-removed",
5242 cast(GObject2.Callback)cb, data, null, cf);
5246 // Base object type for D-Bus objects.
5247 struct DBusObjectIface /* Version 2.30 */ {
5248 GObject2.TypeInterface parent_iface;
5249 // RETURNS: A string owned by @object. Do not free.
5250 extern (C) char* function (DBusObject* object) get_object_path;
5251 // RETURNS: A list of #GDBusInterface instances.
5252 extern (C) GLib2.List* /*new*/ function (DBusObject* object) get_interfaces;
5254 // RETURNS: %NULL if not found, otherwise a
5255 // <interface_name>: A D-Bus interface name.
5256 extern (C) DBusInterface* /*new*/ function (DBusObject* object, char* interface_name) get_interface;
5257 extern (C) void function (DBusObject* object, DBusInterface* interface_) interface_added;
5258 extern (C) void function (DBusObject* object, DBusInterface* interface_) interface_removed;
5262 // The #GDBusObjectManager type is the base type for service- and
5263 // client-side implementations of the standardized <ulink
5264 // url="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager">org.freedesktop.DBus.ObjectManager</ulink>
5265 // interface.
5267 // See #GDBusObjectManagerClient for the client-side implementation
5268 // and #GDBusObjectManagerServer for the service-side implementation.
5269 struct DBusObjectManager {
5271 // Gets the interface proxy for @interface_name at @object_path, if
5272 // any.
5274 // with g_object_unref().
5275 // RETURNS: A #GDBusInterface instance or %NULL. Free
5276 // <object_path>: Object path to lookup.
5277 // <interface_name>: D-Bus interface name to lookup.
5278 DBusInterface* /*new*/ get_interface(char* object_path, char* interface_name) {
5279 return g_dbus_object_manager_get_interface(&this, object_path, interface_name);
5282 // Gets the #GDBusObjectProxy at @object_path, if any.
5284 // g_object_unref().
5285 // RETURNS: A #GDBusObject or %NULL. Free with
5286 // <object_path>: Object path to lookup.
5287 DBusObject* /*new*/ get_object(char* object_path) {
5288 return g_dbus_object_manager_get_object(&this, object_path);
5291 // Gets the object path that @manager is for.
5292 // RETURNS: A string owned by @manager. Do not free.
5293 char* get_object_path() {
5294 return g_dbus_object_manager_get_object_path(&this);
5297 // Gets all #GDBusObject objects known to @manager.
5299 // #GDBusObject objects. The returned list should be freed with
5300 // g_list_free() after each element has been freed with
5301 // g_object_unref().
5302 // RETURNS: A list of
5303 GLib2.List* /*new*/ get_objects() {
5304 return g_dbus_object_manager_get_objects(&this);
5307 // Emitted when @interface is added to @object.
5309 // This signal exists purely as a convenience to avoid having to
5310 // connect signals to all objects managed by @manager.
5311 // <object>: The #GDBusObject on which an interface was added.
5312 // <interface>: The #GDBusInterface that was added.
5313 extern (C) alias static void function (DBusObjectManager* this_, DBusObject* object, DBusInterface* interface_, void* user_data=null) signal_interface_added;
5315 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
5316 return super_.signal_connect!name(cb, data, cf);
5319 ulong signal_connect(string name:"interface-added", CB:signal_interface_added)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
5320 return signal_connect_data(&this, cast(char*)"interface-added",
5321 cast(GObject2.Callback)cb, data, null, cf);
5324 // Emitted when @interface has been removed from @object.
5326 // This signal exists purely as a convenience to avoid having to
5327 // connect signals to all objects managed by @manager.
5328 // <object>: The #GDBusObject on which an interface was removed.
5329 // <interface>: The #GDBusInterface that was removed.
5330 extern (C) alias static void function (DBusObjectManager* this_, DBusObject* object, DBusInterface* interface_, void* user_data=null) signal_interface_removed;
5331 ulong signal_connect(string name:"interface-removed", CB:signal_interface_removed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
5332 return signal_connect_data(&this, cast(char*)"interface-removed",
5333 cast(GObject2.Callback)cb, data, null, cf);
5336 // Emitted when @object is added to @manager.
5337 // <object>: The #GDBusObject that was added.
5338 extern (C) alias static void function (DBusObjectManager* this_, DBusObject* object, void* user_data=null) signal_object_added;
5339 ulong signal_connect(string name:"object-added", CB:signal_object_added)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
5340 return signal_connect_data(&this, cast(char*)"object-added",
5341 cast(GObject2.Callback)cb, data, null, cf);
5344 // Emitted when @object is removed from @manager.
5345 // <object>: The #GDBusObject that was removed.
5346 extern (C) alias static void function (DBusObjectManager* this_, DBusObject* object, void* user_data=null) signal_object_removed;
5347 ulong signal_connect(string name:"object-removed", CB:signal_object_removed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
5348 return signal_connect_data(&this, cast(char*)"object-removed",
5349 cast(GObject2.Callback)cb, data, null, cf);
5354 // #GDBusObjectManagerClient is used to create, monitor and delete object
5355 // proxies for remote objects exported by a #GDBusObjectManagerServer (or any
5356 // code implementing the <ulink
5357 // url="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager">org.freedesktop.DBus.ObjectManager</ulink>
5358 // interface).
5360 // Once an instance of this type has been created, you can connect to
5361 // the #GDBusObjectManager::object-added and
5362 // #GDBusObjectManager::object-removed signals and inspect the
5363 // #GDBusObjectProxy objects returned by
5364 // g_dbus_object_manager_get_objects().
5366 // If the name for a #GDBusObjectManagerClient is not owned by anyone at
5367 // object construction time, the default behavior is to request the
5368 // message bus to launch an owner for the name. This behavior can be
5369 // disabled using the %G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START
5370 // flag. It's also worth noting that this only works if the name of
5371 // interest is activatable in the first place. E.g. in some cases it
5372 // is not possible to launch an owner for the requested name. In this
5373 // case, #GDBusObjectManagerClient object construction still succeeds but
5374 // there will be no object proxies
5375 // (e.g. g_dbus_object_manager_get_objects() returns the empty list) and
5376 // the #GDBusObjectManagerClient:name-owner property is %NULL.
5378 // The owner of the requested name can come and go (for example
5379 // consider a system service being restarted) – #GDBusObjectManagerClient
5380 // handles this case too; simply connect to the #GObject::notify
5381 // signal to watch for changes on the #GDBusObjectManagerClient:name-owner
5382 // property. When the name owner vanishes, the behavior is that
5383 // #GDBusObjectManagerClient:name-owner is set to %NULL (this includes
5384 // emission of the #GObject::notify signal) and then
5385 // #GDBusObjectManager::object-removed signals are synthesized
5386 // for all currently existing object proxies. Since
5387 // #GDBusObjectManagerClient:name-owner is %NULL when this happens, you can
5388 // use this information to disambiguate a synthesized signal from a
5389 // genuine signal caused by object removal on the remote
5390 // #GDBusObjectManager. Similarly, when a new name owner appears,
5391 // #GDBusObjectManager::object-added signals are synthesized
5392 // while #GDBusObjectManagerClient:name-owner is still %NULL. Only when all
5393 // object proxies have been added, the #GDBusObjectManagerClient:name-owner
5394 // is set to the new name owner (this includes emission of the
5395 // #GObject::notify signal). Furthermore, you are guaranteed that
5396 // #GDBusObjectManagerClient:name-owner will alternate between a name owner
5397 // (e.g. <literal>:1.42</literal>) and %NULL even in the case where
5398 // the name of interest is atomically replaced
5400 // Ultimately, #GDBusObjectManagerClient is used to obtain #GDBusProxy
5401 // instances. All signals (including the
5402 // <literal>org.freedesktop.DBus.Properties::PropertiesChanged</literal>
5403 // signal) delivered to #GDBusProxy instances are guaranteed to
5404 // originate from the name owner. This guarantee along with the
5405 // behavior described above, means that certain race conditions
5406 // including the <emphasis><quote>half the proxy is from the old owner
5407 // and the other half is from the new owner</quote></emphasis> problem
5408 // cannot happen.
5410 // To avoid having the application connect to signals on the returned
5411 // #GDBusObjectProxy and #GDBusProxy objects, the
5412 // #GDBusObject::interface-added,
5413 // #GDBusObject::interface-removed,
5414 // #GDBusProxy::g-properties-changed and
5415 // #GDBusProxy::g-signal signals
5416 // are also emitted on the #GDBusObjectManagerClient instance managing these
5417 // objects. The signals emitted are
5418 // #GDBusObjectManager::interface-added,
5419 // #GDBusObjectManager::interface-removed,
5420 // #GDBusObjectManagerClient::interface-proxy-properties-changed and
5421 // #GDBusObjectManagerClient::interface-proxy-signal.
5423 // Note that all callbacks and signals are emitted in the
5424 // <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
5425 // that the #GDBusObjectManagerClient object was constructed
5426 // in. Additionally, the #GDBusObjectProxy and #GDBusProxy objects
5427 // originating from the #GDBusObjectManagerClient object will be created in
5428 // the same context and, consequently, will deliver signals in the
5429 // same main loop.
5430 struct DBusObjectManagerClient /* : GObject.Object */ /* Version 2.30 */ {
5431 alias parent_instance this;
5432 alias parent_instance super_;
5433 alias parent_instance object;
5434 GObject2.Object parent_instance;
5435 private DBusObjectManagerClientPrivate* priv;
5438 // Finishes an operation started with g_dbus_object_manager_client_new().
5440 // #GDBusObjectManagerClient object or %NULL if @error is set. Free
5441 // with g_object_unref().
5442 // RETURNS: A
5443 // <res>: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_object_manager_client_new().
5444 static DBusObjectManagerClient* /*new*/ new_finish(AsyncResult* res, GLib2.Error** error=null) {
5445 return g_dbus_object_manager_client_new_finish(res, error);
5448 // Finishes an operation started with g_dbus_object_manager_client_new_for_bus().
5450 // #GDBusObjectManagerClient object or %NULL if @error is set. Free
5451 // with g_object_unref().
5452 // RETURNS: A
5453 // <res>: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_object_manager_client_new_for_bus().
5454 static DBusObjectManagerClient* /*new*/ new_for_bus_finish(AsyncResult* res, GLib2.Error** error=null) {
5455 return g_dbus_object_manager_client_new_for_bus_finish(res, error);
5458 // Like g_dbus_object_manager_client_new_sync() but takes a #GBusType instead
5459 // of a #GDBusConnection.
5461 // This is a synchronous failable constructor - the calling thread is
5462 // blocked until a reply is received. See g_dbus_object_manager_client_new_for_bus()
5463 // for the asynchronous version.
5465 // #GDBusObjectManagerClient object or %NULL if @error is set. Free
5466 // with g_object_unref().
5467 // RETURNS: A
5468 // <bus_type>: A #GBusType.
5469 // <flags>: Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
5470 // <name>: The owner of the control object (unique or well-known name).
5471 // <object_path>: The object path of the control object.
5472 // <get_proxy_type_func>: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
5473 // <get_proxy_type_user_data>: User data to pass to @get_proxy_type_func.
5474 // <get_proxy_type_destroy_notify>: Free function for @get_proxy_type_user_data or %NULL.
5475 // <cancellable>: A #GCancellable or %NULL
5476 static DBusObjectManagerClient* /*new*/ new_for_bus_sync(BusType bus_type, DBusObjectManagerClientFlags flags, char* name, char* object_path, DBusProxyTypeFunc get_proxy_type_func, void* get_proxy_type_user_data, GLib2.DestroyNotify get_proxy_type_destroy_notify, Cancellable* cancellable, GLib2.Error** error=null) {
5477 return g_dbus_object_manager_client_new_for_bus_sync(bus_type, flags, name, object_path, get_proxy_type_func, get_proxy_type_user_data, get_proxy_type_destroy_notify, cancellable, error);
5480 // Creates a new #GDBusObjectManagerClient object.
5482 // This is a synchronous failable constructor - the calling thread is
5483 // blocked until a reply is received. See g_dbus_object_manager_client_new()
5484 // for the asynchronous version.
5486 // #GDBusObjectManagerClient object or %NULL if @error is set. Free
5487 // with g_object_unref().
5488 // RETURNS: A
5489 // <connection>: A #GDBusConnection.
5490 // <flags>: Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
5491 // <name>: The owner of the control object (unique or well-known name).
5492 // <object_path>: The object path of the control object.
5493 // <get_proxy_type_func>: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
5494 // <get_proxy_type_user_data>: User data to pass to @get_proxy_type_func.
5495 // <get_proxy_type_destroy_notify>: Free function for @get_proxy_type_user_data or %NULL.
5496 // <cancellable>: A #GCancellable or %NULL
5497 static DBusObjectManagerClient* /*new*/ new_sync(DBusConnection* connection, DBusObjectManagerClientFlags flags, char* name, char* object_path, DBusProxyTypeFunc get_proxy_type_func, void* get_proxy_type_user_data, GLib2.DestroyNotify get_proxy_type_destroy_notify, Cancellable* cancellable, GLib2.Error** error=null) {
5498 return g_dbus_object_manager_client_new_sync(connection, flags, name, object_path, get_proxy_type_func, get_proxy_type_user_data, get_proxy_type_destroy_notify, cancellable, error);
5501 // Asynchronously creates a new #GDBusObjectManagerClient object.
5503 // This is an asynchronous failable constructor. When the result is
5504 // ready, @callback will be invoked in the
5505 // <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
5506 // of the thread you are calling this method from. You can
5507 // then call g_dbus_object_manager_client_new_finish() to get the result. See
5508 // g_dbus_object_manager_client_new_sync() for the synchronous version.
5509 // <connection>: A #GDBusConnection.
5510 // <flags>: Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
5511 // <name>: The owner of the control object (unique or well-known name).
5512 // <object_path>: The object path of the control object.
5513 // <get_proxy_type_func>: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
5514 // <get_proxy_type_user_data>: User data to pass to @get_proxy_type_func.
5515 // <get_proxy_type_destroy_notify>: Free function for @get_proxy_type_user_data or %NULL.
5516 // <cancellable>: A #GCancellable or %NULL
5517 // <callback>: A #GAsyncReadyCallback to call when the request is satisfied.
5518 // <user_data>: The data to pass to @callback.
5519 static void new_(DBusConnection* connection, DBusObjectManagerClientFlags flags, char* name, char* object_path, DBusProxyTypeFunc get_proxy_type_func, void* get_proxy_type_user_data, GLib2.DestroyNotify get_proxy_type_destroy_notify, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
5520 g_dbus_object_manager_client_new(connection, flags, name, object_path, get_proxy_type_func, get_proxy_type_user_data, get_proxy_type_destroy_notify, cancellable, callback, user_data);
5523 // Like g_dbus_object_manager_client_new() but takes a #GBusType instead of a
5524 // #GDBusConnection.
5526 // This is an asynchronous failable constructor. When the result is
5527 // ready, @callback will be invoked in the
5528 // <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
5529 // of the thread you are calling this method from. You can
5530 // then call g_dbus_object_manager_client_new_for_bus_finish() to get the result. See
5531 // g_dbus_object_manager_client_new_for_bus_sync() for the synchronous version.
5532 // <bus_type>: A #GBusType.
5533 // <flags>: Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
5534 // <name>: The owner of the control object (unique or well-known name).
5535 // <object_path>: The object path of the control object.
5536 // <get_proxy_type_func>: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
5537 // <get_proxy_type_user_data>: User data to pass to @get_proxy_type_func.
5538 // <get_proxy_type_destroy_notify>: Free function for @get_proxy_type_user_data or %NULL.
5539 // <cancellable>: A #GCancellable or %NULL
5540 // <callback>: A #GAsyncReadyCallback to call when the request is satisfied.
5541 // <user_data>: The data to pass to @callback.
5542 static void new_for_bus(BusType bus_type, DBusObjectManagerClientFlags flags, char* name, char* object_path, DBusProxyTypeFunc get_proxy_type_func, void* get_proxy_type_user_data, GLib2.DestroyNotify get_proxy_type_destroy_notify, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
5543 g_dbus_object_manager_client_new_for_bus(bus_type, flags, name, object_path, get_proxy_type_func, get_proxy_type_user_data, get_proxy_type_destroy_notify, cancellable, callback, user_data);
5546 // Gets the #GDBusConnection used by @manager.
5548 // the object belongs to @manager.
5549 // RETURNS: A #GDBusConnection object. Do not free,
5550 DBusConnection* get_connection() {
5551 return g_dbus_object_manager_client_get_connection(&this);
5554 // Gets the flags that @manager was constructed with.
5556 // enumeration.
5557 // RETURNS: Zero of more flags from the #GDBusObjectManagerClientFlags
5558 DBusObjectManagerClientFlags get_flags() {
5559 return g_dbus_object_manager_client_get_flags(&this);
5562 // Gets the name that @manager is for.
5564 // belongs to @manager.
5565 // RETURNS: A unique or well-known name. Do not free, the string
5566 char* get_name() {
5567 return g_dbus_object_manager_client_get_name(&this);
5570 // The unique name that owns the name that @manager is for or %NULL if
5571 // no-one currently owns that name. You can connect to the
5572 // #GObject::notify signal to track changes to the
5573 // #GDBusObjectManagerClient:name-owner property.
5575 // g_free().
5576 // RETURNS: The name owner or %NULL if no name owner exists. Free with
5577 char* /*new*/ get_name_owner() {
5578 return g_dbus_object_manager_client_get_name_owner(&this);
5581 // Emitted when one or more D-Bus properties on proxy changes. The
5582 // local cache has already been updated when this signal fires. Note
5583 // that both @changed_properties and @invalidated_properties are
5584 // guaranteed to never be %NULL (either may be empty though).
5586 // This signal exists purely as a convenience to avoid having to
5587 // connect signals to all interface proxies managed by @manager.
5589 // This signal is emitted in the
5590 // <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
5591 // that @manager was constructed in.
5592 // <object_proxy>: The #GDBusObjectProxy on which an interface has properties that are changing.
5593 // <interface_proxy>: The #GDBusProxy that has properties that are changing.
5594 // <changed_properties>: A #GVariant containing the properties that changed.
5595 // <invalidated_properties>: A %NULL terminated array of properties that was invalidated.
5596 extern (C) alias static void function (DBusObjectManagerClient* this_, DBusObjectProxy* object_proxy, DBusProxy* interface_proxy, GLib2.Variant* changed_properties, char* invalidated_properties, void* user_data=null) signal_interface_proxy_properties_changed;
5598 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
5599 return super_.signal_connect!name(cb, data, cf);
5602 ulong signal_connect(string name:"interface-proxy-properties-changed", CB:signal_interface_proxy_properties_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
5603 return signal_connect_data(&this, cast(char*)"interface-proxy-properties-changed",
5604 cast(GObject2.Callback)cb, data, null, cf);
5607 // Emitted when a D-Bus signal is received on @interface_proxy.
5609 // This signal exists purely as a convenience to avoid having to
5610 // connect signals to all interface proxies managed by @manager.
5612 // This signal is emitted in the
5613 // <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
5614 // that @manager was constructed in.
5615 // <object_proxy>: The #GDBusObjectProxy on which an interface is emitting a D-Bus signal.
5616 // <interface_proxy>: The #GDBusProxy that is emitting a D-Bus signal.
5617 // <sender_name>: The sender of the signal or NULL if the connection is not a bus connection.
5618 // <signal_name>: The signal name.
5619 // <parameters>: A #GVariant tuple with parameters for the signal.
5620 extern (C) alias static void function (DBusObjectManagerClient* this_, DBusObjectProxy* object_proxy, DBusProxy* interface_proxy, char* sender_name, char* signal_name, GLib2.Variant* parameters, void* user_data=null) signal_interface_proxy_signal;
5621 ulong signal_connect(string name:"interface-proxy-signal", CB:signal_interface_proxy_signal)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
5622 return signal_connect_data(&this, cast(char*)"interface-proxy-signal",
5623 cast(GObject2.Callback)cb, data, null, cf);
5627 // Class structure for #GDBusObjectManagerClient.
5628 struct DBusObjectManagerClientClass /* Version 2.30 */ {
5629 GObject2.ObjectClass parent_class;
5630 extern (C) void function (DBusObjectManagerClient* manager, DBusObjectProxy* object_proxy, DBusProxy* interface_proxy, char* sender_name, char* signal_name, GLib2.Variant* parameters) interface_proxy_signal;
5631 extern (C) void function (DBusObjectManagerClient* manager, DBusObjectProxy* object_proxy, DBusProxy* interface_proxy, GLib2.Variant* changed_properties, char** invalidated_properties) interface_proxy_properties_changed;
5632 private void*[8] padding;
5635 // Flags used when constructing a #GDBusObjectManagerClient.
5636 enum DBusObjectManagerClientFlags /* Version 2.30 */ {
5637 NONE = 0,
5638 DO_NOT_AUTO_START = 1
5640 struct DBusObjectManagerClientPrivate {
5643 // Base type for D-Bus object managers.
5644 struct DBusObjectManagerIface /* Version 2.30 */ {
5645 GObject2.TypeInterface parent_iface;
5646 // RETURNS: A string owned by @manager. Do not free.
5647 extern (C) char* function (DBusObjectManager* manager) get_object_path;
5648 // RETURNS: A list of
5649 extern (C) GLib2.List* /*new*/ function (DBusObjectManager* manager) get_objects;
5651 // RETURNS: A #GDBusObject or %NULL. Free with
5652 // <object_path>: Object path to lookup.
5653 extern (C) DBusObject* /*new*/ function (DBusObjectManager* manager, char* object_path) get_object;
5655 // RETURNS: A #GDBusInterface instance or %NULL. Free
5656 // <object_path>: Object path to lookup.
5657 // <interface_name>: D-Bus interface name to lookup.
5658 extern (C) DBusInterface* /*new*/ function (DBusObjectManager* manager, char* object_path, char* interface_name) get_interface;
5659 extern (C) void function (DBusObjectManager* manager, DBusObject* object) object_added;
5660 extern (C) void function (DBusObjectManager* manager, DBusObject* object) object_removed;
5661 extern (C) void function (DBusObjectManager* manager, DBusObject* object, DBusInterface* interface_) interface_added;
5662 extern (C) void function (DBusObjectManager* manager, DBusObject* object, DBusInterface* interface_) interface_removed;
5666 // #GDBusObjectManagerServer is used to export #GDBusObject instances using
5667 // the standardized <ulink
5668 // url="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager">org.freedesktop.DBus.ObjectManager</ulink>
5669 // interface. For example, remote D-Bus clients can get all objects
5670 // and properties in a single call. Additionally, any change in the
5671 // object hierarchy is broadcast using signals. This means that D-Bus
5672 // clients can keep caches up to date by only listening to D-Bus
5673 // signals.
5675 // See #GDBusObjectManagerClient for the client-side code that is
5676 // intended to be used with #GDBusObjectManagerServer or any D-Bus
5677 // object implementing the org.freedesktop.DBus.ObjectManager
5678 // interface.
5679 struct DBusObjectManagerServer /* : GObject.Object */ /* Version 2.30 */ {
5680 alias parent_instance this;
5681 alias parent_instance super_;
5682 alias parent_instance object;
5683 GObject2.Object parent_instance;
5684 private DBusObjectManagerServerPrivate* priv;
5687 // Creates a new #GDBusObjectManagerServer object.
5689 // The returned server isn't yet exported on any connection. To do so,
5690 // use g_dbus_object_manager_server_set_connection(). Normally you
5691 // want to export all of your objects before doing so to avoid <ulink
5692 // url="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager">InterfacesAdded</ulink>
5693 // signals being emitted.
5694 // RETURNS: A #GDBusObjectManagerServer object. Free with g_object_unref().
5695 // <object_path>: The object path to export the manager object at.
5696 static DBusObjectManagerServer* /*new*/ new_(char* object_path) {
5697 return g_dbus_object_manager_server_new(object_path);
5700 // Exports @object on @manager.
5702 // If there is already a #GDBusObject exported at the object path,
5703 // then the old object is removed.
5705 // The object path for @object must be in the hierarchy rooted by the
5706 // object path for @manager.
5708 // Note that @manager will take a reference on @object for as long as
5709 // it is exported.
5710 // <object>: A #GDBusObjectSkeleton.
5711 void export_(DBusObjectSkeleton* object) {
5712 g_dbus_object_manager_server_export(&this, object);
5715 // Like g_dbus_object_manager_server_export() but appends a string of
5716 // the form <literal>_N</literal> (with N being a natural number) to
5717 // @object<!-- -->'s object path if an object with the given path
5718 // already exists. As such, the #GDBusObjectProxy:object-path property
5719 // of @object may be modified.
5720 // <object>: An object.
5721 void export_uniquely(DBusObjectSkeleton* object) {
5722 g_dbus_object_manager_server_export_uniquely(&this, object);
5725 // Gets the #GDBusConnection used by @manager.
5727 // @manager isn't exported on a connection. The returned object should
5728 // be freed with g_object_unref().
5729 // RETURNS: A #GDBusConnection object or %NULL if
5730 DBusConnection* /*new*/ get_connection() {
5731 return g_dbus_object_manager_server_get_connection(&this);
5734 // Exports all objects managed by @manager on @connection. If
5735 // @connection is %NULL, stops exporting objects.
5736 // <connection>: A #GDBusConnection or %NULL.
5737 void set_connection(DBusConnection* connection=null) {
5738 g_dbus_object_manager_server_set_connection(&this, connection);
5741 // If @manager has an object at @path, removes the object. Otherwise
5742 // does nothing.
5744 // Note that @object_path must be in the hierarchy rooted by the
5745 // object path for @manager.
5746 // RETURNS: %TRUE if object at @object_path was removed, %FALSE otherwise.
5747 // <object_path>: An object path.
5748 int unexport(char* object_path) {
5749 return g_dbus_object_manager_server_unexport(&this, object_path);
5753 // Class structure for #GDBusObjectManagerServer.
5754 struct DBusObjectManagerServerClass /* Version 2.30 */ {
5755 GObject2.ObjectClass parent_class;
5756 private void*[8] padding;
5759 struct DBusObjectManagerServerPrivate {
5763 // A #GDBusObjectProxy is an object used to represent a remote object
5764 // with one or more D-Bus interfaces. Normally, you don't instantiate
5765 // a #GDBusObjectProxy yourself - typically #GDBusObjectManagerClient
5766 // is used to obtain it.
5767 struct DBusObjectProxy /* : GObject.Object */ /* Version 2.30 */ {
5768 alias parent_instance this;
5769 alias parent_instance super_;
5770 alias parent_instance object;
5771 GObject2.Object parent_instance;
5772 private DBusObjectProxyPrivate* priv;
5775 // Creates a new #GDBusObjectProxy for the given connection and
5776 // object path.
5777 // RETURNS: a new #GDBusObjectProxy
5778 // <connection>: a #GDBusConnection
5779 // <object_path>: the object path
5780 static DBusObjectProxy* /*new*/ new_(DBusConnection* connection, char* object_path) {
5781 return g_dbus_object_proxy_new(connection, object_path);
5784 // Gets the connection that @proxy is for.
5786 // object is owned by @proxy.
5787 // RETURNS: A #GDBusConnection. Do not free, the
5788 DBusConnection* get_connection() {
5789 return g_dbus_object_proxy_get_connection(&this);
5793 // Class structure for #GDBusObjectProxy.
5794 struct DBusObjectProxyClass /* Version 2.30 */ {
5795 GObject2.ObjectClass parent_class;
5796 private void*[8] padding;
5799 struct DBusObjectProxyPrivate {
5803 // A #GDBusObjectSkeleton instance is essentially a group of D-Bus
5804 // interfaces. The set of exported interfaces on the object may be
5805 // dynamic and change at runtime.
5807 // This type is intended to be used with #GDBusObjectManager.
5808 struct DBusObjectSkeleton /* : GObject.Object */ /* Version 2.30 */ {
5809 alias parent_instance this;
5810 alias parent_instance super_;
5811 alias parent_instance object;
5812 GObject2.Object parent_instance;
5813 private DBusObjectSkeletonPrivate* priv;
5816 // Creates a new #GDBusObjectSkeleton.
5817 // RETURNS: A #GDBusObjectSkeleton. Free with g_object_unref().
5818 // <object_path>: An object path.
5819 static DBusObjectSkeleton* /*new*/ new_(char* object_path) {
5820 return g_dbus_object_skeleton_new(object_path);
5823 // Adds @interface_ to @object.
5825 // If @object already contains a #GDBusInterfaceSkeleton with the same
5826 // interface name, it is removed before @interface_ is added.
5828 // Note that @object takes its own reference on @interface_ and holds
5829 // it until removed.
5830 // <interface_>: A #GDBusInterfaceSkeleton.
5831 void add_interface(DBusInterfaceSkeleton* interface_) {
5832 g_dbus_object_skeleton_add_interface(&this, interface_);
5835 // This method simply calls g_dbus_interface_skeleton_flush() on all
5836 // interfaces belonging to @object. See that method for when flushing
5837 // is useful.
5838 void flush() {
5839 g_dbus_object_skeleton_flush(&this);
5842 // Removes @interface_ from @object.
5843 // <interface_>: A #GDBusInterfaceSkeleton.
5844 void remove_interface(DBusInterfaceSkeleton* interface_) {
5845 g_dbus_object_skeleton_remove_interface(&this, interface_);
5848 // Removes the #GDBusInterface with @interface_name from @object.
5850 // If no D-Bus interface of the given interface exists, this function
5851 // does nothing.
5852 // <interface_name>: A D-Bus interface name.
5853 void remove_interface_by_name(char* interface_name) {
5854 g_dbus_object_skeleton_remove_interface_by_name(&this, interface_name);
5857 // Sets the object path for @object.
5858 // <object_path>: A valid D-Bus object path.
5859 void set_object_path(char* object_path) {
5860 g_dbus_object_skeleton_set_object_path(&this, object_path);
5863 // Emitted when a method is invoked by a remote caller and used to
5864 // determine if the method call is authorized.
5866 // This signal is like #GDBusInterfaceSkeleton<!-- -->'s
5867 // #GDBusInterfaceSkeleton::g-authorize-method signal, except that it is
5868 // for the enclosing object.
5870 // The default class handler just returns %TRUE.
5871 // RETURNS: %TRUE if the call is authorized, %FALSE otherwise.
5872 // <interface>: The #GDBusInterfaceSkeleton that @invocation is for.
5873 // <invocation>: A #GDBusMethodInvocation.
5874 extern (C) alias static c_int function (DBusObjectSkeleton* this_, DBusInterfaceSkeleton* interface_, DBusMethodInvocation* invocation, void* user_data=null) signal_authorize_method;
5876 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
5877 return super_.signal_connect!name(cb, data, cf);
5880 ulong signal_connect(string name:"authorize-method", CB:signal_authorize_method)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
5881 return signal_connect_data(&this, cast(char*)"authorize-method",
5882 cast(GObject2.Callback)cb, data, null, cf);
5886 // Class structure for #GDBusObjectSkeleton.
5887 struct DBusObjectSkeletonClass /* Version 2.30 */ {
5888 GObject2.ObjectClass parent_class;
5889 extern (C) int function (DBusObjectSkeleton* object, DBusInterfaceSkeleton* interface_, DBusMethodInvocation* invocation) authorize_method;
5890 private void*[8] padding;
5893 struct DBusObjectSkeletonPrivate {
5896 // Information about a D-Bus property on a D-Bus interface.
5897 struct DBusPropertyInfo /* Version 2.26 */ {
5898 int ref_count;
5899 char* name, signature;
5900 DBusPropertyInfoFlags flags;
5901 DBusAnnotationInfo*[666] annotations;
5904 // If @info is statically allocated does nothing. Otherwise increases
5905 // the reference count.
5906 // RETURNS: The same @info.
5907 DBusPropertyInfo* /*new*/ ref_() {
5908 return g_dbus_property_info_ref(&this);
5911 // If @info is statically allocated, does nothing. Otherwise decreases
5912 // the reference count of @info. When its reference count drops to 0,
5913 // the memory used is freed.
5914 void unref() {
5915 g_dbus_property_info_unref(&this);
5919 // Flags describing the access control of a D-Bus property.
5920 enum DBusPropertyInfoFlags /* Version 2.26 */ {
5921 NONE = 0,
5922 READABLE = 1,
5923 WRITABLE = 2
5926 // #GDBusProxy is a base class used for proxies to access a D-Bus
5927 // interface on a remote object. A #GDBusProxy can be constructed for
5928 // both well-known and unique names.
5930 // By default, #GDBusProxy will cache all properties (and listen to
5931 // changes) of the remote object, and proxy all signals that gets
5932 // emitted. This behaviour can be changed by passing suitable
5933 // #GDBusProxyFlags when the proxy is created. If the proxy is for a
5934 // well-known name, the property cache is flushed when the name owner
5935 // vanishes and reloaded when a name owner appears.
5937 // If a #GDBusProxy is used for a well-known name, the owner of the
5938 // name is tracked and can be read from
5939 // #GDBusProxy:g-name-owner. Connect to the #GObject::notify signal to
5940 // get notified of changes. Additionally, only signals and property
5941 // changes emitted from the current name owner are considered and
5942 // calls are always sent to the current name owner. This avoids a
5943 // number of race conditions when the name is lost by one owner and
5944 // claimed by another. However, if no name owner currently exists,
5945 // then calls will be sent to the well-known name which may result in
5946 // the message bus launching an owner (unless
5947 // %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START is set).
5949 // The generic #GDBusProxy::g-properties-changed and
5950 // #GDBusProxy::g-signal signals are not very convenient to work
5951 // with. Therefore, the recommended way of working with proxies is to
5952 // subclass #GDBusProxy, and have more natural properties and signals
5953 // in your derived class. See <xref linkend="gdbus-example-gdbus-codegen"/>
5954 // for how this can easily be done using the
5955 // <command><link linkend="gdbus-codegen">gdbus-codegen</link></command>
5956 // tool.
5958 // A #GDBusProxy instance can be used from multiple threads but note
5959 // that all signals (e.g. #GDBusProxy::g-signal, #GDBusProxy::g-properties-changed
5960 // and #GObject::notify) are emitted in the
5961 // <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
5962 // of the thread where the instance was constructed.
5964 // <example id="gdbus-wellknown-proxy"><title>GDBusProxy for a well-known-name</title><programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gdbus-example-watch-proxy.c"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting></example>
5965 struct DBusProxy /* : GObject.Object */ /* Version 2.26 */ {
5966 alias parent_instance this;
5967 alias parent_instance super_;
5968 alias parent_instance object;
5969 GObject2.Object parent_instance;
5970 private DBusProxyPrivate* priv;
5973 // Finishes creating a #GDBusProxy.
5974 // RETURNS: A #GDBusProxy or %NULL if @error is set. Free with g_object_unref().
5975 // <res>: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to g_dbus_proxy_new().
5976 static DBusProxy* /*new*/ new_finish(AsyncResult* res, GLib2.Error** error=null) {
5977 return g_dbus_proxy_new_finish(res, error);
5980 // Finishes creating a #GDBusProxy.
5981 // RETURNS: A #GDBusProxy or %NULL if @error is set. Free with g_object_unref().
5982 // <res>: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to g_dbus_proxy_new_for_bus().
5983 static DBusProxy* /*new*/ new_for_bus_finish(AsyncResult* res, GLib2.Error** error=null) {
5984 return g_dbus_proxy_new_for_bus_finish(res, error);
5987 // Like g_dbus_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5989 // See <xref linkend="gdbus-wellknown-proxy"/> for an example of how #GDBusProxy can be used.
5990 // RETURNS: A #GDBusProxy or %NULL if error is set. Free with g_object_unref().
5991 // <bus_type>: A #GBusType.
5992 // <flags>: Flags used when constructing the proxy.
5993 // <info>: A #GDBusInterfaceInfo specifying the minimal interface that @proxy conforms to or %NULL.
5994 // <name>: A bus name (well-known or unique).
5995 // <object_path>: An object path.
5996 // <interface_name>: A D-Bus interface name.
5997 // <cancellable>: A #GCancellable or %NULL.
5998 static DBusProxy* /*new*/ new_for_bus_sync(BusType bus_type, DBusProxyFlags flags, DBusInterfaceInfo* info, char* name, char* object_path, char* interface_name, Cancellable* cancellable, GLib2.Error** error=null) {
5999 return g_dbus_proxy_new_for_bus_sync(bus_type, flags, info, name, object_path, interface_name, cancellable, error);
6002 // Creates a proxy for accessing @interface_name on the remote object
6003 // at @object_path owned by @name at @connection and synchronously
6004 // loads D-Bus properties unless the
6005 // %G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES flag is used.
6007 // If the %G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS flag is not set, also sets up
6008 // match rules for signals. Connect to the #GDBusProxy::g-signal signal
6009 // to handle signals from the remote object.
6011 // If @name is a well-known name and the
6012 // %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START flag isn't set and no name
6013 // owner currently exists, the message bus will be requested to launch
6014 // a name owner for the name.
6016 // This is a synchronous failable constructor. See g_dbus_proxy_new()
6017 // and g_dbus_proxy_new_finish() for the asynchronous version.
6019 // See <xref linkend="gdbus-wellknown-proxy"/> for an example of how #GDBusProxy can be used.
6020 // RETURNS: A #GDBusProxy or %NULL if error is set. Free with g_object_unref().
6021 // <connection>: A #GDBusConnection.
6022 // <flags>: Flags used when constructing the proxy.
6023 // <info>: A #GDBusInterfaceInfo specifying the minimal interface that @proxy conforms to or %NULL.
6024 // <name>: A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6025 // <object_path>: An object path.
6026 // <interface_name>: A D-Bus interface name.
6027 // <cancellable>: A #GCancellable or %NULL.
6028 static DBusProxy* /*new*/ new_sync(DBusConnection* connection, DBusProxyFlags flags, DBusInterfaceInfo* info, char* name, char* object_path, char* interface_name, Cancellable* cancellable, GLib2.Error** error=null) {
6029 return g_dbus_proxy_new_sync(connection, flags, info, name, object_path, interface_name, cancellable, error);
6032 // Creates a proxy for accessing @interface_name on the remote object
6033 // at @object_path owned by @name at @connection and asynchronously
6034 // loads D-Bus properties unless the
6035 // %G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES flag is used. Connect to
6036 // the #GDBusProxy::g-properties-changed signal to get notified about
6037 // property changes.
6039 // If the %G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS flag is not set, also sets up
6040 // match rules for signals. Connect to the #GDBusProxy::g-signal signal
6041 // to handle signals from the remote object.
6043 // If @name is a well-known name and the
6044 // %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START flag isn't set and no name
6045 // owner currently exists, the message bus will be requested to launch
6046 // a name owner for the name.
6048 // This is a failable asynchronous constructor - when the proxy is
6049 // ready, @callback will be invoked and you can use
6050 // g_dbus_proxy_new_finish() to get the result.
6052 // See g_dbus_proxy_new_sync() and for a synchronous version of this constructor.
6054 // See <xref linkend="gdbus-wellknown-proxy"/> for an example of how #GDBusProxy can be used.
6055 // <connection>: A #GDBusConnection.
6056 // <flags>: Flags used when constructing the proxy.
6057 // <info>: A #GDBusInterfaceInfo specifying the minimal interface that @proxy conforms to or %NULL.
6058 // <name>: A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6059 // <object_path>: An object path.
6060 // <interface_name>: A D-Bus interface name.
6061 // <cancellable>: A #GCancellable or %NULL.
6062 // <callback>: Callback function to invoke when the proxy is ready.
6063 // <user_data>: User data to pass to @callback.
6064 static void new_(DBusConnection* connection, DBusProxyFlags flags, DBusInterfaceInfo* info, char* name, char* object_path, char* interface_name, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
6065 g_dbus_proxy_new(connection, flags, info, name, object_path, interface_name, cancellable, callback, user_data);
6068 // Like g_dbus_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6070 // See <xref linkend="gdbus-wellknown-proxy"/> for an example of how #GDBusProxy can be used.
6071 // <bus_type>: A #GBusType.
6072 // <flags>: Flags used when constructing the proxy.
6073 // <info>: A #GDBusInterfaceInfo specifying the minimal interface that @proxy conforms to or %NULL.
6074 // <name>: A bus name (well-known or unique).
6075 // <object_path>: An object path.
6076 // <interface_name>: A D-Bus interface name.
6077 // <cancellable>: A #GCancellable or %NULL.
6078 // <callback>: Callback function to invoke when the proxy is ready.
6079 // <user_data>: User data to pass to @callback.
6080 static void new_for_bus(BusType bus_type, DBusProxyFlags flags, DBusInterfaceInfo* info, char* name, char* object_path, char* interface_name, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
6081 g_dbus_proxy_new_for_bus(bus_type, flags, info, name, object_path, interface_name, cancellable, callback, user_data);
6084 // Asynchronously invokes the @method_name method on @proxy.
6086 // If @method_name contains any dots, then @name is split into interface and
6087 // method name parts. This allows using @proxy for invoking methods on
6088 // other interfaces.
6090 // If the #GDBusConnection associated with @proxy is closed then
6091 // the operation will fail with %G_IO_ERROR_CLOSED. If
6092 // @cancellable is canceled, the operation will fail with
6093 // %G_IO_ERROR_CANCELLED. If @parameters contains a value not
6094 // compatible with the D-Bus protocol, the operation fails with
6095 // %G_IO_ERROR_INVALID_ARGUMENT.
6097 // If the @parameters #GVariant is floating, it is consumed. This allows
6098 // convenient 'inline' use of g_variant_new(), e.g.:
6099 // |[
6100 // g_dbus_proxy_call (proxy,
6101 // "TwoStrings",
6102 // g_variant_new ("(ss)",
6103 // "Thing One",
6104 // "Thing Two"),
6105 // G_DBUS_CALL_FLAGS_NONE,
6106 // -1,
6107 // NULL,
6108 // (GAsyncReadyCallback) two_strings_done,
6109 // &amp;data);
6110 // ]|
6112 // This is an asynchronous method. When the operation is finished,
6113 // @callback will be invoked in the
6114 // <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
6115 // of the thread you are calling this method from.
6116 // You can then call g_dbus_proxy_call_finish() to get the result of
6117 // the operation. See g_dbus_proxy_call_sync() for the synchronous
6118 // version of this method.
6119 // <method_name>: Name of method to invoke.
6120 // <parameters>: A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
6121 // <flags>: Flags from the #GDBusCallFlags enumeration.
6122 // <timeout_msec>: The timeout in milliseconds (with %G_MAXINT meaning "infinite") or -1 to use the proxy default timeout.
6123 // <cancellable>: A #GCancellable or %NULL.
6124 // <callback>: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't care about the result of the method invocation.
6125 // <user_data>: The data to pass to @callback.
6126 void call(char* method_name, GLib2.Variant* parameters, DBusCallFlags flags, int timeout_msec, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
6127 g_dbus_proxy_call(&this, method_name, parameters, flags, timeout_msec, cancellable, callback, user_data);
6130 // Finishes an operation started with g_dbus_proxy_call().
6132 // return values. Free with g_variant_unref().
6133 // RETURNS: %NULL if @error is set. Otherwise a #GVariant tuple with
6134 // <res>: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_proxy_call().
6135 GLib2.Variant* /*new*/ call_finish(AsyncResult* res, GLib2.Error** error=null) {
6136 return g_dbus_proxy_call_finish(&this, res, error);
6139 // Synchronously invokes the @method_name method on @proxy.
6141 // If @method_name contains any dots, then @name is split into interface and
6142 // method name parts. This allows using @proxy for invoking methods on
6143 // other interfaces.
6145 // If the #GDBusConnection associated with @proxy is disconnected then
6146 // the operation will fail with %G_IO_ERROR_CLOSED. If
6147 // @cancellable is canceled, the operation will fail with
6148 // %G_IO_ERROR_CANCELLED. If @parameters contains a value not
6149 // compatible with the D-Bus protocol, the operation fails with
6150 // %G_IO_ERROR_INVALID_ARGUMENT.
6152 // If the @parameters #GVariant is floating, it is consumed. This allows
6153 // convenient 'inline' use of g_variant_new(), e.g.:
6154 // |[
6155 // g_dbus_proxy_call_sync (proxy,
6156 // "TwoStrings",
6157 // g_variant_new ("(ss)",
6158 // "Thing One",
6159 // "Thing Two"),
6160 // G_DBUS_CALL_FLAGS_NONE,
6161 // -1,
6162 // NULL,
6163 // &amp;error);
6164 // ]|
6166 // The calling thread is blocked until a reply is received. See
6167 // g_dbus_proxy_call() for the asynchronous version of this
6168 // method.
6170 // return values. Free with g_variant_unref().
6171 // RETURNS: %NULL if @error is set. Otherwise a #GVariant tuple with
6172 // <method_name>: Name of method to invoke.
6173 // <parameters>: A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
6174 // <flags>: Flags from the #GDBusCallFlags enumeration.
6175 // <timeout_msec>: The timeout in milliseconds (with %G_MAXINT meaning "infinite") or -1 to use the proxy default timeout.
6176 // <cancellable>: A #GCancellable or %NULL.
6177 GLib2.Variant* /*new*/ call_sync(char* method_name, GLib2.Variant* parameters, DBusCallFlags flags, int timeout_msec, Cancellable* cancellable, GLib2.Error** error=null) {
6178 return g_dbus_proxy_call_sync(&this, method_name, parameters, flags, timeout_msec, cancellable, error);
6181 // Like g_dbus_proxy_call() but also takes a #GUnixFDList object.
6183 // This method is only available on UNIX.
6184 // <method_name>: Name of method to invoke.
6185 // <parameters>: A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
6186 // <flags>: Flags from the #GDBusCallFlags enumeration.
6187 // <timeout_msec>: The timeout in milliseconds (with %G_MAXINT meaning "infinite") or -1 to use the proxy default timeout.
6188 // <fd_list>: A #GUnixFDList or %NULL.
6189 // <cancellable>: A #GCancellable or %NULL.
6190 // <callback>: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't care about the result of the method invocation.
6191 // <user_data>: The data to pass to @callback.
6192 void call_with_unix_fd_list(char* method_name, GLib2.Variant* parameters, DBusCallFlags flags, int timeout_msec, UnixFDList* fd_list, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
6193 g_dbus_proxy_call_with_unix_fd_list(&this, method_name, parameters, flags, timeout_msec, fd_list, cancellable, callback, user_data);
6196 // Finishes an operation started with g_dbus_proxy_call_with_unix_fd_list().
6198 // return values. Free with g_variant_unref().
6199 // RETURNS: %NULL if @error is set. Otherwise a #GVariant tuple with
6200 // <out_fd_list>: Return location for a #GUnixFDList or %NULL.
6201 // <res>: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_proxy_call_with_unix_fd_list().
6202 GLib2.Variant* /*new*/ call_with_unix_fd_list_finish(/*out*/ UnixFDList** out_fd_list, AsyncResult* res, GLib2.Error** error=null) {
6203 return g_dbus_proxy_call_with_unix_fd_list_finish(&this, out_fd_list, res, error);
6206 // Like g_dbus_proxy_call_sync() but also takes and returns #GUnixFDList objects.
6208 // This method is only available on UNIX.
6210 // return values. Free with g_variant_unref().
6211 // RETURNS: %NULL if @error is set. Otherwise a #GVariant tuple with
6212 // <method_name>: Name of method to invoke.
6213 // <parameters>: A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
6214 // <flags>: Flags from the #GDBusCallFlags enumeration.
6215 // <timeout_msec>: The timeout in milliseconds (with %G_MAXINT meaning "infinite") or -1 to use the proxy default timeout.
6216 // <fd_list>: A #GUnixFDList or %NULL.
6217 // <out_fd_list>: Return location for a #GUnixFDList or %NULL.
6218 // <cancellable>: A #GCancellable or %NULL.
6219 GLib2.Variant* /*new*/ call_with_unix_fd_list_sync(char* method_name, GLib2.Variant* parameters, DBusCallFlags flags, int timeout_msec, UnixFDList* fd_list, /*out*/ UnixFDList** out_fd_list, Cancellable* cancellable, GLib2.Error** error=null) {
6220 return g_dbus_proxy_call_with_unix_fd_list_sync(&this, method_name, parameters, flags, timeout_msec, fd_list, out_fd_list, cancellable, error);
6223 // Looks up the value for a property from the cache. This call does no
6224 // blocking IO.
6226 // If @proxy has an expected interface (see
6227 // #GDBusProxy:g-interface-info), then @property_name (for existence)
6228 // is checked against it.
6230 // for @property_name or %NULL if the value is not in the cache. The
6231 // returned reference must be freed with g_variant_unref().
6232 // RETURNS: A reference to the #GVariant instance that holds the value
6233 // <property_name>: Property name.
6234 GLib2.Variant* /*new*/ get_cached_property(char* property_name) {
6235 return g_dbus_proxy_get_cached_property(&this, property_name);
6238 // Gets the names of all cached properties on @proxy.
6240 // @proxy has no cached properties. Free the returned array with
6241 // g_strfreev().
6242 // RETURNS: A %NULL-terminated array of strings or %NULL if
6243 char** /*new*/ get_cached_property_names() {
6244 return g_dbus_proxy_get_cached_property_names(&this);
6247 // Gets the connection @proxy is for.
6248 // RETURNS: A #GDBusConnection owned by @proxy. Do not free.
6249 DBusConnection* get_connection() {
6250 return g_dbus_proxy_get_connection(&this);
6253 // Gets the timeout to use if -1 (specifying default timeout) is
6254 // passed as @timeout_msec in the g_dbus_proxy_call() and
6255 // g_dbus_proxy_call_sync() functions.
6257 // See the #GDBusProxy:g-default-timeout property for more details.
6258 // RETURNS: Timeout to use for @proxy.
6259 int get_default_timeout() {
6260 return g_dbus_proxy_get_default_timeout(&this);
6263 // Gets the flags that @proxy was constructed with.
6264 // RETURNS: Flags from the #GDBusProxyFlags enumeration.
6265 DBusProxyFlags get_flags() {
6266 return g_dbus_proxy_get_flags(&this);
6269 // Returns the #GDBusInterfaceInfo, if any, specifying the minimal
6270 // interface that @proxy conforms to.
6272 // See the #GDBusProxy:g-interface-info property for more details.
6274 // object, it is owned by @proxy.
6275 // RETURNS: A #GDBusInterfaceInfo or %NULL. Do not unref the returned
6276 DBusInterfaceInfo* /*new*/ get_interface_info() {
6277 return g_dbus_proxy_get_interface_info(&this);
6280 // Gets the D-Bus interface name @proxy is for.
6281 // RETURNS: A string owned by @proxy. Do not free.
6282 char* get_interface_name() {
6283 return g_dbus_proxy_get_interface_name(&this);
6286 // Gets the name that @proxy was constructed for.
6287 // RETURNS: A string owned by @proxy. Do not free.
6288 char* get_name() {
6289 return g_dbus_proxy_get_name(&this);
6292 // The unique name that owns the name that @proxy is for or %NULL if
6293 // no-one currently owns that name. You may connect to the
6294 // #GObject::notify signal to track changes to the
6295 // #GDBusProxy:g-name-owner property.
6296 // RETURNS: The name owner or %NULL if no name owner exists. Free with g_free().
6297 char* /*new*/ get_name_owner() {
6298 return g_dbus_proxy_get_name_owner(&this);
6301 // Gets the object path @proxy is for.
6302 // RETURNS: A string owned by @proxy. Do not free.
6303 char* get_object_path() {
6304 return g_dbus_proxy_get_object_path(&this);
6307 // If @value is not %NULL, sets the cached value for the property with
6308 // name @property_name to the value in @value.
6310 // If @value is %NULL, then the cached value is removed from the
6311 // property cache.
6313 // If @proxy has an expected interface (see
6314 // #GDBusProxy:g-interface-info), then @property_name (for existence)
6315 // and @value (for the type) is checked against it.
6317 // If the @value #GVariant is floating, it is consumed. This allows
6318 // convenient 'inline' use of g_variant_new(), e.g.
6319 // |[
6320 // g_dbus_proxy_set_cached_property (proxy,
6321 // "SomeProperty",
6322 // g_variant_new ("(si)",
6323 // "A String",
6324 // 42));
6325 // ]|
6327 // Normally you will not need to use this method since @proxy is
6328 // tracking changes using the
6329 // <literal>org.freedesktop.DBus.Properties.PropertiesChanged</literal>
6330 // D-Bus signal. However, for performance reasons an object may decide
6331 // to not use this signal for some properties and instead use a
6332 // proprietary out-of-band mechanism to transmit changes.
6334 // As a concrete example, consider an object with a property
6335 // <literal>ChatroomParticipants</literal> which is an array of
6336 // strings. Instead of transmitting the same (long) array every time
6337 // the property changes, it is more efficient to only transmit the
6338 // delta using e.g. signals <literal>ChatroomParticipantJoined(String
6339 // name)</literal> and <literal>ChatroomParticipantParted(String
6340 // name)</literal>.
6341 // <property_name>: Property name.
6342 // <value>: Value for the property or %NULL to remove it from the cache.
6343 void set_cached_property(char* property_name, GLib2.Variant* value=null) {
6344 g_dbus_proxy_set_cached_property(&this, property_name, value);
6347 // Sets the timeout to use if -1 (specifying default timeout) is
6348 // passed as @timeout_msec in the g_dbus_proxy_call() and
6349 // g_dbus_proxy_call_sync() functions.
6351 // See the #GDBusProxy:g-default-timeout property for more details.
6352 // <timeout_msec>: Timeout in milliseconds.
6353 void set_default_timeout(int timeout_msec) {
6354 g_dbus_proxy_set_default_timeout(&this, timeout_msec);
6357 // Ensure that interactions with @proxy conform to the given
6358 // interface. For example, when completing a method call, if the type
6359 // signature of the message isn't what's expected, the given #GError
6360 // is set. Signals that have a type signature mismatch are simply
6361 // dropped.
6363 // See the #GDBusProxy:g-interface-info property for more details.
6364 // <info>: Minimum interface this proxy conforms to or %NULL to unset.
6365 void set_interface_info(DBusInterfaceInfo* info=null) {
6366 g_dbus_proxy_set_interface_info(&this, info);
6369 // Emitted when one or more D-Bus properties on @proxy changes. The
6370 // local cache has already been updated when this signal fires. Note
6371 // that both @changed_properties and @invalidated_properties are
6372 // guaranteed to never be %NULL (either may be empty though).
6374 // This signal corresponds to the
6375 // <literal>PropertiesChanged</literal> D-Bus signal on the
6376 // <literal>org.freedesktop.DBus.Properties</literal> interface.
6377 // <changed_properties>: A #GVariant containing the properties that changed
6378 // <invalidated_properties>: A %NULL terminated array of properties that was invalidated
6379 extern (C) alias static void function (DBusProxy* this_, GLib2.Variant* changed_properties, char* invalidated_properties, void* user_data=null) signal_g_properties_changed;
6381 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
6382 return super_.signal_connect!name(cb, data, cf);
6385 ulong signal_connect(string name:"g-properties-changed", CB:signal_g_properties_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
6386 return signal_connect_data(&this, cast(char*)"g-properties-changed",
6387 cast(GObject2.Callback)cb, data, null, cf);
6390 // Emitted when a signal from the remote object and interface that @proxy is for, has been received.
6391 // <sender_name>: The sender of the signal or %NULL if the connection is not a bus connection.
6392 // <signal_name>: The name of the signal.
6393 // <parameters>: A #GVariant tuple with parameters for the signal.
6394 extern (C) alias static void function (DBusProxy* this_, char* sender_name, char* signal_name, GLib2.Variant* parameters, void* user_data=null) signal_g_signal;
6395 ulong signal_connect(string name:"g-signal", CB:signal_g_signal)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
6396 return signal_connect_data(&this, cast(char*)"g-signal",
6397 cast(GObject2.Callback)cb, data, null, cf);
6401 // Class structure for #GDBusProxy.
6402 struct DBusProxyClass /* Version 2.26 */ {
6403 private GObject2.ObjectClass parent_class;
6404 extern (C) void function (DBusProxy* proxy, GLib2.Variant* changed_properties, char** invalidated_properties) g_properties_changed;
6405 extern (C) void function (DBusProxy* proxy, char* sender_name, char* signal_name, GLib2.Variant* parameters) g_signal;
6406 private void*[32] padding;
6409 // Flags used when constructing an instance of a #GDBusProxy derived class.
6410 enum DBusProxyFlags /* Version 2.26 */ {
6411 NONE = 0,
6412 DO_NOT_LOAD_PROPERTIES = 1,
6413 DO_NOT_CONNECT_SIGNALS = 2,
6414 DO_NOT_AUTO_START = 4
6416 struct DBusProxyPrivate {
6420 // Function signature for a function used to determine the #GType to
6421 // use for an interface proxy (if @interface_name is not %NULL) or
6422 // object proxy (if @interface_name is %NULL).
6424 // This function is called in the
6425 // <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
6426 // that @manager was constructed in.
6428 // must be a #GDBusProxy<!-- -->- or #GDBusObjectProxy<!-- -->-derived
6429 // type.
6430 // RETURNS: A #GType to use for the remote object. The returned type
6431 // <manager>: A #GDBusObjectManagerClient.
6432 // <object_path>: The object path of the remote object.
6433 // <interface_name>: The interface name of the remote object or %NULL if a #GDBusObjectProxy #GType is requested.
6434 // <user_data>: User data.
6435 extern (C) alias Type function (DBusObjectManagerClient* manager, char* object_path, char* interface_name, void* user_data) DBusProxyTypeFunc;
6437 // Flags used when sending #GDBusMessage<!-- -->s on a #GDBusConnection.
6438 enum DBusSendMessageFlags /* Version 2.26 */ {
6439 NONE = 0,
6440 PRESERVE_SERIAL = 1
6443 // #GDBusServer is a helper for listening to and accepting D-Bus
6444 // connections. This can be used to create a new D-Bus server, allowing two
6445 // peers to use the D-Bus protocol for their own specialized communication.
6446 // A server instance provided in this way will not perform message routing or
6447 // implement the org.freedesktop.DBus interface.
6449 // To just export an object on a well-known name on a message bus, such as the
6450 // session or system bus, you should instead use g_bus_own_name().
6452 // <example id="gdbus-peer-to-peer"><title>D-Bus peer-to-peer example</title><programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gdbus-example-peer.c"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting></example>
6453 struct DBusServer /* : GObject.Object */ /* Version 2.26 */ {
6454 alias method_parent this;
6455 alias method_parent super_;
6456 alias method_parent object;
6457 GObject2.Object method_parent;
6460 // Creates a new D-Bus server that listens on the first address in
6461 // @address that works.
6463 // Once constructed, you can use g_dbus_server_get_client_address() to
6464 // get a D-Bus address string that clients can use to connect.
6466 // Connect to the #GDBusServer::new-connection signal to handle
6467 // incoming connections.
6469 // The returned #GDBusServer isn't active - you have to start it with
6470 // g_dbus_server_start().
6472 // See <xref linkend="gdbus-peer-to-peer"/> for how #GDBusServer can
6473 // be used.
6475 // This is a synchronous failable constructor. See
6476 // g_dbus_server_new() for the asynchronous version.
6478 // g_object_unref().
6479 // RETURNS: A #GDBusServer or %NULL if @error is set. Free with
6480 // <address>: A D-Bus address.
6481 // <flags>: Flags from the #GDBusServerFlags enumeration.
6482 // <guid>: A D-Bus GUID.
6483 // <observer>: A #GDBusAuthObserver or %NULL.
6484 // <cancellable>: A #GCancellable or %NULL.
6485 static DBusServer* /*new*/ new_sync(char* address, DBusServerFlags flags, char* guid, DBusAuthObserver* observer, Cancellable* cancellable, GLib2.Error** error=null) {
6486 return g_dbus_server_new_sync(address, flags, guid, observer, cancellable, error);
6489 // Gets a D-Bus address string that can be used by clients to connect
6490 // to @server.
6492 // by @server.
6493 // RETURNS: A D-Bus address string. Do not free, the string is owned
6494 char* get_client_address() {
6495 return g_dbus_server_get_client_address(&this);
6498 // Gets the flags for @server.
6499 // RETURNS: A set of flags from the #GDBusServerFlags enumeration.
6500 DBusServerFlags get_flags() {
6501 return g_dbus_server_get_flags(&this);
6504 // Gets the GUID for @server.
6505 // RETURNS: A D-Bus GUID. Do not free this string, it is owned by @server.
6506 char* get_guid() {
6507 return g_dbus_server_get_guid(&this);
6510 // Gets whether @server is active.
6511 // RETURNS: %TRUE if server is active, %FALSE otherwise.
6512 int is_active() {
6513 return g_dbus_server_is_active(&this);
6515 // Starts @server.
6516 void start() {
6517 g_dbus_server_start(&this);
6519 // Stops @server.
6520 void stop() {
6521 g_dbus_server_stop(&this);
6524 // Emitted when a new authenticated connection has been made. Use
6525 // g_dbus_connection_get_peer_credentials() to figure out what
6526 // identity (if any), was authenticated.
6528 // If you want to accept the connection, take a reference to the
6529 // @connection object and return %TRUE. When you are done with the
6530 // connection call g_dbus_connection_close() and give up your
6531 // reference. Note that the other peer may disconnect at any time -
6532 // a typical thing to do when accepting a connection is to listen to
6533 // the #GDBusConnection::closed signal.
6535 // If #GDBusServer:flags contains %G_DBUS_SERVER_FLAGS_RUN_IN_THREAD
6536 // then the signal is emitted in a new thread dedicated to the
6537 // connection. Otherwise the signal is emitted in the <link
6538 // linkend="g-main-context-push-thread-default">thread-default main
6539 // loop</link> of the thread that @server was constructed in.
6541 // You are guaranteed that signal handlers for this signal runs
6542 // before incoming messages on @connection are processed. This means
6543 // that it's suitable to call g_dbus_connection_register_object() or
6544 // similar from the signal handler.
6546 // run.
6547 // RETURNS: %TRUE to claim @connection, %FALSE to let other handlers
6548 // <connection>: A #GDBusConnection for the new connection.
6549 extern (C) alias static c_int function (DBusServer* this_, DBusConnection* connection, void* user_data=null) signal_new_connection;
6551 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
6552 return super_.signal_connect!name(cb, data, cf);
6555 ulong signal_connect(string name:"new-connection", CB:signal_new_connection)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
6556 return signal_connect_data(&this, cast(char*)"new-connection",
6557 cast(GObject2.Callback)cb, data, null, cf);
6561 // Flags used when creating a #GDBusServer.
6562 enum DBusServerFlags /* Version 2.26 */ {
6563 NONE = 0,
6564 RUN_IN_THREAD = 1,
6565 AUTHENTICATION_ALLOW_ANONYMOUS = 2
6568 // Signature for callback function used in g_dbus_connection_signal_subscribe().
6569 // <connection>: A #GDBusConnection.
6570 // <sender_name>: The unique bus name of the sender of the signal.
6571 // <object_path>: The object path that the signal was emitted on.
6572 // <interface_name>: The name of the interface.
6573 // <signal_name>: The name of the signal.
6574 // <parameters>: A #GVariant tuple with parameters for the signal.
6575 // <user_data>: User data passed when subscribing to the signal.
6576 extern (C) alias void function (DBusConnection* connection, char* sender_name, char* object_path, char* interface_name, char* signal_name, GLib2.Variant* parameters, void* user_data) DBusSignalCallback;
6578 // Flags used when subscribing to signals via g_dbus_connection_signal_subscribe().
6579 enum DBusSignalFlags /* Version 2.26 */ {
6580 NONE = 0,
6581 NO_MATCH_RULE = 1
6583 // Information about a signal on a D-Bus interface.
6584 struct DBusSignalInfo /* Version 2.26 */ {
6585 int ref_count;
6586 char* name;
6587 DBusArgInfo*[666] args;
6588 DBusAnnotationInfo*[666] annotations;
6591 // If @info is statically allocated does nothing. Otherwise increases
6592 // the reference count.
6593 // RETURNS: The same @info.
6594 DBusSignalInfo* /*new*/ ref_() {
6595 return g_dbus_signal_info_ref(&this);
6598 // If @info is statically allocated, does nothing. Otherwise decreases
6599 // the reference count of @info. When its reference count drops to 0,
6600 // the memory used is freed.
6601 void unref() {
6602 g_dbus_signal_info_unref(&this);
6607 // The type of the @dispatch function in #GDBusSubtreeVTable.
6609 // Subtrees are flat. @node, if non-%NULL, is always exactly one
6610 // segment of the object path (ie: it never contains a slash).
6611 // RETURNS: A #GDBusInterfaceVTable or %NULL if you don't want to handle the methods.
6612 // <connection>: A #GDBusConnection.
6613 // <sender>: The unique bus name of the remote caller.
6614 // <object_path>: The object path that was registered with g_dbus_connection_register_subtree().
6615 // <interface_name>: The D-Bus interface name that the method call or property access is for.
6616 // <node>: A node that is a child of @object_path (relative to @object_path) or %NULL for the root of the subtree.
6617 // <out_user_data>: Return location for user data to pass to functions in the returned #GDBusInterfaceVTable (never %NULL).
6618 // <user_data>: The @user_data #gpointer passed to g_dbus_connection_register_subtree().
6619 extern (C) alias DBusInterfaceVTable* function (DBusConnection* connection, char* sender, char* object_path, char* interface_name, char* node, void** out_user_data, void* user_data) DBusSubtreeDispatchFunc;
6622 // Unintrospectable callback: DBusSubtreeEnumerateFunc() / ()
6623 // The type of the @enumerate function in #GDBusSubtreeVTable.
6625 // This function is called when generating introspection data and also
6626 // when preparing to dispatch incoming messages in the event that the
6627 // %G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is not
6628 // specified (ie: to verify that the object path is valid).
6630 // Hierarchies are not supported; the items that you return should not
6631 // contain the '/' character.
6633 // The return value will be freed with g_strfreev().
6634 // RETURNS: A newly allocated array of strings for node names that are children of @object_path.
6635 // <connection>: A #GDBusConnection.
6636 // <sender>: The unique bus name of the remote caller.
6637 // <object_path>: The object path that was registered with g_dbus_connection_register_subtree().
6638 // <user_data>: The @user_data #gpointer passed to g_dbus_connection_register_subtree().
6639 extern (C) alias char** function (DBusConnection* connection, char* sender, char* object_path, void* user_data) DBusSubtreeEnumerateFunc;
6641 // Flags passed to g_dbus_connection_register_subtree().
6642 enum DBusSubtreeFlags /* Version 2.26 */ {
6643 NONE = 0,
6644 DISPATCH_TO_UNENUMERATED_NODES = 1
6647 // The type of the @introspect function in #GDBusSubtreeVTable.
6649 // Subtrees are flat. @node, if non-%NULL, is always exactly one
6650 // segment of the object path (ie: it never contains a slash).
6652 // This function should return %NULL to indicate that there is no object
6653 // at this node.
6655 // If this function returns non-%NULL, the return value is expected to
6656 // be a %NULL-terminated array of pointers to #GDBusInterfaceInfo
6657 // structures describing the interfaces implemented by @node. This
6658 // array will have g_dbus_interface_info_unref() called on each item
6659 // before being freed with g_free().
6661 // The difference between returning %NULL and an array containing zero
6662 // items is that the standard DBus interfaces will returned to the
6663 // remote introspector in the empty array case, but not in the %NULL
6664 // case.
6665 // RETURNS: A %NULL-terminated array of pointers to #GDBusInterfaceInfo, or %NULL.
6666 // <connection>: A #GDBusConnection.
6667 // <sender>: The unique bus name of the remote caller.
6668 // <object_path>: The object path that was registered with g_dbus_connection_register_subtree().
6669 // <node>: A node that is a child of @object_path (relative to @object_path) or %NULL for the root of the subtree.
6670 // <user_data>: The @user_data #gpointer passed to g_dbus_connection_register_subtree().
6671 extern (C) alias DBusInterfaceInfo** /*new*/ function (DBusConnection* connection, char* sender, char* object_path, char* node, void* user_data) DBusSubtreeIntrospectFunc;
6673 // Virtual table for handling subtrees registered with g_dbus_connection_register_subtree().
6674 struct DBusSubtreeVTable /* Version 2.26 */ {
6675 DBusSubtreeEnumerateFunc enumerate;
6676 DBusSubtreeIntrospectFunc introspect;
6677 DBusSubtreeDispatchFunc dispatch;
6678 private void*[8] padding;
6681 enum DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME = "gio-desktop-app-info-lookup";
6683 // Data input stream implements #GInputStream and includes functions for
6684 // reading structured data directly from a binary input stream.
6685 struct DataInputStream /* : BufferedInputStream */ {
6686 alias parent_instance this;
6687 alias parent_instance super_;
6688 alias parent_instance bufferedinputstream;
6689 BufferedInputStream parent_instance;
6690 private DataInputStreamPrivate* priv;
6693 // Creates a new data input stream for the @base_stream.
6694 // RETURNS: a new #GDataInputStream.
6695 // <base_stream>: a #GInputStream.
6696 static DataInputStream* /*new*/ new_(InputStream* base_stream) {
6697 return g_data_input_stream_new(base_stream);
6700 // Gets the byte order for the data input stream.
6701 // RETURNS: the @stream's current #GDataStreamByteOrder.
6702 DataStreamByteOrder get_byte_order() {
6703 return g_data_input_stream_get_byte_order(&this);
6706 // Gets the current newline type for the @stream.
6707 // RETURNS: #GDataStreamNewlineType for the given @stream.
6708 DataStreamNewlineType get_newline_type() {
6709 return g_data_input_stream_get_newline_type(&this);
6712 // Reads an unsigned 8-bit/1-byte value from @stream.
6714 // if an error occurred.
6715 // RETURNS: an unsigned 8-bit/1-byte value read from the @stream or %0
6716 // <cancellable>: optional #GCancellable object, %NULL to ignore.
6717 ubyte read_byte(Cancellable* cancellable, GLib2.Error** error=null) {
6718 return g_data_input_stream_read_byte(&this, cancellable, error);
6721 // Reads a 16-bit/2-byte value from @stream.
6723 // In order to get the correct byte order for this read operation,
6724 // see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
6726 // an error occurred.
6727 // RETURNS: a signed 16-bit/2-byte value read from @stream or %0 if
6728 // <cancellable>: optional #GCancellable object, %NULL to ignore.
6729 short read_int16(Cancellable* cancellable, GLib2.Error** error=null) {
6730 return g_data_input_stream_read_int16(&this, cancellable, error);
6733 // Reads a signed 32-bit/4-byte value from @stream.
6735 // In order to get the correct byte order for this read operation,
6736 // see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
6738 // If @cancellable is not %NULL, then the operation can be cancelled by
6739 // triggering the cancellable object from another thread. If the operation
6740 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
6742 // an error occurred.
6743 // RETURNS: a signed 32-bit/4-byte value read from the @stream or %0 if
6744 // <cancellable>: optional #GCancellable object, %NULL to ignore.
6745 int read_int32(Cancellable* cancellable, GLib2.Error** error=null) {
6746 return g_data_input_stream_read_int32(&this, cancellable, error);
6749 // Reads a 64-bit/8-byte value from @stream.
6751 // In order to get the correct byte order for this read operation,
6752 // see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
6754 // If @cancellable is not %NULL, then the operation can be cancelled by
6755 // triggering the cancellable object from another thread. If the operation
6756 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
6758 // an error occurred.
6759 // RETURNS: a signed 64-bit/8-byte value read from @stream or %0 if
6760 // <cancellable>: optional #GCancellable object, %NULL to ignore.
6761 long read_int64(Cancellable* cancellable, GLib2.Error** error=null) {
6762 return g_data_input_stream_read_int64(&this, cancellable, error);
6765 // Reads a line from the data input stream. Note that no encoding
6766 // checks or conversion is performed; the input is not guaranteed to
6767 // be UTF-8, and may in fact have embedded NUL characters.
6769 // If @cancellable is not %NULL, then the operation can be cancelled by
6770 // triggering the cancellable object from another thread. If the operation
6771 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
6773 // NUL terminated byte array with the line that was read in (without
6774 // the newlines). Set @length to a #gsize to get the length of the
6775 // read line. On an error, it will return %NULL and @error will be
6776 // set. If there's no content to read, it will still return %NULL,
6777 // but @error won't be set.
6778 // RETURNS: a
6779 // <length>: a #gsize to get the length of the data read in.
6780 // <cancellable>: optional #GCancellable object, %NULL to ignore.
6781 ubyte* /*new*/ read_line(/*out*/ size_t* length, Cancellable* cancellable, GLib2.Error** error=null) {
6782 return g_data_input_stream_read_line(&this, length, cancellable, error);
6785 // The asynchronous version of g_data_input_stream_read_line(). It is
6786 // an error to have two outstanding calls to this function.
6788 // When the operation is finished, @callback will be called. You
6789 // can then call g_data_input_stream_read_line_finish() to get
6790 // the result of the operation.
6791 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
6792 // <cancellable>: optional #GCancellable object, %NULL to ignore.
6793 // <callback>: callback to call when the request is satisfied.
6794 // <user_data>: the data to pass to callback function.
6795 void read_line_async(int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
6796 g_data_input_stream_read_line_async(&this, io_priority, cancellable, callback, user_data);
6799 // Finish an asynchronous call started by
6800 // g_data_input_stream_read_line_async(). Note the warning about
6801 // string encoding in g_data_input_stream_read_line() applies here as
6802 // well.
6804 // NUL-terminated byte array with the line that was read in
6805 // (without the newlines). Set @length to a #gsize to get the
6806 // length of the read line. On an error, it will return %NULL and
6807 // @error will be set. If there's no content to read, it will
6808 // still return %NULL, but @error won't be set.
6809 // RETURNS: a
6810 // <result>: the #GAsyncResult that was provided to the callback.
6811 // <length>: a #gsize to get the length of the data read in.
6812 ubyte* /*new*/ read_line_finish(AsyncResult* result, /*out*/ size_t* length, GLib2.Error** error=null) {
6813 return g_data_input_stream_read_line_finish(&this, result, length, error);
6816 // Finish an asynchronous call started by
6817 // g_data_input_stream_read_line_async().
6819 // (without the newlines). Set @length to a #gsize to get the length
6820 // of the read line. On an error, it will return %NULL and @error
6821 // will be set. For UTF-8 conversion errors, the set error domain is
6822 // %G_CONVERT_ERROR. If there's no content to read, it will still
6823 // return %NULL, but @error won't be set.
6824 // RETURNS: a string with the line that was read in
6825 // <result>: the #GAsyncResult that was provided to the callback.
6826 // <length>: a #gsize to get the length of the data read in.
6827 char* /*new*/ read_line_finish_utf8(AsyncResult* result, /*out*/ size_t* length, GLib2.Error** error=null) {
6828 return g_data_input_stream_read_line_finish_utf8(&this, result, length, error);
6831 // Reads a UTF-8 encoded line from the data input stream.
6833 // If @cancellable is not %NULL, then the operation can be cancelled by
6834 // triggering the cancellable object from another thread. If the operation
6835 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
6837 // line that was read in (without the newlines). Set @length to a
6838 // #gsize to get the length of the read line. On an error, it will
6839 // return %NULL and @error will be set. For UTF-8 conversion errors,
6840 // the set error domain is %G_CONVERT_ERROR. If there's no content to
6841 // read, it will still return %NULL, but @error won't be set.
6842 // RETURNS: a NUL terminated UTF-8 string with the
6843 // <length>: a #gsize to get the length of the data read in.
6844 // <cancellable>: optional #GCancellable object, %NULL to ignore.
6845 char* /*new*/ read_line_utf8(/*out*/ size_t* length, Cancellable* cancellable, GLib2.Error** error=null) {
6846 return g_data_input_stream_read_line_utf8(&this, length, cancellable, error);
6849 // Reads an unsigned 16-bit/2-byte value from @stream.
6851 // In order to get the correct byte order for this read operation,
6852 // see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
6854 // an error occurred.
6855 // RETURNS: an unsigned 16-bit/2-byte value read from the @stream or %0 if
6856 // <cancellable>: optional #GCancellable object, %NULL to ignore.
6857 ushort read_uint16(Cancellable* cancellable, GLib2.Error** error=null) {
6858 return g_data_input_stream_read_uint16(&this, cancellable, error);
6861 // Reads an unsigned 32-bit/4-byte value from @stream.
6863 // In order to get the correct byte order for this read operation,
6864 // see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
6866 // If @cancellable is not %NULL, then the operation can be cancelled by
6867 // triggering the cancellable object from another thread. If the operation
6868 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
6870 // an error occurred.
6871 // RETURNS: an unsigned 32-bit/4-byte value read from the @stream or %0 if
6872 // <cancellable>: optional #GCancellable object, %NULL to ignore.
6873 uint read_uint32(Cancellable* cancellable, GLib2.Error** error=null) {
6874 return g_data_input_stream_read_uint32(&this, cancellable, error);
6877 // Reads an unsigned 64-bit/8-byte value from @stream.
6879 // In order to get the correct byte order for this read operation,
6880 // see g_data_input_stream_get_byte_order().
6882 // If @cancellable is not %NULL, then the operation can be cancelled by
6883 // triggering the cancellable object from another thread. If the operation
6884 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
6886 // an error occurred.
6887 // RETURNS: an unsigned 64-bit/8-byte read from @stream or %0 if
6888 // <cancellable>: optional #GCancellable object, %NULL to ignore.
6889 ulong read_uint64(Cancellable* cancellable, GLib2.Error** error=null) {
6890 return g_data_input_stream_read_uint64(&this, cancellable, error);
6893 // Reads a string from the data input stream, up to the first
6894 // occurrence of any of the stop characters.
6896 // Note that, in contrast to g_data_input_stream_read_until_async(),
6897 // this function consumes the stop character that it finds.
6899 // Don't use this function in new code. Its functionality is
6900 // inconsistent with g_data_input_stream_read_until_async(). Both
6901 // functions will be marked as deprecated in a future release. Use
6902 // g_data_input_stream_read_upto() instead, but note that that function
6903 // does not consume the stop character.
6905 // before encountering any of the stop characters. Set @length to
6906 // a #gsize to get the length of the string. This function will
6907 // return %NULL on an error.
6908 // RETURNS: a string with the data that was read
6909 // <stop_chars>: characters to terminate the read.
6910 // <length>: a #gsize to get the length of the data read in.
6911 // <cancellable>: optional #GCancellable object, %NULL to ignore.
6912 char* /*new*/ read_until(char* stop_chars, /*out*/ size_t* length, Cancellable* cancellable, GLib2.Error** error=null) {
6913 return g_data_input_stream_read_until(&this, stop_chars, length, cancellable, error);
6916 // The asynchronous version of g_data_input_stream_read_until().
6917 // It is an error to have two outstanding calls to this function.
6919 // Note that, in contrast to g_data_input_stream_read_until(),
6920 // this function does not consume the stop character that it finds. You
6921 // must read it for yourself.
6923 // When the operation is finished, @callback will be called. You
6924 // can then call g_data_input_stream_read_until_finish() to get
6925 // the result of the operation.
6927 // Don't use this function in new code. Its functionality is
6928 // inconsistent with g_data_input_stream_read_until(). Both functions
6929 // will be marked as deprecated in a future release. Use
6930 // g_data_input_stream_read_upto_async() instead.
6931 // <stop_chars>: characters to terminate the read.
6932 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
6933 // <cancellable>: optional #GCancellable object, %NULL to ignore.
6934 // <callback>: callback to call when the request is satisfied.
6935 // <user_data>: the data to pass to callback function.
6936 void read_until_async(char* stop_chars, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
6937 g_data_input_stream_read_until_async(&this, stop_chars, io_priority, cancellable, callback, user_data);
6940 // Finish an asynchronous call started by
6941 // g_data_input_stream_read_until_async().
6944 // before encountering any of the stop characters. Set @length to
6945 // a #gsize to get the length of the string. This function will
6946 // return %NULL on an error.
6947 // RETURNS: a string with the data that was read
6948 // <result>: the #GAsyncResult that was provided to the callback.
6949 // <length>: a #gsize to get the length of the data read in.
6950 char* /*new*/ read_until_finish(AsyncResult* result, /*out*/ size_t* length, GLib2.Error** error=null) {
6951 return g_data_input_stream_read_until_finish(&this, result, length, error);
6954 // Reads a string from the data input stream, up to the first
6955 // occurrence of any of the stop characters.
6957 // In contrast to g_data_input_stream_read_until(), this function
6958 // does <emphasis>not</emphasis> consume the stop character. You have
6959 // to use g_data_input_stream_read_byte() to get it before calling
6960 // g_data_input_stream_read_upto() again.
6962 // Note that @stop_chars may contain '\0' if @stop_chars_len is
6963 // specified.
6965 // before encountering any of the stop characters. Set @length to
6966 // a #gsize to get the length of the string. This function will
6967 // return %NULL on an error
6968 // RETURNS: a string with the data that was read
6969 // <stop_chars>: characters to terminate the read
6970 // <stop_chars_len>: length of @stop_chars. May be -1 if @stop_chars is nul-terminated
6971 // <length>: a #gsize to get the length of the data read in
6972 // <cancellable>: optional #GCancellable object, %NULL to ignore
6973 char* /*new*/ read_upto(char* stop_chars, ssize_t stop_chars_len, /*out*/ size_t* length, Cancellable* cancellable, GLib2.Error** error=null) {
6974 return g_data_input_stream_read_upto(&this, stop_chars, stop_chars_len, length, cancellable, error);
6977 // The asynchronous version of g_data_input_stream_read_upto().
6978 // It is an error to have two outstanding calls to this function.
6980 // In contrast to g_data_input_stream_read_until(), this function
6981 // does <emphasis>not</emphasis> consume the stop character. You have
6982 // to use g_data_input_stream_read_byte() to get it before calling
6983 // g_data_input_stream_read_upto() again.
6985 // Note that @stop_chars may contain '\0' if @stop_chars_len is
6986 // specified.
6988 // When the operation is finished, @callback will be called. You
6989 // can then call g_data_input_stream_read_upto_finish() to get
6990 // the result of the operation.
6991 // <stop_chars>: characters to terminate the read
6992 // <stop_chars_len>: length of @stop_chars. May be -1 if @stop_chars is nul-terminated
6993 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
6994 // <cancellable>: optional #GCancellable object, %NULL to ignore
6995 // <callback>: callback to call when the request is satisfied
6996 // <user_data>: the data to pass to callback function
6997 void read_upto_async(char* stop_chars, ssize_t stop_chars_len, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
6998 g_data_input_stream_read_upto_async(&this, stop_chars, stop_chars_len, io_priority, cancellable, callback, user_data);
7001 // Finish an asynchronous call started by
7002 // g_data_input_stream_read_upto_async().
7004 // Note that this function does <emphasis>not</emphasis> consume the
7005 // stop character. You have to use g_data_input_stream_read_byte() to
7006 // get it before calling g_data_input_stream_read_upto_async() again.
7008 // before encountering any of the stop characters. Set @length to
7009 // a #gsize to get the length of the string. This function will
7010 // return %NULL on an error.
7011 // RETURNS: a string with the data that was read
7012 // <result>: the #GAsyncResult that was provided to the callback
7013 // <length>: a #gsize to get the length of the data read in
7014 char* /*new*/ read_upto_finish(AsyncResult* result, /*out*/ size_t* length, GLib2.Error** error=null) {
7015 return g_data_input_stream_read_upto_finish(&this, result, length, error);
7018 // This function sets the byte order for the given @stream. All subsequent
7019 // reads from the @stream will be read in the given @order.
7020 // <order>: a #GDataStreamByteOrder to set.
7021 void set_byte_order(DataStreamByteOrder order) {
7022 g_data_input_stream_set_byte_order(&this, order);
7025 // Sets the newline type for the @stream.
7027 // Note that using G_DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a read
7028 // chunk ends in "CR" we must read an additional byte to know if this is "CR" or
7029 // "CR LF", and this might block if there is no more data available.
7030 // <type>: the type of new line return as #GDataStreamNewlineType.
7031 void set_newline_type(DataStreamNewlineType type) {
7032 g_data_input_stream_set_newline_type(&this, type);
7036 struct DataInputStreamClass {
7037 BufferedInputStreamClass parent_class;
7038 extern (C) void function () _g_reserved1;
7039 extern (C) void function () _g_reserved2;
7040 extern (C) void function () _g_reserved3;
7041 extern (C) void function () _g_reserved4;
7042 extern (C) void function () _g_reserved5;
7045 struct DataInputStreamPrivate {
7049 // Data output stream implements #GOutputStream and includes functions for
7050 // writing data directly to an output stream.
7051 struct DataOutputStream /* : FilterOutputStream */ {
7052 alias parent_instance this;
7053 alias parent_instance super_;
7054 alias parent_instance filteroutputstream;
7055 FilterOutputStream parent_instance;
7056 private DataOutputStreamPrivate* priv;
7059 // Creates a new data output stream for @base_stream.
7060 // RETURNS: #GDataOutputStream.
7061 // <base_stream>: a #GOutputStream.
7062 static DataOutputStream* /*new*/ new_(OutputStream* base_stream) {
7063 return g_data_output_stream_new(base_stream);
7066 // Gets the byte order for the stream.
7067 // RETURNS: the #GDataStreamByteOrder for the @stream.
7068 DataStreamByteOrder get_byte_order() {
7069 return g_data_output_stream_get_byte_order(&this);
7072 // Puts a byte into the output stream.
7073 // RETURNS: %TRUE if @data was successfully added to the @stream.
7074 // <data>: a #guchar.
7075 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7076 int put_byte(ubyte data, Cancellable* cancellable, GLib2.Error** error=null) {
7077 return g_data_output_stream_put_byte(&this, data, cancellable, error);
7080 // Puts a signed 16-bit integer into the output stream.
7081 // RETURNS: %TRUE if @data was successfully added to the @stream.
7082 // <data>: a #gint16.
7083 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7084 int put_int16(short data, Cancellable* cancellable, GLib2.Error** error=null) {
7085 return g_data_output_stream_put_int16(&this, data, cancellable, error);
7088 // Puts a signed 32-bit integer into the output stream.
7089 // RETURNS: %TRUE if @data was successfully added to the @stream.
7090 // <data>: a #gint32.
7091 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7092 int put_int32(int data, Cancellable* cancellable, GLib2.Error** error=null) {
7093 return g_data_output_stream_put_int32(&this, data, cancellable, error);
7096 // Puts a signed 64-bit integer into the stream.
7097 // RETURNS: %TRUE if @data was successfully added to the @stream.
7098 // <data>: a #gint64.
7099 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7100 int put_int64(long data, Cancellable* cancellable, GLib2.Error** error=null) {
7101 return g_data_output_stream_put_int64(&this, data, cancellable, error);
7104 // Puts a string into the output stream.
7105 // RETURNS: %TRUE if @string was successfully added to the @stream.
7106 // <str>: a string.
7107 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7108 int put_string(char* str, Cancellable* cancellable, GLib2.Error** error=null) {
7109 return g_data_output_stream_put_string(&this, str, cancellable, error);
7112 // Puts an unsigned 16-bit integer into the output stream.
7113 // RETURNS: %TRUE if @data was successfully added to the @stream.
7114 // <data>: a #guint16.
7115 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7116 int put_uint16(ushort data, Cancellable* cancellable, GLib2.Error** error=null) {
7117 return g_data_output_stream_put_uint16(&this, data, cancellable, error);
7120 // Puts an unsigned 32-bit integer into the stream.
7121 // RETURNS: %TRUE if @data was successfully added to the @stream.
7122 // <data>: a #guint32.
7123 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7124 int put_uint32(uint data, Cancellable* cancellable, GLib2.Error** error=null) {
7125 return g_data_output_stream_put_uint32(&this, data, cancellable, error);
7128 // Puts an unsigned 64-bit integer into the stream.
7129 // RETURNS: %TRUE if @data was successfully added to the @stream.
7130 // <data>: a #guint64.
7131 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7132 int put_uint64(ulong data, Cancellable* cancellable, GLib2.Error** error=null) {
7133 return g_data_output_stream_put_uint64(&this, data, cancellable, error);
7136 // Sets the byte order of the data output stream to @order.
7137 // <order>: a %GDataStreamByteOrder.
7138 void set_byte_order(DataStreamByteOrder order) {
7139 g_data_output_stream_set_byte_order(&this, order);
7143 struct DataOutputStreamClass {
7144 FilterOutputStreamClass parent_class;
7145 extern (C) void function () _g_reserved1;
7146 extern (C) void function () _g_reserved2;
7147 extern (C) void function () _g_reserved3;
7148 extern (C) void function () _g_reserved4;
7149 extern (C) void function () _g_reserved5;
7152 struct DataOutputStreamPrivate {
7156 // #GDataStreamByteOrder is used to ensure proper endianness of streaming data sources
7157 // across various machine architectures.
7158 enum DataStreamByteOrder {
7159 BIG_ENDIAN = 0,
7160 LITTLE_ENDIAN = 1,
7161 HOST_ENDIAN = 2
7163 // #GDataStreamNewlineType is used when checking for or setting the line endings for a given file.
7164 enum DataStreamNewlineType {
7165 LF = 0,
7166 CR = 1,
7167 CR_LF = 2,
7168 ANY = 3
7171 // #GDesktopAppInfo is an implementation of #GAppInfo based on
7172 // desktop files.
7174 // Note that <filename>&lt;gio/gdesktopappinfo.h&gt;</filename> belongs to
7175 // the UNIX-specific GIO interfaces, thus you have to use the
7176 // <filename>gio-unix-2.0.pc</filename> pkg-config file when using it.
7177 struct DesktopAppInfo /* : GObject.Object */ {
7178 alias method_parent this;
7179 alias method_parent super_;
7180 alias method_parent object;
7181 GObject2.Object method_parent;
7184 // Creates a new #GDesktopAppInfo based on a desktop file id.
7186 // A desktop file id is the basename of the desktop file, including the
7187 // .desktop extension. GIO is looking for a desktop file with this name
7188 // in the <filename>applications</filename> subdirectories of the XDG data
7189 // directories (i.e. the directories specified in the
7190 // <envar>XDG_DATA_HOME</envar> and <envar>XDG_DATA_DIRS</envar> environment
7191 // variables). GIO also supports the prefix-to-subdirectory mapping that is
7192 // described in the <ulink url="http://standards.freedesktop.org/menu-spec/latest/">Menu Spec</ulink>
7193 // (i.e. a desktop id of kde-foo.desktop will match
7194 // <filename>/usr/share/applications/kde/foo.desktop</filename>).
7195 // RETURNS: a new #GDesktopAppInfo, or %NULL if no desktop file with that id
7196 // <desktop_id>: the desktop file id
7197 static DesktopAppInfo* /*new*/ new_(char* desktop_id) {
7198 return g_desktop_app_info_new(desktop_id);
7201 // Creates a new #GDesktopAppInfo.
7202 // RETURNS: a new #GDesktopAppInfo or %NULL on error.
7203 // <filename>: the path of a desktop file, in the GLib filename encoding
7204 static DesktopAppInfo* /*new*/ new_from_filename(char* filename) {
7205 return g_desktop_app_info_new_from_filename(filename);
7208 // Creates a new #GDesktopAppInfo.
7209 // RETURNS: a new #GDesktopAppInfo or %NULL on error.
7210 // <key_file>: an opened #GKeyFile
7211 static DesktopAppInfo* /*new*/ new_from_keyfile(GLib2.KeyFile* key_file) {
7212 return g_desktop_app_info_new_from_keyfile(key_file);
7215 // Sets the name of the desktop that the application is running in.
7216 // This is used by g_app_info_should_show() and
7217 // g_desktop_app_info_get_show_in() to evaluate the
7218 // <literal>OnlyShowIn</literal> and <literal>NotShowIn</literal>
7219 // desktop entry fields.
7221 // The <ulink url="http://standards.freedesktop.org/menu-spec/latest/">Desktop
7222 // Menu specification</ulink> recognizes the following:
7223 // <simplelist>
7224 // <member>GNOME</member>
7225 // <member>KDE</member>
7226 // <member>ROX</member>
7227 // <member>XFCE</member>
7228 // <member>Old</member>
7229 // </simplelist>
7231 // Should be called only once; subsequent calls are ignored.
7232 // <desktop_env>: a string specifying what desktop this is
7233 static void set_desktop_env(char* desktop_env) {
7234 g_desktop_app_info_set_desktop_env(desktop_env);
7237 // Gets the categories from the desktop file.
7239 // i.e. no attempt is made to split it by ';' or validate it.
7240 // RETURNS: The unparsed Categories key from the desktop file;
7241 char* get_categories() {
7242 return g_desktop_app_info_get_categories(&this);
7245 // When @info was created from a known filename, return it. In some
7246 // situations such as the #GDesktopAppInfo returned from
7247 // g_desktop_app_info_new_from_keyfile(), this function will return %NULL.
7248 // RETURNS: The full path to the file for @info, or %NULL if not known.
7249 char* get_filename() {
7250 return g_desktop_app_info_get_filename(&this);
7253 // Gets the generic name from the destkop file.
7254 // RETURNS: The value of the GenericName key
7255 char* get_generic_name() {
7256 return g_desktop_app_info_get_generic_name(&this);
7259 // A desktop file is hidden if the Hidden key in it is
7260 // set to True.
7261 // RETURNS: %TRUE if hidden, %FALSE otherwise.
7262 int get_is_hidden() {
7263 return g_desktop_app_info_get_is_hidden(&this);
7266 // Gets the value of the NoDisplay key, which helps determine if the
7267 // application info should be shown in menus. See
7268 // #G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY and g_app_info_should_show().
7269 // RETURNS: The value of the NoDisplay key
7270 int get_nodisplay() {
7271 return g_desktop_app_info_get_nodisplay(&this);
7274 // Checks if the application info should be shown in menus that list available
7275 // applications for a specific name of the desktop, based on the
7276 // <literal>OnlyShowIn</literal> and <literal>NotShowIn</literal> keys.
7278 // If @desktop_env is %NULL, then the name of the desktop set with
7279 // g_desktop_app_info_set_desktop_env() is used.
7281 // Note that g_app_info_should_show() for @info will include this check (with
7282 // %NULL for @desktop_env) as well as additional checks.
7284 // <literal>OnlyShowIn</literal> and <literal>NotShowIn</literal> keys, %FALSE
7285 // otherwise.
7286 // RETURNS: %TRUE if the @info should be shown in @desktop_env according to the
7287 // <desktop_env>: a string specifying a desktop name
7288 int get_show_in(char* desktop_env) {
7289 return g_desktop_app_info_get_show_in(&this, desktop_env);
7292 // This function performs the equivalent of g_app_info_launch_uris(),
7293 // but is intended primarily for operating system components that
7294 // launch applications. Ordinary applications should use
7295 // g_app_info_launch_uris().
7297 // In contrast to g_app_info_launch_uris(), all processes created will
7298 // always be run directly as children as if by the UNIX fork()/exec()
7299 // calls.
7301 // This guarantee allows additional control over the exact environment
7302 // of the child processes, which is provided via a setup function
7303 // @setup, as well as the process identifier of each child process via
7304 // @pid_callback. See g_spawn_async() for more information about the
7305 // semantics of the @setup function.
7306 // RETURNS: %TRUE on successful launch, %FALSE otherwise.
7307 // <uris>: List of URIs
7308 // <launch_context>: a #GAppLaunchContext
7309 // <spawn_flags>: #GSpawnFlags, used for each process
7310 // <user_setup>: a #GSpawnChildSetupFunc, used once for each process.
7311 // <user_setup_data>: User data for @user_setup
7312 // <pid_callback>: Callback for child processes
7313 // <pid_callback_data>: User data for @callback
7314 int launch_uris_as_manager(GLib2.List* uris, AppLaunchContext* launch_context, GLib2.SpawnFlags spawn_flags, GLib2.SpawnChildSetupFunc user_setup, void* user_setup_data, DesktopAppLaunchCallback pid_callback, void* pid_callback_data, GLib2.Error** error=null) {
7315 return g_desktop_app_info_launch_uris_as_manager(&this, uris, launch_context, spawn_flags, user_setup, user_setup_data, pid_callback, pid_callback_data, error);
7319 struct DesktopAppInfoClass {
7320 GObject2.ObjectClass parent_class;
7324 // Interface that is used by backends to associate default
7325 // handlers with URI schemes.
7326 struct DesktopAppInfoLookup {
7328 // Gets the default application for launching applications
7329 // using this URI scheme for a particular GDesktopAppInfoLookup
7330 // implementation.
7332 // The GDesktopAppInfoLookup interface and this function is used
7333 // to implement g_app_info_get_default_for_uri_scheme() backends
7334 // in a GIO module. There is no reason for applications to use it
7335 // directly. Applications should use g_app_info_get_default_for_uri_scheme().
7336 // RETURNS: #GAppInfo for given @uri_scheme or %NULL on error.
7337 // <uri_scheme>: a string containing a URI scheme.
7338 AppInfo* /*new*/ get_default_for_uri_scheme(char* uri_scheme) {
7339 return g_desktop_app_info_lookup_get_default_for_uri_scheme(&this, uri_scheme);
7343 struct DesktopAppInfoLookupIface {
7344 GObject2.TypeInterface g_iface;
7346 // RETURNS: #GAppInfo for given @uri_scheme or %NULL on error.
7347 // <uri_scheme>: a string containing a URI scheme.
7348 extern (C) AppInfo* /*new*/ function (DesktopAppInfoLookup* lookup, char* uri_scheme) get_default_for_uri_scheme;
7352 // During invocation, g_desktop_app_info_launch_uris_as_manager() may
7353 // create one or more child processes. This callback is invoked once
7354 // for each, providing the process ID.
7355 // <appinfo>: a #GDesktopAppInfo
7356 // <pid>: Process identifier
7357 // <user_data>: User data
7358 extern (C) alias void function (DesktopAppInfo* appinfo, GLib2.Pid pid, void* user_data) DesktopAppLaunchCallback;
7361 // #GDrive - this represent a piece of hardware connected to the machine.
7362 // It's generally only created for removable hardware or hardware with
7363 // removable media.
7365 // #GDrive is a container class for #GVolume objects that stem from
7366 // the same piece of media. As such, #GDrive abstracts a drive with
7367 // (or without) removable media and provides operations for querying
7368 // whether media is available, determing whether media change is
7369 // automatically detected and ejecting the media.
7371 // If the #GDrive reports that media isn't automatically detected, one
7372 // can poll for media; typically one should not do this periodically
7373 // as a poll for media operation is potententially expensive and may
7374 // spin up the drive creating noise.
7376 // #GDrive supports starting and stopping drives with authentication
7377 // support for the former. This can be used to support a diverse set
7378 // of use cases including connecting/disconnecting iSCSI devices,
7379 // powering down external disk enclosures and starting/stopping
7380 // multi-disk devices such as RAID devices. Note that the actual
7381 // semantics and side-effects of starting/stopping a #GDrive may vary
7382 // according to implementation. To choose the correct verbs in e.g. a
7383 // file manager, use g_drive_get_start_stop_type().
7385 // For porting from GnomeVFS note that there is no equivalent of
7386 // #GDrive in that API.
7387 struct Drive {
7389 // Checks if a drive can be ejected.
7390 // RETURNS: %TRUE if the @drive can be ejected, %FALSE otherwise.
7391 int can_eject() {
7392 return g_drive_can_eject(&this);
7395 // Checks if a drive can be polled for media changes.
7397 // %FALSE otherwise.
7398 // RETURNS: %TRUE if the @drive can be polled for media changes,
7399 int can_poll_for_media() {
7400 return g_drive_can_poll_for_media(&this);
7403 // Checks if a drive can be started.
7404 // RETURNS: %TRUE if the @drive can be started, %FALSE otherwise.
7405 int can_start() {
7406 return g_drive_can_start(&this);
7409 // Checks if a drive can be started degraded.
7410 // RETURNS: %TRUE if the @drive can be started degraded, %FALSE otherwise.
7411 int can_start_degraded() {
7412 return g_drive_can_start_degraded(&this);
7415 // Checks if a drive can be stopped.
7416 // RETURNS: %TRUE if the @drive can be stopped, %FALSE otherwise.
7417 int can_stop() {
7418 return g_drive_can_stop(&this);
7421 // Asynchronously ejects a drive.
7423 // When the operation is finished, @callback will be called.
7424 // You can then call g_drive_eject_finish() to obtain the
7425 // result of the operation.
7426 // <flags>: flags affecting the unmount if required for eject
7427 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7428 // <callback>: a #GAsyncReadyCallback, or %NULL.
7429 // <user_data>: user data to pass to @callback
7430 void eject(MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
7431 g_drive_eject(&this, flags, cancellable, callback, user_data);
7434 // Finishes ejecting a drive.
7436 // %FALSE otherwise.
7437 // RETURNS: %TRUE if the drive has been ejected successfully,
7438 // <result>: a #GAsyncResult.
7439 int eject_finish(AsyncResult* result, GLib2.Error** error=null) {
7440 return g_drive_eject_finish(&this, result, error);
7443 // Ejects a drive. This is an asynchronous operation, and is
7444 // finished by calling g_drive_eject_with_operation_finish() with the @drive
7445 // and #GAsyncResult data returned in the @callback.
7446 // <flags>: flags affecting the unmount if required for eject
7447 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
7448 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7449 // <callback>: a #GAsyncReadyCallback, or %NULL.
7450 // <user_data>: user data passed to @callback.
7451 void eject_with_operation(MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
7452 g_drive_eject_with_operation(&this, flags, mount_operation, cancellable, callback, user_data);
7455 // Finishes ejecting a drive. If any errors occurred during the operation,
7456 // @error will be set to contain the errors and %FALSE will be returned.
7457 // RETURNS: %TRUE if the drive was successfully ejected. %FALSE otherwise.
7458 // <result>: a #GAsyncResult.
7459 int eject_with_operation_finish(AsyncResult* result, GLib2.Error** error=null) {
7460 return g_drive_eject_with_operation_finish(&this, result, error);
7463 // Gets the kinds of identifiers that @drive has.
7464 // Use g_drive_get_identifer() to obtain the identifiers
7465 // themselves.
7467 // array of strings containing kinds of identifiers. Use g_strfreev()
7468 // to free.
7469 // RETURNS: a %NULL-terminated
7470 char** /*new*/ enumerate_identifiers() {
7471 return g_drive_enumerate_identifiers(&this);
7474 // Gets the icon for @drive.
7476 // Free the returned object with g_object_unref().
7477 // RETURNS: #GIcon for the @drive.
7478 Icon* /*new*/ get_icon() {
7479 return g_drive_get_icon(&this);
7482 // Gets the identifier of the given kind for @drive.
7484 // requested identfier, or %NULL if the #GDrive
7485 // doesn't have this kind of identifier.
7486 // RETURNS: a newly allocated string containing the
7487 // <kind>: the kind of identifier to return
7488 char* /*new*/ get_identifier(char* kind) {
7489 return g_drive_get_identifier(&this, kind);
7492 // Gets the name of @drive.
7494 // string should be freed when no longer needed.
7495 // RETURNS: a string containing @drive's name. The returned
7496 char* /*new*/ get_name() {
7497 return g_drive_get_name(&this);
7500 // Gets a hint about how a drive can be started/stopped.
7501 // RETURNS: A value from the #GDriveStartStopType enumeration.
7502 DriveStartStopType get_start_stop_type() {
7503 return g_drive_get_start_stop_type(&this);
7506 // Get a list of mountable volumes for @drive.
7508 // The returned list should be freed with g_list_free(), after
7509 // its elements have been unreffed with g_object_unref().
7510 // RETURNS: #GList containing any #GVolume objects on the given @drive.
7511 GLib2.List* /*new*/ get_volumes() {
7512 return g_drive_get_volumes(&this);
7515 // Checks if the @drive has media. Note that the OS may not be polling
7516 // the drive for media changes; see g_drive_is_media_check_automatic()
7517 // for more details.
7518 // RETURNS: %TRUE if @drive has media, %FALSE otherwise.
7519 int has_media() {
7520 return g_drive_has_media(&this);
7523 // Check if @drive has any mountable volumes.
7524 // RETURNS: %TRUE if the @drive contains volumes, %FALSE otherwise.
7525 int has_volumes() {
7526 return g_drive_has_volumes(&this);
7529 // Checks if @drive is capabable of automatically detecting media changes.
7531 // media changes, %FALSE otherwise.
7532 // RETURNS: %TRUE if the @drive is capabable of automatically detecting
7533 int is_media_check_automatic() {
7534 return g_drive_is_media_check_automatic(&this);
7537 // Checks if the @drive supports removable media.
7538 // RETURNS: %TRUE if @drive supports removable media, %FALSE otherwise.
7539 int is_media_removable() {
7540 return g_drive_is_media_removable(&this);
7543 // Asynchronously polls @drive to see if media has been inserted or removed.
7545 // When the operation is finished, @callback will be called.
7546 // You can then call g_drive_poll_for_media_finish() to obtain the
7547 // result of the operation.
7548 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7549 // <callback>: a #GAsyncReadyCallback, or %NULL.
7550 // <user_data>: user data to pass to @callback
7551 void poll_for_media(Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
7552 g_drive_poll_for_media(&this, cancellable, callback, user_data);
7555 // Finishes an operation started with g_drive_poll_for_media() on a drive.
7557 // %FALSE otherwise.
7558 // RETURNS: %TRUE if the drive has been poll_for_mediaed successfully,
7559 // <result>: a #GAsyncResult.
7560 int poll_for_media_finish(AsyncResult* result, GLib2.Error** error=null) {
7561 return g_drive_poll_for_media_finish(&this, result, error);
7564 // Asynchronously starts a drive.
7566 // When the operation is finished, @callback will be called.
7567 // You can then call g_drive_start_finish() to obtain the
7568 // result of the operation.
7569 // <flags>: flags affecting the start operation.
7570 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
7571 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7572 // <callback>: a #GAsyncReadyCallback, or %NULL.
7573 // <user_data>: user data to pass to @callback
7574 void start(DriveStartFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
7575 g_drive_start(&this, flags, mount_operation, cancellable, callback, user_data);
7578 // Finishes starting a drive.
7580 // %FALSE otherwise.
7581 // RETURNS: %TRUE if the drive has been started successfully,
7582 // <result>: a #GAsyncResult.
7583 int start_finish(AsyncResult* result, GLib2.Error** error=null) {
7584 return g_drive_start_finish(&this, result, error);
7587 // Asynchronously stops a drive.
7589 // When the operation is finished, @callback will be called.
7590 // You can then call g_drive_stop_finish() to obtain the
7591 // result of the operation.
7592 // <flags>: flags affecting the unmount if required for stopping.
7593 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
7594 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7595 // <callback>: a #GAsyncReadyCallback, or %NULL.
7596 // <user_data>: user data to pass to @callback
7597 void stop(MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
7598 g_drive_stop(&this, flags, mount_operation, cancellable, callback, user_data);
7601 // Finishes stopping a drive.
7603 // %FALSE otherwise.
7604 // RETURNS: %TRUE if the drive has been stopped successfully,
7605 // <result>: a #GAsyncResult.
7606 int stop_finish(AsyncResult* result, GLib2.Error** error=null) {
7607 return g_drive_stop_finish(&this, result, error);
7609 // Emitted when the drive's state has changed.
7610 extern (C) alias static void function (Drive* this_, void* user_data=null) signal_changed;
7612 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
7613 return super_.signal_connect!name(cb, data, cf);
7616 ulong signal_connect(string name:"changed", CB:signal_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
7617 return signal_connect_data(&this, cast(char*)"changed",
7618 cast(GObject2.Callback)cb, data, null, cf);
7621 // This signal is emitted when the #GDrive have been
7622 // disconnected. If the recipient is holding references to the
7623 // object they should release them so the object can be
7624 // finalized.
7625 extern (C) alias static void function (Drive* this_, void* user_data=null) signal_disconnected;
7626 ulong signal_connect(string name:"disconnected", CB:signal_disconnected)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
7627 return signal_connect_data(&this, cast(char*)"disconnected",
7628 cast(GObject2.Callback)cb, data, null, cf);
7631 // Emitted when the physical eject button (if any) of a drive has
7632 // been pressed.
7633 extern (C) alias static void function (Drive* this_, void* user_data=null) signal_eject_button;
7634 ulong signal_connect(string name:"eject-button", CB:signal_eject_button)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
7635 return signal_connect_data(&this, cast(char*)"eject-button",
7636 cast(GObject2.Callback)cb, data, null, cf);
7639 // Emitted when the physical stop button (if any) of a drive has
7640 // been pressed.
7641 extern (C) alias static void function (Drive* this_, void* user_data=null) signal_stop_button;
7642 ulong signal_connect(string name:"stop-button", CB:signal_stop_button)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
7643 return signal_connect_data(&this, cast(char*)"stop-button",
7644 cast(GObject2.Callback)cb, data, null, cf);
7648 // Interface for creating #GDrive implementations.
7649 struct DriveIface {
7650 GObject2.TypeInterface g_iface;
7651 extern (C) void function (Drive* drive) changed;
7652 extern (C) void function (Drive* drive) disconnected;
7653 extern (C) void function (Drive* drive) eject_button;
7654 // RETURNS: a string containing @drive's name. The returned
7655 extern (C) char* /*new*/ function (Drive* drive) get_name;
7656 // RETURNS: #GIcon for the @drive.
7657 extern (C) Icon* /*new*/ function (Drive* drive) get_icon;
7658 // RETURNS: %TRUE if the @drive contains volumes, %FALSE otherwise.
7659 extern (C) int function (Drive* drive) has_volumes;
7660 // RETURNS: #GList containing any #GVolume objects on the given @drive.
7661 extern (C) GLib2.List* /*new*/ function (Drive* drive) get_volumes;
7662 // RETURNS: %TRUE if @drive supports removable media, %FALSE otherwise.
7663 extern (C) int function (Drive* drive) is_media_removable;
7664 // RETURNS: %TRUE if @drive has media, %FALSE otherwise.
7665 extern (C) int function (Drive* drive) has_media;
7666 // RETURNS: %TRUE if the @drive is capabable of automatically detecting
7667 extern (C) int function (Drive* drive) is_media_check_automatic;
7668 // RETURNS: %TRUE if the @drive can be ejected, %FALSE otherwise.
7669 extern (C) int function (Drive* drive) can_eject;
7670 // RETURNS: %TRUE if the @drive can be polled for media changes,
7671 extern (C) int function (Drive* drive) can_poll_for_media;
7673 // <flags>: flags affecting the unmount if required for eject
7674 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7675 // <callback>: a #GAsyncReadyCallback, or %NULL.
7676 // <user_data>: user data to pass to @callback
7677 extern (C) void function (Drive* drive, MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) eject;
7679 // RETURNS: %TRUE if the drive has been ejected successfully,
7680 // <result>: a #GAsyncResult.
7681 extern (C) int function (Drive* drive, AsyncResult* result, GLib2.Error** error=null) eject_finish;
7683 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7684 // <callback>: a #GAsyncReadyCallback, or %NULL.
7685 // <user_data>: user data to pass to @callback
7686 extern (C) void function (Drive* drive, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) poll_for_media;
7688 // RETURNS: %TRUE if the drive has been poll_for_mediaed successfully,
7689 // <result>: a #GAsyncResult.
7690 extern (C) int function (Drive* drive, AsyncResult* result, GLib2.Error** error=null) poll_for_media_finish;
7692 // RETURNS: a newly allocated string containing the
7693 // <kind>: the kind of identifier to return
7694 extern (C) char* /*new*/ function (Drive* drive, char* kind) get_identifier;
7695 // RETURNS: a %NULL-terminated
7696 extern (C) char** /*new*/ function (Drive* drive) enumerate_identifiers;
7697 // RETURNS: A value from the #GDriveStartStopType enumeration.
7698 extern (C) DriveStartStopType function (Drive* drive) get_start_stop_type;
7699 // RETURNS: %TRUE if the @drive can be started, %FALSE otherwise.
7700 extern (C) int function (Drive* drive) can_start;
7701 // RETURNS: %TRUE if the @drive can be started degraded, %FALSE otherwise.
7702 extern (C) int function (Drive* drive) can_start_degraded;
7704 // <flags>: flags affecting the start operation.
7705 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
7706 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7707 // <callback>: a #GAsyncReadyCallback, or %NULL.
7708 // <user_data>: user data to pass to @callback
7709 extern (C) void function (Drive* drive, DriveStartFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) start;
7711 // RETURNS: %TRUE if the drive has been started successfully,
7712 // <result>: a #GAsyncResult.
7713 extern (C) int function (Drive* drive, AsyncResult* result, GLib2.Error** error=null) start_finish;
7714 // RETURNS: %TRUE if the @drive can be stopped, %FALSE otherwise.
7715 extern (C) int function (Drive* drive) can_stop;
7717 // <flags>: flags affecting the unmount if required for stopping.
7718 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
7719 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7720 // <callback>: a #GAsyncReadyCallback, or %NULL.
7721 // <user_data>: user data to pass to @callback
7722 extern (C) void function (Drive* drive, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) stop;
7724 // RETURNS: %TRUE if the drive has been stopped successfully,
7725 // <result>: a #GAsyncResult.
7726 extern (C) int function (Drive* drive, AsyncResult* result, GLib2.Error** error=null) stop_finish;
7727 extern (C) void function (Drive* drive) stop_button;
7729 // <flags>: flags affecting the unmount if required for eject
7730 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
7731 // <cancellable>: optional #GCancellable object, %NULL to ignore.
7732 // <callback>: a #GAsyncReadyCallback, or %NULL.
7733 // <user_data>: user data passed to @callback.
7734 extern (C) void function (Drive* drive, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) eject_with_operation;
7736 // RETURNS: %TRUE if the drive was successfully ejected. %FALSE otherwise.
7737 // <result>: a #GAsyncResult.
7738 extern (C) int function (Drive* drive, AsyncResult* result, GLib2.Error** error=null) eject_with_operation_finish;
7741 // Flags used when starting a drive.
7742 enum DriveStartFlags /* Version 2.22 */ {
7743 NONE = 0
7745 // Enumeration describing how a drive can be started/stopped.
7746 enum DriveStartStopType /* Version 2.22 */ {
7747 UNKNOWN = 0,
7748 SHUTDOWN = 1,
7749 NETWORK = 2,
7750 MULTIDISK = 3,
7751 PASSWORD = 4
7754 // #GEmblem is an implementation of #GIcon that supports
7755 // having an emblem, which is an icon with additional properties.
7756 // It can than be added to a #GEmblemedIcon.
7758 // Currently, only metainformation about the emblem's origin is
7759 // supported. More may be added in the future.
7760 struct Emblem /* : GObject.Object */ {
7761 alias method_parent this;
7762 alias method_parent super_;
7763 alias method_parent object;
7764 GObject2.Object method_parent;
7767 // Creates a new emblem for @icon.
7768 // RETURNS: a new #GEmblem.
7769 // <icon>: a GIcon containing the icon.
7770 static Emblem* /*new*/ new_(Icon* icon) {
7771 return g_emblem_new(icon);
7774 // Creates a new emblem for @icon.
7775 // RETURNS: a new #GEmblem.
7776 // <icon>: a GIcon containing the icon.
7777 // <origin>: a GEmblemOrigin enum defining the emblem's origin
7778 static Emblem* /*new*/ new_with_origin(Icon* icon, EmblemOrigin origin) {
7779 return g_emblem_new_with_origin(icon, origin);
7782 // Gives back the icon from @emblem.
7784 // the emblem and should not be modified or freed.
7785 // RETURNS: a #GIcon. The returned object belongs to
7786 Icon* get_icon() {
7787 return g_emblem_get_icon(&this);
7790 // Gets the origin of the emblem.
7791 // RETURNS: the origin of the emblem
7792 EmblemOrigin get_origin() {
7793 return g_emblem_get_origin(&this);
7797 struct EmblemClass {
7801 // GEmblemOrigin is used to add information about the origin of the emblem
7802 // to #GEmblem.
7803 enum EmblemOrigin /* Version 2.18 */ {
7804 UNKNOWN = 0,
7805 DEVICE = 1,
7806 LIVEMETADATA = 2,
7807 TAG = 3
7810 // #GEmblemedIcon is an implementation of #GIcon that supports
7811 // adding an emblem to an icon. Adding multiple emblems to an
7812 // icon is ensured via g_emblemed_icon_add_emblem().
7814 // Note that #GEmblemedIcon allows no control over the position
7815 // of the emblems. See also #GEmblem for more information.
7816 struct EmblemedIcon /* : GObject.Object */ {
7817 alias parent_instance this;
7818 alias parent_instance super_;
7819 alias parent_instance object;
7820 GObject2.Object parent_instance;
7821 private EmblemedIconPrivate* priv;
7824 // Creates a new emblemed icon for @icon with the emblem @emblem.
7825 // RETURNS: a new #GIcon
7826 // <icon>: a #GIcon
7827 // <emblem>: a #GEmblem, or %NULL
7828 static Icon* /*new*/ new_(Icon* icon, Emblem* emblem=null) {
7829 return g_emblemed_icon_new(icon, emblem);
7832 // Adds @emblem to the #GList of #GEmblem <!-- -->s.
7833 // <emblem>: a #GEmblem
7834 void add_emblem(Emblem* emblem) {
7835 g_emblemed_icon_add_emblem(&this, emblem);
7837 // Removes all the emblems from @icon.
7838 void clear_emblems() {
7839 g_emblemed_icon_clear_emblems(&this);
7842 // Gets the list of emblems for the @icon.
7844 // #GEmblem <!-- -->s that is owned by @emblemed
7845 // RETURNS: a #GList of
7846 GLib2.List* get_emblems() {
7847 return g_emblemed_icon_get_emblems(&this);
7850 // Gets the main icon for @emblemed.
7851 // RETURNS: a #GIcon that is owned by @emblemed
7852 Icon* get_icon() {
7853 return g_emblemed_icon_get_icon(&this);
7857 struct EmblemedIconClass {
7858 GObject2.ObjectClass parent_class;
7861 struct EmblemedIconPrivate {
7864 enum FILE_ATTRIBUTE_ACCESS_CAN_DELETE = "access::can-delete";
7865 enum FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE = "access::can-execute";
7866 enum FILE_ATTRIBUTE_ACCESS_CAN_READ = "access::can-read";
7867 enum FILE_ATTRIBUTE_ACCESS_CAN_RENAME = "access::can-rename";
7868 enum FILE_ATTRIBUTE_ACCESS_CAN_TRASH = "access::can-trash";
7869 enum FILE_ATTRIBUTE_ACCESS_CAN_WRITE = "access::can-write";
7870 enum FILE_ATTRIBUTE_DOS_IS_ARCHIVE = "dos::is-archive";
7871 enum FILE_ATTRIBUTE_DOS_IS_SYSTEM = "dos::is-system";
7872 enum FILE_ATTRIBUTE_ETAG_VALUE = "etag::value";
7873 enum FILE_ATTRIBUTE_FILESYSTEM_FREE = "filesystem::free";
7874 enum FILE_ATTRIBUTE_FILESYSTEM_READONLY = "filesystem::readonly";
7875 enum FILE_ATTRIBUTE_FILESYSTEM_SIZE = "filesystem::size";
7876 enum FILE_ATTRIBUTE_FILESYSTEM_TYPE = "filesystem::type";
7877 enum FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW = "filesystem::use-preview";
7878 enum FILE_ATTRIBUTE_GVFS_BACKEND = "gvfs::backend";
7879 enum FILE_ATTRIBUTE_ID_FILE = "id::file";
7880 enum FILE_ATTRIBUTE_ID_FILESYSTEM = "id::filesystem";
7881 enum FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT = "mountable::can-eject";
7882 enum FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT = "mountable::can-mount";
7883 enum FILE_ATTRIBUTE_MOUNTABLE_CAN_POLL = "mountable::can-poll";
7884 enum FILE_ATTRIBUTE_MOUNTABLE_CAN_START = "mountable::can-start";
7885 enum FILE_ATTRIBUTE_MOUNTABLE_CAN_START_DEGRADED = "mountable::can-start-degraded";
7886 enum FILE_ATTRIBUTE_MOUNTABLE_CAN_STOP = "mountable::can-stop";
7887 enum FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT = "mountable::can-unmount";
7888 enum FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI = "mountable::hal-udi";
7889 enum FILE_ATTRIBUTE_MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC = "mountable::is-media-check-automatic";
7890 enum FILE_ATTRIBUTE_MOUNTABLE_START_STOP_TYPE = "mountable::start-stop-type";
7891 enum FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE = "mountable::unix-device";
7892 enum FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE_FILE = "mountable::unix-device-file";
7893 enum FILE_ATTRIBUTE_OWNER_GROUP = "owner::group";
7894 enum FILE_ATTRIBUTE_OWNER_USER = "owner::user";
7895 enum FILE_ATTRIBUTE_OWNER_USER_REAL = "owner::user-real";
7896 enum FILE_ATTRIBUTE_PREVIEW_ICON = "preview::icon";
7897 enum FILE_ATTRIBUTE_SELINUX_CONTEXT = "selinux::context";
7898 enum FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE = "standard::allocated-size";
7899 enum FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE = "standard::content-type";
7900 enum FILE_ATTRIBUTE_STANDARD_COPY_NAME = "standard::copy-name";
7901 enum FILE_ATTRIBUTE_STANDARD_DESCRIPTION = "standard::description";
7902 enum FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME = "standard::display-name";
7903 enum FILE_ATTRIBUTE_STANDARD_EDIT_NAME = "standard::edit-name";
7904 enum FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE = "standard::fast-content-type";
7905 enum FILE_ATTRIBUTE_STANDARD_ICON = "standard::icon";
7906 enum FILE_ATTRIBUTE_STANDARD_IS_BACKUP = "standard::is-backup";
7907 enum FILE_ATTRIBUTE_STANDARD_IS_HIDDEN = "standard::is-hidden";
7908 enum FILE_ATTRIBUTE_STANDARD_IS_SYMLINK = "standard::is-symlink";
7909 enum FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL = "standard::is-virtual";
7910 enum FILE_ATTRIBUTE_STANDARD_NAME = "standard::name";
7911 enum FILE_ATTRIBUTE_STANDARD_SIZE = "standard::size";
7912 enum FILE_ATTRIBUTE_STANDARD_SORT_ORDER = "standard::sort-order";
7913 enum FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET = "standard::symlink-target";
7914 enum FILE_ATTRIBUTE_STANDARD_TARGET_URI = "standard::target-uri";
7915 enum FILE_ATTRIBUTE_STANDARD_TYPE = "standard::type";
7916 enum FILE_ATTRIBUTE_THUMBNAILING_FAILED = "thumbnail::failed";
7917 enum FILE_ATTRIBUTE_THUMBNAIL_PATH = "thumbnail::path";
7918 enum FILE_ATTRIBUTE_TIME_ACCESS = "time::access";
7919 enum FILE_ATTRIBUTE_TIME_ACCESS_USEC = "time::access-usec";
7920 enum FILE_ATTRIBUTE_TIME_CHANGED = "time::changed";
7921 enum FILE_ATTRIBUTE_TIME_CHANGED_USEC = "time::changed-usec";
7922 enum FILE_ATTRIBUTE_TIME_CREATED = "time::created";
7923 enum FILE_ATTRIBUTE_TIME_CREATED_USEC = "time::created-usec";
7924 enum FILE_ATTRIBUTE_TIME_MODIFIED = "time::modified";
7925 enum FILE_ATTRIBUTE_TIME_MODIFIED_USEC = "time::modified-usec";
7926 enum FILE_ATTRIBUTE_TRASH_DELETION_DATE = "trash::deletion-date";
7927 enum FILE_ATTRIBUTE_TRASH_ITEM_COUNT = "trash::item-count";
7928 enum FILE_ATTRIBUTE_TRASH_ORIG_PATH = "trash::orig-path";
7929 enum FILE_ATTRIBUTE_UNIX_BLOCKS = "unix::blocks";
7930 enum FILE_ATTRIBUTE_UNIX_BLOCK_SIZE = "unix::block-size";
7931 enum FILE_ATTRIBUTE_UNIX_DEVICE = "unix::device";
7932 enum FILE_ATTRIBUTE_UNIX_GID = "unix::gid";
7933 enum FILE_ATTRIBUTE_UNIX_INODE = "unix::inode";
7934 enum FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT = "unix::is-mountpoint";
7935 enum FILE_ATTRIBUTE_UNIX_MODE = "unix::mode";
7936 enum FILE_ATTRIBUTE_UNIX_NLINK = "unix::nlink";
7937 enum FILE_ATTRIBUTE_UNIX_RDEV = "unix::rdev";
7938 enum FILE_ATTRIBUTE_UNIX_UID = "unix::uid";
7940 // #GFile is a high level abstraction for manipulating files on a
7941 // virtual file system. #GFile<!-- -->s are lightweight, immutable
7942 // objects that do no I/O upon creation. It is necessary to understand that
7943 // #GFile objects do not represent files, merely an identifier for a file. All
7944 // file content I/O is implemented as streaming operations (see #GInputStream and
7945 // #GOutputStream).
7947 // To construct a #GFile, you can use:
7948 // g_file_new_for_path() if you have a path.
7949 // g_file_new_for_uri() if you have a URI.
7950 // g_file_new_for_commandline_arg() for a command line argument.
7951 // g_file_parse_name() from a utf8 string gotten from g_file_get_parse_name().
7953 // One way to think of a #GFile is as an abstraction of a pathname. For normal
7954 // files the system pathname is what is stored internally, but as #GFile<!-- -->s
7955 // are extensible it could also be something else that corresponds to a pathname
7956 // in a userspace implementation of a filesystem.
7958 // #GFile<!-- -->s make up hierarchies of directories and files that correspond to the
7959 // files on a filesystem. You can move through the file system with #GFile using
7960 // g_file_get_parent() to get an identifier for the parent directory, g_file_get_child()
7961 // to get a child within a directory, g_file_resolve_relative_path() to resolve a relative
7962 // path between two #GFile<!-- -->s. There can be multiple hierarchies, so you may not
7963 // end up at the same root if you repeatedly call g_file_get_parent() on two different
7964 // files.
7966 // All #GFile<!-- -->s have a basename (get with g_file_get_basename()). These names
7967 // are byte strings that are used to identify the file on the filesystem (relative to
7968 // its parent directory) and there is no guarantees that they have any particular charset
7969 // encoding or even make any sense at all. If you want to use filenames in a user
7970 // interface you should use the display name that you can get by requesting the
7971 // %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with g_file_query_info().
7972 // This is guaranteed to be in utf8 and can be used in a user interface. But always
7973 // store the real basename or the #GFile to use to actually access the file, because
7974 // there is no way to go from a display name to the actual name.
7976 // Using #GFile as an identifier has the same weaknesses as using a path in that
7977 // there may be multiple aliases for the same file. For instance, hard or
7978 // soft links may cause two different #GFile<!-- -->s to refer to the same file.
7979 // Other possible causes for aliases are: case insensitive filesystems, short
7980 // and long names on Fat/NTFS, or bind mounts in Linux. If you want to check if
7981 // two #GFile<!-- -->s point to the same file you can query for the
7982 // %G_FILE_ATTRIBUTE_ID_FILE attribute. Note that #GFile does some trivial
7983 // canonicalization of pathnames passed in, so that trivial differences in the
7984 // path string used at creation (duplicated slashes, slash at end of path, "."
7985 // or ".." path segments, etc) does not create different #GFile<!-- -->s.
7987 // Many #GFile operations have both synchronous and asynchronous versions
7988 // to suit your application. Asynchronous versions of synchronous functions
7989 // simply have _async() appended to their function names. The asynchronous
7990 // I/O functions call a #GAsyncReadyCallback which is then used to finalize
7991 // the operation, producing a GAsyncResult which is then passed to the
7992 // function's matching _finish() operation.
7994 // Some #GFile operations do not have synchronous analogs, as they may
7995 // take a very long time to finish, and blocking may leave an application
7996 // unusable. Notable cases include:
7997 // g_file_mount_mountable() to mount a mountable file.
7998 // g_file_unmount_mountable_with_operation() to unmount a mountable file.
7999 // g_file_eject_mountable_with_operation() to eject a mountable file.
8001 // <para id="gfile-etag"><indexterm><primary>entity tag</primary></indexterm>
8002 // One notable feature of #GFile<!-- -->s are entity tags, or "etags" for
8003 // short. Entity tags are somewhat like a more abstract version of the
8004 // traditional mtime, and can be used to quickly determine if the file has
8005 // been modified from the version on the file system. See the HTTP 1.1
8006 // <ulink url="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">specification</ulink>
8007 // for HTTP Etag headers, which are a very similar concept.
8008 // </para>
8009 struct File {
8011 // Creates a hash value for a #GFile.
8013 // This call does no blocking i/o.
8015 // integer that can be used as hash value for the #GFile.
8016 // This function is intended for easily hashing a #GFile to
8017 // add to a #GHashTable or similar data structure.
8018 // RETURNS: 0 if @file is not a valid #GFile, otherwise an
8019 // <file>: #gconstpointer to a #GFile.
8020 static uint hash(const(void)* file) {
8021 return g_file_hash(file);
8024 // Creates a #GFile with the given argument from the command line. The value of
8025 // @arg can be either a URI, an absolute path or a relative path resolved
8026 // relative to the current working directory.
8027 // This operation never fails, but the returned object might not support any
8028 // I/O operation if @arg points to a malformed path.
8029 // RETURNS: a new #GFile.
8030 // <arg>: a command line string.
8031 static File* /*new*/ new_for_commandline_arg(char* arg) {
8032 return g_file_new_for_commandline_arg(arg);
8035 // Constructs a #GFile for a given path. This operation never
8036 // fails, but the returned object might not support any I/O
8037 // operation if @path is malformed.
8038 // RETURNS: a new #GFile for the given @path.
8039 // <path>: a string containing a relative or absolute path. The string must be encoded in the glib filename encoding.
8040 static File* /*new*/ new_for_path(char* path) {
8041 return g_file_new_for_path(path);
8044 // Constructs a #GFile for a given URI. This operation never
8045 // fails, but the returned object might not support any I/O
8046 // operation if @uri is malformed or if the uri type is
8047 // not supported.
8048 // RETURNS: a #GFile for the given @uri.
8049 // <uri>: a UTF8 string containing a URI.
8050 static File* /*new*/ new_for_uri(char* uri) {
8051 return g_file_new_for_uri(uri);
8054 // Constructs a #GFile with the given @parse_name (i.e. something given by g_file_get_parse_name()).
8055 // This operation never fails, but the returned object might not support any I/O
8056 // operation if the @parse_name cannot be parsed.
8057 // RETURNS: a new #GFile.
8058 // <parse_name>: a file name or path to be parsed.
8059 static File* /*new*/ parse_name(char* parse_name) {
8060 return g_file_parse_name(parse_name);
8063 // Gets an output stream for appending data to the file. If
8064 // the file doesn't already exist it is created.
8066 // By default files created are generally readable by everyone,
8067 // but if you pass #G_FILE_CREATE_PRIVATE in @flags the file
8068 // will be made readable only to the current user, to the level that
8069 // is supported on the target filesystem.
8071 // If @cancellable is not %NULL, then the operation can be cancelled by
8072 // triggering the cancellable object from another thread. If the operation
8073 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8075 // Some file systems don't allow all file names, and may
8076 // return an %G_IO_ERROR_INVALID_FILENAME error.
8077 // If the file is a directory the %G_IO_ERROR_IS_DIRECTORY error will be
8078 // returned. Other errors are possible too, and depend on what kind of
8079 // filesystem the file is on.
8081 // Free the returned object with g_object_unref().
8082 // RETURNS: a #GFileOutputStream, or %NULL on error.
8083 // <flags>: a set of #GFileCreateFlags.
8084 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8085 FileOutputStream* /*new*/ append_to(FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
8086 return g_file_append_to(&this, flags, cancellable, error);
8089 // Asynchronously opens @file for appending.
8091 // For more details, see g_file_append_to() which is
8092 // the synchronous version of this call.
8094 // When the operation is finished, @callback will be called. You can then call
8095 // g_file_append_to_finish() to get the result of the operation.
8096 // <flags>: a set of #GFileCreateFlags.
8097 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
8098 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8099 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
8100 // <user_data>: the data to pass to callback function
8101 void append_to_async(FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
8102 g_file_append_to_async(&this, flags, io_priority, cancellable, callback, user_data);
8105 // Finishes an asynchronous file append operation started with
8106 // g_file_append_to_async().
8108 // Free the returned object with g_object_unref().
8109 // RETURNS: a valid #GFileOutputStream or %NULL on error.
8110 // <res>: #GAsyncResult
8111 FileOutputStream* /*new*/ append_to_finish(AsyncResult* res, GLib2.Error** error=null) {
8112 return g_file_append_to_finish(&this, res, error);
8115 // Copies the file @source to the location specified by @destination.
8116 // Can not handle recursive copies of directories.
8118 // If the flag #G_FILE_COPY_OVERWRITE is specified an already
8119 // existing @destination file is overwritten.
8121 // If the flag #G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks
8122 // will be copied as symlinks, otherwise the target of the
8123 // @source symlink will be copied.
8125 // If @cancellable is not %NULL, then the operation can be cancelled by
8126 // triggering the cancellable object from another thread. If the operation
8127 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8129 // If @progress_callback is not %NULL, then the operation can be monitored by
8130 // setting this to a #GFileProgressCallback function. @progress_callback_data
8131 // will be passed to this function. It is guaranteed that this callback will
8132 // be called after all data has been transferred with the total number of bytes
8133 // copied during the operation.
8135 // If the @source file does not exist then the G_IO_ERROR_NOT_FOUND
8136 // error is returned, independent on the status of the @destination.
8138 // If #G_FILE_COPY_OVERWRITE is not specified and the target exists, then the
8139 // error G_IO_ERROR_EXISTS is returned.
8141 // If trying to overwrite a file over a directory the G_IO_ERROR_IS_DIRECTORY
8142 // error is returned. If trying to overwrite a directory with a directory the
8143 // G_IO_ERROR_WOULD_MERGE error is returned.
8145 // If the source is a directory and the target does not exist, or #G_FILE_COPY_OVERWRITE is
8146 // specified and the target is a file, then the G_IO_ERROR_WOULD_RECURSE error
8147 // is returned.
8149 // If you are interested in copying the #GFile object itself (not the on-disk
8150 // file), see g_file_dup().
8151 // RETURNS: %TRUE on success, %FALSE otherwise.
8152 // <destination>: destination #GFile
8153 // <flags>: set of #GFileCopyFlags
8154 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8155 // <progress_callback>: function to callback with progress information
8156 // <progress_callback_data>: user data to pass to @progress_callback
8157 int copy(File* destination, FileCopyFlags flags, Cancellable* cancellable, FileProgressCallback progress_callback, void* progress_callback_data, GLib2.Error** error=null) {
8158 return g_file_copy(&this, destination, flags, cancellable, progress_callback, progress_callback_data, error);
8161 // Unintrospectable method: copy_async() / g_file_copy_async()
8162 // Copies the file @source to the location specified by @destination
8163 // asynchronously. For details of the behaviour, see g_file_copy().
8165 // If @progress_callback is not %NULL, then that function that will be called
8166 // just like in g_file_copy(), however the callback will run in the main loop,
8167 // not in the thread that is doing the I/O operation.
8169 // When the operation is finished, @callback will be called. You can then call
8170 // g_file_copy_finish() to get the result of the operation.
8171 // <destination>: destination #GFile
8172 // <flags>: set of #GFileCopyFlags
8173 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
8174 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8175 // <progress_callback>: function to callback with progress information
8176 // <progress_callback_data>: user data to pass to @progress_callback
8177 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
8178 // <user_data>: the data to pass to callback function
8179 void copy_async(File* destination, FileCopyFlags flags, int io_priority, Cancellable* cancellable, FileProgressCallback progress_callback, void* progress_callback_data, AsyncReadyCallback callback, void* user_data) {
8180 g_file_copy_async(&this, destination, flags, io_priority, cancellable, progress_callback, progress_callback_data, callback, user_data);
8183 // Copies the file attributes from @source to @destination.
8185 // Normally only a subset of the file attributes are copied,
8186 // those that are copies in a normal file copy operation
8187 // (which for instance does not include e.g. owner). However
8188 // if #G_FILE_COPY_ALL_METADATA is specified in @flags, then
8189 // all the metadata that is possible to copy is copied. This
8190 // is useful when implementing move by copy + delete source.
8191 // RETURNS: %TRUE if the attributes were copied successfully, %FALSE otherwise.
8192 // <destination>: a #GFile to copy attributes to.
8193 // <flags>: a set of #GFileCopyFlags.
8194 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8195 int copy_attributes(File* destination, FileCopyFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
8196 return g_file_copy_attributes(&this, destination, flags, cancellable, error);
8199 // Finishes copying the file started with
8200 // g_file_copy_async().
8201 // RETURNS: a %TRUE on success, %FALSE on error.
8202 // <res>: a #GAsyncResult.
8203 int copy_finish(AsyncResult* res, GLib2.Error** error=null) {
8204 return g_file_copy_finish(&this, res, error);
8207 // Creates a new file and returns an output stream for writing to it.
8208 // The file must not already exist.
8210 // By default files created are generally readable by everyone,
8211 // but if you pass #G_FILE_CREATE_PRIVATE in @flags the file
8212 // will be made readable only to the current user, to the level that
8213 // is supported on the target filesystem.
8215 // If @cancellable is not %NULL, then the operation can be cancelled by
8216 // triggering the cancellable object from another thread. If the operation
8217 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8219 // If a file or directory with this name already exists the G_IO_ERROR_EXISTS
8220 // error will be returned.
8221 // Some file systems don't allow all file names, and may
8222 // return an G_IO_ERROR_INVALID_FILENAME error, and if the name
8223 // is to long G_IO_ERROR_FILENAME_TOO_LONG will be returned.
8224 // Other errors are possible too, and depend on what kind of
8225 // filesystem the file is on.
8227 // %NULL on error.
8228 // Free the returned object with g_object_unref().
8229 // RETURNS: a #GFileOutputStream for the newly created file, or
8230 // <flags>: a set of #GFileCreateFlags.
8231 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8232 FileOutputStream* /*new*/ create(FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
8233 return g_file_create(&this, flags, cancellable, error);
8236 // Asynchronously creates a new file and returns an output stream for writing to it.
8237 // The file must not already exist.
8239 // For more details, see g_file_create() which is
8240 // the synchronous version of this call.
8242 // When the operation is finished, @callback will be called. You can then call
8243 // g_file_create_finish() to get the result of the operation.
8244 // <flags>: a set of #GFileCreateFlags.
8245 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
8246 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8247 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
8248 // <user_data>: the data to pass to callback function
8249 void create_async(FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
8250 g_file_create_async(&this, flags, io_priority, cancellable, callback, user_data);
8253 // Finishes an asynchronous file create operation started with
8254 // g_file_create_async().
8256 // Free the returned object with g_object_unref().
8257 // RETURNS: a #GFileOutputStream or %NULL on error.
8258 // <res>: a #GAsyncResult.
8259 FileOutputStream* /*new*/ create_finish(AsyncResult* res, GLib2.Error** error=null) {
8260 return g_file_create_finish(&this, res, error);
8263 // Creates a new file and returns a stream for reading and writing to it.
8264 // The file must not already exist.
8266 // By default files created are generally readable by everyone,
8267 // but if you pass #G_FILE_CREATE_PRIVATE in @flags the file
8268 // will be made readable only to the current user, to the level that
8269 // is supported on the target filesystem.
8271 // If @cancellable is not %NULL, then the operation can be cancelled by
8272 // triggering the cancellable object from another thread. If the operation
8273 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8275 // If a file or directory with this name already exists the %G_IO_ERROR_EXISTS
8276 // error will be returned. Some file systems don't allow all file names,
8277 // and may return an %G_IO_ERROR_INVALID_FILENAME error, and if the name
8278 // is too long, %G_IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors
8279 // are possible too, and depend on what kind of filesystem the file is on.
8281 // Note that in many non-local file cases read and write streams are not
8282 // supported, so make sure you really need to do read and write streaming,
8283 // rather than just opening for reading or writing.
8285 // Free the returned object with g_object_unref().
8286 // RETURNS: a #GFileIOStream for the newly created file, or %NULL on error.
8287 // <flags>: a set of #GFileCreateFlags
8288 // <cancellable>: optional #GCancellable object, %NULL to ignore
8289 FileIOStream* /*new*/ create_readwrite(FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
8290 return g_file_create_readwrite(&this, flags, cancellable, error);
8293 // Asynchronously creates a new file and returns a stream for reading and
8294 // writing to it. The file must not already exist.
8296 // For more details, see g_file_create_readwrite() which is
8297 // the synchronous version of this call.
8299 // When the operation is finished, @callback will be called. You can then
8300 // call g_file_create_readwrite_finish() to get the result of the operation.
8301 // <flags>: a set of #GFileCreateFlags
8302 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request
8303 // <cancellable>: optional #GCancellable object, %NULL to ignore
8304 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
8305 // <user_data>: the data to pass to callback function
8306 void create_readwrite_async(FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
8307 g_file_create_readwrite_async(&this, flags, io_priority, cancellable, callback, user_data);
8310 // Finishes an asynchronous file create operation started with
8311 // g_file_create_readwrite_async().
8313 // Free the returned object with g_object_unref().
8314 // RETURNS: a #GFileIOStream or %NULL on error.
8315 // <res>: a #GAsyncResult
8316 FileIOStream* /*new*/ create_readwrite_finish(AsyncResult* res, GLib2.Error** error=null) {
8317 return g_file_create_readwrite_finish(&this, res, error);
8320 // Deletes a file. If the @file is a directory, it will only be deleted if it
8321 // is empty.
8323 // If @cancellable is not %NULL, then the operation can be cancelled by
8324 // triggering the cancellable object from another thread. If the operation
8325 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8326 // RETURNS: %TRUE if the file was deleted. %FALSE otherwise.
8327 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8328 int delete_(Cancellable* cancellable, GLib2.Error** error=null) {
8329 return g_file_delete(&this, cancellable, error);
8332 // Duplicates a #GFile handle. This operation does not duplicate
8333 // the actual file or directory represented by the #GFile; see
8334 // g_file_copy() if attempting to copy a file.
8336 // This call does no blocking i/o.
8337 // RETURNS: a new #GFile that is a duplicate of the given #GFile.
8338 File* /*new*/ dup() {
8339 return g_file_dup(&this);
8342 // Starts an asynchronous eject on a mountable.
8343 // When this operation has completed, @callback will be called with
8344 // @user_user data, and the operation can be finalized with
8345 // g_file_eject_mountable_finish().
8347 // If @cancellable is not %NULL, then the operation can be cancelled by
8348 // triggering the cancellable object from another thread. If the operation
8349 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8350 // <flags>: flags affecting the operation
8351 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8352 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
8353 // <user_data>: the data to pass to callback function
8354 void eject_mountable(MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
8355 g_file_eject_mountable(&this, flags, cancellable, callback, user_data);
8358 // Finishes an asynchronous eject operation started by
8359 // g_file_eject_mountable().
8361 // otherwise.
8362 // RETURNS: %TRUE if the @file was ejected successfully. %FALSE
8363 // <result>: a #GAsyncResult.
8364 int eject_mountable_finish(AsyncResult* result, GLib2.Error** error=null) {
8365 return g_file_eject_mountable_finish(&this, result, error);
8368 // Starts an asynchronous eject on a mountable.
8369 // When this operation has completed, @callback will be called with
8370 // @user_user data, and the operation can be finalized with
8371 // g_file_eject_mountable_with_operation_finish().
8373 // If @cancellable is not %NULL, then the operation can be cancelled by
8374 // triggering the cancellable object from another thread. If the operation
8375 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8376 // <flags>: flags affecting the operation
8377 // <mount_operation>: a #GMountOperation, or %NULL to avoid user interaction.
8378 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8379 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
8380 // <user_data>: the data to pass to callback function
8381 void eject_mountable_with_operation(MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
8382 g_file_eject_mountable_with_operation(&this, flags, mount_operation, cancellable, callback, user_data);
8385 // Finishes an asynchronous eject operation started by
8386 // g_file_eject_mountable_with_operation().
8388 // otherwise.
8389 // RETURNS: %TRUE if the @file was ejected successfully. %FALSE
8390 // <result>: a #GAsyncResult.
8391 int eject_mountable_with_operation_finish(AsyncResult* result, GLib2.Error** error=null) {
8392 return g_file_eject_mountable_with_operation_finish(&this, result, error);
8395 // Gets the requested information about the files in a directory. The result
8396 // is a #GFileEnumerator object that will give out #GFileInfo objects for
8397 // all the files in the directory.
8399 // The @attributes value is a string that specifies the file attributes that
8400 // should be gathered. It is not an error if it's not possible to read a particular
8401 // requested attribute from a file - it just won't be set. @attributes should
8402 // be a comma-separated list of attributes or attribute wildcards. The wildcard "*"
8403 // means all attributes, and a wildcard like "standard::*" means all attributes in the standard
8404 // namespace. An example attribute query be "standard::*,owner::user".
8405 // The standard attributes are available as defines, like #G_FILE_ATTRIBUTE_STANDARD_NAME.
8407 // If @cancellable is not %NULL, then the operation can be cancelled by
8408 // triggering the cancellable object from another thread. If the operation
8409 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8411 // If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned.
8412 // If the file is not a directory, the G_FILE_ERROR_NOTDIR error will be returned.
8413 // Other errors are possible too.
8415 // Free the returned object with g_object_unref().
8416 // RETURNS: A #GFileEnumerator if successful, %NULL on error.
8417 // <attributes>: an attribute query string.
8418 // <flags>: a set of #GFileQueryInfoFlags.
8419 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8420 FileEnumerator* /*new*/ enumerate_children(char* attributes, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
8421 return g_file_enumerate_children(&this, attributes, flags, cancellable, error);
8424 // Asynchronously gets the requested information about the files in a directory. The result
8425 // is a #GFileEnumerator object that will give out #GFileInfo objects for
8426 // all the files in the directory.
8428 // For more details, see g_file_enumerate_children() which is
8429 // the synchronous version of this call.
8431 // When the operation is finished, @callback will be called. You can then call
8432 // g_file_enumerate_children_finish() to get the result of the operation.
8433 // <attributes>: an attribute query string.
8434 // <flags>: a set of #GFileQueryInfoFlags.
8435 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
8436 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8437 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
8438 // <user_data>: the data to pass to callback function
8439 void enumerate_children_async(char* attributes, FileQueryInfoFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
8440 g_file_enumerate_children_async(&this, attributes, flags, io_priority, cancellable, callback, user_data);
8443 // Finishes an async enumerate children operation.
8444 // See g_file_enumerate_children_async().
8446 // Free the returned object with g_object_unref().
8447 // RETURNS: a #GFileEnumerator or %NULL if an error occurred.
8448 // <res>: a #GAsyncResult.
8449 FileEnumerator* /*new*/ enumerate_children_finish(AsyncResult* res, GLib2.Error** error=null) {
8450 return g_file_enumerate_children_finish(&this, res, error);
8453 // Checks equality of two given #GFile<!-- -->s. Note that two
8454 // #GFile<!-- -->s that differ can still refer to the same
8455 // file on the filesystem due to various forms of filename
8456 // aliasing.
8458 // This call does no blocking i/o.
8460 // %FALSE if either is not a #GFile.
8461 // RETURNS: %TRUE if @file1 and @file2 are equal.
8462 // <file2>: the second #GFile.
8463 int equal(File* file2) {
8464 return g_file_equal(&this, file2);
8467 // Gets a #GMount for the #GFile.
8469 // If the #GFileIface for @file does not have a mount (e.g. possibly a
8470 // remote share), @error will be set to %G_IO_ERROR_NOT_FOUND and %NULL
8471 // will be returned.
8473 // If @cancellable is not %NULL, then the operation can be cancelled by
8474 // triggering the cancellable object from another thread. If the operation
8475 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8477 // Free the returned object with g_object_unref().
8478 // RETURNS: a #GMount where the @file is located or %NULL on error.
8479 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8480 Mount* /*new*/ find_enclosing_mount(Cancellable* cancellable, GLib2.Error** error=null) {
8481 return g_file_find_enclosing_mount(&this, cancellable, error);
8484 // Asynchronously gets the mount for the file.
8486 // For more details, see g_file_find_enclosing_mount() which is
8487 // the synchronous version of this call.
8489 // When the operation is finished, @callback will be called. You can then call
8490 // g_file_find_enclosing_mount_finish() to get the result of the operation.
8491 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
8492 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8493 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
8494 // <user_data>: the data to pass to callback function
8495 void find_enclosing_mount_async(int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
8496 g_file_find_enclosing_mount_async(&this, io_priority, cancellable, callback, user_data);
8499 // Finishes an asynchronous find mount request.
8500 // See g_file_find_enclosing_mount_async().
8502 // Free the returned object with g_object_unref().
8503 // RETURNS: #GMount for given @file or %NULL on error.
8504 // <res>: a #GAsyncResult
8505 Mount* /*new*/ find_enclosing_mount_finish(AsyncResult* res, GLib2.Error** error=null) {
8506 return g_file_find_enclosing_mount_finish(&this, res, error);
8509 // Gets the base name (the last component of the path) for a given #GFile.
8511 // If called for the top level of a system (such as the filesystem root
8512 // or a uri like sftp://host/) it will return a single directory separator
8513 // (and on Windows, possibly a drive letter).
8515 // The base name is a byte string (*not* UTF-8). It has no defined encoding
8516 // or rules other than it may not contain zero bytes. If you want to use
8517 // filenames in a user interface you should use the display name that you
8518 // can get by requesting the %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME
8519 // attribute with g_file_query_info().
8521 // This call does no blocking i/o.
8523 // if given #GFile is invalid. The returned string should be
8524 // freed with g_free() when no longer needed.
8525 // RETURNS: string containing the #GFile's base name, or %NULL
8526 char* /*new*/ get_basename() {
8527 return g_file_get_basename(&this);
8530 // Gets a child of @file with basename equal to @name.
8532 // Note that the file with that specific name might not exist, but
8533 // you can still have a #GFile that points to it. You can use this
8534 // for instance to create that file.
8536 // This call does no blocking i/o.
8538 // Free the returned object with g_object_unref().
8539 // RETURNS: a #GFile to a child specified by @name.
8540 // <name>: string containing the child's basename.
8541 File* /*new*/ get_child(char* name) {
8542 return g_file_get_child(&this, name);
8545 // Gets the child of @file for a given @display_name (i.e. a UTF8
8546 // version of the name). If this function fails, it returns %NULL and @error will be
8547 // set. This is very useful when constructing a GFile for a new file
8548 // and the user entered the filename in the user interface, for instance
8549 // when you select a directory and type a filename in the file selector.
8551 // This call does no blocking i/o.
8553 // %NULL if the display name couldn't be converted.
8554 // Free the returned object with g_object_unref().
8555 // RETURNS: a #GFile to the specified child, or
8556 // <display_name>: string to a possible child.
8557 File* /*new*/ get_child_for_display_name(char* display_name, GLib2.Error** error=null) {
8558 return g_file_get_child_for_display_name(&this, display_name, error);
8561 // Gets the parent directory for the @file.
8562 // If the @file represents the root directory of the
8563 // file system, then %NULL will be returned.
8565 // This call does no blocking i/o.
8567 // #GFile or %NULL if there is no parent.
8568 // Free the returned object with g_object_unref().
8569 // RETURNS: a #GFile structure to the parent of the given
8570 File* /*new*/ get_parent() {
8571 return g_file_get_parent(&this);
8574 // Gets the parse name of the @file.
8575 // A parse name is a UTF-8 string that describes the
8576 // file such that one can get the #GFile back using
8577 // g_file_parse_name().
8579 // This is generally used to show the #GFile as a nice
8580 // full-pathname kind of string in a user interface,
8581 // like in a location entry.
8583 // For local files with names that can safely be converted
8584 // to UTF8 the pathname is used, otherwise the IRI is used
8585 // (a form of URI that allows UTF8 characters unescaped).
8587 // This call does no blocking i/o.
8589 // string should be freed with g_free() when no longer needed.
8590 // RETURNS: a string containing the #GFile's parse name. The returned
8591 char* /*new*/ get_parse_name() {
8592 return g_file_get_parse_name(&this);
8595 // Gets the local pathname for #GFile, if one exists.
8597 // This call does no blocking i/o.
8599 // no such path exists. The returned string should be
8600 // freed with g_free() when no longer needed.
8601 // RETURNS: string containing the #GFile's path, or %NULL if
8602 char* /*new*/ get_path() {
8603 return g_file_get_path(&this);
8606 // Gets the path for @descendant relative to @parent.
8608 // This call does no blocking i/o.
8610 // to @parent, or %NULL if @descendant doesn't have @parent as prefix.
8611 // The returned string should be freed with g_free() when no longer needed.
8612 // RETURNS: string with the relative path from @descendant
8613 // <descendant>: input #GFile.
8614 char* /*new*/ get_relative_path(File* descendant) {
8615 return g_file_get_relative_path(&this, descendant);
8618 // Gets the URI for the @file.
8620 // This call does no blocking i/o.
8622 // The returned string should be freed with g_free() when no longer needed.
8623 // RETURNS: a string containing the #GFile's URI.
8624 char* /*new*/ get_uri() {
8625 return g_file_get_uri(&this);
8628 // Gets the URI scheme for a #GFile.
8629 // RFC 3986 decodes the scheme as:
8630 // <programlisting>
8631 // URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
8632 // </programlisting>
8633 // Common schemes include "file", "http", "ftp", etc.
8635 // This call does no blocking i/o.
8637 // #GFile. The returned string should be freed with g_free()
8638 // when no longer needed.
8639 // RETURNS: a string containing the URI scheme for the given
8640 char* /*new*/ get_uri_scheme() {
8641 return g_file_get_uri_scheme(&this);
8644 // Checks if @file has a parent, and optionally, if it is @parent.
8646 // If @parent is %NULL then this function returns %TRUE if @file has any
8647 // parent at all. If @parent is non-%NULL then %TRUE is only returned
8648 // if @file is a child of @parent.
8650 // case that @parent is %NULL).
8651 // RETURNS: %TRUE if @file is a child of @parent (or any parent in the
8652 // <parent>: the parent to check for, or %NULL
8653 int has_parent(File* parent) {
8654 return g_file_has_parent(&this, parent);
8657 // Checks whether @file has the prefix specified by @prefix. In other word,
8658 // if the names of initial elements of @file<!-- -->s pathname match @prefix.
8659 // Only full pathname elements are matched, so a path like /foo is not
8660 // considered a prefix of /foobar, only of /foo/bar.
8662 // This call does no i/o, as it works purely on names. As such it can
8663 // sometimes return %FALSE even if @file is inside a @prefix (from a
8664 // filesystem point of view), because the prefix of @file is an alias
8665 // of @prefix.
8667 // %FALSE otherwise.
8668 // RETURNS: %TRUE if the @files's parent, grandparent, etc is @prefix.
8669 // <prefix>: input #GFile.
8670 int has_prefix(File* prefix) {
8671 return g_file_has_prefix(&this, prefix);
8674 // Checks to see if a #GFile has a given URI scheme.
8676 // This call does no blocking i/o.
8678 // given URI scheme, %FALSE if URI scheme is %NULL,
8679 // not supported, or #GFile is invalid.
8680 // RETURNS: %TRUE if #GFile's backend supports the
8681 // <uri_scheme>: a string containing a URI scheme.
8682 int has_uri_scheme(char* uri_scheme) {
8683 return g_file_has_uri_scheme(&this, uri_scheme);
8686 // Creates a new icon for a file.
8687 // RETURNS: a #GIcon for the given @file, or %NULL on error.
8688 Icon* /*new*/ icon_new() {
8689 return g_file_icon_new(&this);
8692 // Checks to see if a file is native to the platform.
8694 // A native file s one expressed in the platform-native filename format,
8695 // e.g. "C:\Windows" or "/usr/bin/". This does not mean the file is local,
8696 // as it might be on a locally mounted remote filesystem.
8698 // On some systems non-native files may be available using
8699 // the native filesystem via a userspace filesystem (FUSE), in
8700 // these cases this call will return %FALSE, but g_file_get_path()
8701 // will still return a native path.
8703 // This call does no blocking i/o.
8704 // RETURNS: %TRUE if file is native.
8705 int is_native() {
8706 return g_file_is_native(&this);
8709 // Loads the content of the file into memory. The data is always
8710 // zero-terminated, but this is not included in the resultant @length.
8711 // The returned @content should be freed with g_free() when no longer
8712 // needed.
8714 // If @cancellable is not %NULL, then the operation can be cancelled by
8715 // triggering the cancellable object from another thread. If the operation
8716 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8718 // %FALSE if there were errors.
8719 // RETURNS: %TRUE if the @file's contents were successfully loaded.
8720 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8721 // <contents>: a location to place the contents of the file.
8722 // <length>: a location to place the length of the contents of the file, or %NULL if the length is not needed
8723 // <etag_out>: a location to place the current entity tag for the file, or %NULL if the entity tag is not needed
8724 int load_contents(Cancellable* cancellable, /*out*/ ubyte** contents, /*out*/ size_t* length, /*out*/ char** etag_out, GLib2.Error** error=null) {
8725 return g_file_load_contents(&this, cancellable, contents, length, etag_out, error);
8728 // Starts an asynchronous load of the @file's contents.
8730 // For more details, see g_file_load_contents() which is
8731 // the synchronous version of this call.
8733 // When the load operation has completed, @callback will be called
8734 // with @user data. To finish the operation, call
8735 // g_file_load_contents_finish() with the #GAsyncResult returned by
8736 // the @callback.
8738 // If @cancellable is not %NULL, then the operation can be cancelled by
8739 // triggering the cancellable object from another thread. If the operation
8740 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8741 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8742 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
8743 // <user_data>: the data to pass to callback function
8744 void load_contents_async(Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
8745 g_file_load_contents_async(&this, cancellable, callback, user_data);
8748 // Finishes an asynchronous load of the @file's contents.
8749 // The contents are placed in @contents, and @length is set to the
8750 // size of the @contents string. The @content should be freed with
8751 // g_free() when no longer needed. If @etag_out is present, it will be
8752 // set to the new entity tag for the @file.
8754 // present, it will be set appropriately.
8755 // RETURNS: %TRUE if the load was successful. If %FALSE and @error is
8756 // <res>: a #GAsyncResult.
8757 // <contents>: a location to place the contents of the file.
8758 // <length>: a location to place the length of the contents of the file, or %NULL if the length is not needed
8759 // <etag_out>: a location to place the current entity tag for the file, or %NULL if the entity tag is not needed
8760 int load_contents_finish(AsyncResult* res, /*out*/ ubyte** contents, /*out*/ size_t* length, /*out*/ char** etag_out, GLib2.Error** error=null) {
8761 return g_file_load_contents_finish(&this, res, contents, length, etag_out, error);
8764 // Unintrospectable method: load_partial_contents_async() / g_file_load_partial_contents_async()
8765 // Reads the partial contents of a file. A #GFileReadMoreCallback should be
8766 // used to stop reading from the file when appropriate, else this function
8767 // will behave exactly as g_file_load_contents_async(). This operation
8768 // can be finished by g_file_load_partial_contents_finish().
8770 // Users of this function should be aware that @user_data is passed to
8771 // both the @read_more_callback and the @callback.
8773 // If @cancellable is not %NULL, then the operation can be cancelled by
8774 // triggering the cancellable object from another thread. If the operation
8775 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8776 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8777 // <read_more_callback>: a #GFileReadMoreCallback to receive partial data and to specify whether further data should be read.
8778 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
8779 // <user_data>: the data to pass to the callback functions.
8780 void load_partial_contents_async(Cancellable* cancellable, FileReadMoreCallback read_more_callback, AsyncReadyCallback callback, void* user_data) {
8781 g_file_load_partial_contents_async(&this, cancellable, read_more_callback, callback, user_data);
8784 // Finishes an asynchronous partial load operation that was started
8785 // with g_file_load_partial_contents_async(). The data is always
8786 // zero-terminated, but this is not included in the resultant @length.
8787 // The returned @content should be freed with g_free() when no longer
8788 // needed.
8790 // present, it will be set appropriately.
8791 // RETURNS: %TRUE if the load was successful. If %FALSE and @error is
8792 // <res>: a #GAsyncResult.
8793 // <contents>: a location to place the contents of the file.
8794 // <length>: a location to place the length of the contents of the file, or %NULL if the length is not needed
8795 // <etag_out>: a location to place the current entity tag for the file, or %NULL if the entity tag is not needed
8796 int load_partial_contents_finish(AsyncResult* res, /*out*/ ubyte** contents, /*out*/ size_t* length, /*out*/ char** etag_out, GLib2.Error** error=null) {
8797 return g_file_load_partial_contents_finish(&this, res, contents, length, etag_out, error);
8800 // Creates a directory. Note that this will only create a child directory of
8801 // the immediate parent directory of the path or URI given by the #GFile. To
8802 // recursively create directories, see g_file_make_directory_with_parents().
8803 // This function will fail if the parent directory does not exist, setting
8804 // @error to %G_IO_ERROR_NOT_FOUND. If the file system doesn't support creating
8805 // directories, this function will fail, setting @error to
8806 // %G_IO_ERROR_NOT_SUPPORTED.
8808 // For a local #GFile the newly created directory will have the default
8809 // (current) ownership and permissions of the current process.
8811 // If @cancellable is not %NULL, then the operation can be cancelled by
8812 // triggering the cancellable object from another thread. If the operation
8813 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8814 // RETURNS: %TRUE on successful creation, %FALSE otherwise.
8815 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8816 int make_directory(Cancellable* cancellable, GLib2.Error** error=null) {
8817 return g_file_make_directory(&this, cancellable, error);
8820 // Creates a directory and any parent directories that may not exist similar to
8821 // 'mkdir -p'. If the file system does not support creating directories, this
8822 // function will fail, setting @error to %G_IO_ERROR_NOT_SUPPORTED.
8824 // For a local #GFile the newly created directories will have the default
8825 // (current) ownership and permissions of the current process.
8827 // If @cancellable is not %NULL, then the operation can be cancelled by
8828 // triggering the cancellable object from another thread. If the operation
8829 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8831 // otherwise.
8832 // RETURNS: %TRUE if all directories have been successfully created, %FALSE
8833 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8834 int make_directory_with_parents(Cancellable* cancellable, GLib2.Error** error=null) {
8835 return g_file_make_directory_with_parents(&this, cancellable, error);
8838 // Creates a symbolic link named @file which contains the string
8839 // @symlink_value.
8841 // If @cancellable is not %NULL, then the operation can be cancelled by
8842 // triggering the cancellable object from another thread. If the operation
8843 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8844 // RETURNS: %TRUE on the creation of a new symlink, %FALSE otherwise.
8845 // <symlink_value>: a string with the path for the target of the new symlink
8846 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8847 int make_symbolic_link(char* symlink_value, Cancellable* cancellable, GLib2.Error** error=null) {
8848 return g_file_make_symbolic_link(&this, symlink_value, cancellable, error);
8851 // Obtains a file or directory monitor for the given file, depending
8852 // on the type of the file.
8854 // If @cancellable is not %NULL, then the operation can be cancelled by
8855 // triggering the cancellable object from another thread. If the operation
8856 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8858 // Free the returned object with g_object_unref().
8859 // RETURNS: a #GFileMonitor for the given @file, or %NULL on error.
8860 // <flags>: a set of #GFileMonitorFlags
8861 // <cancellable>: optional #GCancellable object, %NULL to ignore
8862 FileMonitor* /*new*/ monitor(FileMonitorFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
8863 return g_file_monitor(&this, flags, cancellable, error);
8866 // Obtains a directory monitor for the given file.
8867 // This may fail if directory monitoring is not supported.
8869 // If @cancellable is not %NULL, then the operation can be cancelled by
8870 // triggering the cancellable object from another thread. If the operation
8871 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8873 // Free the returned object with g_object_unref().
8874 // RETURNS: a #GFileMonitor for the given @file, or %NULL on error.
8875 // <flags>: a set of #GFileMonitorFlags.
8876 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8877 FileMonitor* /*new*/ monitor_directory(FileMonitorFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
8878 return g_file_monitor_directory(&this, flags, cancellable, error);
8881 // Obtains a file monitor for the given file. If no file notification
8882 // mechanism exists, then regular polling of the file is used.
8884 // If @cancellable is not %NULL, then the operation can be cancelled by
8885 // triggering the cancellable object from another thread. If the operation
8886 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8888 // Free the returned object with g_object_unref().
8889 // RETURNS: a #GFileMonitor for the given @file, or %NULL on error.
8890 // <flags>: a set of #GFileMonitorFlags.
8891 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8892 FileMonitor* /*new*/ monitor_file(FileMonitorFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
8893 return g_file_monitor_file(&this, flags, cancellable, error);
8896 // Starts a @mount_operation, mounting the volume that contains the file @location.
8898 // When this operation has completed, @callback will be called with
8899 // @user_user data, and the operation can be finalized with
8900 // g_file_mount_enclosing_volume_finish().
8902 // If @cancellable is not %NULL, then the operation can be cancelled by
8903 // triggering the cancellable object from another thread. If the operation
8904 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8905 // <flags>: flags affecting the operation
8906 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
8907 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8908 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
8909 // <user_data>: the data to pass to callback function
8910 void mount_enclosing_volume(MountMountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
8911 g_file_mount_enclosing_volume(&this, flags, mount_operation, cancellable, callback, user_data);
8914 // Finishes a mount operation started by g_file_mount_enclosing_volume().
8916 // has occurred, this function will return %FALSE and set @error
8917 // appropriately if present.
8918 // RETURNS: %TRUE if successful. If an error
8919 // <result>: a #GAsyncResult.
8920 int mount_enclosing_volume_finish(AsyncResult* result, GLib2.Error** error=null) {
8921 return g_file_mount_enclosing_volume_finish(&this, result, error);
8924 // Mounts a file of type G_FILE_TYPE_MOUNTABLE.
8925 // Using @mount_operation, you can request callbacks when, for instance,
8926 // passwords are needed during authentication.
8928 // If @cancellable is not %NULL, then the operation can be cancelled by
8929 // triggering the cancellable object from another thread. If the operation
8930 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8932 // When the operation is finished, @callback will be called. You can then call
8933 // g_file_mount_mountable_finish() to get the result of the operation.
8934 // <flags>: flags affecting the operation
8935 // <mount_operation>: a #GMountOperation, or %NULL to avoid user interaction.
8936 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8937 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
8938 // <user_data>: the data to pass to callback function
8939 void mount_mountable(MountMountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
8940 g_file_mount_mountable(&this, flags, mount_operation, cancellable, callback, user_data);
8943 // Finishes a mount operation. See g_file_mount_mountable() for details.
8945 // Finish an asynchronous mount operation that was started
8946 // with g_file_mount_mountable().
8948 // Free the returned object with g_object_unref().
8949 // RETURNS: a #GFile or %NULL on error.
8950 // <result>: a #GAsyncResult.
8951 File* /*new*/ mount_mountable_finish(AsyncResult* result, GLib2.Error** error=null) {
8952 return g_file_mount_mountable_finish(&this, result, error);
8955 // Tries to move the file or directory @source to the location specified by @destination.
8956 // If native move operations are supported then this is used, otherwise a copy + delete
8957 // fallback is used. The native implementation may support moving directories (for instance
8958 // on moves inside the same filesystem), but the fallback code does not.
8960 // If the flag #G_FILE_COPY_OVERWRITE is specified an already
8961 // existing @destination file is overwritten.
8963 // If the flag #G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks
8964 // will be copied as symlinks, otherwise the target of the
8965 // @source symlink will be copied.
8967 // If @cancellable is not %NULL, then the operation can be cancelled by
8968 // triggering the cancellable object from another thread. If the operation
8969 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
8971 // If @progress_callback is not %NULL, then the operation can be monitored by
8972 // setting this to a #GFileProgressCallback function. @progress_callback_data
8973 // will be passed to this function. It is guaranteed that this callback will
8974 // be called after all data has been transferred with the total number of bytes
8975 // copied during the operation.
8977 // If the @source file does not exist then the G_IO_ERROR_NOT_FOUND
8978 // error is returned, independent on the status of the @destination.
8980 // If #G_FILE_COPY_OVERWRITE is not specified and the target exists, then the
8981 // error G_IO_ERROR_EXISTS is returned.
8983 // If trying to overwrite a file over a directory the G_IO_ERROR_IS_DIRECTORY
8984 // error is returned. If trying to overwrite a directory with a directory the
8985 // G_IO_ERROR_WOULD_MERGE error is returned.
8987 // If the source is a directory and the target does not exist, or #G_FILE_COPY_OVERWRITE is
8988 // specified and the target is a file, then the G_IO_ERROR_WOULD_RECURSE error
8989 // may be returned (if the native move operation isn't available).
8990 // RETURNS: %TRUE on successful move, %FALSE otherwise.
8991 // <destination>: #GFile pointing to the destination location.
8992 // <flags>: set of #GFileCopyFlags.
8993 // <cancellable>: optional #GCancellable object, %NULL to ignore.
8994 // <progress_callback>: #GFileProgressCallback function for updates.
8995 // <progress_callback_data>: gpointer to user data for the callback function.
8996 int move(File* destination, FileCopyFlags flags, Cancellable* cancellable, FileProgressCallback progress_callback, void* progress_callback_data, GLib2.Error** error=null) {
8997 return g_file_move(&this, destination, flags, cancellable, progress_callback, progress_callback_data, error);
9000 // Opens an existing file for reading and writing. The result is
9001 // a #GFileIOStream that can be used to read and write the contents of the file.
9003 // If @cancellable is not %NULL, then the operation can be cancelled by
9004 // triggering the cancellable object from another thread. If the operation
9005 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9007 // If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned.
9008 // If the file is a directory, the G_IO_ERROR_IS_DIRECTORY error will be returned.
9009 // Other errors are possible too, and depend on what kind of filesystem the file is on.
9010 // Note that in many non-local file cases read and write streams are not supported,
9011 // so make sure you really need to do read and write streaming, rather than
9012 // just opening for reading or writing.
9014 // Free the returned object with g_object_unref().
9015 // RETURNS: #GFileIOStream or %NULL on error.
9016 // <cancellable>: a #GCancellable
9017 FileIOStream* /*new*/ open_readwrite(Cancellable* cancellable, GLib2.Error** error=null) {
9018 return g_file_open_readwrite(&this, cancellable, error);
9021 // Asynchronously opens @file for reading and writing.
9023 // For more details, see g_file_open_readwrite() which is
9024 // the synchronous version of this call.
9026 // When the operation is finished, @callback will be called. You can then call
9027 // g_file_open_readwrite_finish() to get the result of the operation.
9028 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
9029 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9030 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
9031 // <user_data>: the data to pass to callback function
9032 void open_readwrite_async(int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
9033 g_file_open_readwrite_async(&this, io_priority, cancellable, callback, user_data);
9036 // Finishes an asynchronous file read operation started with
9037 // g_file_open_readwrite_async().
9039 // Free the returned object with g_object_unref().
9040 // RETURNS: a #GFileIOStream or %NULL on error.
9041 // <res>: a #GAsyncResult.
9042 FileIOStream* /*new*/ open_readwrite_finish(AsyncResult* res, GLib2.Error** error=null) {
9043 return g_file_open_readwrite_finish(&this, res, error);
9046 // Polls a file of type G_FILE_TYPE_MOUNTABLE.
9048 // If @cancellable is not %NULL, then the operation can be cancelled by
9049 // triggering the cancellable object from another thread. If the operation
9050 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9052 // When the operation is finished, @callback will be called. You can then call
9053 // g_file_mount_mountable_finish() to get the result of the operation.
9054 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9055 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
9056 // <user_data>: the data to pass to callback function
9057 void poll_mountable(Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
9058 g_file_poll_mountable(&this, cancellable, callback, user_data);
9061 // Finishes a poll operation. See g_file_poll_mountable() for details.
9063 // Finish an asynchronous poll operation that was polled
9064 // with g_file_poll_mountable().
9066 // otherwise.
9067 // RETURNS: %TRUE if the operation finished successfully. %FALSE
9068 // <result>: a #GAsyncResult.
9069 int poll_mountable_finish(AsyncResult* result, GLib2.Error** error=null) {
9070 return g_file_poll_mountable_finish(&this, result, error);
9073 // Returns the #GAppInfo that is registered as the default
9074 // application to handle the file specified by @file.
9076 // If @cancellable is not %NULL, then the operation can be cancelled by
9077 // triggering the cancellable object from another thread. If the operation
9078 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9080 // When you are done with it, release it with g_object_unref()
9081 // RETURNS: a #GAppInfo if the handle was found, %NULL if there were errors.
9082 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9083 AppInfo* /*new*/ query_default_handler(Cancellable* cancellable, GLib2.Error** error=null) {
9084 return g_file_query_default_handler(&this, cancellable, error);
9087 // Utility function to check if a particular file exists. This is
9088 // implemented using g_file_query_info() and as such does blocking I/O.
9090 // Note that in many cases it is racy to first check for file existence
9091 // and then execute something based on the outcome of that, because the
9092 // file might have been created or removed in between the operations. The
9093 // general approach to handling that is to not check, but just do the
9094 // operation and handle the errors as they come.
9096 // As an example of race-free checking, take the case of reading a file, and
9097 // if it doesn't exist, creating it. There are two racy versions: read it, and
9098 // on error create it; and: check if it exists, if not create it. These
9099 // can both result in two processes creating the file (with perhaps a partially
9100 // written file as the result). The correct approach is to always try to create
9101 // the file with g_file_create() which will either atomically create the file
9102 // or fail with a G_IO_ERROR_EXISTS error.
9104 // However, in many cases an existence check is useful in a user
9105 // interface, for instance to make a menu item sensitive/insensitive, so that
9106 // you don't have to fool users that something is possible and then just show
9107 // and error dialog. If you do this, you should make sure to also handle the
9108 // errors that can happen due to races when you execute the operation.
9109 // RETURNS: %TRUE if the file exists (and can be detected without error), %FALSE otherwise (or if cancelled).
9110 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9111 int query_exists(Cancellable* cancellable=null) {
9112 return g_file_query_exists(&this, cancellable);
9115 // Utility function to inspect the #GFileType of a file. This is
9116 // implemented using g_file_query_info() and as such does blocking I/O.
9118 // The primary use case of this method is to check if a file is a regular file,
9119 // directory, or symlink.
9121 // does not exist
9122 // RETURNS: The #GFileType of the file and #G_FILE_TYPE_UNKNOWN if the file
9123 // <flags>: a set of #GFileQueryInfoFlags passed to g_file_query_info().
9124 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9125 FileType query_file_type(FileQueryInfoFlags flags, Cancellable* cancellable=null) {
9126 return g_file_query_file_type(&this, flags, cancellable);
9129 // Similar to g_file_query_info(), but obtains information
9130 // about the filesystem the @file is on, rather than the file itself.
9131 // For instance the amount of space available and the type of
9132 // the filesystem.
9134 // The @attributes value is a string that specifies the file attributes that
9135 // should be gathered. It is not an error if it's not possible to read a particular
9136 // requested attribute from a file - it just won't be set. @attributes should
9137 // be a comma-separated list of attributes or attribute wildcards. The wildcard "*"
9138 // means all attributes, and a wildcard like "filesystem::*" means all attributes in the
9139 // filesystem namespace. The standard namespace for filesystem attributes is "filesystem".
9140 // Common attributes of interest are #G_FILE_ATTRIBUTE_FILESYSTEM_SIZE
9141 // (the total size of the filesystem in bytes), #G_FILE_ATTRIBUTE_FILESYSTEM_FREE (number of
9142 // bytes available), and #G_FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem).
9144 // If @cancellable is not %NULL, then the operation can be cancelled by
9145 // triggering the cancellable object from another thread. If the operation
9146 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9148 // If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned.
9149 // Other errors are possible too, and depend on what kind of filesystem the file is on.
9151 // Free the returned object with g_object_unref().
9152 // RETURNS: a #GFileInfo or %NULL if there was an error.
9153 // <attributes>: an attribute query string.
9154 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9155 FileInfo* /*new*/ query_filesystem_info(char* attributes, Cancellable* cancellable, GLib2.Error** error=null) {
9156 return g_file_query_filesystem_info(&this, attributes, cancellable, error);
9159 // Asynchronously gets the requested information about the filesystem
9160 // that the specified @file is on. The result is a #GFileInfo object
9161 // that contains key-value attributes (such as type or size for the
9162 // file).
9164 // For more details, see g_file_query_filesystem_info() which is the
9165 // synchronous version of this call.
9167 // When the operation is finished, @callback will be called. You can
9168 // then call g_file_query_info_finish() to get the result of the
9169 // operation.
9170 // <attributes>: an attribute query string.
9171 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
9172 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9173 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
9174 // <user_data>: the data to pass to callback function
9175 void query_filesystem_info_async(char* attributes, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
9176 g_file_query_filesystem_info_async(&this, attributes, io_priority, cancellable, callback, user_data);
9179 // Finishes an asynchronous filesystem info query. See
9180 // g_file_query_filesystem_info_async().
9182 // Free the returned object with g_object_unref().
9183 // RETURNS: #GFileInfo for given @file or %NULL on error.
9184 // <res>: a #GAsyncResult.
9185 FileInfo* /*new*/ query_filesystem_info_finish(AsyncResult* res, GLib2.Error** error=null) {
9186 return g_file_query_filesystem_info_finish(&this, res, error);
9189 // Gets the requested information about specified @file. The result
9190 // is a #GFileInfo object that contains key-value attributes (such as
9191 // the type or size of the file).
9193 // The @attributes value is a string that specifies the file attributes that
9194 // should be gathered. It is not an error if it's not possible to read a particular
9195 // requested attribute from a file - it just won't be set. @attributes should
9196 // be a comma-separated list of attributes or attribute wildcards. The wildcard "*"
9197 // means all attributes, and a wildcard like "standard::*" means all attributes in the standard
9198 // namespace. An example attribute query be "standard::*,owner::user".
9199 // The standard attributes are available as defines, like #G_FILE_ATTRIBUTE_STANDARD_NAME.
9201 // If @cancellable is not %NULL, then the operation can be cancelled by
9202 // triggering the cancellable object from another thread. If the operation
9203 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9205 // For symlinks, normally the information about the target of the
9206 // symlink is returned, rather than information about the symlink itself.
9207 // However if you pass #G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS in @flags the
9208 // information about the symlink itself will be returned. Also, for symlinks
9209 // that point to non-existing files the information about the symlink itself
9210 // will be returned.
9212 // If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned.
9213 // Other errors are possible too, and depend on what kind of filesystem the file is on.
9215 // Free the returned object with g_object_unref().
9216 // RETURNS: a #GFileInfo for the given @file, or %NULL on error.
9217 // <attributes>: an attribute query string.
9218 // <flags>: a set of #GFileQueryInfoFlags.
9219 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9220 FileInfo* /*new*/ query_info(char* attributes, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
9221 return g_file_query_info(&this, attributes, flags, cancellable, error);
9224 // Asynchronously gets the requested information about specified @file. The result
9225 // is a #GFileInfo object that contains key-value attributes (such as type or size
9226 // for the file).
9228 // For more details, see g_file_query_info() which is
9229 // the synchronous version of this call.
9231 // When the operation is finished, @callback will be called. You can then call
9232 // g_file_query_info_finish() to get the result of the operation.
9233 // <attributes>: an attribute query string.
9234 // <flags>: a set of #GFileQueryInfoFlags.
9235 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
9236 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9237 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
9238 // <user_data>: the data to pass to callback function
9239 void query_info_async(char* attributes, FileQueryInfoFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
9240 g_file_query_info_async(&this, attributes, flags, io_priority, cancellable, callback, user_data);
9243 // Finishes an asynchronous file info query.
9244 // See g_file_query_info_async().
9246 // Free the returned object with g_object_unref().
9247 // RETURNS: #GFileInfo for given @file or %NULL on error.
9248 // <res>: a #GAsyncResult.
9249 FileInfo* /*new*/ query_info_finish(AsyncResult* res, GLib2.Error** error=null) {
9250 return g_file_query_info_finish(&this, res, error);
9253 // Obtain the list of settable attributes for the file.
9255 // Returns the type and full attribute name of all the attributes
9256 // that can be set on this file. This doesn't mean setting it will always
9257 // succeed though, you might get an access failure, or some specific
9258 // file may not support a specific attribute.
9260 // If @cancellable is not %NULL, then the operation can be cancelled by
9261 // triggering the cancellable object from another thread. If the operation
9262 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9264 // When you are done with it, release it with g_file_attribute_info_list_unref()
9265 // RETURNS: a #GFileAttributeInfoList describing the settable attributes.
9266 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9267 FileAttributeInfoList* /*new*/ query_settable_attributes(Cancellable* cancellable, GLib2.Error** error=null) {
9268 return g_file_query_settable_attributes(&this, cancellable, error);
9271 // Obtain the list of attribute namespaces where new attributes
9272 // can be created by a user. An example of this is extended
9273 // attributes (in the "xattr" namespace).
9275 // If @cancellable is not %NULL, then the operation can be cancelled by
9276 // triggering the cancellable object from another thread. If the operation
9277 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9279 // When you are done with it, release it with g_file_attribute_info_list_unref()
9280 // RETURNS: a #GFileAttributeInfoList describing the writable namespaces.
9281 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9282 FileAttributeInfoList* /*new*/ query_writable_namespaces(Cancellable* cancellable, GLib2.Error** error=null) {
9283 return g_file_query_writable_namespaces(&this, cancellable, error);
9286 // Opens a file for reading. The result is a #GFileInputStream that
9287 // can be used to read the contents of the file.
9289 // If @cancellable is not %NULL, then the operation can be cancelled by
9290 // triggering the cancellable object from another thread. If the operation
9291 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9293 // If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned.
9294 // If the file is a directory, the G_IO_ERROR_IS_DIRECTORY error will be returned.
9295 // Other errors are possible too, and depend on what kind of filesystem the file is on.
9297 // Free the returned object with g_object_unref().
9298 // RETURNS: #GFileInputStream or %NULL on error.
9299 // <cancellable>: a #GCancellable
9300 FileInputStream* /*new*/ read(Cancellable* cancellable, GLib2.Error** error=null) {
9301 return g_file_read(&this, cancellable, error);
9304 // Asynchronously opens @file for reading.
9306 // For more details, see g_file_read() which is
9307 // the synchronous version of this call.
9309 // When the operation is finished, @callback will be called. You can then call
9310 // g_file_read_finish() to get the result of the operation.
9311 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
9312 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9313 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
9314 // <user_data>: the data to pass to callback function
9315 void read_async(int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
9316 g_file_read_async(&this, io_priority, cancellable, callback, user_data);
9319 // Finishes an asynchronous file read operation started with
9320 // g_file_read_async().
9322 // Free the returned object with g_object_unref().
9323 // RETURNS: a #GFileInputStream or %NULL on error.
9324 // <res>: a #GAsyncResult.
9325 FileInputStream* /*new*/ read_finish(AsyncResult* res, GLib2.Error** error=null) {
9326 return g_file_read_finish(&this, res, error);
9329 // Returns an output stream for overwriting the file, possibly
9330 // creating a backup copy of the file first. If the file doesn't exist,
9331 // it will be created.
9333 // This will try to replace the file in the safest way possible so
9334 // that any errors during the writing will not affect an already
9335 // existing copy of the file. For instance, for local files it
9336 // may write to a temporary file and then atomically rename over
9337 // the destination when the stream is closed.
9339 // By default files created are generally readable by everyone,
9340 // but if you pass #G_FILE_CREATE_PRIVATE in @flags the file
9341 // will be made readable only to the current user, to the level that
9342 // is supported on the target filesystem.
9344 // If @cancellable is not %NULL, then the operation can be cancelled by
9345 // triggering the cancellable object from another thread. If the operation
9346 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9348 // If you pass in a non-#NULL @etag value, then this value is
9349 // compared to the current entity tag of the file, and if they differ
9350 // an G_IO_ERROR_WRONG_ETAG error is returned. This generally means
9351 // that the file has been changed since you last read it. You can get
9352 // the new etag from g_file_output_stream_get_etag() after you've
9353 // finished writing and closed the #GFileOutputStream. When you load
9354 // a new file you can use g_file_input_stream_query_info() to get
9355 // the etag of the file.
9357 // If @make_backup is %TRUE, this function will attempt to make a backup
9358 // of the current file before overwriting it. If this fails a G_IO_ERROR_CANT_CREATE_BACKUP
9359 // error will be returned. If you want to replace anyway, try again with
9360 // @make_backup set to %FALSE.
9362 // If the file is a directory the G_IO_ERROR_IS_DIRECTORY error will be returned,
9363 // and if the file is some other form of non-regular file then a
9364 // G_IO_ERROR_NOT_REGULAR_FILE error will be returned.
9365 // Some file systems don't allow all file names, and may
9366 // return an G_IO_ERROR_INVALID_FILENAME error, and if the name
9367 // is to long G_IO_ERROR_FILENAME_TOO_LONG will be returned.
9368 // Other errors are possible too, and depend on what kind of
9369 // filesystem the file is on.
9371 // Free the returned object with g_object_unref().
9372 // RETURNS: a #GFileOutputStream or %NULL on error.
9373 // <etag>: an optional <link linkend="gfile-etag">entity tag</link> for the current #GFile, or #NULL to ignore.
9374 // <make_backup>: %TRUE if a backup should be created.
9375 // <flags>: a set of #GFileCreateFlags.
9376 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9377 FileOutputStream* /*new*/ replace(char* etag, int make_backup, FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
9378 return g_file_replace(&this, etag, make_backup, flags, cancellable, error);
9381 // Asynchronously overwrites the file, replacing the contents, possibly
9382 // creating a backup copy of the file first.
9384 // For more details, see g_file_replace() which is
9385 // the synchronous version of this call.
9387 // When the operation is finished, @callback will be called. You can then call
9388 // g_file_replace_finish() to get the result of the operation.
9389 // <etag>: an <link linkend="gfile-etag">entity tag</link> for the current #GFile, or NULL to ignore.
9390 // <make_backup>: %TRUE if a backup should be created.
9391 // <flags>: a set of #GFileCreateFlags.
9392 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
9393 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9394 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
9395 // <user_data>: the data to pass to callback function
9396 void replace_async(char* etag, int make_backup, FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
9397 g_file_replace_async(&this, etag, make_backup, flags, io_priority, cancellable, callback, user_data);
9400 // Replaces the contents of @file with @contents of @length bytes.
9401 // If @etag is specified (not %NULL) any existing file must have that etag, or
9402 // the error %G_IO_ERROR_WRONG_ETAG will be returned.
9404 // If @make_backup is %TRUE, this function will attempt to make a backup of @file.
9406 // If @cancellable is not %NULL, then the operation can be cancelled by
9407 // triggering the cancellable object from another thread. If the operation
9408 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9410 // The returned @new_etag can be used to verify that the file hasn't changed the
9411 // next time it is saved over.
9413 // has occurred, this function will return %FALSE and set @error
9414 // appropriately if present.
9415 // RETURNS: %TRUE if successful. If an error
9416 // <contents>: a string containing the new contents for @file.
9417 // <length>: the length of @contents in bytes.
9418 // <etag>: the old <link linkend="gfile-etag">entity tag</link> for the document, or %NULL
9419 // <make_backup>: %TRUE if a backup should be created.
9420 // <flags>: a set of #GFileCreateFlags.
9421 // <new_etag>: a location to a new <link linkend="gfile-etag">entity tag</link> for the document. This should be freed with g_free() when no longer needed, or %NULL
9422 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9423 int replace_contents(ubyte* contents, size_t length, char* etag, int make_backup, FileCreateFlags flags, /*out*/ char** new_etag, Cancellable* cancellable, GLib2.Error** error=null) {
9424 return g_file_replace_contents(&this, contents, length, etag, make_backup, flags, new_etag, cancellable, error);
9427 // Starts an asynchronous replacement of @file with the given
9428 // @contents of @length bytes. @etag will replace the document's
9429 // current entity tag.
9431 // When this operation has completed, @callback will be called with
9432 // @user_user data, and the operation can be finalized with
9433 // g_file_replace_contents_finish().
9435 // If @cancellable is not %NULL, then the operation can be cancelled by
9436 // triggering the cancellable object from another thread. If the operation
9437 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9439 // If @make_backup is %TRUE, this function will attempt to
9440 // make a backup of @file.
9441 // <contents>: string of contents to replace the file with.
9442 // <length>: the length of @contents in bytes.
9443 // <etag>: a new <link linkend="gfile-etag">entity tag</link> for the @file, or %NULL
9444 // <make_backup>: %TRUE if a backup should be created.
9445 // <flags>: a set of #GFileCreateFlags.
9446 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9447 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
9448 // <user_data>: the data to pass to callback function
9449 void replace_contents_async(ubyte* contents, size_t length, char* etag, int make_backup, FileCreateFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
9450 g_file_replace_contents_async(&this, contents, length, etag, make_backup, flags, cancellable, callback, user_data);
9453 // Finishes an asynchronous replace of the given @file. See
9454 // g_file_replace_contents_async(). Sets @new_etag to the new entity
9455 // tag for the document, if present.
9456 // RETURNS: %TRUE on success, %FALSE on failure.
9457 // <res>: a #GAsyncResult.
9458 // <new_etag>: a location of a new <link linkend="gfile-etag">entity tag</link> for the document. This should be freed with g_free() when it is no longer needed, or %NULL
9459 int replace_contents_finish(AsyncResult* res, /*out*/ char** new_etag, GLib2.Error** error=null) {
9460 return g_file_replace_contents_finish(&this, res, new_etag, error);
9463 // Finishes an asynchronous file replace operation started with
9464 // g_file_replace_async().
9466 // Free the returned object with g_object_unref().
9467 // RETURNS: a #GFileOutputStream, or %NULL on error.
9468 // <res>: a #GAsyncResult.
9469 FileOutputStream* /*new*/ replace_finish(AsyncResult* res, GLib2.Error** error=null) {
9470 return g_file_replace_finish(&this, res, error);
9473 // Returns an output stream for overwriting the file in readwrite mode,
9474 // possibly creating a backup copy of the file first. If the file doesn't
9475 // exist, it will be created.
9477 // For details about the behaviour, see g_file_replace() which does the same
9478 // thing but returns an output stream only.
9480 // Note that in many non-local file cases read and write streams are not
9481 // supported, so make sure you really need to do read and write streaming,
9482 // rather than just opening for reading or writing.
9484 // Free the returned object with g_object_unref().
9485 // RETURNS: a #GFileIOStream or %NULL on error.
9486 // <etag>: an optional <link linkend="gfile-etag">entity tag</link> for the current #GFile, or #NULL to ignore
9487 // <make_backup>: %TRUE if a backup should be created
9488 // <flags>: a set of #GFileCreateFlags
9489 // <cancellable>: optional #GCancellable object, %NULL to ignore
9490 FileIOStream* /*new*/ replace_readwrite(char* etag, int make_backup, FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
9491 return g_file_replace_readwrite(&this, etag, make_backup, flags, cancellable, error);
9494 // Asynchronously overwrites the file in read-write mode, replacing the
9495 // contents, possibly creating a backup copy of the file first.
9497 // For more details, see g_file_replace_readwrite() which is
9498 // the synchronous version of this call.
9500 // When the operation is finished, @callback will be called. You can then
9501 // call g_file_replace_readwrite_finish() to get the result of the operation.
9502 // <etag>: an <link linkend="gfile-etag">entity tag</link> for the current #GFile, or NULL to ignore.
9503 // <make_backup>: %TRUE if a backup should be created.
9504 // <flags>: a set of #GFileCreateFlags.
9505 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
9506 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9507 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
9508 // <user_data>: the data to pass to callback function
9509 void replace_readwrite_async(char* etag, int make_backup, FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
9510 g_file_replace_readwrite_async(&this, etag, make_backup, flags, io_priority, cancellable, callback, user_data);
9513 // Finishes an asynchronous file replace operation started with
9514 // g_file_replace_readwrite_async().
9516 // Free the returned object with g_object_unref().
9517 // RETURNS: a #GFileIOStream, or %NULL on error.
9518 // <res>: a #GAsyncResult.
9519 FileIOStream* /*new*/ replace_readwrite_finish(AsyncResult* res, GLib2.Error** error=null) {
9520 return g_file_replace_readwrite_finish(&this, res, error);
9523 // Resolves a relative path for @file to an absolute path.
9525 // This call does no blocking i/o.
9527 // is %NULL or if @file is invalid.
9528 // Free the returned object with g_object_unref().
9529 // RETURNS: #GFile to the resolved path. %NULL if @relative_path
9530 // <relative_path>: a given relative path string.
9531 File* /*new*/ resolve_relative_path(char* relative_path) {
9532 return g_file_resolve_relative_path(&this, relative_path);
9535 // Sets an attribute in the file with attribute name @attribute to @value.
9537 // Some attributes can be unset by setting @attribute to
9538 // %G_FILE_ATTRIBUTE_TYPE_INVALID and @value to %NULL.
9540 // If @cancellable is not %NULL, then the operation can be cancelled by
9541 // triggering the cancellable object from another thread. If the operation
9542 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9543 // RETURNS: %TRUE if the attribute was set, %FALSE otherwise.
9544 // <attribute>: a string containing the attribute's name.
9545 // <type>: The type of the attribute
9546 // <value_p>: a pointer to the value (or the pointer itself if the type is a pointer type)
9547 // <flags>: a set of #GFileQueryInfoFlags.
9548 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9549 int set_attribute(char* attribute, FileAttributeType type, void* value_p, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
9550 return g_file_set_attribute(&this, attribute, type, value_p, flags, cancellable, error);
9553 // Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING to @value.
9554 // If @attribute is of a different type, this operation will fail,
9555 // returning %FALSE.
9557 // If @cancellable is not %NULL, then the operation can be cancelled by
9558 // triggering the cancellable object from another thread. If the operation
9559 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9561 // in the @file, %FALSE otherwise.
9562 // RETURNS: %TRUE if the @attribute was successfully set to @value
9563 // <attribute>: a string containing the attribute's name.
9564 // <value>: a string containing the attribute's new value.
9565 // <flags>: a #GFileQueryInfoFlags.
9566 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9567 int set_attribute_byte_string(char* attribute, char* value, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
9568 return g_file_set_attribute_byte_string(&this, attribute, value, flags, cancellable, error);
9571 // Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_INT32 to @value.
9572 // If @attribute is of a different type, this operation will fail.
9574 // If @cancellable is not %NULL, then the operation can be cancelled by
9575 // triggering the cancellable object from another thread. If the operation
9576 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9578 // in the @file, %FALSE otherwise.
9579 // RETURNS: %TRUE if the @attribute was successfully set to @value
9580 // <attribute>: a string containing the attribute's name.
9581 // <value>: a #gint32 containing the attribute's new value.
9582 // <flags>: a #GFileQueryInfoFlags.
9583 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9584 int set_attribute_int32(char* attribute, int value, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
9585 return g_file_set_attribute_int32(&this, attribute, value, flags, cancellable, error);
9588 // Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_INT64 to @value.
9589 // If @attribute is of a different type, this operation will fail.
9591 // If @cancellable is not %NULL, then the operation can be cancelled by
9592 // triggering the cancellable object from another thread. If the operation
9593 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9594 // RETURNS: %TRUE if the @attribute was successfully set, %FALSE otherwise.
9595 // <attribute>: a string containing the attribute's name.
9596 // <value>: a #guint64 containing the attribute's new value.
9597 // <flags>: a #GFileQueryInfoFlags.
9598 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9599 int set_attribute_int64(char* attribute, long value, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
9600 return g_file_set_attribute_int64(&this, attribute, value, flags, cancellable, error);
9603 // Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_STRING to @value.
9604 // If @attribute is of a different type, this operation will fail.
9606 // If @cancellable is not %NULL, then the operation can be cancelled by
9607 // triggering the cancellable object from another thread. If the operation
9608 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9609 // RETURNS: %TRUE if the @attribute was successfully set, %FALSE otherwise.
9610 // <attribute>: a string containing the attribute's name.
9611 // <value>: a string containing the attribute's value.
9612 // <flags>: #GFileQueryInfoFlags.
9613 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9614 int set_attribute_string(char* attribute, char* value, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
9615 return g_file_set_attribute_string(&this, attribute, value, flags, cancellable, error);
9618 // Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_UINT32 to @value.
9619 // If @attribute is of a different type, this operation will fail.
9621 // If @cancellable is not %NULL, then the operation can be cancelled by
9622 // triggering the cancellable object from another thread. If the operation
9623 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9625 // in the @file, %FALSE otherwise.
9626 // RETURNS: %TRUE if the @attribute was successfully set to @value
9627 // <attribute>: a string containing the attribute's name.
9628 // <value>: a #guint32 containing the attribute's new value.
9629 // <flags>: a #GFileQueryInfoFlags.
9630 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9631 int set_attribute_uint32(char* attribute, uint value, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
9632 return g_file_set_attribute_uint32(&this, attribute, value, flags, cancellable, error);
9635 // Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_UINT64 to @value.
9636 // If @attribute is of a different type, this operation will fail.
9638 // If @cancellable is not %NULL, then the operation can be cancelled by
9639 // triggering the cancellable object from another thread. If the operation
9640 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9642 // in the @file, %FALSE otherwise.
9643 // RETURNS: %TRUE if the @attribute was successfully set to @value
9644 // <attribute>: a string containing the attribute's name.
9645 // <value>: a #guint64 containing the attribute's new value.
9646 // <flags>: a #GFileQueryInfoFlags.
9647 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9648 int set_attribute_uint64(char* attribute, ulong value, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
9649 return g_file_set_attribute_uint64(&this, attribute, value, flags, cancellable, error);
9652 // Asynchronously sets the attributes of @file with @info.
9654 // For more details, see g_file_set_attributes_from_info() which is
9655 // the synchronous version of this call.
9657 // When the operation is finished, @callback will be called. You can then call
9658 // g_file_set_attributes_finish() to get the result of the operation.
9659 // <info>: a #GFileInfo.
9660 // <flags>: a #GFileQueryInfoFlags.
9661 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
9662 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9663 // <callback>: a #GAsyncReadyCallback.
9664 // <user_data>: a #gpointer.
9665 void set_attributes_async(FileInfo* info, FileQueryInfoFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
9666 g_file_set_attributes_async(&this, info, flags, io_priority, cancellable, callback, user_data);
9669 // Finishes setting an attribute started in g_file_set_attributes_async().
9670 // RETURNS: %TRUE if the attributes were set correctly, %FALSE otherwise.
9671 // <result>: a #GAsyncResult.
9672 // <info>: a #GFileInfo.
9673 int set_attributes_finish(AsyncResult* result, /*out*/ FileInfo** info, GLib2.Error** error=null) {
9674 return g_file_set_attributes_finish(&this, result, info, error);
9677 // Tries to set all attributes in the #GFileInfo on the target values,
9678 // not stopping on the first error.
9680 // If there is any error during this operation then @error will be set to
9681 // the first error. Error on particular fields are flagged by setting
9682 // the "status" field in the attribute value to
9683 // %G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING, which means you can also detect
9684 // further errors.
9686 // If @cancellable is not %NULL, then the operation can be cancelled by
9687 // triggering the cancellable object from another thread. If the operation
9688 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9689 // RETURNS: %TRUE if there was any error, %FALSE otherwise.
9690 // <info>: a #GFileInfo.
9691 // <flags>: #GFileQueryInfoFlags
9692 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9693 int set_attributes_from_info(FileInfo* info, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
9694 return g_file_set_attributes_from_info(&this, info, flags, cancellable, error);
9697 // Renames @file to the specified display name.
9699 // The display name is converted from UTF8 to the correct encoding for the target
9700 // filesystem if possible and the @file is renamed to this.
9702 // If you want to implement a rename operation in the user interface the edit name
9703 // (#G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the initial value in the rename
9704 // widget, and then the result after editing should be passed to g_file_set_display_name().
9706 // On success the resulting converted filename is returned.
9708 // If @cancellable is not %NULL, then the operation can be cancelled by
9709 // triggering the cancellable object from another thread. If the operation
9710 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9712 // if there was an error.
9713 // Free the returned object with g_object_unref().
9714 // RETURNS: a #GFile specifying what @file was renamed to, or %NULL
9715 // <display_name>: a string.
9716 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9717 File* /*new*/ set_display_name(char* display_name, Cancellable* cancellable, GLib2.Error** error=null) {
9718 return g_file_set_display_name(&this, display_name, cancellable, error);
9721 // Asynchronously sets the display name for a given #GFile.
9723 // For more details, see g_file_set_display_name() which is
9724 // the synchronous version of this call.
9726 // When the operation is finished, @callback will be called. You can then call
9727 // g_file_set_display_name_finish() to get the result of the operation.
9728 // <display_name>: a string.
9729 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
9730 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9731 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
9732 // <user_data>: the data to pass to callback function
9733 void set_display_name_async(char* display_name, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
9734 g_file_set_display_name_async(&this, display_name, io_priority, cancellable, callback, user_data);
9737 // Finishes setting a display name started with
9738 // g_file_set_display_name_async().
9740 // Free the returned object with g_object_unref().
9741 // RETURNS: a #GFile or %NULL on error.
9742 // <res>: a #GAsyncResult.
9743 File* /*new*/ set_display_name_finish(AsyncResult* res, GLib2.Error** error=null) {
9744 return g_file_set_display_name_finish(&this, res, error);
9747 // Starts a file of type G_FILE_TYPE_MOUNTABLE.
9748 // Using @start_operation, you can request callbacks when, for instance,
9749 // passwords are needed during authentication.
9751 // If @cancellable is not %NULL, then the operation can be cancelled by
9752 // triggering the cancellable object from another thread. If the operation
9753 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9755 // When the operation is finished, @callback will be called. You can then call
9756 // g_file_mount_mountable_finish() to get the result of the operation.
9757 // <flags>: flags affecting the operation
9758 // <start_operation>: a #GMountOperation, or %NULL to avoid user interaction.
9759 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9760 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
9761 // <user_data>: the data to pass to callback function
9762 void start_mountable(DriveStartFlags flags, MountOperation* start_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
9763 g_file_start_mountable(&this, flags, start_operation, cancellable, callback, user_data);
9766 // Finishes a start operation. See g_file_start_mountable() for details.
9768 // Finish an asynchronous start operation that was started
9769 // with g_file_start_mountable().
9771 // otherwise.
9772 // RETURNS: %TRUE if the operation finished successfully. %FALSE
9773 // <result>: a #GAsyncResult.
9774 int start_mountable_finish(AsyncResult* result, GLib2.Error** error=null) {
9775 return g_file_start_mountable_finish(&this, result, error);
9778 // Stops a file of type G_FILE_TYPE_MOUNTABLE.
9780 // If @cancellable is not %NULL, then the operation can be cancelled by
9781 // triggering the cancellable object from another thread. If the operation
9782 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9784 // When the operation is finished, @callback will be called. You can then call
9785 // g_file_stop_mountable_finish() to get the result of the operation.
9786 // <flags>: flags affecting the operation
9787 // <mount_operation>: a #GMountOperation, or %NULL to avoid user interaction.
9788 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9789 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
9790 // <user_data>: the data to pass to callback function
9791 void stop_mountable(MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
9792 g_file_stop_mountable(&this, flags, mount_operation, cancellable, callback, user_data);
9795 // Finishes an stop operation, see g_file_stop_mountable() for details.
9797 // Finish an asynchronous stop operation that was started
9798 // with g_file_stop_mountable().
9800 // otherwise.
9801 // RETURNS: %TRUE if the operation finished successfully. %FALSE
9802 // <result>: a #GAsyncResult.
9803 int stop_mountable_finish(AsyncResult* result, GLib2.Error** error=null) {
9804 return g_file_stop_mountable_finish(&this, result, error);
9807 // Checks if @file supports <link
9808 // linkend="g-main-context-push-thread-default-context">thread-default
9809 // contexts</link>. If this returns %FALSE, you cannot perform
9810 // asynchronous operations on @file in a thread that has a
9811 // thread-default context.
9812 // RETURNS: Whether or not @file supports thread-default contexts.
9813 int supports_thread_contexts() {
9814 return g_file_supports_thread_contexts(&this);
9817 // Sends @file to the "Trashcan", if possible. This is similar to
9818 // deleting it, but the user can recover it before emptying the trashcan.
9819 // Not all file systems support trashing, so this call can return the
9820 // %G_IO_ERROR_NOT_SUPPORTED error.
9823 // If @cancellable is not %NULL, then the operation can be cancelled by
9824 // triggering the cancellable object from another thread. If the operation
9825 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9826 // RETURNS: %TRUE on successful trash, %FALSE otherwise.
9827 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9828 int trash(Cancellable* cancellable, GLib2.Error** error=null) {
9829 return g_file_trash(&this, cancellable, error);
9832 // Unmounts a file of type G_FILE_TYPE_MOUNTABLE.
9834 // If @cancellable is not %NULL, then the operation can be cancelled by
9835 // triggering the cancellable object from another thread. If the operation
9836 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9838 // When the operation is finished, @callback will be called. You can then call
9839 // g_file_unmount_mountable_finish() to get the result of the operation.
9840 // <flags>: flags affecting the operation
9841 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9842 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
9843 // <user_data>: the data to pass to callback function
9844 void unmount_mountable(MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
9845 g_file_unmount_mountable(&this, flags, cancellable, callback, user_data);
9848 // Finishes an unmount operation, see g_file_unmount_mountable() for details.
9850 // Finish an asynchronous unmount operation that was started
9851 // with g_file_unmount_mountable().
9853 // otherwise.
9854 // RETURNS: %TRUE if the operation finished successfully. %FALSE
9855 // <result>: a #GAsyncResult.
9856 int unmount_mountable_finish(AsyncResult* result, GLib2.Error** error=null) {
9857 return g_file_unmount_mountable_finish(&this, result, error);
9860 // Unmounts a file of type G_FILE_TYPE_MOUNTABLE.
9862 // If @cancellable is not %NULL, then the operation can be cancelled by
9863 // triggering the cancellable object from another thread. If the operation
9864 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
9866 // When the operation is finished, @callback will be called. You can then call
9867 // g_file_unmount_mountable_finish() to get the result of the operation.
9868 // <flags>: flags affecting the operation
9869 // <mount_operation>: a #GMountOperation, or %NULL to avoid user interaction.
9870 // <cancellable>: optional #GCancellable object, %NULL to ignore.
9871 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
9872 // <user_data>: the data to pass to callback function
9873 void unmount_mountable_with_operation(MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
9874 g_file_unmount_mountable_with_operation(&this, flags, mount_operation, cancellable, callback, user_data);
9877 // Finishes an unmount operation, see g_file_unmount_mountable_with_operation() for details.
9879 // Finish an asynchronous unmount operation that was started
9880 // with g_file_unmount_mountable_with_operation().
9882 // otherwise.
9883 // RETURNS: %TRUE if the operation finished successfully. %FALSE
9884 // <result>: a #GAsyncResult.
9885 int unmount_mountable_with_operation_finish(AsyncResult* result, GLib2.Error** error=null) {
9886 return g_file_unmount_mountable_with_operation_finish(&this, result, error);
9890 // Information about a specific attribute.
9891 struct FileAttributeInfo {
9892 char* name;
9893 FileAttributeType type;
9894 FileAttributeInfoFlags flags;
9897 // Flags specifying the behaviour of an attribute.
9898 enum FileAttributeInfoFlags {
9899 NONE = 0,
9900 COPY_WITH_FILE = 1,
9901 COPY_WHEN_MOVED = 2
9904 // Acts as a lightweight registry for possible valid file attributes.
9905 // The registry stores Key-Value pair formats as #GFileAttributeInfo<!-- -->s.
9906 struct FileAttributeInfoList {
9907 FileAttributeInfo* infos;
9908 int n_infos;
9911 // Creates a new file attribute info list.
9912 // RETURNS: a #GFileAttributeInfoList.
9913 static FileAttributeInfoList* /*new*/ new_() {
9914 return g_file_attribute_info_list_new();
9917 // Adds a new attribute with @name to the @list, setting
9918 // its @type and @flags.
9919 // <name>: the name of the attribute to add.
9920 // <type>: the #GFileAttributeType for the attribute.
9921 // <flags>: #GFileAttributeInfoFlags for the attribute.
9922 void add(char* name, FileAttributeType type, FileAttributeInfoFlags flags) {
9923 g_file_attribute_info_list_add(&this, name, type, flags);
9926 // Makes a duplicate of a file attribute info list.
9927 // RETURNS: a copy of the given @list.
9928 FileAttributeInfoList* /*new*/ dup() {
9929 return g_file_attribute_info_list_dup(&this);
9932 // Gets the file attribute with the name @name from @list.
9934 // attribute isn't found.
9935 // RETURNS: a #GFileAttributeInfo for the @name, or %NULL if an
9936 // <name>: the name of the attribute to lookup.
9937 FileAttributeInfo* lookup(char* name) {
9938 return g_file_attribute_info_list_lookup(&this, name);
9941 // References a file attribute info list.
9942 // RETURNS: #GFileAttributeInfoList or %NULL on error.
9943 FileAttributeInfoList* /*new*/ ref_() {
9944 return g_file_attribute_info_list_ref(&this);
9947 // Removes a reference from the given @list. If the reference count
9948 // falls to zero, the @list is deleted.
9949 void unref() {
9950 g_file_attribute_info_list_unref(&this);
9954 // Determines if a string matches a file attribute.
9955 struct FileAttributeMatcher {
9957 // Creates a new file attribute matcher, which matches attributes
9958 // against a given string. #GFileAttributeMatcher<!-- -->s are reference
9959 // counted structures, and are created with a reference count of 1. If
9960 // the number of references falls to 0, the #GFileAttributeMatcher is
9961 // automatically destroyed.
9963 // The @attribute string should be formatted with specific keys separated
9964 // from namespaces with a double colon. Several "namespace::key" strings may be
9965 // concatenated with a single comma (e.g. "standard::type,standard::is-hidden").
9966 // The wildcard "*" may be used to match all keys and namespaces, or
9967 // "namespace::*" will match all keys in a given namespace.
9969 // Examples of strings to use:
9970 // <table>
9971 // <title>File Attribute Matcher strings and results</title>
9972 // <tgroup cols='2' align='left'><thead>
9973 // <row><entry> Matcher String </entry><entry> Matches </entry></row></thead>
9974 // <tbody>
9975 // <row><entry>"*"</entry><entry>matches all attributes.</entry></row>
9976 // <row><entry>"standard::is-hidden"</entry><entry>matches only the key is-hidden in the standard namespace.</entry></row>
9977 // <row><entry>"standard::type,unix::*"</entry><entry>matches the type key in the standard namespace and
9978 // all keys in the unix namespace.</entry></row>
9979 // </tbody></tgroup>
9980 // </table>
9981 // RETURNS: a #GFileAttributeMatcher.
9982 // <attributes>: an attribute string to match.
9983 static FileAttributeMatcher* /*new*/ new_(char* attributes) {
9984 return g_file_attribute_matcher_new(attributes);
9987 // Checks if the matcher will match all of the keys in a given namespace.
9988 // This will always return %TRUE if a wildcard character is in use (e.g. if
9989 // matcher was created with "standard::*" and @ns is "standard", or if matcher was created
9990 // using "*" and namespace is anything.)
9992 // TODO: this is awkwardly worded.
9994 // in the given @ns, %FALSE otherwise.
9995 // RETURNS: %TRUE if the matcher matches all of the entries
9996 // <ns>: a string containing a file attribute namespace.
9997 int enumerate_namespace(char* ns) {
9998 return g_file_attribute_matcher_enumerate_namespace(&this, ns);
10001 // Gets the next matched attribute from a #GFileAttributeMatcher.
10003 // no more attribute exist.
10004 // RETURNS: a string containing the next attribute or %NULL if
10005 char* enumerate_next() {
10006 return g_file_attribute_matcher_enumerate_next(&this);
10009 // Checks if an attribute will be matched by an attribute matcher. If
10010 // the matcher was created with the "*" matching string, this function
10011 // will always return %TRUE.
10012 // RETURNS: %TRUE if @attribute matches @matcher. %FALSE otherwise.
10013 // <attribute>: a file attribute key.
10014 int matches(char* attribute) {
10015 return g_file_attribute_matcher_matches(&this, attribute);
10018 // Checks if a attribute matcher only matches a given attribute. Always
10019 // returns %FALSE if "*" was used when creating the matcher.
10020 // RETURNS: %TRUE if the matcher only matches @attribute. %FALSE otherwise.
10021 // <attribute>: a file attribute key.
10022 int matches_only(char* attribute) {
10023 return g_file_attribute_matcher_matches_only(&this, attribute);
10026 // References a file attribute matcher.
10027 // RETURNS: a #GFileAttributeMatcher.
10028 FileAttributeMatcher* /*new*/ ref_() {
10029 return g_file_attribute_matcher_ref(&this);
10032 // Unreferences @matcher. If the reference count falls below 1,
10033 // the @matcher is automatically freed.
10034 void unref() {
10035 g_file_attribute_matcher_unref(&this);
10039 // Used by g_file_set_attributes_from_info() when setting file attributes.
10040 enum FileAttributeStatus {
10041 UNSET = 0,
10042 SET = 1,
10043 ERROR_SETTING = 2
10045 // The data types for file attributes.
10046 enum FileAttributeType {
10047 INVALID = 0,
10048 STRING = 1,
10049 BYTE_STRING = 2,
10050 BOOLEAN = 3,
10051 UINT32 = 4,
10052 INT32 = 5,
10053 UINT64 = 6,
10054 INT64 = 7,
10055 OBJECT = 8,
10056 STRINGV = 9
10058 // Flags used when copying or moving files.
10059 enum FileCopyFlags {
10060 NONE = 0,
10061 OVERWRITE = 1,
10062 BACKUP = 2,
10063 NOFOLLOW_SYMLINKS = 4,
10064 ALL_METADATA = 8,
10065 NO_FALLBACK_FOR_MOVE = 16,
10066 TARGET_DEFAULT_PERMS = 32
10068 // Flags used when an operation may create a file.
10069 enum FileCreateFlags {
10070 NONE = 0,
10071 PRIVATE = 1,
10072 REPLACE_DESTINATION = 2
10075 // #GFileDescriptorBased is implemented by streams (implementations of
10076 // #GInputStream or #GOutputStream) that are based on file descriptors.
10078 // Note that <filename>&lt;gio/gfiledescriptorbased.h&gt;</filename> belongs to
10079 // the UNIX-specific GIO interfaces, thus you have to use the
10080 // <filename>gio-unix-2.0.pc</filename> pkg-config file when using it.
10081 struct FileDescriptorBased {
10083 // Gets the underlying file descriptor.
10084 // RETURNS: The file descriptor
10085 int get_fd() {
10086 return g_file_descriptor_based_get_fd(&this);
10090 struct FileDescriptorBasedIface {
10091 GObject2.TypeInterface g_iface;
10092 // RETURNS: The file descriptor
10093 extern (C) int function (FileDescriptorBased* fd_based) get_fd;
10097 // #GFileEnumerator allows you to operate on a set of #GFile<!-- -->s,
10098 // returning a #GFileInfo structure for each file enumerated (e.g.
10099 // g_file_enumerate_children() will return a #GFileEnumerator for each
10100 // of the children within a directory).
10102 // To get the next file's information from a #GFileEnumerator, use
10103 // g_file_enumerator_next_file() or its asynchronous version,
10104 // g_file_enumerator_next_files_async(). Note that the asynchronous
10105 // version will return a list of #GFileInfo<!---->s, whereas the
10106 // synchronous will only return the next file in the enumerator.
10108 // To close a #GFileEnumerator, use g_file_enumerator_close(), or
10109 // its asynchronous version, g_file_enumerator_close_async(). Once
10110 // a #GFileEnumerator is closed, no further actions may be performed
10111 // on it, and it should be freed with g_object_unref().
10112 struct FileEnumerator /* : GObject.Object */ {
10113 alias parent_instance this;
10114 alias parent_instance super_;
10115 alias parent_instance object;
10116 GObject2.Object parent_instance;
10117 private FileEnumeratorPrivate* priv;
10120 // Releases all resources used by this enumerator, making the
10121 // enumerator return %G_IO_ERROR_CLOSED on all calls.
10123 // This will be automatically called when the last reference
10124 // is dropped, but you might want to call this function to make
10125 // sure resources are released as early as possible.
10126 // RETURNS: #TRUE on success or #FALSE on error.
10127 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10128 int close(Cancellable* cancellable, GLib2.Error** error=null) {
10129 return g_file_enumerator_close(&this, cancellable, error);
10132 // Asynchronously closes the file enumerator.
10134 // If @cancellable is not %NULL, then the operation can be cancelled by
10135 // triggering the cancellable object from another thread. If the operation
10136 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned in
10137 // g_file_enumerator_close_finish().
10138 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10139 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10140 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10141 // <user_data>: the data to pass to callback function
10142 void close_async(int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
10143 g_file_enumerator_close_async(&this, io_priority, cancellable, callback, user_data);
10146 // Finishes closing a file enumerator, started from g_file_enumerator_close_async().
10148 // If the file enumerator was already closed when g_file_enumerator_close_async()
10149 // was called, then this function will report %G_IO_ERROR_CLOSED in @error, and
10150 // return %FALSE. If the file enumerator had pending operation when the close
10151 // operation was started, then this function will report %G_IO_ERROR_PENDING, and
10152 // return %FALSE. If @cancellable was not %NULL, then the operation may have been
10153 // cancelled by triggering the cancellable object from another thread. If the operation
10154 // was cancelled, the error %G_IO_ERROR_CANCELLED will be set, and %FALSE will be
10155 // returned.
10156 // RETURNS: %TRUE if the close operation has finished successfully.
10157 // <result>: a #GAsyncResult.
10158 int close_finish(AsyncResult* result, GLib2.Error** error=null) {
10159 return g_file_enumerator_close_finish(&this, result, error);
10162 // Get the #GFile container which is being enumerated.
10163 // RETURNS: the #GFile which is being enumerated.
10164 File* get_container() {
10165 return g_file_enumerator_get_container(&this);
10168 // Checks if the file enumerator has pending operations.
10169 // RETURNS: %TRUE if the @enumerator has pending operations.
10170 int has_pending() {
10171 return g_file_enumerator_has_pending(&this);
10174 // Checks if the file enumerator has been closed.
10175 // RETURNS: %TRUE if the @enumerator is closed.
10176 int is_closed() {
10177 return g_file_enumerator_is_closed(&this);
10180 // Returns information for the next file in the enumerated object.
10181 // Will block until the information is available. The #GFileInfo
10182 // returned from this function will contain attributes that match the
10183 // attribute string that was passed when the #GFileEnumerator was created.
10185 // On error, returns %NULL and sets @error to the error. If the
10186 // enumerator is at the end, %NULL will be returned and @error will
10187 // be unset.
10189 // Free the returned object with g_object_unref() when no longer needed.
10190 // RETURNS: A #GFileInfo or %NULL on error or end of enumerator.
10191 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10192 FileInfo* /*new*/ next_file(Cancellable* cancellable, GLib2.Error** error=null) {
10193 return g_file_enumerator_next_file(&this, cancellable, error);
10196 // Request information for a number of files from the enumerator asynchronously.
10197 // When all i/o for the operation is finished the @callback will be called with
10198 // the requested information.
10200 // The callback can be called with less than @num_files files in case of error
10201 // or at the end of the enumerator. In case of a partial error the callback will
10202 // be called with any succeeding items and no error, and on the next request the
10203 // error will be reported. If a request is cancelled the callback will be called
10204 // with %G_IO_ERROR_CANCELLED.
10206 // During an async request no other sync and async calls are allowed, and will
10207 // result in %G_IO_ERROR_PENDING errors.
10209 // Any outstanding i/o request with higher priority (lower numerical value) will
10210 // be executed before an outstanding request with lower priority. Default
10211 // priority is %G_PRIORITY_DEFAULT.
10212 // <num_files>: the number of file info objects to request
10213 // <io_priority>: the <link linkend="gioscheduler">io priority</link> of the request.
10214 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10215 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10216 // <user_data>: the data to pass to callback function
10217 void next_files_async(int num_files, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
10218 g_file_enumerator_next_files_async(&this, num_files, io_priority, cancellable, callback, user_data);
10221 // Finishes the asynchronous operation started with g_file_enumerator_next_files_async().
10223 // g_list_free() and unref the infos with g_object_unref() when you're
10224 // done with them.
10225 // RETURNS: a #GList of #GFileInfo<!---->s. You must free the list with
10226 // <result>: a #GAsyncResult.
10227 GLib2.List* /*new*/ next_files_finish(AsyncResult* result, GLib2.Error** error=null) {
10228 return g_file_enumerator_next_files_finish(&this, result, error);
10231 // Sets the file enumerator as having pending operations.
10232 // <pending>: a boolean value.
10233 void set_pending(int pending) {
10234 g_file_enumerator_set_pending(&this, pending);
10238 struct FileEnumeratorClass {
10239 GObject2.ObjectClass parent_class;
10241 // RETURNS: A #GFileInfo or %NULL on error or end of enumerator.
10242 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10243 extern (C) FileInfo* /*new*/ function (FileEnumerator* enumerator, Cancellable* cancellable, GLib2.Error** error=null) next_file;
10244 extern (C) int function (FileEnumerator* enumerator, Cancellable* cancellable, GLib2.Error** error=null) close_fn;
10246 // <num_files>: the number of file info objects to request
10247 // <io_priority>: the <link linkend="gioscheduler">io priority</link> of the request.
10248 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10249 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10250 // <user_data>: the data to pass to callback function
10251 extern (C) void function (FileEnumerator* enumerator, int num_files, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) next_files_async;
10253 // RETURNS: a #GList of #GFileInfo<!---->s. You must free the list with
10254 // <result>: a #GAsyncResult.
10255 extern (C) GLib2.List* /*new*/ function (FileEnumerator* enumerator, AsyncResult* result, GLib2.Error** error=null) next_files_finish;
10257 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10258 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10259 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10260 // <user_data>: the data to pass to callback function
10261 extern (C) void function (FileEnumerator* enumerator, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) close_async;
10263 // RETURNS: %TRUE if the close operation has finished successfully.
10264 // <result>: a #GAsyncResult.
10265 extern (C) int function (FileEnumerator* enumerator, AsyncResult* result, GLib2.Error** error=null) close_finish;
10266 extern (C) void function () _g_reserved1;
10267 extern (C) void function () _g_reserved2;
10268 extern (C) void function () _g_reserved3;
10269 extern (C) void function () _g_reserved4;
10270 extern (C) void function () _g_reserved5;
10271 extern (C) void function () _g_reserved6;
10272 extern (C) void function () _g_reserved7;
10275 struct FileEnumeratorPrivate {
10279 // GFileIOStream provides io streams that both read and write to the same
10280 // file handle.
10282 // GFileIOStream implements #GSeekable, which allows the io
10283 // stream to jump to arbitrary positions in the file and to truncate
10284 // the file, provided the filesystem of the file supports these
10285 // operations.
10287 // To find the position of a file io stream, use
10288 // g_seekable_tell().
10290 // To find out if a file io stream supports seeking, use g_seekable_can_seek().
10291 // To position a file io stream, use g_seekable_seek().
10292 // To find out if a file io stream supports truncating, use
10293 // g_seekable_can_truncate(). To truncate a file io
10294 // stream, use g_seekable_truncate().
10296 // The default implementation of all the #GFileIOStream operations
10297 // and the implementation of #GSeekable just call into the same operations
10298 // on the output stream.
10299 struct FileIOStream /* : IOStream */ {
10300 alias parent_instance this;
10301 alias parent_instance super_;
10302 alias parent_instance iostream;
10303 IOStream parent_instance;
10304 private FileIOStreamPrivate* priv;
10307 // Gets the entity tag for the file when it has been written.
10308 // This must be called after the stream has been written
10309 // and closed, as the etag can change while writing.
10310 // RETURNS: the entity tag for the stream.
10311 char* /*new*/ get_etag() {
10312 return g_file_io_stream_get_etag(&this);
10315 // Queries a file io stream for the given @attributes.
10316 // This function blocks while querying the stream. For the asynchronous
10317 // version of this function, see g_file_io_stream_query_info_async().
10318 // While the stream is blocked, the stream will set the pending flag
10319 // internally, and any other operations on the stream will fail with
10320 // %G_IO_ERROR_PENDING.
10322 // Can fail if the stream was already closed (with @error being set to
10323 // %G_IO_ERROR_CLOSED), the stream has pending operations (with @error being
10324 // set to %G_IO_ERROR_PENDING), or if querying info is not supported for
10325 // the stream's interface (with @error being set to %G_IO_ERROR_NOT_SUPPORTED). I
10326 // all cases of failure, %NULL will be returned.
10328 // If @cancellable is not %NULL, then the operation can be cancelled by
10329 // triggering the cancellable object from another thread. If the operation
10330 // was cancelled, the error %G_IO_ERROR_CANCELLED will be set, and %NULL will
10331 // be returned.
10332 // RETURNS: a #GFileInfo for the @stream, or %NULL on error.
10333 // <attributes>: a file attribute query string.
10334 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10335 FileInfo* /*new*/ query_info(char* attributes, Cancellable* cancellable, GLib2.Error** error=null) {
10336 return g_file_io_stream_query_info(&this, attributes, cancellable, error);
10339 // Asynchronously queries the @stream for a #GFileInfo. When completed,
10340 // @callback will be called with a #GAsyncResult which can be used to
10341 // finish the operation with g_file_io_stream_query_info_finish().
10343 // For the synchronous version of this function, see
10344 // g_file_io_stream_query_info().
10345 // <attributes>: a file attribute query string.
10346 // <io_priority>: the <link linkend="gio-GIOScheduler">I/O priority</link> of the request.
10347 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10348 // <callback>: callback to call when the request is satisfied
10349 // <user_data>: the data to pass to callback function
10350 void query_info_async(char* attributes, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
10351 g_file_io_stream_query_info_async(&this, attributes, io_priority, cancellable, callback, user_data);
10354 // Finalizes the asynchronous query started
10355 // by g_file_io_stream_query_info_async().
10356 // RETURNS: A #GFileInfo for the finished query.
10357 // <result>: a #GAsyncResult.
10358 FileInfo* /*new*/ query_info_finish(AsyncResult* result, GLib2.Error** error=null) {
10359 return g_file_io_stream_query_info_finish(&this, result, error);
10363 struct FileIOStreamClass {
10364 IOStreamClass parent_class;
10365 extern (C) long function (FileIOStream* stream) tell;
10366 extern (C) int function (FileIOStream* stream) can_seek;
10367 extern (C) int function (FileIOStream* stream, long offset, GLib2.SeekType type, Cancellable* cancellable, GLib2.Error** error=null) seek;
10368 extern (C) int function (FileIOStream* stream) can_truncate;
10369 extern (C) int function (FileIOStream* stream, long size, Cancellable* cancellable, GLib2.Error** error=null) truncate_fn;
10371 // RETURNS: a #GFileInfo for the @stream, or %NULL on error.
10372 // <attributes>: a file attribute query string.
10373 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10374 extern (C) FileInfo* /*new*/ function (FileIOStream* stream, char* attributes, Cancellable* cancellable, GLib2.Error** error=null) query_info;
10376 // <attributes>: a file attribute query string.
10377 // <io_priority>: the <link linkend="gio-GIOScheduler">I/O priority</link> of the request.
10378 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10379 // <callback>: callback to call when the request is satisfied
10380 // <user_data>: the data to pass to callback function
10381 extern (C) void function (FileIOStream* stream, char* attributes, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) query_info_async;
10383 // RETURNS: A #GFileInfo for the finished query.
10384 // <result>: a #GAsyncResult.
10385 extern (C) FileInfo* /*new*/ function (FileIOStream* stream, AsyncResult* result, GLib2.Error** error=null) query_info_finish;
10386 // RETURNS: the entity tag for the stream.
10387 extern (C) char* /*new*/ function (FileIOStream* stream) get_etag;
10388 extern (C) void function () _g_reserved1;
10389 extern (C) void function () _g_reserved2;
10390 extern (C) void function () _g_reserved3;
10391 extern (C) void function () _g_reserved4;
10392 extern (C) void function () _g_reserved5;
10395 struct FileIOStreamPrivate {
10399 // #GFileIcon specifies an icon by pointing to an image file
10400 // to be used as icon.
10401 struct FileIcon /* : GObject.Object */ {
10402 alias method_parent this;
10403 alias method_parent super_;
10404 alias method_parent object;
10405 GObject2.Object method_parent;
10408 // Gets the #GFile associated with the given @icon.
10409 // RETURNS: a #GFile, or %NULL.
10410 File* get_file() {
10411 return g_file_icon_get_file(&this);
10415 struct FileIconClass {
10418 // An interface for writing VFS file handles.
10419 struct FileIface {
10420 GObject2.TypeInterface g_iface;
10421 // RETURNS: a new #GFile that is a duplicate of the given #GFile.
10422 extern (C) File* /*new*/ function (File* file) dup;
10423 // RETURNS: 0 if @file is not a valid #GFile, otherwise an
10424 extern (C) uint function (File* file) hash;
10426 // RETURNS: %TRUE if @file1 and @file2 are equal.
10427 // <file2>: the second #GFile.
10428 extern (C) int function (File* file1, File* file2) equal;
10429 // RETURNS: %TRUE if file is native.
10430 extern (C) int function (File* file) is_native;
10432 // RETURNS: %TRUE if #GFile's backend supports the
10433 // <uri_scheme>: a string containing a URI scheme.
10434 extern (C) int function (File* file, char* uri_scheme) has_uri_scheme;
10435 // RETURNS: a string containing the URI scheme for the given
10436 extern (C) char* /*new*/ function (File* file) get_uri_scheme;
10437 // RETURNS: string containing the #GFile's base name, or %NULL
10438 extern (C) char* /*new*/ function (File* file) get_basename;
10439 // RETURNS: string containing the #GFile's path, or %NULL if
10440 extern (C) char* /*new*/ function (File* file) get_path;
10441 // RETURNS: a string containing the #GFile's URI.
10442 extern (C) char* /*new*/ function (File* file) get_uri;
10443 // RETURNS: a string containing the #GFile's parse name. The returned
10444 extern (C) char* /*new*/ function (File* file) get_parse_name;
10445 // RETURNS: a #GFile structure to the parent of the given
10446 extern (C) File* /*new*/ function (File* file) get_parent;
10448 // RETURNS: %TRUE if the @files's parent, grandparent, etc is @prefix.
10449 // <file>: input #GFile.
10450 extern (C) int function (File* prefix, File* file) prefix_matches;
10452 // RETURNS: string with the relative path from @descendant
10453 // <descendant>: input #GFile.
10454 extern (C) char* /*new*/ function (File* parent, File* descendant) get_relative_path;
10456 // RETURNS: #GFile to the resolved path. %NULL if @relative_path
10457 // <relative_path>: a given relative path string.
10458 extern (C) File* /*new*/ function (File* file, char* relative_path) resolve_relative_path;
10460 // RETURNS: a #GFile to the specified child, or
10461 // <display_name>: string to a possible child.
10462 extern (C) File* /*new*/ function (File* file, char* display_name, GLib2.Error** error=null) get_child_for_display_name;
10464 // RETURNS: A #GFileEnumerator if successful, %NULL on error.
10465 // <attributes>: an attribute query string.
10466 // <flags>: a set of #GFileQueryInfoFlags.
10467 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10468 extern (C) FileEnumerator* /*new*/ function (File* file, char* attributes, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) enumerate_children;
10470 // <attributes>: an attribute query string.
10471 // <flags>: a set of #GFileQueryInfoFlags.
10472 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10473 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10474 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10475 // <user_data>: the data to pass to callback function
10476 extern (C) void function (File* file, char* attributes, FileQueryInfoFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) enumerate_children_async;
10478 // RETURNS: a #GFileEnumerator or %NULL if an error occurred.
10479 // <res>: a #GAsyncResult.
10480 extern (C) FileEnumerator* /*new*/ function (File* file, AsyncResult* res, GLib2.Error** error=null) enumerate_children_finish;
10482 // RETURNS: a #GFileInfo for the given @file, or %NULL on error.
10483 // <attributes>: an attribute query string.
10484 // <flags>: a set of #GFileQueryInfoFlags.
10485 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10486 extern (C) FileInfo* /*new*/ function (File* file, char* attributes, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) query_info;
10488 // <attributes>: an attribute query string.
10489 // <flags>: a set of #GFileQueryInfoFlags.
10490 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10491 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10492 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10493 // <user_data>: the data to pass to callback function
10494 extern (C) void function (File* file, char* attributes, FileQueryInfoFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) query_info_async;
10496 // RETURNS: #GFileInfo for given @file or %NULL on error.
10497 // <res>: a #GAsyncResult.
10498 extern (C) FileInfo* /*new*/ function (File* file, AsyncResult* res, GLib2.Error** error=null) query_info_finish;
10500 // RETURNS: a #GFileInfo or %NULL if there was an error.
10501 // <attributes>: an attribute query string.
10502 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10503 extern (C) FileInfo* /*new*/ function (File* file, char* attributes, Cancellable* cancellable, GLib2.Error** error=null) query_filesystem_info;
10505 // <attributes>: an attribute query string.
10506 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10507 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10508 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10509 // <user_data>: the data to pass to callback function
10510 extern (C) void function (File* file, char* attributes, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) query_filesystem_info_async;
10512 // RETURNS: #GFileInfo for given @file or %NULL on error.
10513 // <res>: a #GAsyncResult.
10514 extern (C) FileInfo* /*new*/ function (File* file, AsyncResult* res, GLib2.Error** error=null) query_filesystem_info_finish;
10516 // RETURNS: a #GMount where the @file is located or %NULL on error.
10517 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10518 extern (C) Mount* /*new*/ function (File* file, Cancellable* cancellable, GLib2.Error** error=null) find_enclosing_mount;
10520 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10521 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10522 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10523 // <user_data>: the data to pass to callback function
10524 extern (C) void function (File* file, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) find_enclosing_mount_async;
10526 // RETURNS: #GMount for given @file or %NULL on error.
10527 // <res>: a #GAsyncResult
10528 extern (C) Mount* /*new*/ function (File* file, AsyncResult* res, GLib2.Error** error=null) find_enclosing_mount_finish;
10530 // RETURNS: a #GFile specifying what @file was renamed to, or %NULL
10531 // <display_name>: a string.
10532 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10533 extern (C) File* /*new*/ function (File* file, char* display_name, Cancellable* cancellable, GLib2.Error** error=null) set_display_name;
10535 // <display_name>: a string.
10536 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10537 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10538 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10539 // <user_data>: the data to pass to callback function
10540 extern (C) void function (File* file, char* display_name, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) set_display_name_async;
10542 // RETURNS: a #GFile or %NULL on error.
10543 // <res>: a #GAsyncResult.
10544 extern (C) File* /*new*/ function (File* file, AsyncResult* res, GLib2.Error** error=null) set_display_name_finish;
10546 // RETURNS: a #GFileAttributeInfoList describing the settable attributes.
10547 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10548 extern (C) FileAttributeInfoList* /*new*/ function (File* file, Cancellable* cancellable, GLib2.Error** error=null) query_settable_attributes;
10549 extern (C) void function () _query_settable_attributes_async;
10550 extern (C) void function () _query_settable_attributes_finish;
10552 // RETURNS: a #GFileAttributeInfoList describing the writable namespaces.
10553 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10554 extern (C) FileAttributeInfoList* /*new*/ function (File* file, Cancellable* cancellable, GLib2.Error** error=null) query_writable_namespaces;
10555 extern (C) void function () _query_writable_namespaces_async;
10556 extern (C) void function () _query_writable_namespaces_finish;
10558 // RETURNS: %TRUE if the attribute was set, %FALSE otherwise.
10559 // <attribute>: a string containing the attribute's name.
10560 // <type>: The type of the attribute
10561 // <value_p>: a pointer to the value (or the pointer itself if the type is a pointer type)
10562 // <flags>: a set of #GFileQueryInfoFlags.
10563 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10564 extern (C) int function (File* file, char* attribute, FileAttributeType type, void* value_p, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) set_attribute;
10566 // RETURNS: %TRUE if there was any error, %FALSE otherwise.
10567 // <info>: a #GFileInfo.
10568 // <flags>: #GFileQueryInfoFlags
10569 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10570 extern (C) int function (File* file, FileInfo* info, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) set_attributes_from_info;
10572 // <info>: a #GFileInfo.
10573 // <flags>: a #GFileQueryInfoFlags.
10574 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10575 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10576 // <callback>: a #GAsyncReadyCallback.
10577 // <user_data>: a #gpointer.
10578 extern (C) void function (File* file, FileInfo* info, FileQueryInfoFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) set_attributes_async;
10580 // RETURNS: %TRUE if the attributes were set correctly, %FALSE otherwise.
10581 // <result>: a #GAsyncResult.
10582 // <info>: a #GFileInfo.
10583 extern (C) int function (File* file, AsyncResult* result, /*out*/ FileInfo** info, GLib2.Error** error=null) set_attributes_finish;
10585 // RETURNS: #GFileInputStream or %NULL on error.
10586 // <cancellable>: a #GCancellable
10587 extern (C) FileInputStream* /*new*/ function (File* file, Cancellable* cancellable, GLib2.Error** error=null) read_fn;
10589 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10590 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10591 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10592 // <user_data>: the data to pass to callback function
10593 extern (C) void function (File* file, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) read_async;
10595 // RETURNS: a #GFileInputStream or %NULL on error.
10596 // <res>: a #GAsyncResult.
10597 extern (C) FileInputStream* /*new*/ function (File* file, AsyncResult* res, GLib2.Error** error=null) read_finish;
10599 // RETURNS: a #GFileOutputStream, or %NULL on error.
10600 // <flags>: a set of #GFileCreateFlags.
10601 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10602 extern (C) FileOutputStream* /*new*/ function (File* file, FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error=null) append_to;
10604 // <flags>: a set of #GFileCreateFlags.
10605 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10606 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10607 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10608 // <user_data>: the data to pass to callback function
10609 extern (C) void function (File* file, FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) append_to_async;
10611 // RETURNS: a valid #GFileOutputStream or %NULL on error.
10612 // <res>: #GAsyncResult
10613 extern (C) FileOutputStream* /*new*/ function (File* file, AsyncResult* res, GLib2.Error** error=null) append_to_finish;
10615 // RETURNS: a #GFileOutputStream for the newly created file, or
10616 // <flags>: a set of #GFileCreateFlags.
10617 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10618 extern (C) FileOutputStream* /*new*/ function (File* file, FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error=null) create;
10620 // <flags>: a set of #GFileCreateFlags.
10621 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10622 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10623 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10624 // <user_data>: the data to pass to callback function
10625 extern (C) void function (File* file, FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) create_async;
10627 // RETURNS: a #GFileOutputStream or %NULL on error.
10628 // <res>: a #GAsyncResult.
10629 extern (C) FileOutputStream* /*new*/ function (File* file, AsyncResult* res, GLib2.Error** error=null) create_finish;
10631 // RETURNS: a #GFileOutputStream or %NULL on error.
10632 // <etag>: an optional <link linkend="gfile-etag">entity tag</link> for the current #GFile, or #NULL to ignore.
10633 // <make_backup>: %TRUE if a backup should be created.
10634 // <flags>: a set of #GFileCreateFlags.
10635 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10636 extern (C) FileOutputStream* /*new*/ function (File* file, char* etag, int make_backup, FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error=null) replace;
10638 // <etag>: an <link linkend="gfile-etag">entity tag</link> for the current #GFile, or NULL to ignore.
10639 // <make_backup>: %TRUE if a backup should be created.
10640 // <flags>: a set of #GFileCreateFlags.
10641 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10642 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10643 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10644 // <user_data>: the data to pass to callback function
10645 extern (C) void function (File* file, char* etag, int make_backup, FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) replace_async;
10647 // RETURNS: a #GFileOutputStream, or %NULL on error.
10648 // <res>: a #GAsyncResult.
10649 extern (C) FileOutputStream* /*new*/ function (File* file, AsyncResult* res, GLib2.Error** error=null) replace_finish;
10651 // RETURNS: %TRUE if the file was deleted. %FALSE otherwise.
10652 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10653 extern (C) int function (File* file, Cancellable* cancellable, GLib2.Error** error=null) delete_file;
10654 extern (C) void function () _delete_file_async;
10655 extern (C) void function () _delete_file_finish;
10657 // RETURNS: %TRUE on successful trash, %FALSE otherwise.
10658 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10659 extern (C) int function (File* file, Cancellable* cancellable, GLib2.Error** error=null) trash;
10660 extern (C) void function () _trash_async;
10661 extern (C) void function () _trash_finish;
10663 // RETURNS: %TRUE on successful creation, %FALSE otherwise.
10664 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10665 extern (C) int function (File* file, Cancellable* cancellable, GLib2.Error** error=null) make_directory;
10666 extern (C) void function () _make_directory_async;
10667 extern (C) void function () _make_directory_finish;
10669 // RETURNS: %TRUE on the creation of a new symlink, %FALSE otherwise.
10670 // <symlink_value>: a string with the path for the target of the new symlink
10671 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10672 extern (C) int function (File* file, char* symlink_value, Cancellable* cancellable, GLib2.Error** error=null) make_symbolic_link;
10673 extern (C) void function () _make_symbolic_link_async;
10674 extern (C) void function () _make_symbolic_link_finish;
10676 // RETURNS: %TRUE on success, %FALSE otherwise.
10677 // <destination>: destination #GFile
10678 // <flags>: set of #GFileCopyFlags
10679 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10680 // <progress_callback>: function to callback with progress information
10681 // <progress_callback_data>: user data to pass to @progress_callback
10682 extern (C) int function (File* source, File* destination, FileCopyFlags flags, Cancellable* cancellable, FileProgressCallback progress_callback, void* progress_callback_data, GLib2.Error** error=null) copy;
10684 // Unintrospectable functionp: copy_async() / ()
10686 // <destination>: destination #GFile
10687 // <flags>: set of #GFileCopyFlags
10688 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10689 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10690 // <progress_callback>: function to callback with progress information
10691 // <progress_callback_data>: user data to pass to @progress_callback
10692 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10693 // <user_data>: the data to pass to callback function
10694 extern (C) void function (File* source, File* destination, FileCopyFlags flags, int io_priority, Cancellable* cancellable, FileProgressCallback progress_callback, void* progress_callback_data, AsyncReadyCallback callback, void* user_data) copy_async;
10696 // RETURNS: a %TRUE on success, %FALSE on error.
10697 // <res>: a #GAsyncResult.
10698 extern (C) int function (File* file, AsyncResult* res, GLib2.Error** error=null) copy_finish;
10700 // RETURNS: %TRUE on successful move, %FALSE otherwise.
10701 // <destination>: #GFile pointing to the destination location.
10702 // <flags>: set of #GFileCopyFlags.
10703 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10704 // <progress_callback>: #GFileProgressCallback function for updates.
10705 // <progress_callback_data>: gpointer to user data for the callback function.
10706 extern (C) int function (File* source, File* destination, FileCopyFlags flags, Cancellable* cancellable, FileProgressCallback progress_callback, void* progress_callback_data, GLib2.Error** error=null) move;
10707 extern (C) void function () _move_async;
10708 extern (C) void function () _move_finish;
10710 // <flags>: flags affecting the operation
10711 // <mount_operation>: a #GMountOperation, or %NULL to avoid user interaction.
10712 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10713 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
10714 // <user_data>: the data to pass to callback function
10715 extern (C) void function (File* file, MountMountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) mount_mountable;
10717 // RETURNS: a #GFile or %NULL on error.
10718 // <result>: a #GAsyncResult.
10719 extern (C) File* /*new*/ function (File* file, AsyncResult* result, GLib2.Error** error=null) mount_mountable_finish;
10721 // <flags>: flags affecting the operation
10722 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10723 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
10724 // <user_data>: the data to pass to callback function
10725 extern (C) void function (File* file, MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) unmount_mountable;
10727 // RETURNS: %TRUE if the operation finished successfully. %FALSE
10728 // <result>: a #GAsyncResult.
10729 extern (C) int function (File* file, AsyncResult* result, GLib2.Error** error=null) unmount_mountable_finish;
10731 // <flags>: flags affecting the operation
10732 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10733 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
10734 // <user_data>: the data to pass to callback function
10735 extern (C) void function (File* file, MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) eject_mountable;
10737 // RETURNS: %TRUE if the @file was ejected successfully. %FALSE
10738 // <result>: a #GAsyncResult.
10739 extern (C) int function (File* file, AsyncResult* result, GLib2.Error** error=null) eject_mountable_finish;
10741 // <flags>: flags affecting the operation
10742 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
10743 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10744 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
10745 // <user_data>: the data to pass to callback function
10746 extern (C) void function (File* location, MountMountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) mount_enclosing_volume;
10748 // RETURNS: %TRUE if successful. If an error
10749 // <result>: a #GAsyncResult.
10750 extern (C) int function (File* location, AsyncResult* result, GLib2.Error** error=null) mount_enclosing_volume_finish;
10752 // RETURNS: a #GFileMonitor for the given @file, or %NULL on error.
10753 // <flags>: a set of #GFileMonitorFlags.
10754 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10755 extern (C) FileMonitor* /*new*/ function (File* file, FileMonitorFlags flags, Cancellable* cancellable, GLib2.Error** error=null) monitor_dir;
10757 // RETURNS: a #GFileMonitor for the given @file, or %NULL on error.
10758 // <flags>: a set of #GFileMonitorFlags.
10759 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10760 extern (C) FileMonitor* /*new*/ function (File* file, FileMonitorFlags flags, Cancellable* cancellable, GLib2.Error** error=null) monitor_file;
10762 // RETURNS: #GFileIOStream or %NULL on error.
10763 // <cancellable>: a #GCancellable
10764 extern (C) FileIOStream* /*new*/ function (File* file, Cancellable* cancellable, GLib2.Error** error=null) open_readwrite;
10766 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10767 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10768 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10769 // <user_data>: the data to pass to callback function
10770 extern (C) void function (File* file, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) open_readwrite_async;
10772 // RETURNS: a #GFileIOStream or %NULL on error.
10773 // <res>: a #GAsyncResult.
10774 extern (C) FileIOStream* /*new*/ function (File* file, AsyncResult* res, GLib2.Error** error=null) open_readwrite_finish;
10776 // RETURNS: a #GFileIOStream for the newly created file, or %NULL on error.
10777 // <flags>: a set of #GFileCreateFlags
10778 // <cancellable>: optional #GCancellable object, %NULL to ignore
10779 extern (C) FileIOStream* /*new*/ function (File* file, FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error=null) create_readwrite;
10781 // <flags>: a set of #GFileCreateFlags
10782 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request
10783 // <cancellable>: optional #GCancellable object, %NULL to ignore
10784 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10785 // <user_data>: the data to pass to callback function
10786 extern (C) void function (File* file, FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) create_readwrite_async;
10788 // RETURNS: a #GFileIOStream or %NULL on error.
10789 // <res>: a #GAsyncResult
10790 extern (C) FileIOStream* /*new*/ function (File* file, AsyncResult* res, GLib2.Error** error=null) create_readwrite_finish;
10792 // RETURNS: a #GFileIOStream or %NULL on error.
10793 // <etag>: an optional <link linkend="gfile-etag">entity tag</link> for the current #GFile, or #NULL to ignore
10794 // <make_backup>: %TRUE if a backup should be created
10795 // <flags>: a set of #GFileCreateFlags
10796 // <cancellable>: optional #GCancellable object, %NULL to ignore
10797 extern (C) FileIOStream* /*new*/ function (File* file, char* etag, int make_backup, FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error=null) replace_readwrite;
10799 // <etag>: an <link linkend="gfile-etag">entity tag</link> for the current #GFile, or NULL to ignore.
10800 // <make_backup>: %TRUE if a backup should be created.
10801 // <flags>: a set of #GFileCreateFlags.
10802 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
10803 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10804 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
10805 // <user_data>: the data to pass to callback function
10806 extern (C) void function (File* file, char* etag, int make_backup, FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) replace_readwrite_async;
10808 // RETURNS: a #GFileIOStream, or %NULL on error.
10809 // <res>: a #GAsyncResult.
10810 extern (C) FileIOStream* /*new*/ function (File* file, AsyncResult* res, GLib2.Error** error=null) replace_readwrite_finish;
10812 // <flags>: flags affecting the operation
10813 // <start_operation>: a #GMountOperation, or %NULL to avoid user interaction.
10814 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10815 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
10816 // <user_data>: the data to pass to callback function
10817 extern (C) void function (File* file, DriveStartFlags flags, MountOperation* start_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) start_mountable;
10819 // RETURNS: %TRUE if the operation finished successfully. %FALSE
10820 // <result>: a #GAsyncResult.
10821 extern (C) int function (File* file, AsyncResult* result, GLib2.Error** error=null) start_mountable_finish;
10823 // <flags>: flags affecting the operation
10824 // <mount_operation>: a #GMountOperation, or %NULL to avoid user interaction.
10825 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10826 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
10827 // <user_data>: the data to pass to callback function
10828 extern (C) void function (File* file, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) stop_mountable;
10830 // RETURNS: %TRUE if the operation finished successfully. %FALSE
10831 // <result>: a #GAsyncResult.
10832 extern (C) int function (File* file, AsyncResult* result, GLib2.Error** error=null) stop_mountable_finish;
10833 int supports_thread_contexts;
10835 // <flags>: flags affecting the operation
10836 // <mount_operation>: a #GMountOperation, or %NULL to avoid user interaction.
10837 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10838 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
10839 // <user_data>: the data to pass to callback function
10840 extern (C) void function (File* file, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) unmount_mountable_with_operation;
10842 // RETURNS: %TRUE if the operation finished successfully. %FALSE
10843 // <result>: a #GAsyncResult.
10844 extern (C) int function (File* file, AsyncResult* result, GLib2.Error** error=null) unmount_mountable_with_operation_finish;
10846 // <flags>: flags affecting the operation
10847 // <mount_operation>: a #GMountOperation, or %NULL to avoid user interaction.
10848 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10849 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
10850 // <user_data>: the data to pass to callback function
10851 extern (C) void function (File* file, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) eject_mountable_with_operation;
10853 // RETURNS: %TRUE if the @file was ejected successfully. %FALSE
10854 // <result>: a #GAsyncResult.
10855 extern (C) int function (File* file, AsyncResult* result, GLib2.Error** error=null) eject_mountable_with_operation_finish;
10857 // <cancellable>: optional #GCancellable object, %NULL to ignore.
10858 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
10859 // <user_data>: the data to pass to callback function
10860 extern (C) void function (File* file, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) poll_mountable;
10862 // RETURNS: %TRUE if the operation finished successfully. %FALSE
10863 // <result>: a #GAsyncResult.
10864 extern (C) int function (File* file, AsyncResult* result, GLib2.Error** error=null) poll_mountable_finish;
10868 // Functionality for manipulating basic metadata for files. #GFileInfo
10869 // implements methods for getting information that all files should
10870 // contain, and allows for manipulation of extended attributes.
10872 // See <link linkend="gio-GFileAttribute">GFileAttribute</link> for more
10873 // information on how GIO handles file attributes.
10875 // To obtain a #GFileInfo for a #GFile, use g_file_query_info() (or its
10876 // async variant). To obtain a #GFileInfo for a file input or output
10877 // stream, use g_file_input_stream_query_info() or
10878 // g_file_output_stream_query_info() (or their async variants).
10880 // To change the actual attributes of a file, you should then set the
10881 // attribute in the #GFileInfo and call g_file_set_attributes_from_info()
10882 // or g_file_set_attributes_async() on a GFile.
10884 // However, not all attributes can be changed in the file. For instance,
10885 // the actual size of a file cannot be changed via g_file_info_set_size().
10886 // You may call g_file_query_settable_attributes() and
10887 // g_file_query_writable_namespaces() to discover the settable attributes
10888 // of a particular file at runtime.
10890 // #GFileAttributeMatcher allows for searching through a #GFileInfo for
10891 // attributes.
10892 struct FileInfo /* : GObject.Object */ {
10893 alias method_parent this;
10894 alias method_parent super_;
10895 alias method_parent object;
10896 GObject2.Object method_parent;
10899 // Creates a new file info structure.
10900 // RETURNS: a #GFileInfo.
10901 static FileInfo* /*new*/ new_() {
10902 return g_file_info_new();
10904 // Clears the status information from @info.
10905 void clear_status() {
10906 g_file_info_clear_status(&this);
10909 // Copies all of the #GFileAttribute<!-- -->s from @src_info to @dest_info.
10910 // <dest_info>: destination to copy attributes to.
10911 void copy_into(FileInfo* dest_info) {
10912 g_file_info_copy_into(&this, dest_info);
10915 // Duplicates a file info structure.
10916 // RETURNS: a duplicate #GFileInfo of @other.
10917 FileInfo* /*new*/ dup() {
10918 return g_file_info_dup(&this);
10921 // Gets the value of a attribute, formated as a string.
10922 // This escapes things as needed to make the string valid
10923 // utf8.
10925 // When you're done with the string it must be freed with g_free().
10926 // RETURNS: a UTF-8 string associated with the given @attribute.
10927 // <attribute>: a file attribute key.
10928 char* /*new*/ get_attribute_as_string(char* attribute) {
10929 return g_file_info_get_attribute_as_string(&this, attribute);
10932 // Gets the value of a boolean attribute. If the attribute does not
10933 // contain a boolean value, %FALSE will be returned.
10934 // RETURNS: the boolean value contained within the attribute.
10935 // <attribute>: a file attribute key.
10936 int get_attribute_boolean(char* attribute) {
10937 return g_file_info_get_attribute_boolean(&this, attribute);
10940 // Gets the value of a byte string attribute. If the attribute does
10941 // not contain a byte string, %NULL will be returned.
10943 // %NULL otherwise.
10944 // RETURNS: the contents of the @attribute value as a byte string, or
10945 // <attribute>: a file attribute key.
10946 char* get_attribute_byte_string(char* attribute) {
10947 return g_file_info_get_attribute_byte_string(&this, attribute);
10950 // Gets the attribute type, value and status for an attribute key.
10952 // %FALSE otherwise.
10953 // RETURNS: %TRUE if @info has an attribute named @attribute,
10954 // <attribute>: a file attribute key
10955 // <type>: return location for the attribute type, or %NULL
10956 // <value_pp>: return location for the attribute value, or %NULL
10957 // <status>: return location for the attribute status, or %NULL
10958 int get_attribute_data(char* attribute, /*out*/ FileAttributeType* type=null, /*out*/ void** value_pp=null, /*out*/ FileAttributeStatus* status=null) {
10959 return g_file_info_get_attribute_data(&this, attribute, type, value_pp, status);
10962 // Gets a signed 32-bit integer contained within the attribute. If the
10963 // attribute does not contain a signed 32-bit integer, or is invalid,
10964 // 0 will be returned.
10965 // RETURNS: a signed 32-bit integer from the attribute.
10966 // <attribute>: a file attribute key.
10967 int get_attribute_int32(char* attribute) {
10968 return g_file_info_get_attribute_int32(&this, attribute);
10971 // Gets a signed 64-bit integer contained within the attribute. If the
10972 // attribute does not contain an signed 64-bit integer, or is invalid,
10973 // 0 will be returned.
10974 // RETURNS: a signed 64-bit integer from the attribute.
10975 // <attribute>: a file attribute key.
10976 long get_attribute_int64(char* attribute) {
10977 return g_file_info_get_attribute_int64(&this, attribute);
10980 // Gets the value of a #GObject attribute. If the attribute does
10981 // not contain a #GObject, %NULL will be returned.
10983 // %NULL otherwise.
10984 // RETURNS: a #GObject associated with the given @attribute, or
10985 // <attribute>: a file attribute key.
10986 GObject2.Object* get_attribute_object(char* attribute) {
10987 return g_file_info_get_attribute_object(&this, attribute);
10990 // Gets the attribute status for an attribute key.
10992 // %G_FILE_ATTRIBUTE_STATUS_UNSET if the key is invalid.
10993 // RETURNS: a #GFileAttributeStatus for the given @attribute, or
10994 // <attribute>: a file attribute key
10995 FileAttributeStatus get_attribute_status(char* attribute) {
10996 return g_file_info_get_attribute_status(&this, attribute);
10999 // Gets the value of a string attribute. If the attribute does
11000 // not contain a string, %NULL will be returned.
11002 // %NULL otherwise.
11003 // RETURNS: the contents of the @attribute value as a UTF-8 string, or
11004 // <attribute>: a file attribute key.
11005 char* get_attribute_string(char* attribute) {
11006 return g_file_info_get_attribute_string(&this, attribute);
11009 // Gets the value of a stringv attribute. If the attribute does
11010 // not contain a stringv, %NULL will be returned.
11012 // %NULL otherwise. Do not free. These returned strings are UTF-8.
11013 // RETURNS: the contents of the @attribute value as a stringv, or
11014 // <attribute>: a file attribute key.
11015 char** get_attribute_stringv(char* attribute) {
11016 return g_file_info_get_attribute_stringv(&this, attribute);
11019 // Gets the attribute type for an attribute key.
11021 // %G_FILE_ATTRIBUTE_TYPE_INVALID if the key is not set.
11022 // RETURNS: a #GFileAttributeType for the given @attribute, or
11023 // <attribute>: a file attribute key.
11024 FileAttributeType get_attribute_type(char* attribute) {
11025 return g_file_info_get_attribute_type(&this, attribute);
11028 // Gets an unsigned 32-bit integer contained within the attribute. If the
11029 // attribute does not contain an unsigned 32-bit integer, or is invalid,
11030 // 0 will be returned.
11031 // RETURNS: an unsigned 32-bit integer from the attribute.
11032 // <attribute>: a file attribute key.
11033 uint get_attribute_uint32(char* attribute) {
11034 return g_file_info_get_attribute_uint32(&this, attribute);
11037 // Gets a unsigned 64-bit integer contained within the attribute. If the
11038 // attribute does not contain an unsigned 64-bit integer, or is invalid,
11039 // 0 will be returned.
11040 // RETURNS: a unsigned 64-bit integer from the attribute.
11041 // <attribute>: a file attribute key.
11042 ulong get_attribute_uint64(char* attribute) {
11043 return g_file_info_get_attribute_uint64(&this, attribute);
11046 // Gets the file's content type.
11047 // RETURNS: a string containing the file's content type.
11048 char* get_content_type() {
11049 return g_file_info_get_content_type(&this);
11052 // Gets a display name for a file.
11053 // RETURNS: a string containing the display name.
11054 char* get_display_name() {
11055 return g_file_info_get_display_name(&this);
11058 // Gets the edit name for a file.
11059 // RETURNS: a string containing the edit name.
11060 char* get_edit_name() {
11061 return g_file_info_get_edit_name(&this);
11064 // Gets the <link linkend="gfile-etag">entity tag</link> for a given
11065 // #GFileInfo. See %G_FILE_ATTRIBUTE_ETAG_VALUE.
11066 // RETURNS: a string containing the value of the "etag:value" attribute.
11067 char* get_etag() {
11068 return g_file_info_get_etag(&this);
11071 // Gets a file's type (whether it is a regular file, symlink, etc).
11072 // This is different from the file's content type, see g_file_info_get_content_type().
11073 // RETURNS: a #GFileType for the given file.
11074 FileType get_file_type() {
11075 return g_file_info_get_file_type(&this);
11078 // Gets the icon for a file.
11079 // RETURNS: #GIcon for the given @info.
11080 Icon* get_icon() {
11081 return g_file_info_get_icon(&this);
11084 // Checks if a file is a backup file.
11085 // RETURNS: %TRUE if file is a backup file, %FALSE otherwise.
11086 int get_is_backup() {
11087 return g_file_info_get_is_backup(&this);
11090 // Checks if a file is hidden.
11091 // RETURNS: %TRUE if the file is a hidden file, %FALSE otherwise.
11092 int get_is_hidden() {
11093 return g_file_info_get_is_hidden(&this);
11096 // Checks if a file is a symlink.
11097 // RETURNS: %TRUE if the given @info is a symlink.
11098 int get_is_symlink() {
11099 return g_file_info_get_is_symlink(&this);
11102 // Gets the modification time of the current @info and sets it
11103 // in @result.
11104 // <result>: a #GTimeVal.
11105 void get_modification_time(GLib2.TimeVal* result) {
11106 g_file_info_get_modification_time(&this, result);
11109 // Gets the name for a file.
11110 // RETURNS: a string containing the file name.
11111 char* get_name() {
11112 return g_file_info_get_name(&this);
11115 // Gets the file's size.
11116 // RETURNS: a #goffset containing the file's size.
11117 long get_size() {
11118 return g_file_info_get_size(&this);
11121 // Gets the value of the sort_order attribute from the #GFileInfo.
11122 // See %G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.
11123 // RETURNS: a #gint32 containing the value of the "standard::sort_order" attribute.
11124 int get_sort_order() {
11125 return g_file_info_get_sort_order(&this);
11128 // Gets the symlink target for a given #GFileInfo.
11129 // RETURNS: a string containing the symlink target.
11130 char* get_symlink_target() {
11131 return g_file_info_get_symlink_target(&this);
11134 // Checks if a file info structure has an attribute named @attribute.
11136 // %FALSE otherwise.
11137 // RETURNS: %TRUE if @Ginfo has an attribute named @attribute,
11138 // <attribute>: a file attribute key.
11139 int has_attribute(char* attribute) {
11140 return g_file_info_has_attribute(&this, attribute);
11143 // Checks if a file info structure has an attribute in the
11144 // specified @name_space.
11146 // %FALSE otherwise.
11147 // RETURNS: %TRUE if @Ginfo has an attribute in @name_space,
11148 // <name_space>: a file attribute namespace.
11149 int has_namespace(char* name_space) {
11150 return g_file_info_has_namespace(&this, name_space);
11153 // Lists the file info structure's attributes.
11155 // possible attribute types for the given @name_space, or
11156 // %NULL on error.
11157 // RETURNS: a null-terminated array of strings of all of the
11158 // <name_space>: a file attribute key's namespace.
11159 char** /*new*/ list_attributes(char* name_space) {
11160 return g_file_info_list_attributes(&this, name_space);
11163 // Removes all cases of @attribute from @info if it exists.
11164 // <attribute>: a file attribute key.
11165 void remove_attribute(char* attribute) {
11166 g_file_info_remove_attribute(&this, attribute);
11169 // Sets the @attribute to contain the given value, if possible.
11170 // <attribute>: a file attribute key.
11171 // <type>: a #GFileAttributeType
11172 // <value_p>: pointer to the value
11173 void set_attribute(char* attribute, FileAttributeType type, void* value_p) {
11174 g_file_info_set_attribute(&this, attribute, type, value_p);
11177 // Sets the @attribute to contain the given @attr_value,
11178 // if possible.
11179 // <attribute>: a file attribute key.
11180 // <attr_value>: a boolean value.
11181 void set_attribute_boolean(char* attribute, int attr_value) {
11182 g_file_info_set_attribute_boolean(&this, attribute, attr_value);
11185 // Sets the @attribute to contain the given @attr_value,
11186 // if possible.
11187 // <attribute>: a file attribute key.
11188 // <attr_value>: a byte string.
11189 void set_attribute_byte_string(char* attribute, char* attr_value) {
11190 g_file_info_set_attribute_byte_string(&this, attribute, attr_value);
11193 // Sets the @attribute to contain the given @attr_value,
11194 // if possible.
11195 // <attribute>: a file attribute key.
11196 // <attr_value>: a signed 32-bit integer
11197 void set_attribute_int32(char* attribute, int attr_value) {
11198 g_file_info_set_attribute_int32(&this, attribute, attr_value);
11201 // Sets the @attribute to contain the given @attr_value,
11202 // if possible.
11203 // <attribute>: attribute name to set.
11204 // <attr_value>: int64 value to set attribute to.
11205 void set_attribute_int64(char* attribute, long attr_value) {
11206 g_file_info_set_attribute_int64(&this, attribute, attr_value);
11209 // Sets @mask on @info to match specific attribute types.
11210 // <mask>: a #GFileAttributeMatcher.
11211 void set_attribute_mask(FileAttributeMatcher* mask) {
11212 g_file_info_set_attribute_mask(&this, mask);
11215 // Sets the @attribute to contain the given @attr_value,
11216 // if possible.
11217 // <attribute>: a file attribute key.
11218 // <attr_value>: a #GObject.
11219 void set_attribute_object(char* attribute, GObject2.Object* attr_value) {
11220 g_file_info_set_attribute_object(&this, attribute, attr_value);
11223 // Sets the attribute status for an attribute key. This is only
11224 // needed by external code that implement g_file_set_attributes_from_info()
11225 // or similar functions.
11227 // The attribute must exist in @info for this to work. Otherwise %FALSE
11228 // is returned and @info is unchanged.
11229 // RETURNS: %TRUE if the status was changed, %FALSE if the key was not set.
11230 // <attribute>: a file attribute key
11231 // <status>: a #GFileAttributeStatus
11232 int set_attribute_status(char* attribute, FileAttributeStatus status) {
11233 return g_file_info_set_attribute_status(&this, attribute, status);
11236 // Sets the @attribute to contain the given @attr_value,
11237 // if possible.
11238 // <attribute>: a file attribute key.
11239 // <attr_value>: a UTF-8 string.
11240 void set_attribute_string(char* attribute, char* attr_value) {
11241 g_file_info_set_attribute_string(&this, attribute, attr_value);
11244 // Sets the @attribute to contain the given @attr_value,
11245 // if possible.
11247 // Sinze: 2.22
11248 // <attribute>: a file attribute key
11249 // <attr_value>: a %NULL terminated array of UTF-8 strings.
11250 void set_attribute_stringv(char* attribute, char** attr_value) {
11251 g_file_info_set_attribute_stringv(&this, attribute, attr_value);
11254 // Sets the @attribute to contain the given @attr_value,
11255 // if possible.
11256 // <attribute>: a file attribute key.
11257 // <attr_value>: an unsigned 32-bit integer.
11258 void set_attribute_uint32(char* attribute, uint attr_value) {
11259 g_file_info_set_attribute_uint32(&this, attribute, attr_value);
11262 // Sets the @attribute to contain the given @attr_value,
11263 // if possible.
11264 // <attribute>: a file attribute key.
11265 // <attr_value>: an unsigned 64-bit integer.
11266 void set_attribute_uint64(char* attribute, ulong attr_value) {
11267 g_file_info_set_attribute_uint64(&this, attribute, attr_value);
11270 // Sets the content type attribute for a given #GFileInfo.
11271 // See %G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.
11272 // <content_type>: a content type. See <link linkend="gio-GContentType">GContentType</link>.
11273 void set_content_type(char* content_type) {
11274 g_file_info_set_content_type(&this, content_type);
11277 // Sets the display name for the current #GFileInfo.
11278 // See %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.
11279 // <display_name>: a string containing a display name.
11280 void set_display_name(char* display_name) {
11281 g_file_info_set_display_name(&this, display_name);
11284 // Sets the edit name for the current file.
11285 // See %G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME.
11286 // <edit_name>: a string containing an edit name.
11287 void set_edit_name(char* edit_name) {
11288 g_file_info_set_edit_name(&this, edit_name);
11291 // Sets the file type in a #GFileInfo to @type.
11292 // See %G_FILE_ATTRIBUTE_STANDARD_TYPE.
11293 // <type>: a #GFileType.
11294 void set_file_type(FileType type) {
11295 g_file_info_set_file_type(&this, type);
11298 // Sets the icon for a given #GFileInfo.
11299 // See %G_FILE_ATTRIBUTE_STANDARD_ICON.
11300 // <icon>: a #GIcon.
11301 void set_icon(Icon* icon) {
11302 g_file_info_set_icon(&this, icon);
11305 // Sets the "is_hidden" attribute in a #GFileInfo according to @is_symlink.
11306 // See %G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.
11307 // <is_hidden>: a #gboolean.
11308 void set_is_hidden(int is_hidden) {
11309 g_file_info_set_is_hidden(&this, is_hidden);
11312 // Sets the "is_symlink" attribute in a #GFileInfo according to @is_symlink.
11313 // See %G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.
11314 // <is_symlink>: a #gboolean.
11315 void set_is_symlink(int is_symlink) {
11316 g_file_info_set_is_symlink(&this, is_symlink);
11319 // Sets the %G_FILE_ATTRIBUTE_TIME_MODIFIED attribute in the file
11320 // info to the given time value.
11321 // <mtime>: a #GTimeVal.
11322 void set_modification_time(GLib2.TimeVal* mtime) {
11323 g_file_info_set_modification_time(&this, mtime);
11326 // Sets the name attribute for the current #GFileInfo.
11327 // See %G_FILE_ATTRIBUTE_STANDARD_NAME.
11328 // <name>: a string containing a name.
11329 void set_name(char* name) {
11330 g_file_info_set_name(&this, name);
11333 // Sets the %G_FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info
11334 // to the given size.
11335 // <size>: a #goffset containing the file's size.
11336 void set_size(long size) {
11337 g_file_info_set_size(&this, size);
11340 // Sets the sort order attribute in the file info structure. See
11341 // %G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.
11342 // <sort_order>: a sort order integer.
11343 void set_sort_order(int sort_order) {
11344 g_file_info_set_sort_order(&this, sort_order);
11347 // Sets the %G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET attribute in the file info
11348 // to the given symlink target.
11349 // <symlink_target>: a static string containing a path to a symlink target.
11350 void set_symlink_target(char* symlink_target) {
11351 g_file_info_set_symlink_target(&this, symlink_target);
11354 // Unsets a mask set by g_file_info_set_attribute_mask(), if one
11355 // is set.
11356 void unset_attribute_mask() {
11357 g_file_info_unset_attribute_mask(&this);
11361 struct FileInfoClass {
11365 // GFileInputStream provides input streams that take their
11366 // content from a file.
11368 // GFileInputStream implements #GSeekable, which allows the input
11369 // stream to jump to arbitrary positions in the file, provided the
11370 // filesystem of the file allows it. To find the position of a file
11371 // input stream, use g_seekable_tell(). To find out if a file input
11372 // stream supports seeking, use g_seekable_stream_can_seek().
11373 // To position a file input stream, use g_seekable_seek().
11374 struct FileInputStream /* : InputStream */ {
11375 alias parent_instance this;
11376 alias parent_instance super_;
11377 alias parent_instance inputstream;
11378 InputStream parent_instance;
11379 private FileInputStreamPrivate* priv;
11382 // Queries a file input stream the given @attributes. This function blocks
11383 // while querying the stream. For the asynchronous (non-blocking) version
11384 // of this function, see g_file_input_stream_query_info_async(). While the
11385 // stream is blocked, the stream will set the pending flag internally, and
11386 // any other operations on the stream will fail with %G_IO_ERROR_PENDING.
11387 // RETURNS: a #GFileInfo, or %NULL on error.
11388 // <attributes>: a file attribute query string.
11389 // <cancellable>: optional #GCancellable object, %NULL to ignore.
11390 FileInfo* /*new*/ query_info(char* attributes, Cancellable* cancellable, GLib2.Error** error=null) {
11391 return g_file_input_stream_query_info(&this, attributes, cancellable, error);
11394 // Queries the stream information asynchronously.
11395 // When the operation is finished @callback will be called.
11396 // You can then call g_file_input_stream_query_info_finish()
11397 // to get the result of the operation.
11399 // For the synchronous version of this function,
11400 // see g_file_input_stream_query_info().
11402 // If @cancellable is not %NULL, then the operation can be cancelled by
11403 // triggering the cancellable object from another thread. If the operation
11404 // was cancelled, the error %G_IO_ERROR_CANCELLED will be set
11405 // <attributes>: a file attribute query string.
11406 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
11407 // <cancellable>: optional #GCancellable object, %NULL to ignore.
11408 // <callback>: callback to call when the request is satisfied
11409 // <user_data>: the data to pass to callback function
11410 void query_info_async(char* attributes, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
11411 g_file_input_stream_query_info_async(&this, attributes, io_priority, cancellable, callback, user_data);
11414 // Finishes an asynchronous info query operation.
11415 // RETURNS: #GFileInfo.
11416 // <result>: a #GAsyncResult.
11417 FileInfo* /*new*/ query_info_finish(AsyncResult* result, GLib2.Error** error=null) {
11418 return g_file_input_stream_query_info_finish(&this, result, error);
11422 struct FileInputStreamClass {
11423 InputStreamClass parent_class;
11424 extern (C) long function (FileInputStream* stream) tell;
11425 extern (C) int function (FileInputStream* stream) can_seek;
11426 extern (C) int function (FileInputStream* stream, long offset, GLib2.SeekType type, Cancellable* cancellable, GLib2.Error** error=null) seek;
11428 // RETURNS: a #GFileInfo, or %NULL on error.
11429 // <attributes>: a file attribute query string.
11430 // <cancellable>: optional #GCancellable object, %NULL to ignore.
11431 extern (C) FileInfo* /*new*/ function (FileInputStream* stream, char* attributes, Cancellable* cancellable, GLib2.Error** error=null) query_info;
11433 // <attributes>: a file attribute query string.
11434 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
11435 // <cancellable>: optional #GCancellable object, %NULL to ignore.
11436 // <callback>: callback to call when the request is satisfied
11437 // <user_data>: the data to pass to callback function
11438 extern (C) void function (FileInputStream* stream, char* attributes, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) query_info_async;
11440 // RETURNS: #GFileInfo.
11441 // <result>: a #GAsyncResult.
11442 extern (C) FileInfo* /*new*/ function (FileInputStream* stream, AsyncResult* result, GLib2.Error** error=null) query_info_finish;
11443 extern (C) void function () _g_reserved1;
11444 extern (C) void function () _g_reserved2;
11445 extern (C) void function () _g_reserved3;
11446 extern (C) void function () _g_reserved4;
11447 extern (C) void function () _g_reserved5;
11450 struct FileInputStreamPrivate {
11454 // Monitors a file or directory for changes.
11456 // To obtain a #GFileMonitor for a file or directory, use
11457 // g_file_monitor(), g_file_monitor_file(), or
11458 // g_file_monitor_directory().
11460 // To get informed about changes to the file or directory you are
11461 // monitoring, connect to the #GFileMonitor::changed signal. The
11462 // signal will be emitted in the <link
11463 // linkend="g-main-context-push-thread-default">thread-default main
11464 // context</link> of the thread that the monitor was created in
11465 // (though if the global default main context is blocked, this may
11466 // cause notifications to be blocked even if the thread-default
11467 // context is still running).
11468 struct FileMonitor /* : GObject.Object */ {
11469 alias parent_instance this;
11470 alias parent_instance super_;
11471 alias parent_instance object;
11472 GObject2.Object parent_instance;
11473 private FileMonitorPrivate* priv;
11476 // Cancels a file monitor.
11477 // RETURNS: %TRUE if monitor was cancelled.
11478 int cancel() {
11479 return g_file_monitor_cancel(&this);
11482 // Emits the #GFileMonitor::changed signal if a change
11483 // has taken place. Should be called from file monitor
11484 // implementations only.
11486 // The signal will be emitted from an idle handler (in the <link
11487 // linkend="g-main-context-push-thread-default">thread-default main
11488 // context</link>).
11489 // <child>: a #GFile.
11490 // <other_file>: a #GFile.
11491 // <event_type>: a set of #GFileMonitorEvent flags.
11492 void emit_event(File* child, File* other_file, FileMonitorEvent event_type) {
11493 g_file_monitor_emit_event(&this, child, other_file, event_type);
11496 // Returns whether the monitor is canceled.
11497 // RETURNS: %TRUE if monitor is canceled. %FALSE otherwise.
11498 int is_cancelled() {
11499 return g_file_monitor_is_cancelled(&this);
11502 // Sets the rate limit to which the @monitor will report
11503 // consecutive change events to the same file.
11504 // <limit_msecs>: a non-negative integer with the limit in milliseconds to poll for changes
11505 void set_rate_limit(int limit_msecs) {
11506 g_file_monitor_set_rate_limit(&this, limit_msecs);
11509 // Emitted when @file has been changed.
11511 // If using #G_FILE_MONITOR_SEND_MOVED flag and @event_type is
11512 // #G_FILE_MONITOR_SEND_MOVED, @file will be set to a #GFile containing the
11513 // old path, and @other_file will be set to a #GFile containing the new path.
11515 // In all the other cases, @other_file will be set to #NULL.
11516 // <file>: a #GFile.
11517 // <other_file>: a #GFile or #NULL.
11518 // <event_type>: a #GFileMonitorEvent.
11519 extern (C) alias static void function (FileMonitor* this_, File* file, File* other_file, FileMonitorEvent* event_type, void* user_data=null) signal_changed;
11521 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
11522 return super_.signal_connect!name(cb, data, cf);
11525 ulong signal_connect(string name:"changed", CB:signal_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
11526 return signal_connect_data(&this, cast(char*)"changed",
11527 cast(GObject2.Callback)cb, data, null, cf);
11531 struct FileMonitorClass {
11532 GObject2.ObjectClass parent_class;
11533 extern (C) void function (FileMonitor* monitor, File* file, File* other_file, FileMonitorEvent event_type) changed;
11534 // RETURNS: %TRUE if monitor was cancelled.
11535 extern (C) int function (FileMonitor* monitor) cancel;
11536 extern (C) void function () _g_reserved1;
11537 extern (C) void function () _g_reserved2;
11538 extern (C) void function () _g_reserved3;
11539 extern (C) void function () _g_reserved4;
11540 extern (C) void function () _g_reserved5;
11543 // Specifies what type of event a monitor event is.
11544 enum FileMonitorEvent {
11545 CHANGED = 0,
11546 CHANGES_DONE_HINT = 1,
11547 DELETED = 2,
11548 CREATED = 3,
11549 ATTRIBUTE_CHANGED = 4,
11550 PRE_UNMOUNT = 5,
11551 UNMOUNTED = 6,
11552 MOVED = 7
11554 // Flags used to set what a #GFileMonitor will watch for.
11555 enum FileMonitorFlags {
11556 NONE = 0,
11557 WATCH_MOUNTS = 1,
11558 SEND_MOVED = 2
11560 struct FileMonitorPrivate {
11564 // GFileOutputStream provides output streams that write their
11565 // content to a file.
11567 // GFileOutputStream implements #GSeekable, which allows the output
11568 // stream to jump to arbitrary positions in the file and to truncate
11569 // the file, provided the filesystem of the file supports these
11570 // operations.
11572 // To find the position of a file output stream, use g_seekable_tell().
11573 // To find out if a file output stream supports seeking, use
11574 // g_seekable_can_seek().To position a file output stream, use
11575 // g_seekable_seek(). To find out if a file output stream supports
11576 // truncating, use g_seekable_can_truncate(). To truncate a file output
11577 // stream, use g_seekable_truncate().
11578 struct FileOutputStream /* : OutputStream */ {
11579 alias parent_instance this;
11580 alias parent_instance super_;
11581 alias parent_instance outputstream;
11582 OutputStream parent_instance;
11583 private FileOutputStreamPrivate* priv;
11586 // Gets the entity tag for the file when it has been written.
11587 // This must be called after the stream has been written
11588 // and closed, as the etag can change while writing.
11589 // RETURNS: the entity tag for the stream.
11590 char* /*new*/ get_etag() {
11591 return g_file_output_stream_get_etag(&this);
11594 // Queries a file output stream for the given @attributes.
11595 // This function blocks while querying the stream. For the asynchronous
11596 // version of this function, see g_file_output_stream_query_info_async().
11597 // While the stream is blocked, the stream will set the pending flag
11598 // internally, and any other operations on the stream will fail with
11599 // %G_IO_ERROR_PENDING.
11601 // Can fail if the stream was already closed (with @error being set to
11602 // %G_IO_ERROR_CLOSED), the stream has pending operations (with @error being
11603 // set to %G_IO_ERROR_PENDING), or if querying info is not supported for
11604 // the stream's interface (with @error being set to %G_IO_ERROR_NOT_SUPPORTED). In
11605 // all cases of failure, %NULL will be returned.
11607 // If @cancellable is not %NULL, then the operation can be cancelled by
11608 // triggering the cancellable object from another thread. If the operation
11609 // was cancelled, the error %G_IO_ERROR_CANCELLED will be set, and %NULL will
11610 // be returned.
11611 // RETURNS: a #GFileInfo for the @stream, or %NULL on error.
11612 // <attributes>: a file attribute query string.
11613 // <cancellable>: optional #GCancellable object, %NULL to ignore.
11614 FileInfo* /*new*/ query_info(char* attributes, Cancellable* cancellable, GLib2.Error** error=null) {
11615 return g_file_output_stream_query_info(&this, attributes, cancellable, error);
11618 // Asynchronously queries the @stream for a #GFileInfo. When completed,
11619 // @callback will be called with a #GAsyncResult which can be used to
11620 // finish the operation with g_file_output_stream_query_info_finish().
11622 // For the synchronous version of this function, see
11623 // g_file_output_stream_query_info().
11624 // <attributes>: a file attribute query string.
11625 // <io_priority>: the <link linkend="gio-GIOScheduler">I/O priority</link> of the request.
11626 // <cancellable>: optional #GCancellable object, %NULL to ignore.
11627 // <callback>: callback to call when the request is satisfied
11628 // <user_data>: the data to pass to callback function
11629 void query_info_async(char* attributes, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
11630 g_file_output_stream_query_info_async(&this, attributes, io_priority, cancellable, callback, user_data);
11633 // Finalizes the asynchronous query started
11634 // by g_file_output_stream_query_info_async().
11635 // RETURNS: A #GFileInfo for the finished query.
11636 // <result>: a #GAsyncResult.
11637 FileInfo* /*new*/ query_info_finish(AsyncResult* result, GLib2.Error** error=null) {
11638 return g_file_output_stream_query_info_finish(&this, result, error);
11642 struct FileOutputStreamClass {
11643 OutputStreamClass parent_class;
11644 extern (C) long function (FileOutputStream* stream) tell;
11645 extern (C) int function (FileOutputStream* stream) can_seek;
11646 extern (C) int function (FileOutputStream* stream, long offset, GLib2.SeekType type, Cancellable* cancellable, GLib2.Error** error=null) seek;
11647 extern (C) int function (FileOutputStream* stream) can_truncate;
11648 extern (C) int function (FileOutputStream* stream, long size, Cancellable* cancellable, GLib2.Error** error=null) truncate_fn;
11650 // RETURNS: a #GFileInfo for the @stream, or %NULL on error.
11651 // <attributes>: a file attribute query string.
11652 // <cancellable>: optional #GCancellable object, %NULL to ignore.
11653 extern (C) FileInfo* /*new*/ function (FileOutputStream* stream, char* attributes, Cancellable* cancellable, GLib2.Error** error=null) query_info;
11655 // <attributes>: a file attribute query string.
11656 // <io_priority>: the <link linkend="gio-GIOScheduler">I/O priority</link> of the request.
11657 // <cancellable>: optional #GCancellable object, %NULL to ignore.
11658 // <callback>: callback to call when the request is satisfied
11659 // <user_data>: the data to pass to callback function
11660 extern (C) void function (FileOutputStream* stream, char* attributes, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) query_info_async;
11662 // RETURNS: A #GFileInfo for the finished query.
11663 // <result>: a #GAsyncResult.
11664 extern (C) FileInfo* /*new*/ function (FileOutputStream* stream, AsyncResult* result, GLib2.Error** error=null) query_info_finish;
11665 // RETURNS: the entity tag for the stream.
11666 extern (C) char* /*new*/ function (FileOutputStream* stream) get_etag;
11667 extern (C) void function () _g_reserved1;
11668 extern (C) void function () _g_reserved2;
11669 extern (C) void function () _g_reserved3;
11670 extern (C) void function () _g_reserved4;
11671 extern (C) void function () _g_reserved5;
11674 struct FileOutputStreamPrivate {
11678 // When doing file operations that may take a while, such as moving
11679 // a file or copying a file, a progress callback is used to pass how
11680 // far along that operation is to the application.
11681 // <current_num_bytes>: the current number of bytes in the operation.
11682 // <total_num_bytes>: the total number of bytes in the operation.
11683 // <user_data>: user data passed to the callback.
11684 extern (C) alias void function (long current_num_bytes, long total_num_bytes, void* user_data) FileProgressCallback;
11686 // Flags used when querying a #GFileInfo.
11687 enum FileQueryInfoFlags {
11688 NONE = 0,
11689 NOFOLLOW_SYMLINKS = 1
11692 // When loading the partial contents of a file with g_file_load_partial_contents_async(),
11693 // it may become necessary to determine if any more data from the file should be loaded.
11694 // A #GFileReadMoreCallback function facilitates this by returning %TRUE if more data
11695 // should be read, or %FALSE otherwise.
11696 // RETURNS: %TRUE if more data should be read back. %FALSE otherwise.
11697 // <file_contents>: the data as currently read.
11698 // <file_size>: the size of the data currently read.
11699 // <callback_data>: data passed to the callback.
11700 extern (C) alias int function (char* file_contents, long file_size, void* callback_data) FileReadMoreCallback;
11702 // Indicates the file's on-disk type.
11703 enum FileType {
11704 UNKNOWN = 0,
11705 REGULAR = 1,
11706 DIRECTORY = 2,
11707 SYMBOLIC_LINK = 3,
11708 SPECIAL = 4,
11709 SHORTCUT = 5,
11710 MOUNTABLE = 6
11713 // Completes partial file and directory names given a partial string by
11714 // looking in the file system for clues. Can return a list of possible
11715 // completion strings for widget implementations.
11716 struct FilenameCompleter /* : GObject.Object */ {
11717 alias method_parent this;
11718 alias method_parent super_;
11719 alias method_parent object;
11720 GObject2.Object method_parent;
11723 // Creates a new filename completer.
11724 // RETURNS: a #GFilenameCompleter.
11725 static FilenameCompleter* /*new*/ new_() {
11726 return g_filename_completer_new();
11729 // Obtains a completion for @initial_text from @completer.
11731 // This string is not owned by GIO, so remember to g_free() it
11732 // when finished.
11733 // RETURNS: a completed string, or %NULL if no completion exists.
11734 // <initial_text>: text to be completed.
11735 char* /*new*/ get_completion_suffix(char* initial_text) {
11736 return g_filename_completer_get_completion_suffix(&this, initial_text);
11739 // Gets an array of completion strings for a given initial text.
11741 // This array must be freed by g_strfreev() when finished.
11742 // RETURNS: array of strings with possible completions for @initial_text.
11743 // <initial_text>: text to be completed.
11744 char** /*new*/ get_completions(char* initial_text) {
11745 return g_filename_completer_get_completions(&this, initial_text);
11748 // If @dirs_only is %TRUE, @completer will only
11749 // complete directory names, and not file names.
11750 // <dirs_only>: a #gboolean.
11751 void set_dirs_only(int dirs_only) {
11752 g_filename_completer_set_dirs_only(&this, dirs_only);
11754 // Emitted when the file name completion information comes available.
11755 extern (C) alias static void function (FilenameCompleter* this_, void* user_data=null) signal_got_completion_data;
11757 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
11758 return super_.signal_connect!name(cb, data, cf);
11761 ulong signal_connect(string name:"got-completion-data", CB:signal_got_completion_data)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
11762 return signal_connect_data(&this, cast(char*)"got-completion-data",
11763 cast(GObject2.Callback)cb, data, null, cf);
11767 struct FilenameCompleterClass {
11768 GObject2.ObjectClass parent_class;
11769 extern (C) void function (FilenameCompleter* filename_completer) got_completion_data;
11770 extern (C) void function () _g_reserved1;
11771 extern (C) void function () _g_reserved2;
11772 extern (C) void function () _g_reserved3;
11776 // Indicates a hint from the file system whether files should be
11777 // previewed in a file manager. Returned as the value of the key
11778 // #G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW.
11779 enum FilesystemPreviewType {
11780 IF_ALWAYS = 0,
11781 IF_LOCAL = 1,
11782 NEVER = 2
11785 // Base class for input stream implementations that perform some
11786 // kind of filtering operation on a base stream. Typical examples
11787 // of filtering operations are character set conversion, compression
11788 // and byte order flipping.
11789 struct FilterInputStream /* : InputStream */ {
11790 alias parent_instance this;
11791 alias parent_instance super_;
11792 alias parent_instance inputstream;
11793 InputStream parent_instance;
11794 InputStream* base_stream;
11797 // Gets the base stream for the filter stream.
11798 // RETURNS: a #GInputStream.
11799 InputStream* get_base_stream() {
11800 return g_filter_input_stream_get_base_stream(&this);
11803 // Returns whether the base stream will be closed when @stream is
11804 // closed.
11805 // RETURNS: %TRUE if the base stream will be closed.
11806 int get_close_base_stream() {
11807 return g_filter_input_stream_get_close_base_stream(&this);
11810 // Sets whether the base stream will be closed when @stream is closed.
11811 // <close_base>: %TRUE to close the base stream.
11812 void set_close_base_stream(int close_base) {
11813 g_filter_input_stream_set_close_base_stream(&this, close_base);
11817 struct FilterInputStreamClass {
11818 InputStreamClass parent_class;
11819 extern (C) void function () _g_reserved1;
11820 extern (C) void function () _g_reserved2;
11821 extern (C) void function () _g_reserved3;
11825 // Base class for output stream implementations that perform some
11826 // kind of filtering operation on a base stream. Typical examples
11827 // of filtering operations are character set conversion, compression
11828 // and byte order flipping.
11829 struct FilterOutputStream /* : OutputStream */ {
11830 alias parent_instance this;
11831 alias parent_instance super_;
11832 alias parent_instance outputstream;
11833 OutputStream parent_instance;
11834 OutputStream* base_stream;
11837 // Gets the base stream for the filter stream.
11838 // RETURNS: a #GOutputStream.
11839 OutputStream* get_base_stream() {
11840 return g_filter_output_stream_get_base_stream(&this);
11843 // Returns whether the base stream will be closed when @stream is
11844 // closed.
11845 // RETURNS: %TRUE if the base stream will be closed.
11846 int get_close_base_stream() {
11847 return g_filter_output_stream_get_close_base_stream(&this);
11850 // Sets whether the base stream will be closed when @stream is closed.
11851 // <close_base>: %TRUE to close the base stream.
11852 void set_close_base_stream(int close_base) {
11853 g_filter_output_stream_set_close_base_stream(&this, close_base);
11857 struct FilterOutputStreamClass {
11858 OutputStreamClass parent_class;
11859 extern (C) void function () _g_reserved1;
11860 extern (C) void function () _g_reserved2;
11861 extern (C) void function () _g_reserved3;
11864 // Error codes returned by GIO functions.
11865 enum IOErrorEnum {
11866 FAILED = 0,
11867 NOT_FOUND = 1,
11868 EXISTS = 2,
11869 IS_DIRECTORY = 3,
11870 NOT_DIRECTORY = 4,
11871 NOT_EMPTY = 5,
11872 NOT_REGULAR_FILE = 6,
11873 NOT_SYMBOLIC_LINK = 7,
11874 NOT_MOUNTABLE_FILE = 8,
11875 FILENAME_TOO_LONG = 9,
11876 INVALID_FILENAME = 10,
11877 TOO_MANY_LINKS = 11,
11878 NO_SPACE = 12,
11879 INVALID_ARGUMENT = 13,
11880 PERMISSION_DENIED = 14,
11881 NOT_SUPPORTED = 15,
11882 NOT_MOUNTED = 16,
11883 ALREADY_MOUNTED = 17,
11884 CLOSED = 18,
11885 CANCELLED = 19,
11886 PENDING = 20,
11887 READ_ONLY = 21,
11888 CANT_CREATE_BACKUP = 22,
11889 WRONG_ETAG = 23,
11890 TIMED_OUT = 24,
11891 WOULD_RECURSE = 25,
11892 BUSY = 26,
11893 WOULD_BLOCK = 27,
11894 HOST_NOT_FOUND = 28,
11895 WOULD_MERGE = 29,
11896 FAILED_HANDLED = 30,
11897 TOO_MANY_OPEN_FILES = 31,
11898 NOT_INITIALIZED = 32,
11899 ADDRESS_IN_USE = 33,
11900 PARTIAL_INPUT = 34,
11901 INVALID_DATA = 35,
11902 DBUS_ERROR = 36,
11903 HOST_UNREACHABLE = 37,
11904 NETWORK_UNREACHABLE = 38,
11905 CONNECTION_REFUSED = 39,
11906 PROXY_FAILED = 40,
11907 PROXY_AUTH_FAILED = 41,
11908 PROXY_NEED_AUTH = 42,
11909 PROXY_NOT_ALLOWED = 43
11911 struct IOExtension {
11913 // Gets the name under which @extension was registered.
11915 // Note that the same type may be registered as extension
11916 // for multiple extension points, under different names.
11917 // RETURNS: the name of @extension.
11918 char* get_name() {
11919 return g_io_extension_get_name(&this);
11922 // Gets the priority with which @extension was registered.
11923 // RETURNS: the priority of @extension
11924 int get_priority() {
11925 return g_io_extension_get_priority(&this);
11928 // Unintrospectable method: ref_class() / g_io_extension_ref_class()
11929 // Gets a reference to the class for the type that is
11930 // associated with @extension.
11931 // RETURNS: the #GTypeClass for the type of @extension
11932 GObject2.TypeClass* /*new*/ ref_class() {
11933 return g_io_extension_ref_class(&this);
11937 struct IOExtensionPoint {
11939 // Finds a #GIOExtension for an extension point by name.
11941 // given name, or %NULL if there is no extension with that name
11942 // RETURNS: the #GIOExtension for @extension_point that has the
11943 // <name>: the name of the extension to get
11944 IOExtension* get_extension_by_name(char* name) {
11945 return g_io_extension_point_get_extension_by_name(&this, name);
11948 // Gets a list of all extensions that implement this extension point.
11949 // The list is sorted by priority, beginning with the highest priority.
11951 // #GIOExtension<!-- -->s. The list is owned by GIO and should not be
11952 // modified.
11953 // RETURNS: a #GList of
11954 GLib2.List* get_extensions() {
11955 return g_io_extension_point_get_extensions(&this);
11958 // Gets the required type for @extension_point.
11960 // or #G_TYPE_INVALID if the extension point has no required type
11961 // RETURNS: the #GType that all implementations must have,
11962 Type get_required_type() {
11963 return g_io_extension_point_get_required_type(&this);
11966 // Sets the required type for @extension_point to @type.
11967 // All implementations must henceforth have this type.
11968 // <type>: the #GType to require
11969 void set_required_type(Type type) {
11970 g_io_extension_point_set_required_type(&this, type);
11973 // Registers @type as extension for the extension point with name
11974 // @extension_point_name.
11976 // If @type has already been registered as an extension for this
11977 // extension point, the existing #GIOExtension object is returned.
11978 // RETURNS: a #GIOExtension object for #GType
11979 // <extension_point_name>: the name of the extension point
11980 // <type>: the #GType to register as extension
11981 // <extension_name>: the name for the extension
11982 // <priority>: the priority for the extension
11983 static IOExtension* implement(char* extension_point_name, Type type, char* extension_name, int priority) {
11984 return g_io_extension_point_implement(extension_point_name, type, extension_name, priority);
11987 // Looks up an existing extension point.
11989 // is no registered extension point with the given name.
11990 // RETURNS: the #GIOExtensionPoint, or %NULL if there
11991 // <name>: the name of the extension point
11992 static IOExtensionPoint* lookup(char* name) {
11993 return g_io_extension_point_lookup(name);
11996 // Registers an extension point.
11998 // owned by GIO and should not be freed.
11999 // RETURNS: the new #GIOExtensionPoint. This object is
12000 // <name>: The name of the extension point
12001 static IOExtensionPoint* register(char* name) {
12002 return g_io_extension_point_register(name);
12007 // Provides an interface and default functions for loading and unloading
12008 // modules. This is used internally to make GIO extensible, but can also
12009 // be used by others to implement module loading.
12010 struct IOModule /* : GObject.TypeModule */ {
12011 alias method_parent this;
12012 alias method_parent super_;
12013 alias method_parent typemodule;
12014 GObject2.TypeModule method_parent;
12017 // Creates a new GIOModule that will load the specific
12018 // shared library when in use.
12020 // or %NULL on error.
12021 // RETURNS: a #GIOModule from given @filename,
12022 // <filename>: filename of the shared library module.
12023 static IOModule* /*new*/ new_(char* filename) {
12024 return g_io_module_new(filename);
12027 // Optional API for GIO modules to implement.
12029 // Should return a list of all the extension points that may be
12030 // implemented in this module.
12032 // This method will not be called in normal use, however it may be
12033 // called when probing existing modules and recording which extension
12034 // points that this model is used for. This means we won't have to
12035 // load and initialze this module unless its needed.
12037 // If this function is not implemented by the module the module will
12038 // always be loaded, initialized and then unloaded on application startup
12039 // so that it can register its extension points during init.
12041 // Note that a module need not actually implement all the extension points
12042 // that g_io_module_query returns, since the exact list of extension may
12043 // depend on runtime issues. However all extension points actually implemented
12044 // must be returned by g_io_module_query() (if defined).
12046 // When installing a module that implements g_io_module_query you must
12047 // run gio-querymodules in order to build the cache files required for
12048 // lazy loading.
12050 // extension points of the module. The array must be suitable for
12051 // freeing with g_strfreev().
12052 // RETURNS: A %NULL-terminated array of strings, listing the supported
12053 static char** /*new*/ query() {
12054 return g_io_module_query();
12057 // Required API for GIO modules to implement.
12058 // This function is ran after the module has been loaded into GIO,
12059 // to initialize the module.
12060 void load() {
12061 g_io_module_load(&this);
12064 // Required API for GIO modules to implement.
12065 // This function is ran when the module is being unloaded from GIO,
12066 // to finalize the module.
12067 void unload() {
12068 g_io_module_unload(&this);
12072 struct IOModuleClass {
12076 // Represents a scope for loading IO modules. A scope can be used for blocking
12077 // duplicate modules, or blocking a module you don't want to load.
12079 // The scope can be used with g_io_modules_load_all_in_directory_with_scope()
12080 // or g_io_modules_scan_all_in_directory_with_scope().
12081 struct IOModuleScope /* Version 2.30 */ {
12083 // Block modules with the given @basename from being loaded when
12084 // this scope is used with g_io_modules_scan_all_in_directory_with_scope()
12085 // or g_io_modules_load_all_in_directory_with_scope().
12086 // <basename>: the basename to block
12087 void block(char* basename) {
12088 g_io_module_scope_block(&this, basename);
12090 // Free a module scope.
12091 void free() {
12092 g_io_module_scope_free(&this);
12095 // Unintrospectable function: new() / g_io_module_scope_new()
12096 // Create a new scope for loading of IO modules. A scope can be used for
12097 // blocking duplicate modules, or blocking a module you don't want to load.
12099 // Specify the %G_IO_MODULES_SCOPE_BLOCK_DUPLICATES flag to block modules
12100 // which have the same base name as a module that has already been seen
12101 // in this scope.
12102 // RETURNS: the new module scope
12103 // <flags>: flags for the new scope
12104 static IOModuleScope* /*new*/ new_(IOModuleScopeFlags flags) {
12105 return g_io_module_scope_new(flags);
12109 // Flags for use with g_io_module_scope_new().
12110 enum IOModuleScopeFlags /* Version 2.30 */ {
12111 NONE = 0,
12112 BLOCK_DUPLICATES = 1
12114 // Opaque class for defining and scheduling IO jobs.
12115 struct IOSchedulerJob {
12117 // Used from an I/O job to send a callback to be run in the thread
12118 // that the job was started from, waiting for the result (and thus
12119 // blocking the I/O job).
12120 // RETURNS: The return value of @func
12121 // <func>: a #GSourceFunc callback that will be called in the original thread
12122 // <user_data>: data to pass to @func
12123 // <notify>: a #GDestroyNotify for @user_data, or %NULL
12124 int send_to_mainloop(GLib2.SourceFunc func, void* user_data, GLib2.DestroyNotify notify) {
12125 return g_io_scheduler_job_send_to_mainloop(&this, func, user_data, notify);
12128 // Used from an I/O job to send a callback to be run asynchronously in
12129 // the thread that the job was started from. The callback will be run
12130 // when the main loop is available, but at that time the I/O job might
12131 // have finished. The return value from the callback is ignored.
12133 // Note that if you are passing the @user_data from g_io_scheduler_push_job()
12134 // on to this function you have to ensure that it is not freed before
12135 // @func is called, either by passing %NULL as @notify to
12136 // g_io_scheduler_push_job() or by using refcounting for @user_data.
12137 // <func>: a #GSourceFunc callback that will be called in the original thread
12138 // <user_data>: data to pass to @func
12139 // <notify>: a #GDestroyNotify for @user_data, or %NULL
12140 void send_to_mainloop_async(GLib2.SourceFunc func, void* user_data, GLib2.DestroyNotify notify) {
12141 g_io_scheduler_job_send_to_mainloop_async(&this, func, user_data, notify);
12146 // I/O Job function.
12148 // Note that depending on whether threads are available, the
12149 // #GIOScheduler may run jobs in separate threads or in an idle
12150 // in the mainloop.
12152 // Long-running jobs should periodically check the @cancellable
12153 // to see if they have been cancelled.
12155 // complete the job, %FALSE if the job is complete (or cancelled)
12156 // RETURNS: %TRUE if this function should be called again to
12157 // <job>: a #GIOSchedulerJob.
12158 // <cancellable>: optional #GCancellable object, %NULL to ignore.
12159 // <user_data>: the data to pass to callback function
12160 extern (C) alias int function (IOSchedulerJob* job, Cancellable* cancellable, void* user_data) IOSchedulerJobFunc;
12163 // GIOStream represents an object that has both read and write streams.
12164 // Generally the two streams acts as separate input and output streams,
12165 // but they share some common resources and state. For instance, for
12166 // seekable streams they may use the same position in both streams.
12168 // Examples of #GIOStream objects are #GSocketConnection which represents
12169 // a two-way network connection, and #GFileIOStream which represent a
12170 // file handle opened in read-write mode.
12172 // To do the actual reading and writing you need to get the substreams
12173 // with g_io_stream_get_input_stream() and g_io_stream_get_output_stream().
12175 // The #GIOStream object owns the input and the output streams, not the other
12176 // way around, so keeping the substreams alive will not keep the #GIOStream
12177 // object alive. If the #GIOStream object is freed it will be closed, thus
12178 // closing the substream, so even if the substreams stay alive they will
12179 // always just return a %G_IO_ERROR_CLOSED for all operations.
12181 // To close a stream use g_io_stream_close() which will close the common
12182 // stream object and also the individual substreams. You can also close
12183 // the substreams themselves. In most cases this only marks the
12184 // substream as closed, so further I/O on it fails. However, some streams
12185 // may support "half-closed" states where one direction of the stream
12186 // is actually shut down.
12187 struct IOStream /* : GObject.Object */ {
12188 alias parent_instance this;
12189 alias parent_instance super_;
12190 alias parent_instance object;
12191 GObject2.Object parent_instance;
12192 private IOStreamPrivate* priv;
12195 // Finishes an asynchronous io stream splice operation.
12196 // RETURNS: %TRUE on success, %FALSE otherwise.
12197 // <result>: a #GAsyncResult.
12198 static int splice_finish(AsyncResult* result, GLib2.Error** error=null) {
12199 return g_io_stream_splice_finish(result, error);
12201 // Clears the pending flag on @stream.
12202 void clear_pending() {
12203 g_io_stream_clear_pending(&this);
12206 // Closes the stream, releasing resources related to it. This will also
12207 // closes the individual input and output streams, if they are not already
12208 // closed.
12210 // Once the stream is closed, all other operations will return
12211 // %G_IO_ERROR_CLOSED. Closing a stream multiple times will not
12212 // return an error.
12214 // Closing a stream will automatically flush any outstanding buffers
12215 // in the stream.
12217 // Streams will be automatically closed when the last reference
12218 // is dropped, but you might want to call this function to make sure
12219 // resources are released as early as possible.
12221 // Some streams might keep the backing store of the stream (e.g. a file
12222 // descriptor) open after the stream is closed. See the documentation for
12223 // the individual stream for details.
12225 // On failure the first error that happened will be reported, but the
12226 // close operation will finish as much as possible. A stream that failed
12227 // to close will still return %G_IO_ERROR_CLOSED for all operations.
12228 // Still, it is important to check and report the error to the user,
12229 // otherwise there might be a loss of data as all data might not be written.
12231 // If @cancellable is not NULL, then the operation can be cancelled by
12232 // triggering the cancellable object from another thread. If the operation
12233 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
12234 // Cancelling a close will still leave the stream closed, but some streams
12235 // can use a faster close that doesn't block to e.g. check errors.
12237 // The default implementation of this method just calls close on the
12238 // individual input/output streams.
12239 // RETURNS: %TRUE on success, %FALSE on failure
12240 // <cancellable>: optional #GCancellable object, %NULL to ignore
12241 int close(Cancellable* cancellable, GLib2.Error** error=null) {
12242 return g_io_stream_close(&this, cancellable, error);
12245 // Requests an asynchronous close of the stream, releasing resources
12246 // related to it. When the operation is finished @callback will be
12247 // called. You can then call g_io_stream_close_finish() to get
12248 // the result of the operation.
12250 // For behaviour details see g_io_stream_close().
12252 // The asynchronous methods have a default fallback that uses threads
12253 // to implement asynchronicity, so they are optional for inheriting
12254 // classes. However, if you override one you must override all.
12255 // <io_priority>: the io priority of the request
12256 // <cancellable>: optional cancellable object
12257 // <callback>: callback to call when the request is satisfied
12258 // <user_data>: the data to pass to callback function
12259 void close_async(int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
12260 g_io_stream_close_async(&this, io_priority, cancellable, callback, user_data);
12263 // Closes a stream.
12264 // RETURNS: %TRUE if stream was successfully closed, %FALSE otherwise.
12265 // <result>: a #GAsyncResult
12266 int close_finish(AsyncResult* result, GLib2.Error** error=null) {
12267 return g_io_stream_close_finish(&this, result, error);
12270 // Gets the input stream for this object. This is used
12271 // for reading.
12273 // Do not free.
12274 // RETURNS: a #GInputStream, owned by the #GIOStream.
12275 InputStream* get_input_stream() {
12276 return g_io_stream_get_input_stream(&this);
12279 // Gets the output stream for this object. This is used for
12280 // writing.
12282 // Do not free.
12283 // RETURNS: a #GOutputStream, owned by the #GIOStream.
12284 OutputStream* get_output_stream() {
12285 return g_io_stream_get_output_stream(&this);
12288 // Checks if a stream has pending actions.
12289 // RETURNS: %TRUE if @stream has pending actions.
12290 int has_pending() {
12291 return g_io_stream_has_pending(&this);
12294 // Checks if a stream is closed.
12295 // RETURNS: %TRUE if the stream is closed.
12296 int is_closed() {
12297 return g_io_stream_is_closed(&this);
12300 // Sets @stream to have actions pending. If the pending flag is
12301 // already set or @stream is closed, it will return %FALSE and set
12302 // @error.
12303 // RETURNS: %TRUE if pending was previously unset and is now set.
12304 int set_pending(GLib2.Error** error=null) {
12305 return g_io_stream_set_pending(&this, error);
12308 // Asyncronously splice the output stream of @stream1 to the input stream of
12309 // @stream2, and splice the output stream of @stream2 to the input stream of
12310 // @stream1.
12312 // When the operation is finished @callback will be called.
12313 // You can then call g_io_stream_splice_finish() to get the
12314 // result of the operation.
12315 // <stream2>: a #GIOStream.
12316 // <flags>: a set of #GIOStreamSpliceFlags.
12317 // <io_priority>: the io priority of the request.
12318 // <cancellable>: optional #GCancellable object, %NULL to ignore.
12319 // <callback>: a #GAsyncReadyCallback.
12320 // <user_data>: user data passed to @callback.
12321 void splice_async(IOStream* stream2, IOStreamSpliceFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
12322 g_io_stream_splice_async(&this, stream2, flags, io_priority, cancellable, callback, user_data);
12326 struct IOStreamAdapter {
12329 struct IOStreamClass {
12330 GObject2.ObjectClass parent_class;
12331 // RETURNS: a #GInputStream, owned by the #GIOStream.
12332 extern (C) InputStream* function (IOStream* stream) get_input_stream;
12333 // RETURNS: a #GOutputStream, owned by the #GIOStream.
12334 extern (C) OutputStream* function (IOStream* stream) get_output_stream;
12335 extern (C) int function (IOStream* stream, Cancellable* cancellable, GLib2.Error** error=null) close_fn;
12337 // <io_priority>: the io priority of the request
12338 // <cancellable>: optional cancellable object
12339 // <callback>: callback to call when the request is satisfied
12340 // <user_data>: the data to pass to callback function
12341 extern (C) void function (IOStream* stream, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) close_async;
12343 // RETURNS: %TRUE if stream was successfully closed, %FALSE otherwise.
12344 // <result>: a #GAsyncResult
12345 extern (C) int function (IOStream* stream, AsyncResult* result, GLib2.Error** error=null) close_finish;
12346 extern (C) void function () _g_reserved1;
12347 extern (C) void function () _g_reserved2;
12348 extern (C) void function () _g_reserved3;
12349 extern (C) void function () _g_reserved4;
12350 extern (C) void function () _g_reserved5;
12351 extern (C) void function () _g_reserved6;
12352 extern (C) void function () _g_reserved7;
12353 extern (C) void function () _g_reserved8;
12354 extern (C) void function () _g_reserved9;
12355 extern (C) void function () _g_reserved10;
12358 struct IOStreamPrivate {
12361 // GIOStreamSpliceFlags determine how streams should be spliced.
12362 enum IOStreamSpliceFlags /* Version 2.28 */ {
12363 NONE = 0,
12364 CLOSE_STREAM1 = 1,
12365 CLOSE_STREAM2 = 2,
12366 WAIT_FOR_BOTH = 4
12369 // #GIcon is a very minimal interface for icons. It provides functions
12370 // for checking the equality of two icons, hashing of icons and
12371 // serializing an icon to and from strings.
12373 // #GIcon does not provide the actual pixmap for the icon as this is out
12374 // of GIO's scope, however implementations of #GIcon may contain the name
12375 // of an icon (see #GThemedIcon), or the path to an icon (see #GLoadableIcon).
12377 // To obtain a hash of a #GIcon, see g_icon_hash().
12379 // To check if two #GIcons are equal, see g_icon_equal().
12381 // For serializing a #GIcon, use g_icon_to_string() and
12382 // g_icon_new_for_string().
12384 // If your application or library provides one or more #GIcon
12385 // implementations you need to ensure that each #GType is registered
12386 // with the type system prior to calling g_icon_new_for_string().
12387 struct Icon {
12389 // Gets a hash for an icon.
12391 // use in a #GHashTable or similar data structure.
12392 // RETURNS: a #guint containing a hash for the @icon, suitable for
12393 // <icon>: #gconstpointer to an icon object.
12394 static uint hash(const(void)* icon) {
12395 return g_icon_hash(icon);
12398 // Generate a #GIcon instance from @str. This function can fail if
12399 // @str is not valid - see g_icon_to_string() for discussion.
12401 // If your application or library provides one or more #GIcon
12402 // implementations you need to ensure that each #GType is registered
12403 // with the type system prior to calling g_icon_new_for_string().
12405 // interface or %NULL if @error is set.
12406 // RETURNS: An object implementing the #GIcon
12407 // <str>: A string obtained via g_icon_to_string().
12408 static Icon* /*new*/ new_for_string(char* str, GLib2.Error** error=null) {
12409 return g_icon_new_for_string(str, error);
12412 // Checks if two icons are equal.
12413 // RETURNS: %TRUE if @icon1 is equal to @icon2. %FALSE otherwise.
12414 // <icon2>: pointer to the second #GIcon.
12415 int equal(Icon* icon2) {
12416 return g_icon_equal(&this, icon2);
12419 // Generates a textual representation of @icon that can be used for
12420 // serialization such as when passing @icon to a different process or
12421 // saving it to persistent storage. Use g_icon_new_for_string() to
12422 // get @icon back from the returned string.
12424 // The encoding of the returned string is proprietary to #GIcon except
12425 // in the following two cases
12427 // <itemizedlist>
12428 // <listitem><para>
12429 // If @icon is a #GFileIcon, the returned string is a native path
12430 // (such as <literal>/path/to/my icon.png</literal>) without escaping
12431 // if the #GFile for @icon is a native file. If the file is not
12432 // native, the returned string is the result of g_file_get_uri()
12433 // (such as <literal>sftp://path/to/my&percnt;20icon.png</literal>).
12434 // </para></listitem>
12435 // <listitem><para>
12436 // If @icon is a #GThemedIcon with exactly one name, the encoding is
12437 // simply the name (such as <literal>network-server</literal>).
12438 // </para></listitem>
12439 // </itemizedlist>
12441 // be serialized. Use g_free() to free.
12442 // RETURNS: An allocated NUL-terminated UTF8 string or %NULL if @icon can't
12443 char* /*new*/ to_string() {
12444 return g_icon_to_string(&this);
12449 // GIconIface is used to implement GIcon types for various
12450 // different systems. See #GThemedIcon and #GLoadableIcon for
12451 // examples of how to implement this interface.
12452 struct IconIface {
12453 GObject2.TypeInterface g_iface;
12454 // RETURNS: a #guint containing a hash for the @icon, suitable for
12455 extern (C) uint function (Icon* icon) hash;
12457 // RETURNS: %TRUE if @icon1 is equal to @icon2. %FALSE otherwise.
12458 // <icon2>: pointer to the second #GIcon.
12459 extern (C) int function (Icon* icon1, Icon* icon2) equal;
12460 // RETURNS: An allocated NUL-terminated UTF8 string or %NULL if @icon can't
12461 extern (C) int function (Icon* icon, PtrArray* tokens, int* out_version) to_tokens;
12462 // Unintrospectable functionp: from_tokens() / ()
12463 extern (C) Icon* function (char** tokens, int num_tokens, int version_, GLib2.Error** error=null) from_tokens;
12467 // #GInetAddress represents an IPv4 or IPv6 internet address. Use
12468 // g_resolver_lookup_by_name() or g_resolver_lookup_by_name_async() to
12469 // look up the #GInetAddress for a hostname. Use
12470 // g_resolver_lookup_by_address() or
12471 // g_resolver_lookup_by_address_async() to look up the hostname for a
12472 // #GInetAddress.
12474 // To actually connect to a remote host, you will need a
12475 // #GInetSocketAddress (which includes a #GInetAddress as well as a
12476 // port number).
12477 struct InetAddress /* : GObject.Object */ {
12478 alias parent_instance this;
12479 alias parent_instance super_;
12480 alias parent_instance object;
12481 GObject2.Object parent_instance;
12482 private InetAddressPrivate* priv;
12485 // Creates a #GInetAddress for the "any" address (unassigned/"don't
12486 // care") for @family.
12488 // for @family.
12489 // RETURNS: a new #GInetAddress corresponding to the "any" address
12490 // <family>: the address family
12491 static InetAddress* /*new*/ new_any(SocketFamily family) {
12492 return g_inet_address_new_any(family);
12495 // Creates a new #GInetAddress from the given @family and @bytes.
12496 // @bytes should be 4 bytes for %G_INET_ADDRESS_IPV4 and 16 bytes for
12497 // %G_INET_ADDRESS_IPV6.
12498 // RETURNS: a new #GInetAddress corresponding to @family and @bytes.
12499 // <bytes>: raw address data
12500 // <family>: the address family of @bytes
12501 static InetAddress* /*new*/ new_from_bytes(ubyte* bytes, SocketFamily family) {
12502 return g_inet_address_new_from_bytes(bytes, family);
12505 // Parses @string as an IP address and creates a new #GInetAddress.
12507 // @string could not be parsed.
12508 // RETURNS: a new #GInetAddress corresponding to @string, or %NULL if
12509 // <string>: a string representation of an IP address
12510 static InetAddress* /*new*/ new_from_string(char* string_) {
12511 return g_inet_address_new_from_string(string_);
12514 // Creates a #GInetAddress for the loopback address for @family.
12516 // for @family.
12517 // RETURNS: a new #GInetAddress corresponding to the loopback address
12518 // <family>: the address family
12519 static InetAddress* /*new*/ new_loopback(SocketFamily family) {
12520 return g_inet_address_new_loopback(family);
12523 // Checks if two #GInetAddress instances are equal, e.g. the same address.
12524 // RETURNS: %TRUE if @address and @other_address are equal, %FALSE otherwise.
12525 // <other_address>: Another #GInetAddress.
12526 int equal(InetAddress* other_address) {
12527 return g_inet_address_equal(&this, other_address);
12530 // Gets @address's family
12531 // RETURNS: @address's family
12532 SocketFamily get_family() {
12533 return g_inet_address_get_family(&this);
12536 // Tests whether @address is the "any" address for its family.
12537 // RETURNS: %TRUE if @address is the "any" address for its family.
12538 int get_is_any() {
12539 return g_inet_address_get_is_any(&this);
12542 // Tests whether @address is a link-local address (that is, if it
12543 // identifies a host on a local network that is not connected to the
12544 // Internet).
12545 // RETURNS: %TRUE if @address is a link-local address.
12546 int get_is_link_local() {
12547 return g_inet_address_get_is_link_local(&this);
12550 // Tests whether @address is the loopback address for its family.
12551 // RETURNS: %TRUE if @address is the loopback address for its family.
12552 int get_is_loopback() {
12553 return g_inet_address_get_is_loopback(&this);
12556 // Tests whether @address is a global multicast address.
12557 // RETURNS: %TRUE if @address is a global multicast address.
12558 int get_is_mc_global() {
12559 return g_inet_address_get_is_mc_global(&this);
12562 // Tests whether @address is a link-local multicast address.
12563 // RETURNS: %TRUE if @address is a link-local multicast address.
12564 int get_is_mc_link_local() {
12565 return g_inet_address_get_is_mc_link_local(&this);
12568 // Tests whether @address is a node-local multicast address.
12569 // RETURNS: %TRUE if @address is a node-local multicast address.
12570 int get_is_mc_node_local() {
12571 return g_inet_address_get_is_mc_node_local(&this);
12574 // Tests whether @address is an organization-local multicast address.
12575 // RETURNS: %TRUE if @address is an organization-local multicast address.
12576 int get_is_mc_org_local() {
12577 return g_inet_address_get_is_mc_org_local(&this);
12580 // Tests whether @address is a site-local multicast address.
12581 // RETURNS: %TRUE if @address is a site-local multicast address.
12582 int get_is_mc_site_local() {
12583 return g_inet_address_get_is_mc_site_local(&this);
12586 // Tests whether @address is a multicast address.
12587 // RETURNS: %TRUE if @address is a multicast address.
12588 int get_is_multicast() {
12589 return g_inet_address_get_is_multicast(&this);
12592 // Tests whether @address is a site-local address such as 10.0.0.1
12593 // (that is, the address identifies a host on a local network that can
12594 // not be reached directly from the Internet, but which may have
12595 // outgoing Internet connectivity via a NAT or firewall).
12596 // RETURNS: %TRUE if @address is a site-local address.
12597 int get_is_site_local() {
12598 return g_inet_address_get_is_site_local(&this);
12601 // Gets the size of the native raw binary address for @address. This
12602 // is the size of the data that you get from g_inet_address_to_bytes().
12603 // RETURNS: the number of bytes used for the native version of @address.
12604 size_t get_native_size() {
12605 return g_inet_address_get_native_size(&this);
12608 // Unintrospectable method: to_bytes() / g_inet_address_to_bytes()
12609 // Gets the raw binary address data from @address.
12611 // which should not be modified, stored, or freed. The size of this
12612 // array can be gotten with g_inet_address_get_native_size().
12613 // RETURNS: a pointer to an internal array of the bytes in @address,
12614 ubyte* to_bytes() {
12615 return g_inet_address_to_bytes(&this);
12618 // Converts @address to string form.
12620 // freed after use.
12621 // RETURNS: a representation of @address as a string, which should be
12622 char* /*new*/ to_string() {
12623 return g_inet_address_to_string(&this);
12627 struct InetAddressClass {
12628 GObject2.ObjectClass parent_class;
12629 // RETURNS: a representation of @address as a string, which should be
12630 extern (C) char* /*new*/ function (InetAddress* address) to_string;
12631 // RETURNS: a pointer to an internal array of the bytes in @address,
12632 extern (C) ubyte* function (InetAddress* address) to_bytes;
12635 struct InetAddressPrivate {
12639 // An IPv4 or IPv6 socket address; that is, the combination of a
12640 // #GInetAddress and a port number.
12641 struct InetSocketAddress /* : SocketAddress */ {
12642 alias parent_instance this;
12643 alias parent_instance super_;
12644 alias parent_instance socketaddress;
12645 SocketAddress parent_instance;
12646 private InetSocketAddressPrivate* priv;
12649 // Creates a new #GInetSocketAddress for @address and @port.
12650 // RETURNS: a new #GInetSocketAddress
12651 // <address>: a #GInetAddress
12652 // <port>: a port number
12653 static InetSocketAddress* /*new*/ new_(InetAddress* address, ushort port) {
12654 return g_inet_socket_address_new(address, port);
12657 // Gets @address's #GInetAddress.
12659 // g_object_ref()'d if it will be stored
12660 // RETURNS: the #GInetAddress for @address, which must be
12661 InetAddress* get_address() {
12662 return g_inet_socket_address_get_address(&this);
12665 // Gets @address's port.
12666 // RETURNS: the port for @address
12667 ushort get_port() {
12668 return g_inet_socket_address_get_port(&this);
12672 struct InetSocketAddressClass {
12673 SocketAddressClass parent_class;
12676 struct InetSocketAddressPrivate {
12680 // #GInitable is implemented by objects that can fail during
12681 // initialization. If an object implements this interface the
12682 // g_initable_init() function must be called as the first thing
12683 // after construction. If g_initable_init() is not called, or if
12684 // it returns an error, all further operations on the object
12685 // should fail, generally with a %G_IO_ERROR_NOT_INITIALIZED error.
12687 // Users of objects implementing this are not intended to use
12688 // the interface method directly, instead it will be used automatically
12689 // in various ways. For C applications you generally just call
12690 // g_initable_new() directly, or indirectly via a foo_thing_new() wrapper.
12691 // This will call g_initable_init() under the cover, returning %NULL and
12692 // setting a #GError on failure (at which point the instance is
12693 // unreferenced).
12695 // For bindings in languages where the native constructor supports
12696 // exceptions the binding could check for objects implemention %GInitable
12697 // during normal construction and automatically initialize them, throwing
12698 // an exception on failure.
12699 struct Initable /* Version 2.22 */ {
12701 // Unintrospectable function: new() / g_initable_new()
12702 // Helper function for constructing #GInitiable object. This is
12703 // similar to g_object_new() but also initializes the object
12704 // and returns %NULL, setting an error on failure.
12705 // RETURNS: a newly allocated #GObject, or %NULL on error
12706 // <object_type>: a #GType supporting #GInitable.
12707 // <cancellable>: optional #GCancellable object, %NULL to ignore.
12708 // <error>: a #GError location to store the error occurring, or %NULL to ignore.
12709 // <first_property_name>: the name of the first property, or %NULL if no properties
12710 alias g_initable_new new_; // Variadic
12712 // Unintrospectable function: new_valist() / g_initable_new_valist()
12713 // Helper function for constructing #GInitiable object. This is
12714 // similar to g_object_new_valist() but also initializes the object
12715 // and returns %NULL, setting an error on failure.
12716 // RETURNS: a newly allocated #GObject, or %NULL on error
12717 // <object_type>: a #GType supporting #GInitable.
12718 // <first_property_name>: the name of the first property, followed by the value, and other property value pairs, and ended by %NULL.
12719 // <var_args>: The var args list generated from @first_property_name.
12720 // <cancellable>: optional #GCancellable object, %NULL to ignore.
12721 static GObject2.Object* /*new*/ new_valist(Type object_type, char* first_property_name, va_list var_args, Cancellable* cancellable, GLib2.Error** error=null) {
12722 return g_initable_new_valist(object_type, first_property_name, var_args, cancellable, error);
12725 // Helper function for constructing #GInitiable object. This is
12726 // similar to g_object_newv() but also initializes the object
12727 // and returns %NULL, setting an error on failure.
12728 // RETURNS: a newly allocated #GObject, or %NULL on error
12729 // <object_type>: a #GType supporting #GInitable.
12730 // <n_parameters>: the number of parameters in @parameters
12731 // <parameters>: the parameters to use to construct the object
12732 // <cancellable>: optional #GCancellable object, %NULL to ignore.
12733 static void* /*new*/ newv(Type object_type, uint n_parameters, GObject2.Parameter* parameters, Cancellable* cancellable, GLib2.Error** error=null) {
12734 return g_initable_newv(object_type, n_parameters, parameters, cancellable, error);
12737 // Initializes the object implementing the interface. This must be
12738 // done before any real use of the object after initial construction.
12740 // Implementations may also support cancellation. If @cancellable is not %NULL,
12741 // then initialization can be cancelled by triggering the cancellable object
12742 // from another thread. If the operation was cancelled, the error
12743 // %G_IO_ERROR_CANCELLED will be returned. If @cancellable is not %NULL and
12744 // the object doesn't support cancellable initialization the error
12745 // %G_IO_ERROR_NOT_SUPPORTED will be returned.
12747 // If this function is not called, or returns with an error then all
12748 // operations on the object should fail, generally returning the
12749 // error %G_IO_ERROR_NOT_INITIALIZED.
12751 // Implementations of this method must be idempotent, i.e. multiple calls
12752 // to this function with the same argument should return the same results.
12753 // Only the first call initializes the object, further calls return the result
12754 // of the first call. This is so that its safe to implement the singleton
12755 // pattern in the GObject constructor function.
12757 // return %FALSE and set @error appropriately if present.
12758 // RETURNS: %TRUE if successful. If an error has occurred, this function will
12759 // <cancellable>: optional #GCancellable object, %NULL to ignore.
12760 int init(Cancellable* cancellable, GLib2.Error** error=null) {
12761 return g_initable_init(&this, cancellable, error);
12766 // Provides an interface for initializing object such that initialization
12767 // may fail.
12768 struct InitableIface /* Version 2.22 */ {
12769 GObject2.TypeInterface g_iface;
12771 // RETURNS: %TRUE if successful. If an error has occurred, this function will
12772 // <cancellable>: optional #GCancellable object, %NULL to ignore.
12773 extern (C) int function (Initable* initable, Cancellable* cancellable, GLib2.Error** error=null) init;
12777 // GInputStream has functions to read from a stream (g_input_stream_read()),
12778 // to close a stream (g_input_stream_close()) and to skip some content
12779 // (g_input_stream_skip()).
12781 // To copy the content of an input stream to an output stream without
12782 // manually handling the reads and writes, use g_output_stream_splice().
12784 // All of these functions have async variants too.
12785 struct InputStream /* : GObject.Object */ {
12786 alias parent_instance this;
12787 alias parent_instance super_;
12788 alias parent_instance object;
12789 GObject2.Object parent_instance;
12790 private InputStreamPrivate* priv;
12792 // Clears the pending flag on @stream.
12793 void clear_pending() {
12794 g_input_stream_clear_pending(&this);
12797 // Closes the stream, releasing resources related to it.
12799 // Once the stream is closed, all other operations will return %G_IO_ERROR_CLOSED.
12800 // Closing a stream multiple times will not return an error.
12802 // Streams will be automatically closed when the last reference
12803 // is dropped, but you might want to call this function to make sure
12804 // resources are released as early as possible.
12806 // Some streams might keep the backing store of the stream (e.g. a file descriptor)
12807 // open after the stream is closed. See the documentation for the individual
12808 // stream for details.
12810 // On failure the first error that happened will be reported, but the close
12811 // operation will finish as much as possible. A stream that failed to
12812 // close will still return %G_IO_ERROR_CLOSED for all operations. Still, it
12813 // is important to check and report the error to the user.
12815 // If @cancellable is not NULL, then the operation can be cancelled by
12816 // triggering the cancellable object from another thread. If the operation
12817 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
12818 // Cancelling a close will still leave the stream closed, but some streams
12819 // can use a faster close that doesn't block to e.g. check errors.
12820 // RETURNS: %TRUE on success, %FALSE on failure
12821 // <cancellable>: optional #GCancellable object, %NULL to ignore.
12822 int close(Cancellable* cancellable, GLib2.Error** error=null) {
12823 return g_input_stream_close(&this, cancellable, error);
12826 // Requests an asynchronous closes of the stream, releasing resources related to it.
12827 // When the operation is finished @callback will be called.
12828 // You can then call g_input_stream_close_finish() to get the result of the
12829 // operation.
12831 // For behaviour details see g_input_stream_close().
12833 // The asyncronous methods have a default fallback that uses threads to implement
12834 // asynchronicity, so they are optional for inheriting classes. However, if you
12835 // override one you must override all.
12836 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
12837 // <cancellable>: optional cancellable object
12838 // <callback>: callback to call when the request is satisfied
12839 // <user_data>: the data to pass to callback function
12840 void close_async(int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
12841 g_input_stream_close_async(&this, io_priority, cancellable, callback, user_data);
12844 // Finishes closing a stream asynchronously, started from g_input_stream_close_async().
12845 // RETURNS: %TRUE if the stream was closed successfully.
12846 // <result>: a #GAsyncResult.
12847 int close_finish(AsyncResult* result, GLib2.Error** error=null) {
12848 return g_input_stream_close_finish(&this, result, error);
12851 // Checks if an input stream has pending actions.
12852 // RETURNS: %TRUE if @stream has pending actions.
12853 int has_pending() {
12854 return g_input_stream_has_pending(&this);
12857 // Checks if an input stream is closed.
12858 // RETURNS: %TRUE if the stream is closed.
12859 int is_closed() {
12860 return g_input_stream_is_closed(&this);
12863 // Tries to read @count bytes from the stream into the buffer starting at
12864 // @buffer. Will block during this read.
12866 // If count is zero returns zero and does nothing. A value of @count
12867 // larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
12869 // On success, the number of bytes read into the buffer is returned.
12870 // It is not an error if this is not the same as the requested size, as it
12871 // can happen e.g. near the end of a file. Zero is returned on end of file
12872 // (or if @count is zero), but never otherwise.
12874 // If @cancellable is not NULL, then the operation can be cancelled by
12875 // triggering the cancellable object from another thread. If the operation
12876 // was cancelled, the error G_IO_ERROR_CANCELLED will be returned. If an
12877 // operation was partially finished when the operation was cancelled the
12878 // partial result will be returned, without an error.
12880 // On error -1 is returned and @error is set accordingly.
12881 // RETURNS: Number of bytes read, or -1 on error
12882 // <buffer>: a buffer to read data into (which should be at least count bytes long).
12883 // <count>: the number of bytes that will be read from the stream
12884 // <cancellable>: optional #GCancellable object, %NULL to ignore.
12885 ssize_t read(void* buffer, size_t count, Cancellable* cancellable, GLib2.Error** error=null) {
12886 return g_input_stream_read(&this, buffer, count, cancellable, error);
12889 // Tries to read @count bytes from the stream into the buffer starting at
12890 // @buffer. Will block during this read.
12892 // This function is similar to g_input_stream_read(), except it tries to
12893 // read as many bytes as requested, only stopping on an error or end of stream.
12895 // On a successful read of @count bytes, or if we reached the end of the
12896 // stream, %TRUE is returned, and @bytes_read is set to the number of bytes
12897 // read into @buffer.
12899 // If there is an error during the operation %FALSE is returned and @error
12900 // is set to indicate the error status, @bytes_read is updated to contain
12901 // the number of bytes read into @buffer before the error occurred.
12902 // RETURNS: %TRUE on success, %FALSE if there was an error
12903 // <buffer>: a buffer to read data into (which should be at least count bytes long).
12904 // <count>: the number of bytes that will be read from the stream
12905 // <bytes_read>: location to store the number of bytes that was read from the stream
12906 // <cancellable>: optional #GCancellable object, %NULL to ignore.
12907 int read_all(void* buffer, size_t count, /*out*/ size_t* bytes_read, Cancellable* cancellable, GLib2.Error** error=null) {
12908 return g_input_stream_read_all(&this, buffer, count, bytes_read, cancellable, error);
12911 // Request an asynchronous read of @count bytes from the stream into the buffer
12912 // starting at @buffer. When the operation is finished @callback will be called.
12913 // You can then call g_input_stream_read_finish() to get the result of the
12914 // operation.
12916 // During an async request no other sync and async calls are allowed on @stream, and will
12917 // result in %G_IO_ERROR_PENDING errors.
12919 // A value of @count larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
12921 // On success, the number of bytes read into the buffer will be passed to the
12922 // callback. It is not an error if this is not the same as the requested size, as it
12923 // can happen e.g. near the end of a file, but generally we try to read
12924 // as many bytes as requested. Zero is returned on end of file
12925 // (or if @count is zero), but never otherwise.
12927 // Any outstanding i/o request with higher priority (lower numerical value) will
12928 // be executed before an outstanding request with lower priority. Default
12929 // priority is %G_PRIORITY_DEFAULT.
12931 // The asyncronous methods have a default fallback that uses threads to implement
12932 // asynchronicity, so they are optional for inheriting classes. However, if you
12933 // override one you must override all.
12934 // <buffer>: a buffer to read data into (which should be at least count bytes long).
12935 // <count>: the number of bytes that will be read from the stream
12936 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
12937 // <cancellable>: optional #GCancellable object, %NULL to ignore.
12938 // <callback>: callback to call when the request is satisfied
12939 // <user_data>: the data to pass to callback function
12940 void read_async(void* buffer, size_t count, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
12941 g_input_stream_read_async(&this, buffer, count, io_priority, cancellable, callback, user_data);
12944 // Finishes an asynchronous stream read operation.
12945 // RETURNS: number of bytes read in, or -1 on error.
12946 // <result>: a #GAsyncResult.
12947 ssize_t read_finish(AsyncResult* result, GLib2.Error** error=null) {
12948 return g_input_stream_read_finish(&this, result, error);
12951 // Sets @stream to have actions pending. If the pending flag is
12952 // already set or @stream is closed, it will return %FALSE and set
12953 // @error.
12954 // RETURNS: %TRUE if pending was previously unset and is now set.
12955 int set_pending(GLib2.Error** error=null) {
12956 return g_input_stream_set_pending(&this, error);
12959 // Tries to skip @count bytes from the stream. Will block during the operation.
12961 // This is identical to g_input_stream_read(), from a behaviour standpoint,
12962 // but the bytes that are skipped are not returned to the user. Some
12963 // streams have an implementation that is more efficient than reading the data.
12965 // This function is optional for inherited classes, as the default implementation
12966 // emulates it using read.
12968 // If @cancellable is not %NULL, then the operation can be cancelled by
12969 // triggering the cancellable object from another thread. If the operation
12970 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
12971 // operation was partially finished when the operation was cancelled the
12972 // partial result will be returned, without an error.
12973 // RETURNS: Number of bytes skipped, or -1 on error
12974 // <count>: the number of bytes that will be skipped from the stream
12975 // <cancellable>: optional #GCancellable object, %NULL to ignore.
12976 ssize_t skip(size_t count, Cancellable* cancellable, GLib2.Error** error=null) {
12977 return g_input_stream_skip(&this, count, cancellable, error);
12980 // Request an asynchronous skip of @count bytes from the stream.
12981 // When the operation is finished @callback will be called.
12982 // You can then call g_input_stream_skip_finish() to get the result
12983 // of the operation.
12985 // During an async request no other sync and async calls are allowed,
12986 // and will result in %G_IO_ERROR_PENDING errors.
12988 // A value of @count larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
12990 // On success, the number of bytes skipped will be passed to the callback.
12991 // It is not an error if this is not the same as the requested size, as it
12992 // can happen e.g. near the end of a file, but generally we try to skip
12993 // as many bytes as requested. Zero is returned on end of file
12994 // (or if @count is zero), but never otherwise.
12996 // Any outstanding i/o request with higher priority (lower numerical value)
12997 // will be executed before an outstanding request with lower priority.
12998 // Default priority is %G_PRIORITY_DEFAULT.
13000 // The asynchronous methods have a default fallback that uses threads to
13001 // implement asynchronicity, so they are optional for inheriting classes.
13002 // However, if you override one, you must override all.
13003 // <count>: the number of bytes that will be skipped from the stream
13004 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
13005 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13006 // <callback>: callback to call when the request is satisfied
13007 // <user_data>: the data to pass to callback function
13008 void skip_async(size_t count, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
13009 g_input_stream_skip_async(&this, count, io_priority, cancellable, callback, user_data);
13012 // Finishes a stream skip operation.
13013 // RETURNS: the size of the bytes skipped, or %-1 on error.
13014 // <result>: a #GAsyncResult.
13015 ssize_t skip_finish(AsyncResult* result, GLib2.Error** error=null) {
13016 return g_input_stream_skip_finish(&this, result, error);
13020 struct InputStreamClass {
13021 GObject2.ObjectClass parent_class;
13022 extern (C) ssize_t function (InputStream* stream, void* buffer, size_t count, Cancellable* cancellable, GLib2.Error** error=null) read_fn;
13024 // RETURNS: Number of bytes skipped, or -1 on error
13025 // <count>: the number of bytes that will be skipped from the stream
13026 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13027 extern (C) ssize_t function (InputStream* stream, size_t count, Cancellable* cancellable, GLib2.Error** error=null) skip;
13028 extern (C) int function (InputStream* stream, Cancellable* cancellable, GLib2.Error** error=null) close_fn;
13030 // <buffer>: a buffer to read data into (which should be at least count bytes long).
13031 // <count>: the number of bytes that will be read from the stream
13032 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
13033 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13034 // <callback>: callback to call when the request is satisfied
13035 // <user_data>: the data to pass to callback function
13036 extern (C) void function (InputStream* stream, void* buffer, size_t count, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) read_async;
13038 // RETURNS: number of bytes read in, or -1 on error.
13039 // <result>: a #GAsyncResult.
13040 extern (C) ssize_t function (InputStream* stream, AsyncResult* result, GLib2.Error** error=null) read_finish;
13042 // <count>: the number of bytes that will be skipped from the stream
13043 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
13044 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13045 // <callback>: callback to call when the request is satisfied
13046 // <user_data>: the data to pass to callback function
13047 extern (C) void function (InputStream* stream, size_t count, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) skip_async;
13049 // RETURNS: the size of the bytes skipped, or %-1 on error.
13050 // <result>: a #GAsyncResult.
13051 extern (C) ssize_t function (InputStream* stream, AsyncResult* result, GLib2.Error** error=null) skip_finish;
13053 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
13054 // <cancellable>: optional cancellable object
13055 // <callback>: callback to call when the request is satisfied
13056 // <user_data>: the data to pass to callback function
13057 extern (C) void function (InputStream* stream, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) close_async;
13059 // RETURNS: %TRUE if the stream was closed successfully.
13060 // <result>: a #GAsyncResult.
13061 extern (C) int function (InputStream* stream, AsyncResult* result, GLib2.Error** error=null) close_finish;
13062 extern (C) void function () _g_reserved1;
13063 extern (C) void function () _g_reserved2;
13064 extern (C) void function () _g_reserved3;
13065 extern (C) void function () _g_reserved4;
13066 extern (C) void function () _g_reserved5;
13069 struct InputStreamPrivate {
13073 // Structure used for scatter/gather data input.
13074 // You generally pass in an array of #GInputVector<!-- -->s
13075 // and the operation will store the read data starting in the
13076 // first buffer, switching to the next as needed.
13077 struct InputVector /* Version 2.22 */ {
13078 void* buffer;
13079 size_t size;
13083 // Extends the #GIcon interface and adds the ability to
13084 // load icons from streams.
13085 struct LoadableIcon {
13087 // Loads a loadable icon. For the asynchronous version of this function,
13088 // see g_loadable_icon_load_async().
13089 // RETURNS: a #GInputStream to read the icon from.
13090 // <size>: an integer.
13091 // <type>: a location to store the type of the loaded icon, %NULL to ignore.
13092 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13093 InputStream* /*new*/ load(int size, /*out*/ char** type, Cancellable* cancellable, GLib2.Error** error=null) {
13094 return g_loadable_icon_load(&this, size, type, cancellable, error);
13097 // Loads an icon asynchronously. To finish this function, see
13098 // g_loadable_icon_load_finish(). For the synchronous, blocking
13099 // version of this function, see g_loadable_icon_load().
13100 // <size>: an integer.
13101 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13102 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
13103 // <user_data>: the data to pass to callback function
13104 void load_async(int size, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
13105 g_loadable_icon_load_async(&this, size, cancellable, callback, user_data);
13108 // Finishes an asynchronous icon load started in g_loadable_icon_load_async().
13109 // RETURNS: a #GInputStream to read the icon from.
13110 // <res>: a #GAsyncResult.
13111 // <type>: a location to store the type of the loaded icon, %NULL to ignore.
13112 InputStream* /*new*/ load_finish(AsyncResult* res, char** type, GLib2.Error** error=null) {
13113 return g_loadable_icon_load_finish(&this, res, type, error);
13117 // Interface for icons that can be loaded as a stream.
13118 struct LoadableIconIface {
13119 GObject2.TypeInterface g_iface;
13121 // RETURNS: a #GInputStream to read the icon from.
13122 // <size>: an integer.
13123 // <type>: a location to store the type of the loaded icon, %NULL to ignore.
13124 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13125 extern (C) InputStream* /*new*/ function (LoadableIcon* icon, int size, /*out*/ char** type, Cancellable* cancellable, GLib2.Error** error=null) load;
13127 // <size>: an integer.
13128 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13129 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
13130 // <user_data>: the data to pass to callback function
13131 extern (C) void function (LoadableIcon* icon, int size, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) load_async;
13133 // RETURNS: a #GInputStream to read the icon from.
13134 // <res>: a #GAsyncResult.
13135 // <type>: a location to store the type of the loaded icon, %NULL to ignore.
13136 extern (C) InputStream* /*new*/ function (LoadableIcon* icon, AsyncResult* res, char** type, GLib2.Error** error=null) load_finish;
13140 // #GMemoryInputStream is a class for using arbitrary
13141 // memory chunks as input for GIO streaming input operations.
13142 struct MemoryInputStream /* : InputStream */ {
13143 alias parent_instance this;
13144 alias parent_instance super_;
13145 alias parent_instance inputstream;
13146 InputStream parent_instance;
13147 private MemoryInputStreamPrivate* priv;
13150 // Creates a new empty #GMemoryInputStream.
13151 // RETURNS: a new #GInputStream
13152 static MemoryInputStream* /*new*/ new_() {
13153 return g_memory_input_stream_new();
13156 // Creates a new #GMemoryInputStream with data in memory of a given size.
13157 // RETURNS: new #GInputStream read from @data of @len bytes.
13158 // <data>: input data
13159 // <len>: length of the data, may be -1 if @data is a nul-terminated string
13160 // <destroy>: function that is called to free @data, or %NULL
13161 static MemoryInputStream* /*new*/ new_from_data(ubyte* data, ssize_t len, GLib2.DestroyNotify destroy=null) {
13162 return g_memory_input_stream_new_from_data(data, len, destroy);
13165 // Appends @data to data that can be read from the input stream
13166 // <data>: input data
13167 // <len>: length of the data, may be -1 if @data is a nul-terminated string
13168 // <destroy>: function that is called to free @data, or %NULL
13169 void add_data(ubyte* data, ssize_t len, GLib2.DestroyNotify destroy=null) {
13170 g_memory_input_stream_add_data(&this, data, len, destroy);
13174 struct MemoryInputStreamClass {
13175 InputStreamClass parent_class;
13176 extern (C) void function () _g_reserved1;
13177 extern (C) void function () _g_reserved2;
13178 extern (C) void function () _g_reserved3;
13179 extern (C) void function () _g_reserved4;
13180 extern (C) void function () _g_reserved5;
13183 struct MemoryInputStreamPrivate {
13187 // #GMemoryOutputStream is a class for using arbitrary
13188 // memory chunks as output for GIO streaming output operations.
13189 struct MemoryOutputStream /* : OutputStream */ {
13190 alias parent_instance this;
13191 alias parent_instance super_;
13192 alias parent_instance outputstream;
13193 OutputStream parent_instance;
13194 private MemoryOutputStreamPrivate* priv;
13197 // Unintrospectable constructor: new() / g_memory_output_stream_new()
13198 // Creates a new #GMemoryOutputStream.
13200 // If @data is non-%NULL, the stream will use that for its internal storage.
13201 // If @realloc_fn is non-%NULL, it will be used for resizing the internal
13202 // storage when necessary. To construct a fixed-size output stream,
13203 // pass %NULL as @realloc_fn.
13205 // |[
13206 // /&ast; a stream that can grow &ast;/
13207 // stream = g_memory_output_stream_new (NULL, 0, realloc, free);
13209 // /&ast; another stream that can grow &ast;/
13210 // stream2 = g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
13212 // /&ast; a fixed-size stream &ast;/
13213 // data = malloc (200);
13214 // stream3 = g_memory_output_stream_new (data, 200, NULL, free);
13215 // ]|
13216 // RETURNS: A newly created #GMemoryOutputStream object.
13217 // <data>: pointer to a chunk of memory to use, or %NULL
13218 // <size>: the size of @data
13219 // <realloc_function>: a function with realloc() semantics (like g_realloc()) to be called when @data needs to be grown, or %NULL
13220 // <destroy_function>: a function to be called on @data when the stream is finalized, or %NULL
13221 static MemoryOutputStream* /*new*/ new_(void* data, size_t size, ReallocFunc realloc_function, GLib2.DestroyNotify destroy_function) {
13222 return g_memory_output_stream_new(data, size, realloc_function, destroy_function);
13225 // Gets any loaded data from the @ostream.
13227 // Note that the returned pointer may become invalid on the next
13228 // write or truncate operation on the stream.
13229 // RETURNS: pointer to the stream's data
13230 void* get_data() {
13231 return g_memory_output_stream_get_data(&this);
13234 // Returns the number of bytes from the start up
13235 // to including the last byte written in the stream
13236 // that has not been truncated away.
13237 // RETURNS: the number of bytes written to the stream
13238 size_t get_data_size() {
13239 return g_memory_output_stream_get_data_size(&this);
13242 // Gets the size of the currently allocated data area (available from
13243 // g_memory_output_stream_get_data()). If the stream isn't
13244 // growable (no realloc was passed to g_memory_output_stream_new()) then
13245 // this is the maximum size of the stream and further writes
13246 // will return %G_IO_ERROR_NO_SPACE.
13248 // Note that for growable streams the returned size may become invalid on
13249 // the next write or truncate operation on the stream.
13251 // If you want the number of bytes currently written to the stream, use
13252 // g_memory_output_stream_get_data_size().
13253 // RETURNS: the number of bytes allocated for the data buffer
13254 size_t get_size() {
13255 return g_memory_output_stream_get_size(&this);
13258 // Gets any loaded data from the @ostream. Ownership of the data
13259 // is transferred to the caller; when no longer needed it must be
13260 // freed using the free function set in @ostream's
13261 // #GMemoryOutputStream:destroy-function property.
13263 // @ostream must be closed before calling this function.
13264 // RETURNS: the stream's data
13265 void* /*new*/ steal_data() {
13266 return g_memory_output_stream_steal_data(&this);
13270 struct MemoryOutputStreamClass {
13271 OutputStreamClass parent_class;
13272 extern (C) void function () _g_reserved1;
13273 extern (C) void function () _g_reserved2;
13274 extern (C) void function () _g_reserved3;
13275 extern (C) void function () _g_reserved4;
13276 extern (C) void function () _g_reserved5;
13279 struct MemoryOutputStreamPrivate {
13283 // The #GMount interface represents user-visible mounts. Note, when
13284 // porting from GnomeVFS, #GMount is the moral equivalent of #GnomeVFSVolume.
13286 // #GMount is a "mounted" filesystem that you can access. Mounted is in
13287 // quotes because it's not the same as a unix mount, it might be a gvfs
13288 // mount, but you can still access the files on it if you use GIO. Might or
13289 // might not be related to a volume object.
13291 // Unmounting a #GMount instance is an asynchronous operation. For
13292 // more information about asynchronous operations, see #GAsyncReady
13293 // and #GSimpleAsyncReady. To unmount a #GMount instance, first call
13294 // g_mount_unmount_with_operation() with (at least) the #GMount instance and a
13295 // #GAsyncReadyCallback. The callback will be fired when the
13296 // operation has resolved (either with success or failure), and a
13297 // #GAsyncReady structure will be passed to the callback. That
13298 // callback should then call g_mount_unmount_with_operation_finish() with the #GMount
13299 // and the #GAsyncReady data to see if the operation was completed
13300 // successfully. If an @error is present when g_mount_unmount_with_operation_finish()
13301 // is called, then it will be filled with any error information.
13302 struct Mount {
13304 // Checks if @mount can be eject.
13305 // RETURNS: %TRUE if the @mount can be ejected.
13306 int can_eject() {
13307 return g_mount_can_eject(&this);
13310 // Checks if @mount can be mounted.
13311 // RETURNS: %TRUE if the @mount can be unmounted.
13312 int can_unmount() {
13313 return g_mount_can_unmount(&this);
13316 // Ejects a mount. This is an asynchronous operation, and is
13317 // finished by calling g_mount_eject_finish() with the @mount
13318 // and #GAsyncResult data returned in the @callback.
13319 // <flags>: flags affecting the unmount if required for eject
13320 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13321 // <callback>: a #GAsyncReadyCallback, or %NULL.
13322 // <user_data>: user data passed to @callback.
13323 void eject(MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
13324 g_mount_eject(&this, flags, cancellable, callback, user_data);
13327 // Finishes ejecting a mount. If any errors occurred during the operation,
13328 // @error will be set to contain the errors and %FALSE will be returned.
13329 // RETURNS: %TRUE if the mount was successfully ejected. %FALSE otherwise.
13330 // <result>: a #GAsyncResult.
13331 int eject_finish(AsyncResult* result, GLib2.Error** error=null) {
13332 return g_mount_eject_finish(&this, result, error);
13335 // Ejects a mount. This is an asynchronous operation, and is
13336 // finished by calling g_mount_eject_with_operation_finish() with the @mount
13337 // and #GAsyncResult data returned in the @callback.
13338 // <flags>: flags affecting the unmount if required for eject
13339 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
13340 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13341 // <callback>: a #GAsyncReadyCallback, or %NULL.
13342 // <user_data>: user data passed to @callback.
13343 void eject_with_operation(MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
13344 g_mount_eject_with_operation(&this, flags, mount_operation, cancellable, callback, user_data);
13347 // Finishes ejecting a mount. If any errors occurred during the operation,
13348 // @error will be set to contain the errors and %FALSE will be returned.
13349 // RETURNS: %TRUE if the mount was successfully ejected. %FALSE otherwise.
13350 // <result>: a #GAsyncResult.
13351 int eject_with_operation_finish(AsyncResult* result, GLib2.Error** error=null) {
13352 return g_mount_eject_with_operation_finish(&this, result, error);
13355 // Gets the default location of @mount. The default location of the given
13356 // @mount is a path that reflects the main entry point for the user (e.g.
13357 // the home directory, or the root of the volume).
13359 // The returned object should be unreffed with
13360 // g_object_unref() when no longer needed.
13361 // RETURNS: a #GFile.
13362 File* /*new*/ get_default_location() {
13363 return g_mount_get_default_location(&this);
13366 // Gets the drive for the @mount.
13368 // This is a convenience method for getting the #GVolume and then
13369 // using that object to get the #GDrive.
13371 // The returned object should be unreffed with
13372 // g_object_unref() when no longer needed.
13373 // RETURNS: a #GDrive or %NULL if @mount is not associated with a volume or a drive.
13374 Drive* /*new*/ get_drive() {
13375 return g_mount_get_drive(&this);
13378 // Gets the icon for @mount.
13380 // The returned object should be unreffed with
13381 // g_object_unref() when no longer needed.
13382 // RETURNS: a #GIcon.
13383 Icon* /*new*/ get_icon() {
13384 return g_mount_get_icon(&this);
13387 // Gets the name of @mount.
13389 // The returned string should be freed with g_free()
13390 // when no longer needed.
13391 // RETURNS: the name for the given @mount.
13392 char* /*new*/ get_name() {
13393 return g_mount_get_name(&this);
13396 // Gets the root directory on @mount.
13398 // The returned object should be unreffed with
13399 // g_object_unref() when no longer needed.
13400 // RETURNS: a #GFile.
13401 File* /*new*/ get_root() {
13402 return g_mount_get_root(&this);
13405 // Gets the UUID for the @mount. The reference is typically based on
13406 // the file system UUID for the mount in question and should be
13407 // considered an opaque string. Returns %NULL if there is no UUID
13408 // available.
13410 // The returned string should be freed with g_free()
13411 // when no longer needed.
13412 // RETURNS: the UUID for @mount or %NULL if no UUID can be computed.
13413 char* /*new*/ get_uuid() {
13414 return g_mount_get_uuid(&this);
13417 // Gets the volume for the @mount.
13419 // The returned object should be unreffed with
13420 // g_object_unref() when no longer needed.
13421 // RETURNS: a #GVolume or %NULL if @mount is not associated with a volume.
13422 Volume* /*new*/ get_volume() {
13423 return g_mount_get_volume(&this);
13426 // Tries to guess the type of content stored on @mount. Returns one or
13427 // more textual identifiers of well-known content types (typically
13428 // prefixed with "x-content/"), e.g. x-content/image-dcf for camera
13429 // memory cards. See the <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink>
13430 // specification for more on x-content types.
13432 // This is an asynchronous operation (see
13433 // g_mount_guess_content_type_sync() for the synchronous version), and
13434 // is finished by calling g_mount_guess_content_type_finish() with the
13435 // @mount and #GAsyncResult data returned in the @callback.
13436 // <force_rescan>: Whether to force a rescan of the content. Otherwise a cached result will be used if available
13437 // <cancellable>: optional #GCancellable object, %NULL to ignore
13438 // <callback>: a #GAsyncReadyCallback
13439 // <user_data>: user data passed to @callback
13440 void guess_content_type(int force_rescan, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
13441 g_mount_guess_content_type(&this, force_rescan, cancellable, callback, user_data);
13444 // Finishes guessing content types of @mount. If any errors occurred
13445 // during the operation, @error will be set to contain the errors and
13446 // %FALSE will be returned. In particular, you may get an
13447 // %G_IO_ERROR_NOT_SUPPORTED if the mount does not support content
13448 // guessing.
13450 // Caller should free this array with g_strfreev() when done with it.
13451 // RETURNS: a %NULL-terminated array of content types or %NULL on error.
13452 // <result>: a #GAsyncResult
13453 char** /*new*/ guess_content_type_finish(AsyncResult* result, GLib2.Error** error=null) {
13454 return g_mount_guess_content_type_finish(&this, result, error);
13457 // Tries to guess the type of content stored on @mount. Returns one or
13458 // more textual identifiers of well-known content types (typically
13459 // prefixed with "x-content/"), e.g. x-content/image-dcf for camera
13460 // memory cards. See the <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink>
13461 // specification for more on x-content types.
13463 // This is an synchronous operation and as such may block doing IO;
13464 // see g_mount_guess_content_type() for the asynchronous version.
13466 // Caller should free this array with g_strfreev() when done with it.
13467 // RETURNS: a %NULL-terminated array of content types or %NULL on error.
13468 // <force_rescan>: Whether to force a rescan of the content. Otherwise a cached result will be used if available
13469 // <cancellable>: optional #GCancellable object, %NULL to ignore
13470 char** /*new*/ guess_content_type_sync(int force_rescan, Cancellable* cancellable, GLib2.Error** error=null) {
13471 return g_mount_guess_content_type_sync(&this, force_rescan, cancellable, error);
13474 // Determines if @mount is shadowed. Applications or libraries should
13475 // avoid displaying @mount in the user interface if it is shadowed.
13477 // A mount is said to be shadowed if there exists one or more user
13478 // visible objects (currently #GMount objects) with a root that is
13479 // inside the root of @mount.
13481 // One application of shadow mounts is when exposing a single file
13482 // system that is used to address several logical volumes. In this
13483 // situation, a #GVolumeMonitor implementation would create two
13484 // #GVolume objects (for example, one for the camera functionality of
13485 // the device and one for a SD card reader on the device) with
13486 // activation URIs <literal>gphoto2://[usb:001,002]/store1/</literal>
13487 // and <literal>gphoto2://[usb:001,002]/store2/</literal>. When the
13488 // underlying mount (with root
13489 // <literal>gphoto2://[usb:001,002]/</literal>) is mounted, said
13490 // #GVolumeMonitor implementation would create two #GMount objects
13491 // (each with their root matching the corresponding volume activation
13492 // root) that would shadow the original mount.
13494 // The proxy monitor in GVfs 2.26 and later, automatically creates and
13495 // manage shadow mounts (and shadows the underlying mount) if the
13496 // activation root on a #GVolume is set.
13497 // RETURNS: %TRUE if @mount is shadowed.
13498 int is_shadowed() {
13499 return g_mount_is_shadowed(&this);
13502 // Remounts a mount. This is an asynchronous operation, and is
13503 // finished by calling g_mount_remount_finish() with the @mount
13504 // and #GAsyncResults data returned in the @callback.
13506 // Remounting is useful when some setting affecting the operation
13507 // of the volume has been changed, as these may need a remount to
13508 // take affect. While this is semantically equivalent with unmounting
13509 // and then remounting not all backends might need to actually be
13510 // unmounted.
13511 // <flags>: flags affecting the operation
13512 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
13513 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13514 // <callback>: a #GAsyncReadyCallback, or %NULL.
13515 // <user_data>: user data passed to @callback.
13516 void remount(MountMountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
13517 g_mount_remount(&this, flags, mount_operation, cancellable, callback, user_data);
13520 // Finishes remounting a mount. If any errors occurred during the operation,
13521 // @error will be set to contain the errors and %FALSE will be returned.
13522 // RETURNS: %TRUE if the mount was successfully remounted. %FALSE otherwise.
13523 // <result>: a #GAsyncResult.
13524 int remount_finish(AsyncResult* result, GLib2.Error** error=null) {
13525 return g_mount_remount_finish(&this, result, error);
13528 // Increments the shadow count on @mount. Usually used by
13529 // #GVolumeMonitor implementations when creating a shadow mount for
13530 // @mount, see g_mount_is_shadowed() for more information. The caller
13531 // will need to emit the #GMount::changed signal on @mount manually.
13532 void shadow() {
13533 g_mount_shadow(&this);
13536 // Unmounts a mount. This is an asynchronous operation, and is
13537 // finished by calling g_mount_unmount_finish() with the @mount
13538 // and #GAsyncResult data returned in the @callback.
13539 // <flags>: flags affecting the operation
13540 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13541 // <callback>: a #GAsyncReadyCallback, or %NULL.
13542 // <user_data>: user data passed to @callback.
13543 void unmount(MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
13544 g_mount_unmount(&this, flags, cancellable, callback, user_data);
13547 // Finishes unmounting a mount. If any errors occurred during the operation,
13548 // @error will be set to contain the errors and %FALSE will be returned.
13549 // RETURNS: %TRUE if the mount was successfully unmounted. %FALSE otherwise.
13550 // <result>: a #GAsyncResult.
13551 int unmount_finish(AsyncResult* result, GLib2.Error** error=null) {
13552 return g_mount_unmount_finish(&this, result, error);
13555 // Unmounts a mount. This is an asynchronous operation, and is
13556 // finished by calling g_mount_unmount_with_operation_finish() with the @mount
13557 // and #GAsyncResult data returned in the @callback.
13558 // <flags>: flags affecting the operation
13559 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
13560 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13561 // <callback>: a #GAsyncReadyCallback, or %NULL.
13562 // <user_data>: user data passed to @callback.
13563 void unmount_with_operation(MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
13564 g_mount_unmount_with_operation(&this, flags, mount_operation, cancellable, callback, user_data);
13567 // Finishes unmounting a mount. If any errors occurred during the operation,
13568 // @error will be set to contain the errors and %FALSE will be returned.
13569 // RETURNS: %TRUE if the mount was successfully unmounted. %FALSE otherwise.
13570 // <result>: a #GAsyncResult.
13571 int unmount_with_operation_finish(AsyncResult* result, GLib2.Error** error=null) {
13572 return g_mount_unmount_with_operation_finish(&this, result, error);
13575 // Decrements the shadow count on @mount. Usually used by
13576 // #GVolumeMonitor implementations when destroying a shadow mount for
13577 // @mount, see g_mount_is_shadowed() for more information. The caller
13578 // will need to emit the #GMount::changed signal on @mount manually.
13579 void unshadow() {
13580 g_mount_unshadow(&this);
13582 // Emitted when the mount has been changed.
13583 extern (C) alias static void function (Mount* this_, void* user_data=null) signal_changed;
13585 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
13586 return super_.signal_connect!name(cb, data, cf);
13589 ulong signal_connect(string name:"changed", CB:signal_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
13590 return signal_connect_data(&this, cast(char*)"changed",
13591 cast(GObject2.Callback)cb, data, null, cf);
13594 // This signal is emitted when the #GMount is about to be
13595 // unmounted.
13596 extern (C) alias static void function (Mount* this_, void* user_data=null) signal_pre_unmount;
13597 ulong signal_connect(string name:"pre-unmount", CB:signal_pre_unmount)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
13598 return signal_connect_data(&this, cast(char*)"pre-unmount",
13599 cast(GObject2.Callback)cb, data, null, cf);
13602 // This signal is emitted when the #GMount have been
13603 // unmounted. If the recipient is holding references to the
13604 // object they should release them so the object can be
13605 // finalized.
13606 extern (C) alias static void function (Mount* this_, void* user_data=null) signal_unmounted;
13607 ulong signal_connect(string name:"unmounted", CB:signal_unmounted)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
13608 return signal_connect_data(&this, cast(char*)"unmounted",
13609 cast(GObject2.Callback)cb, data, null, cf);
13613 // Interface for implementing operations for mounts.
13614 struct MountIface {
13615 GObject2.TypeInterface g_iface;
13616 extern (C) void function (Mount* mount) changed;
13617 extern (C) void function (Mount* mount) unmounted;
13618 // RETURNS: a #GFile.
13619 extern (C) File* /*new*/ function (Mount* mount) get_root;
13620 // RETURNS: the name for the given @mount.
13621 extern (C) char* /*new*/ function (Mount* mount) get_name;
13622 // RETURNS: a #GIcon.
13623 extern (C) Icon* /*new*/ function (Mount* mount) get_icon;
13624 // RETURNS: the UUID for @mount or %NULL if no UUID can be computed.
13625 extern (C) char* /*new*/ function (Mount* mount) get_uuid;
13626 // RETURNS: a #GVolume or %NULL if @mount is not associated with a volume.
13627 extern (C) Volume* /*new*/ function (Mount* mount) get_volume;
13628 // RETURNS: a #GDrive or %NULL if @mount is not associated with a volume or a drive.
13629 extern (C) Drive* /*new*/ function (Mount* mount) get_drive;
13630 // RETURNS: %TRUE if the @mount can be unmounted.
13631 extern (C) int function (Mount* mount) can_unmount;
13632 // RETURNS: %TRUE if the @mount can be ejected.
13633 extern (C) int function (Mount* mount) can_eject;
13635 // <flags>: flags affecting the operation
13636 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13637 // <callback>: a #GAsyncReadyCallback, or %NULL.
13638 // <user_data>: user data passed to @callback.
13639 extern (C) void function (Mount* mount, MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) unmount;
13641 // RETURNS: %TRUE if the mount was successfully unmounted. %FALSE otherwise.
13642 // <result>: a #GAsyncResult.
13643 extern (C) int function (Mount* mount, AsyncResult* result, GLib2.Error** error=null) unmount_finish;
13645 // <flags>: flags affecting the unmount if required for eject
13646 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13647 // <callback>: a #GAsyncReadyCallback, or %NULL.
13648 // <user_data>: user data passed to @callback.
13649 extern (C) void function (Mount* mount, MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) eject;
13651 // RETURNS: %TRUE if the mount was successfully ejected. %FALSE otherwise.
13652 // <result>: a #GAsyncResult.
13653 extern (C) int function (Mount* mount, AsyncResult* result, GLib2.Error** error=null) eject_finish;
13655 // <flags>: flags affecting the operation
13656 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
13657 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13658 // <callback>: a #GAsyncReadyCallback, or %NULL.
13659 // <user_data>: user data passed to @callback.
13660 extern (C) void function (Mount* mount, MountMountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) remount;
13662 // RETURNS: %TRUE if the mount was successfully remounted. %FALSE otherwise.
13663 // <result>: a #GAsyncResult.
13664 extern (C) int function (Mount* mount, AsyncResult* result, GLib2.Error** error=null) remount_finish;
13666 // <force_rescan>: Whether to force a rescan of the content. Otherwise a cached result will be used if available
13667 // <cancellable>: optional #GCancellable object, %NULL to ignore
13668 // <callback>: a #GAsyncReadyCallback
13669 // <user_data>: user data passed to @callback
13670 extern (C) void function (Mount* mount, int force_rescan, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) guess_content_type;
13672 // RETURNS: a %NULL-terminated array of content types or %NULL on error.
13673 // <result>: a #GAsyncResult
13674 extern (C) char** /*new*/ function (Mount* mount, AsyncResult* result, GLib2.Error** error=null) guess_content_type_finish;
13676 // RETURNS: a %NULL-terminated array of content types or %NULL on error.
13677 // <force_rescan>: Whether to force a rescan of the content. Otherwise a cached result will be used if available
13678 // <cancellable>: optional #GCancellable object, %NULL to ignore
13679 extern (C) char** /*new*/ function (Mount* mount, int force_rescan, Cancellable* cancellable, GLib2.Error** error=null) guess_content_type_sync;
13680 extern (C) void function (Mount* mount) pre_unmount;
13682 // <flags>: flags affecting the operation
13683 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
13684 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13685 // <callback>: a #GAsyncReadyCallback, or %NULL.
13686 // <user_data>: user data passed to @callback.
13687 extern (C) void function (Mount* mount, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) unmount_with_operation;
13689 // RETURNS: %TRUE if the mount was successfully unmounted. %FALSE otherwise.
13690 // <result>: a #GAsyncResult.
13691 extern (C) int function (Mount* mount, AsyncResult* result, GLib2.Error** error=null) unmount_with_operation_finish;
13693 // <flags>: flags affecting the unmount if required for eject
13694 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
13695 // <cancellable>: optional #GCancellable object, %NULL to ignore.
13696 // <callback>: a #GAsyncReadyCallback, or %NULL.
13697 // <user_data>: user data passed to @callback.
13698 extern (C) void function (Mount* mount, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) eject_with_operation;
13700 // RETURNS: %TRUE if the mount was successfully ejected. %FALSE otherwise.
13701 // <result>: a #GAsyncResult.
13702 extern (C) int function (Mount* mount, AsyncResult* result, GLib2.Error** error=null) eject_with_operation_finish;
13703 // RETURNS: a #GFile.
13704 extern (C) File* /*new*/ function (Mount* mount) get_default_location;
13707 // Flags used when mounting a mount.
13708 enum MountMountFlags {
13709 NONE = 0
13712 // #GMountOperation provides a mechanism for interacting with the user.
13713 // It can be used for authenticating mountable operations, such as loop
13714 // mounting files, hard drive partitions or server locations. It can
13715 // also be used to ask the user questions or show a list of applications
13716 // preventing unmount or eject operations from completing.
13718 // Note that #GMountOperation is used for more than just #GMount
13719 // objects – for example it is also used in g_drive_start() and
13720 // g_drive_stop().
13722 // Users should instantiate a subclass of this that implements all the
13723 // various callbacks to show the required dialogs, such as
13724 // #GtkMountOperation. If no user interaction is desired (for example
13725 // when automounting filesystems at login time), usually %NULL can be
13726 // passed, see each method taking a #GMountOperation for details.
13727 struct MountOperation /* : GObject.Object */ {
13728 alias parent_instance this;
13729 alias parent_instance super_;
13730 alias parent_instance object;
13731 GObject2.Object parent_instance;
13732 MountOperationPrivate* priv;
13735 // Creates a new mount operation.
13736 // RETURNS: a #GMountOperation.
13737 static MountOperation* /*new*/ new_() {
13738 return g_mount_operation_new();
13741 // Check to see whether the mount operation is being used
13742 // for an anonymous user.
13743 // RETURNS: %TRUE if mount operation is anonymous.
13744 int get_anonymous() {
13745 return g_mount_operation_get_anonymous(&this);
13748 // Gets a choice from the mount operation.
13750 // the choice's list, or %0.
13751 // RETURNS: an integer containing an index of the user's choice from
13752 int get_choice() {
13753 return g_mount_operation_get_choice(&this);
13756 // Gets the domain of the mount operation.
13757 // RETURNS: a string set to the domain.
13758 char* get_domain() {
13759 return g_mount_operation_get_domain(&this);
13762 // Gets a password from the mount operation.
13763 // RETURNS: a string containing the password within @op.
13764 char* get_password() {
13765 return g_mount_operation_get_password(&this);
13768 // Gets the state of saving passwords for the mount operation.
13769 // RETURNS: a #GPasswordSave flag.
13770 PasswordSave get_password_save() {
13771 return g_mount_operation_get_password_save(&this);
13774 // Get the user name from the mount operation.
13775 // RETURNS: a string containing the user name.
13776 char* get_username() {
13777 return g_mount_operation_get_username(&this);
13780 // Emits the #GMountOperation::reply signal.
13781 // <result>: a #GMountOperationResult
13782 void reply(MountOperationResult result) {
13783 g_mount_operation_reply(&this, result);
13786 // Sets the mount operation to use an anonymous user if @anonymous is %TRUE.
13787 // <anonymous>: boolean value.
13788 void set_anonymous(int anonymous) {
13789 g_mount_operation_set_anonymous(&this, anonymous);
13792 // Sets a default choice for the mount operation.
13793 // <choice>: an integer.
13794 void set_choice(int choice) {
13795 g_mount_operation_set_choice(&this, choice);
13798 // Sets the mount operation's domain.
13799 // <domain>: the domain to set.
13800 void set_domain(char* domain) {
13801 g_mount_operation_set_domain(&this, domain);
13804 // Sets the mount operation's password to @password.
13805 // <password>: password to set.
13806 void set_password(char* password) {
13807 g_mount_operation_set_password(&this, password);
13810 // Sets the state of saving passwords for the mount operation.
13811 // <save>: a set of #GPasswordSave flags.
13812 void set_password_save(PasswordSave save) {
13813 g_mount_operation_set_password_save(&this, save);
13816 // Sets the user name within @op to @username.
13817 // <username>: input username.
13818 void set_username(char* username) {
13819 g_mount_operation_set_username(&this, username);
13822 // Emitted by the backend when e.g. a device becomes unavailable
13823 // while a mount operation is in progress.
13825 // Implementations of GMountOperation should handle this signal
13826 // by dismissing open password dialogs.
13827 extern (C) alias static void function (MountOperation* this_, void* user_data=null) signal_aborted;
13829 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
13830 return super_.signal_connect!name(cb, data, cf);
13833 ulong signal_connect(string name:"aborted", CB:signal_aborted)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
13834 return signal_connect_data(&this, cast(char*)"aborted",
13835 cast(GObject2.Callback)cb, data, null, cf);
13838 // Emitted when a mount operation asks the user for a password.
13840 // If the message contains a line break, the first line should be
13841 // presented as a heading. For example, it may be used as the
13842 // primary text in a #GtkMessageDialog.
13843 // <message>: string containing a message to display to the user.
13844 // <default_user>: string containing the default user name.
13845 // <default_domain>: string containing the default domain.
13846 // <flags>: a set of #GAskPasswordFlags.
13847 extern (C) alias static void function (MountOperation* this_, char* message, char* default_user, char* default_domain, AskPasswordFlags* flags, void* user_data=null) signal_ask_password;
13848 ulong signal_connect(string name:"ask-password", CB:signal_ask_password)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
13849 return signal_connect_data(&this, cast(char*)"ask-password",
13850 cast(GObject2.Callback)cb, data, null, cf);
13853 // Emitted when asking the user a question and gives a list of
13854 // choices for the user to choose from.
13856 // If the message contains a line break, the first line should be
13857 // presented as a heading. For example, it may be used as the
13858 // primary text in a #GtkMessageDialog.
13859 // <message>: string containing a message to display to the user.
13860 // <choices>: an array of strings for each possible choice.
13861 extern (C) alias static void function (MountOperation* this_, char* message, char* choices, void* user_data=null) signal_ask_question;
13862 ulong signal_connect(string name:"ask-question", CB:signal_ask_question)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
13863 return signal_connect_data(&this, cast(char*)"ask-question",
13864 cast(GObject2.Callback)cb, data, null, cf);
13867 // Emitted when the user has replied to the mount operation.
13868 // <result>: a #GMountOperationResult indicating how the request was handled
13869 extern (C) alias static void function (MountOperation* this_, MountOperationResult* result, void* user_data=null) signal_reply;
13870 ulong signal_connect(string name:"reply", CB:signal_reply)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
13871 return signal_connect_data(&this, cast(char*)"reply",
13872 cast(GObject2.Callback)cb, data, null, cf);
13875 // Emitted when one or more processes are blocking an operation
13876 // e.g. unmounting/ejecting a #GMount or stopping a #GDrive.
13878 // Note that this signal may be emitted several times to update the
13879 // list of blocking processes as processes close files. The
13880 // application should only respond with g_mount_operation_reply() to
13881 // the latest signal (setting #GMountOperation:choice to the choice
13882 // the user made).
13884 // If the message contains a line break, the first line should be
13885 // presented as a heading. For example, it may be used as the
13886 // primary text in a #GtkMessageDialog.
13887 // <message>: string containing a message to display to the user.
13888 // <processes>: an array of #GPid for processes blocking the operation.
13889 // <choices>: an array of strings for each possible choice.
13890 extern (C) alias static void function (MountOperation* this_, char* message, void* processes, char* choices, void* user_data=null) signal_show_processes;
13891 ulong signal_connect(string name:"show-processes", CB:signal_show_processes)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
13892 return signal_connect_data(&this, cast(char*)"show-processes",
13893 cast(GObject2.Callback)cb, data, null, cf);
13897 struct MountOperationClass {
13898 GObject2.ObjectClass parent_class;
13899 extern (C) void function (MountOperation* op, char* message, char* default_user, char* default_domain, AskPasswordFlags flags) ask_password;
13900 extern (C) void function (MountOperation* op, char* message, char* choices) ask_question;
13901 // <result>: a #GMountOperationResult
13902 extern (C) void function (MountOperation* op, MountOperationResult result) reply;
13903 extern (C) void function (MountOperation* op) aborted;
13904 extern (C) void function (MountOperation* op, char* message, Array* processes, char* choices) show_processes;
13905 extern (C) void function () _g_reserved1;
13906 extern (C) void function () _g_reserved2;
13907 extern (C) void function () _g_reserved3;
13908 extern (C) void function () _g_reserved4;
13909 extern (C) void function () _g_reserved5;
13910 extern (C) void function () _g_reserved6;
13911 extern (C) void function () _g_reserved7;
13912 extern (C) void function () _g_reserved8;
13913 extern (C) void function () _g_reserved9;
13914 extern (C) void function () _g_reserved10;
13917 struct MountOperationPrivate {
13921 // #GMountOperationResult is returned as a result when a request for
13922 // information is send by the mounting operation.
13923 enum MountOperationResult {
13924 HANDLED = 0,
13925 ABORTED = 1,
13926 UNHANDLED = 2
13928 // Flags used when an unmounting a mount.
13929 enum MountUnmountFlags {
13930 NONE = 0,
13931 FORCE = 1
13933 enum NATIVE_VOLUME_MONITOR_EXTENSION_POINT_NAME = "gio-native-volume-monitor";
13934 struct NativeVolumeMonitor /* : VolumeMonitor */ {
13935 alias parent_instance this;
13936 alias parent_instance super_;
13937 alias parent_instance volumemonitor;
13938 VolumeMonitor parent_instance;
13941 struct NativeVolumeMonitorClass {
13942 VolumeMonitorClass parent_class;
13943 // Unintrospectable functionp: get_mount_for_mount_path() / ()
13944 extern (C) Mount* function (char* mount_path, Cancellable* cancellable) get_mount_for_mount_path;
13948 // #GNetworkAddress provides an easy way to resolve a hostname and
13949 // then attempt to connect to that host, handling the possibility of
13950 // multiple IP addresses and multiple address families.
13952 // See #GSocketConnectable for and example of using the connectable
13953 // interface.
13954 struct NetworkAddress /* : GObject.Object */ {
13955 alias parent_instance this;
13956 alias parent_instance super_;
13957 alias parent_instance object;
13958 GObject2.Object parent_instance;
13959 private NetworkAddressPrivate* priv;
13962 // Creates a new #GSocketConnectable for connecting to the given
13963 // @hostname and @port.
13964 // RETURNS: the new #GNetworkAddress
13965 // <hostname>: the hostname
13966 // <port>: the port
13967 static SocketConnectable* /*new*/ new_(char* hostname, ushort port) {
13968 return g_network_address_new(hostname, port);
13971 // Creates a new #GSocketConnectable for connecting to the given
13972 // @hostname and @port. May fail and return %NULL in case
13973 // parsing @host_and_port fails.
13975 // @host_and_port may be in any of a number of recognised formats; an IPv6
13976 // address, an IPv4 address, or a domain name (in which case a DNS
13977 // lookup is performed). Quoting with [] is supported for all address
13978 // types. A port override may be specified in the usual way with a
13979 // colon. Ports may be given as decimal numbers or symbolic names (in
13980 // which case an /etc/services lookup is performed).
13982 // If no port is specified in @host_and_port then @default_port will be
13983 // used as the port number to connect to.
13985 // In general, @host_and_port is expected to be provided by the user
13986 // (allowing them to give the hostname, and a port overide if necessary)
13987 // and @default_port is expected to be provided by the application.
13988 // RETURNS: the new #GNetworkAddress, or %NULL on error
13989 // <host_and_port>: the hostname and optionally a port
13990 // <default_port>: the default port if not in @host_and_port
13991 static SocketConnectable* /*new*/ parse(char* host_and_port, ushort default_port, GLib2.Error** error=null) {
13992 return g_network_address_parse(host_and_port, default_port, error);
13995 // Creates a new #GSocketConnectable for connecting to the given
13996 // @uri. May fail and return %NULL in case parsing @uri fails.
13998 // Using this rather than g_network_address_new() or
13999 // g_network_address_parse_host() allows #GSocketClient to determine
14000 // when to use application-specific proxy protocols.
14001 // RETURNS: the new #GNetworkAddress, or %NULL on error
14002 // <uri>: the hostname and optionally a port
14003 // <default_port>: The default port if none is found in the URI
14004 static SocketConnectable* /*new*/ parse_uri(char* uri, ushort default_port, GLib2.Error** error=null) {
14005 return g_network_address_parse_uri(uri, default_port, error);
14008 // Gets @addr's hostname. This might be either UTF-8 or ASCII-encoded,
14009 // depending on what @addr was created with.
14010 // RETURNS: @addr's hostname
14011 char* get_hostname() {
14012 return g_network_address_get_hostname(&this);
14015 // Gets @addr's port number
14016 // RETURNS: @addr's port (which may be 0)
14017 ushort get_port() {
14018 return g_network_address_get_port(&this);
14021 // Gets @addr's scheme
14022 // RETURNS: @addr's scheme (%NULL if not built from URI)
14023 char* get_scheme() {
14024 return g_network_address_get_scheme(&this);
14028 struct NetworkAddressClass {
14029 GObject2.ObjectClass parent_class;
14032 struct NetworkAddressPrivate {
14036 // Like #GNetworkAddress does with hostnames, #GNetworkService
14037 // provides an easy way to resolve a SRV record, and then attempt to
14038 // connect to one of the hosts that implements that service, handling
14039 // service priority/weighting, multiple IP addresses, and multiple
14040 // address families.
14042 // See #GSrvTarget for more information about SRV records, and see
14043 // #GSocketConnectable for and example of using the connectable
14044 // interface.
14045 struct NetworkService /* : GObject.Object */ {
14046 alias parent_instance this;
14047 alias parent_instance super_;
14048 alias parent_instance object;
14049 GObject2.Object parent_instance;
14050 private NetworkServicePrivate* priv;
14053 // Creates a new #GNetworkService representing the given @service,
14054 // @protocol, and @domain. This will initially be unresolved; use the
14055 // #GSocketConnectable interface to resolve it.
14056 // RETURNS: a new #GNetworkService
14057 // <service>: the service type to look up (eg, "ldap")
14058 // <protocol>: the networking protocol to use for @service (eg, "tcp")
14059 // <domain>: the DNS domain to look up the service in
14060 static SocketConnectable* /*new*/ new_(char* service, char* protocol, char* domain) {
14061 return g_network_service_new(service, protocol, domain);
14064 // Gets the domain that @srv serves. This might be either UTF-8 or
14065 // ASCII-encoded, depending on what @srv was created with.
14066 // RETURNS: @srv's domain name
14067 char* get_domain() {
14068 return g_network_service_get_domain(&this);
14071 // Gets @srv's protocol name (eg, "tcp").
14072 // RETURNS: @srv's protocol name
14073 char* get_protocol() {
14074 return g_network_service_get_protocol(&this);
14077 // Get's the URI scheme used to resolve proxies. By default, the service name
14078 // is used as scheme.
14079 // RETURNS: @srv's scheme name
14080 char* get_scheme() {
14081 return g_network_service_get_scheme(&this);
14084 // Gets @srv's service name (eg, "ldap").
14085 // RETURNS: @srv's service name
14086 char* get_service() {
14087 return g_network_service_get_service(&this);
14090 // Set's the URI scheme used to resolve proxies. By default, the service name
14091 // is used as scheme.
14092 // <scheme>: a URI scheme
14093 void set_scheme(char* scheme) {
14094 g_network_service_set_scheme(&this, scheme);
14098 struct NetworkServiceClass {
14099 GObject2.ObjectClass parent_class;
14102 struct NetworkServicePrivate {
14106 // GOutputStream has functions to write to a stream (g_output_stream_write()),
14107 // to close a stream (g_output_stream_close()) and to flush pending writes
14108 // (g_output_stream_flush()).
14110 // To copy the content of an input stream to an output stream without
14111 // manually handling the reads and writes, use g_output_stream_splice().
14113 // All of these functions have async variants too.
14114 struct OutputStream /* : GObject.Object */ {
14115 alias parent_instance this;
14116 alias parent_instance super_;
14117 alias parent_instance object;
14118 GObject2.Object parent_instance;
14119 private OutputStreamPrivate* priv;
14121 // Clears the pending flag on @stream.
14122 void clear_pending() {
14123 g_output_stream_clear_pending(&this);
14126 // Closes the stream, releasing resources related to it.
14128 // Once the stream is closed, all other operations will return %G_IO_ERROR_CLOSED.
14129 // Closing a stream multiple times will not return an error.
14131 // Closing a stream will automatically flush any outstanding buffers in the
14132 // stream.
14134 // Streams will be automatically closed when the last reference
14135 // is dropped, but you might want to call this function to make sure
14136 // resources are released as early as possible.
14138 // Some streams might keep the backing store of the stream (e.g. a file descriptor)
14139 // open after the stream is closed. See the documentation for the individual
14140 // stream for details.
14142 // On failure the first error that happened will be reported, but the close
14143 // operation will finish as much as possible. A stream that failed to
14144 // close will still return %G_IO_ERROR_CLOSED for all operations. Still, it
14145 // is important to check and report the error to the user, otherwise
14146 // there might be a loss of data as all data might not be written.
14148 // If @cancellable is not NULL, then the operation can be cancelled by
14149 // triggering the cancellable object from another thread. If the operation
14150 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
14151 // Cancelling a close will still leave the stream closed, but there some streams
14152 // can use a faster close that doesn't block to e.g. check errors. On
14153 // cancellation (as with any error) there is no guarantee that all written
14154 // data will reach the target.
14155 // RETURNS: %TRUE on success, %FALSE on failure
14156 // <cancellable>: optional cancellable object
14157 int close(Cancellable* cancellable, GLib2.Error** error=null) {
14158 return g_output_stream_close(&this, cancellable, error);
14161 // Requests an asynchronous close of the stream, releasing resources
14162 // related to it. When the operation is finished @callback will be
14163 // called. You can then call g_output_stream_close_finish() to get
14164 // the result of the operation.
14166 // For behaviour details see g_output_stream_close().
14168 // The asyncronous methods have a default fallback that uses threads
14169 // to implement asynchronicity, so they are optional for inheriting
14170 // classes. However, if you override one you must override all.
14171 // <io_priority>: the io priority of the request.
14172 // <cancellable>: optional cancellable object
14173 // <callback>: callback to call when the request is satisfied
14174 // <user_data>: the data to pass to callback function
14175 void close_async(int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
14176 g_output_stream_close_async(&this, io_priority, cancellable, callback, user_data);
14179 // Closes an output stream.
14180 // RETURNS: %TRUE if stream was successfully closed, %FALSE otherwise.
14181 // <result>: a #GAsyncResult.
14182 int close_finish(AsyncResult* result, GLib2.Error** error=null) {
14183 return g_output_stream_close_finish(&this, result, error);
14186 // Flushed any outstanding buffers in the stream. Will block during
14187 // the operation. Closing the stream will implicitly cause a flush.
14189 // This function is optional for inherited classes.
14191 // If @cancellable is not %NULL, then the operation can be cancelled by
14192 // triggering the cancellable object from another thread. If the operation
14193 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
14194 // RETURNS: %TRUE on success, %FALSE on error
14195 // <cancellable>: optional cancellable object
14196 int flush(Cancellable* cancellable, GLib2.Error** error=null) {
14197 return g_output_stream_flush(&this, cancellable, error);
14200 // Flushes a stream asynchronously.
14201 // For behaviour details see g_output_stream_flush().
14203 // When the operation is finished @callback will be
14204 // called. You can then call g_output_stream_flush_finish() to get the
14205 // result of the operation.
14206 // <io_priority>: the io priority of the request.
14207 // <cancellable>: optional #GCancellable object, %NULL to ignore.
14208 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
14209 // <user_data>: the data to pass to callback function
14210 void flush_async(int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
14211 g_output_stream_flush_async(&this, io_priority, cancellable, callback, user_data);
14214 // Finishes flushing an output stream.
14215 // RETURNS: %TRUE if flush operation succeeded, %FALSE otherwise.
14216 // <result>: a GAsyncResult.
14217 int flush_finish(AsyncResult* result, GLib2.Error** error=null) {
14218 return g_output_stream_flush_finish(&this, result, error);
14221 // Checks if an ouput stream has pending actions.
14222 // RETURNS: %TRUE if @stream has pending actions.
14223 int has_pending() {
14224 return g_output_stream_has_pending(&this);
14227 // Checks if an output stream has already been closed.
14228 // RETURNS: %TRUE if @stream is closed. %FALSE otherwise.
14229 int is_closed() {
14230 return g_output_stream_is_closed(&this);
14233 // Checks if an output stream is being closed. This can be
14234 // used inside e.g. a flush implementation to see if the
14235 // flush (or other i/o operation) is called from within
14236 // the closing operation.
14237 // RETURNS: %TRUE if @stream is being closed. %FALSE otherwise.
14238 int is_closing() {
14239 return g_output_stream_is_closing(&this);
14242 // Sets @stream to have actions pending. If the pending flag is
14243 // already set or @stream is closed, it will return %FALSE and set
14244 // @error.
14245 // RETURNS: %TRUE if pending was previously unset and is now set.
14246 int set_pending(GLib2.Error** error=null) {
14247 return g_output_stream_set_pending(&this, error);
14250 // Splices an input stream into an output stream.
14252 // -1 if an error occurred. Note that if the number of bytes
14253 // spliced is greater than %G_MAXSSIZE, then that will be
14254 // returned, and there is no way to determine the actual number
14255 // of bytes spliced.
14256 // RETURNS: a #gssize containing the size of the data spliced, or
14257 // <source>: a #GInputStream.
14258 // <flags>: a set of #GOutputStreamSpliceFlags.
14259 // <cancellable>: optional #GCancellable object, %NULL to ignore.
14260 ssize_t splice(InputStream* source, OutputStreamSpliceFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
14261 return g_output_stream_splice(&this, source, flags, cancellable, error);
14264 // Splices a stream asynchronously.
14265 // When the operation is finished @callback will be called.
14266 // You can then call g_output_stream_splice_finish() to get the
14267 // result of the operation.
14269 // For the synchronous, blocking version of this function, see
14270 // g_output_stream_splice().
14271 // <source>: a #GInputStream.
14272 // <flags>: a set of #GOutputStreamSpliceFlags.
14273 // <io_priority>: the io priority of the request.
14274 // <cancellable>: optional #GCancellable object, %NULL to ignore.
14275 // <callback>: a #GAsyncReadyCallback.
14276 // <user_data>: user data passed to @callback.
14277 void splice_async(InputStream* source, OutputStreamSpliceFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
14278 g_output_stream_splice_async(&this, source, flags, io_priority, cancellable, callback, user_data);
14281 // Finishes an asynchronous stream splice operation.
14283 // number of bytes spliced is greater than %G_MAXSSIZE, then that
14284 // will be returned, and there is no way to determine the actual
14285 // number of bytes spliced.
14286 // RETURNS: a #gssize of the number of bytes spliced. Note that if the
14287 // <result>: a #GAsyncResult.
14288 ssize_t splice_finish(AsyncResult* result, GLib2.Error** error=null) {
14289 return g_output_stream_splice_finish(&this, result, error);
14292 // Tries to write @count bytes from @buffer into the stream. Will block
14293 // during the operation.
14295 // If count is 0, returns 0 and does nothing. A value of @count
14296 // larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
14298 // On success, the number of bytes written to the stream is returned.
14299 // It is not an error if this is not the same as the requested size, as it
14300 // can happen e.g. on a partial I/O error, or if there is not enough
14301 // storage in the stream. All writes block until at least one byte
14302 // is written or an error occurs; 0 is never returned (unless
14303 // @count is 0).
14305 // If @cancellable is not NULL, then the operation can be cancelled by
14306 // triggering the cancellable object from another thread. If the operation
14307 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
14308 // operation was partially finished when the operation was cancelled the
14309 // partial result will be returned, without an error.
14311 // On error -1 is returned and @error is set accordingly.
14312 // RETURNS: Number of bytes written, or -1 on error
14313 // <buffer>: the buffer containing the data to write.
14314 // <count>: the number of bytes to write
14315 // <cancellable>: optional cancellable object
14316 ssize_t write(ubyte* buffer, size_t count, Cancellable* cancellable, GLib2.Error** error=null) {
14317 return g_output_stream_write(&this, buffer, count, cancellable, error);
14320 // Tries to write @count bytes from @buffer into the stream. Will block
14321 // during the operation.
14323 // This function is similar to g_output_stream_write(), except it tries to
14324 // write as many bytes as requested, only stopping on an error.
14326 // On a successful write of @count bytes, %TRUE is returned, and @bytes_written
14327 // is set to @count.
14329 // If there is an error during the operation FALSE is returned and @error
14330 // is set to indicate the error status, @bytes_written is updated to contain
14331 // the number of bytes written into the stream before the error occurred.
14332 // RETURNS: %TRUE on success, %FALSE if there was an error
14333 // <buffer>: the buffer containing the data to write.
14334 // <count>: the number of bytes to write
14335 // <bytes_written>: location to store the number of bytes that was written to the stream
14336 // <cancellable>: optional #GCancellable object, %NULL to ignore.
14337 int write_all(ubyte* buffer, size_t count, /*out*/ size_t* bytes_written, Cancellable* cancellable, GLib2.Error** error=null) {
14338 return g_output_stream_write_all(&this, buffer, count, bytes_written, cancellable, error);
14341 // Request an asynchronous write of @count bytes from @buffer into
14342 // the stream. When the operation is finished @callback will be called.
14343 // You can then call g_output_stream_write_finish() to get the result of the
14344 // operation.
14346 // During an async request no other sync and async calls are allowed,
14347 // and will result in %G_IO_ERROR_PENDING errors.
14349 // A value of @count larger than %G_MAXSSIZE will cause a
14350 // %G_IO_ERROR_INVALID_ARGUMENT error.
14352 // On success, the number of bytes written will be passed to the
14353 // @callback. It is not an error if this is not the same as the
14354 // requested size, as it can happen e.g. on a partial I/O error,
14355 // but generally we try to write as many bytes as requested.
14357 // You are guaranteed that this method will never fail with
14358 // %G_IO_ERROR_WOULD_BLOCK - if @stream can't accept more data, the
14359 // method will just wait until this changes.
14361 // Any outstanding I/O request with higher priority (lower numerical
14362 // value) will be executed before an outstanding request with lower
14363 // priority. Default priority is %G_PRIORITY_DEFAULT.
14365 // The asyncronous methods have a default fallback that uses threads
14366 // to implement asynchronicity, so they are optional for inheriting
14367 // classes. However, if you override one you must override all.
14369 // For the synchronous, blocking version of this function, see
14370 // g_output_stream_write().
14371 // <buffer>: the buffer containing the data to write.
14372 // <count>: the number of bytes to write
14373 // <io_priority>: the io priority of the request.
14374 // <cancellable>: optional #GCancellable object, %NULL to ignore.
14375 // <callback>: callback to call when the request is satisfied
14376 // <user_data>: the data to pass to callback function
14377 void write_async(ubyte* buffer, size_t count, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
14378 g_output_stream_write_async(&this, buffer, count, io_priority, cancellable, callback, user_data);
14381 // Finishes a stream write operation.
14382 // RETURNS: a #gssize containing the number of bytes written to the stream.
14383 // <result>: a #GAsyncResult.
14384 ssize_t write_finish(AsyncResult* result, GLib2.Error** error=null) {
14385 return g_output_stream_write_finish(&this, result, error);
14389 struct OutputStreamClass {
14390 GObject2.ObjectClass parent_class;
14391 extern (C) ssize_t function (OutputStream* stream, void* buffer, size_t count, Cancellable* cancellable, GLib2.Error** error=null) write_fn;
14393 // RETURNS: a #gssize containing the size of the data spliced, or
14394 // <source>: a #GInputStream.
14395 // <flags>: a set of #GOutputStreamSpliceFlags.
14396 // <cancellable>: optional #GCancellable object, %NULL to ignore.
14397 extern (C) ssize_t function (OutputStream* stream, InputStream* source, OutputStreamSpliceFlags flags, Cancellable* cancellable, GLib2.Error** error=null) splice;
14399 // RETURNS: %TRUE on success, %FALSE on error
14400 // <cancellable>: optional cancellable object
14401 extern (C) int function (OutputStream* stream, Cancellable* cancellable, GLib2.Error** error=null) flush;
14402 extern (C) int function (OutputStream* stream, Cancellable* cancellable, GLib2.Error** error=null) close_fn;
14404 // <buffer>: the buffer containing the data to write.
14405 // <count>: the number of bytes to write
14406 // <io_priority>: the io priority of the request.
14407 // <cancellable>: optional #GCancellable object, %NULL to ignore.
14408 // <callback>: callback to call when the request is satisfied
14409 // <user_data>: the data to pass to callback function
14410 extern (C) void function (OutputStream* stream, ubyte* buffer, size_t count, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) write_async;
14412 // RETURNS: a #gssize containing the number of bytes written to the stream.
14413 // <result>: a #GAsyncResult.
14414 extern (C) ssize_t function (OutputStream* stream, AsyncResult* result, GLib2.Error** error=null) write_finish;
14416 // <source>: a #GInputStream.
14417 // <flags>: a set of #GOutputStreamSpliceFlags.
14418 // <io_priority>: the io priority of the request.
14419 // <cancellable>: optional #GCancellable object, %NULL to ignore.
14420 // <callback>: a #GAsyncReadyCallback.
14421 // <user_data>: user data passed to @callback.
14422 extern (C) void function (OutputStream* stream, InputStream* source, OutputStreamSpliceFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) splice_async;
14424 // RETURNS: a #gssize of the number of bytes spliced. Note that if the
14425 // <result>: a #GAsyncResult.
14426 extern (C) ssize_t function (OutputStream* stream, AsyncResult* result, GLib2.Error** error=null) splice_finish;
14428 // <io_priority>: the io priority of the request.
14429 // <cancellable>: optional #GCancellable object, %NULL to ignore.
14430 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
14431 // <user_data>: the data to pass to callback function
14432 extern (C) void function (OutputStream* stream, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) flush_async;
14434 // RETURNS: %TRUE if flush operation succeeded, %FALSE otherwise.
14435 // <result>: a GAsyncResult.
14436 extern (C) int function (OutputStream* stream, AsyncResult* result, GLib2.Error** error=null) flush_finish;
14438 // <io_priority>: the io priority of the request.
14439 // <cancellable>: optional cancellable object
14440 // <callback>: callback to call when the request is satisfied
14441 // <user_data>: the data to pass to callback function
14442 extern (C) void function (OutputStream* stream, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) close_async;
14444 // RETURNS: %TRUE if stream was successfully closed, %FALSE otherwise.
14445 // <result>: a #GAsyncResult.
14446 extern (C) int function (OutputStream* stream, AsyncResult* result, GLib2.Error** error=null) close_finish;
14447 extern (C) void function () _g_reserved1;
14448 extern (C) void function () _g_reserved2;
14449 extern (C) void function () _g_reserved3;
14450 extern (C) void function () _g_reserved4;
14451 extern (C) void function () _g_reserved5;
14452 extern (C) void function () _g_reserved6;
14453 extern (C) void function () _g_reserved7;
14454 extern (C) void function () _g_reserved8;
14457 struct OutputStreamPrivate {
14460 // GOutputStreamSpliceFlags determine how streams should be spliced.
14461 enum OutputStreamSpliceFlags {
14462 NONE = 0,
14463 CLOSE_SOURCE = 1,
14464 CLOSE_TARGET = 2
14467 // Structure used for scatter/gather data output.
14468 // You generally pass in an array of #GOutputVector<!-- -->s
14469 // and the operation will use all the buffers as if they were
14470 // one buffer.
14471 struct OutputVector /* Version 2.22 */ {
14472 const(void)* buffer;
14473 size_t size;
14476 enum PROXY_EXTENSION_POINT_NAME = "gio-proxy";
14477 enum PROXY_RESOLVER_EXTENSION_POINT_NAME = "gio-proxy-resolver";
14479 // #GPasswordSave is used to indicate the lifespan of a saved password.
14481 // #Gvfs stores passwords in the Gnome keyring when this flag allows it
14482 // to, and later retrieves it again from there.
14483 enum PasswordSave {
14484 NEVER = 0,
14485 FOR_SESSION = 1,
14486 PERMANENTLY = 2
14489 // A #GPermission represents the status of the caller's permission to
14490 // perform a certain action.
14492 // You can query if the action is currently allowed and if it is
14493 // possible to acquire the permission so that the action will be allowed
14494 // in the future.
14496 // There is also an API to actually acquire the permission and one to
14497 // release it.
14499 // As an example, a #GPermission might represent the ability for the
14500 // user to write to a #GSettings object. This #GPermission object could
14501 // then be used to decide if it is appropriate to show a "Click here to
14502 // unlock" button in a dialog and to provide the mechanism to invoke
14503 // when that button is clicked.
14504 struct Permission /* : GObject.Object */ {
14505 alias parent_instance this;
14506 alias parent_instance super_;
14507 alias parent_instance object;
14508 GObject2.Object parent_instance;
14509 private PermissionPrivate* priv;
14512 // Attempts to acquire the permission represented by @permission.
14514 // The precise method by which this happens depends on the permission
14515 // and the underlying authentication mechanism. A simple example is
14516 // that a dialog may appear asking the user to enter their password.
14518 // You should check with g_permission_get_can_acquire() before calling
14519 // this function.
14521 // If the permission is acquired then %TRUE is returned. Otherwise,
14522 // %FALSE is returned and @error is set appropriately.
14524 // This call is blocking, likely for a very long time (in the case that
14525 // user interaction is required). See g_permission_acquire_async() for
14526 // the non-blocking version.
14527 // RETURNS: %TRUE if the permission was successfully acquired
14528 // <cancellable>: a #GCancellable, or %NULL
14529 int acquire(Cancellable* cancellable, GLib2.Error** error=null) {
14530 return g_permission_acquire(&this, cancellable, error);
14533 // Attempts to acquire the permission represented by @permission.
14535 // This is the first half of the asynchronous version of
14536 // g_permission_acquire().
14537 // <cancellable>: a #GCancellable, or %NULL
14538 // <callback>: the #GAsyncReadyCallback to call when done
14539 // <user_data>: the user data to pass to @callback
14540 void acquire_async(Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
14541 g_permission_acquire_async(&this, cancellable, callback, user_data);
14544 // Collects the result of attempting to acquire the permission
14545 // represented by @permission.
14547 // This is the second half of the asynchronous version of
14548 // g_permission_acquire().
14549 // RETURNS: %TRUE if the permission was successfully acquired
14550 // <result>: the #GAsyncResult given to the #GAsyncReadyCallback
14551 int acquire_finish(AsyncResult* result, GLib2.Error** error=null) {
14552 return g_permission_acquire_finish(&this, result, error);
14555 // Gets the value of the 'allowed' property. This property is %TRUE if
14556 // the caller currently has permission to perform the action that
14557 // @permission represents the permission to perform.
14558 // RETURNS: the value of the 'allowed' property
14559 int get_allowed() {
14560 return g_permission_get_allowed(&this);
14563 // Gets the value of the 'can-acquire' property. This property is %TRUE
14564 // if it is generally possible to acquire the permission by calling
14565 // g_permission_acquire().
14566 // RETURNS: the value of the 'can-acquire' property
14567 int get_can_acquire() {
14568 return g_permission_get_can_acquire(&this);
14571 // Gets the value of the 'can-release' property. This property is %TRUE
14572 // if it is generally possible to release the permission by calling
14573 // g_permission_release().
14574 // RETURNS: the value of the 'can-release' property
14575 int get_can_release() {
14576 return g_permission_get_can_release(&this);
14579 // This function is called by the #GPermission implementation to update
14580 // the properties of the permission. You should never call this
14581 // function except from a #GPermission implementation.
14583 // GObject notify signals are generated, as appropriate.
14584 // <allowed>: the new value for the 'allowed' property
14585 // <can_acquire>: the new value for the 'can-acquire' property
14586 // <can_release>: the new value for the 'can-release' property
14587 void impl_update(int allowed, int can_acquire, int can_release) {
14588 g_permission_impl_update(&this, allowed, can_acquire, can_release);
14591 // Attempts to release the permission represented by @permission.
14593 // The precise method by which this happens depends on the permission
14594 // and the underlying authentication mechanism. In most cases the
14595 // permission will be dropped immediately without further action.
14597 // You should check with g_permission_get_can_release() before calling
14598 // this function.
14600 // If the permission is released then %TRUE is returned. Otherwise,
14601 // %FALSE is returned and @error is set appropriately.
14603 // This call is blocking, likely for a very long time (in the case that
14604 // user interaction is required). See g_permission_release_async() for
14605 // the non-blocking version.
14606 // RETURNS: %TRUE if the permission was successfully released
14607 // <cancellable>: a #GCancellable, or %NULL
14608 int release(Cancellable* cancellable, GLib2.Error** error=null) {
14609 return g_permission_release(&this, cancellable, error);
14612 // Attempts to release the permission represented by @permission.
14614 // This is the first half of the asynchronous version of
14615 // g_permission_release().
14616 // <cancellable>: a #GCancellable, or %NULL
14617 // <callback>: the #GAsyncReadyCallback to call when done
14618 // <user_data>: the user data to pass to @callback
14619 void release_async(Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
14620 g_permission_release_async(&this, cancellable, callback, user_data);
14623 // Collects the result of attempting to release the permission
14624 // represented by @permission.
14626 // This is the second half of the asynchronous version of
14627 // g_permission_release().
14628 // RETURNS: %TRUE if the permission was successfully released
14629 // <result>: the #GAsyncResult given to the #GAsyncReadyCallback
14630 int release_finish(AsyncResult* result, GLib2.Error** error=null) {
14631 return g_permission_release_finish(&this, result, error);
14635 struct PermissionClass {
14636 GObject2.ObjectClass parent_class;
14638 // RETURNS: %TRUE if the permission was successfully acquired
14639 // <cancellable>: a #GCancellable, or %NULL
14640 extern (C) int function (Permission* permission, Cancellable* cancellable, GLib2.Error** error=null) acquire;
14642 // <cancellable>: a #GCancellable, or %NULL
14643 // <callback>: the #GAsyncReadyCallback to call when done
14644 // <user_data>: the user data to pass to @callback
14645 extern (C) void function (Permission* permission, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) acquire_async;
14647 // RETURNS: %TRUE if the permission was successfully acquired
14648 // <result>: the #GAsyncResult given to the #GAsyncReadyCallback
14649 extern (C) int function (Permission* permission, AsyncResult* result, GLib2.Error** error=null) acquire_finish;
14651 // RETURNS: %TRUE if the permission was successfully released
14652 // <cancellable>: a #GCancellable, or %NULL
14653 extern (C) int function (Permission* permission, Cancellable* cancellable, GLib2.Error** error=null) release;
14655 // <cancellable>: a #GCancellable, or %NULL
14656 // <callback>: the #GAsyncReadyCallback to call when done
14657 // <user_data>: the user data to pass to @callback
14658 extern (C) void function (Permission* permission, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) release_async;
14660 // RETURNS: %TRUE if the permission was successfully released
14661 // <result>: the #GAsyncResult given to the #GAsyncReadyCallback
14662 extern (C) int function (Permission* permission, AsyncResult* result, GLib2.Error** error=null) release_finish;
14663 void*[16] reserved;
14666 struct PermissionPrivate {
14670 // #GPollableInputStream is implemented by #GInputStream<!-- -->s that
14671 // can be polled for readiness to read. This can be used when
14672 // interfacing with a non-GIO API that expects
14673 // UNIX-file-descriptor-style asynchronous I/O rather than GIO-style.
14674 struct PollableInputStream /* Version 2.28 */ {
14676 // Checks if @stream is actually pollable. Some classes may implement
14677 // #GPollableInputStream but have only certain instances of that class
14678 // be pollable. If this method returns %FALSE, then the behavior of
14679 // other #GPollableInputStream methods is undefined.
14681 // For any given stream, the value returned by this method is constant;
14682 // a stream cannot switch from pollable to non-pollable or vice versa.
14683 // RETURNS: %TRUE if @stream is pollable, %FALSE if not.
14684 int can_poll() {
14685 return g_pollable_input_stream_can_poll(&this);
14688 // Unintrospectable method: create_source() / g_pollable_input_stream_create_source()
14689 // Creates a #GSource that triggers when @stream can be read, or
14690 // @cancellable is triggered or an error occurs. The callback on the
14691 // source is of the #GPollableSourceFunc type.
14693 // As with g_pollable_input_stream_is_readable(), it is possible that
14694 // the stream may not actually be readable even after the source
14695 // triggers, so you should use g_pollable_input_stream_read_nonblocking()
14696 // rather than g_input_stream_read() from the callback.
14697 // RETURNS: a new #GSource
14698 // <cancellable>: a #GCancellable, or %NULL
14699 GLib2.Source* /*new*/ create_source(Cancellable* cancellable=null) {
14700 return g_pollable_input_stream_create_source(&this, cancellable);
14703 // Checks if @stream can be read.
14705 // Note that some stream types may not be able to implement this 100%
14706 // reliably, and it is possible that a call to g_input_stream_read()
14707 // after this returns %TRUE would still block. To guarantee
14708 // non-blocking behavior, you should always use
14709 // g_pollable_input_stream_read_nonblocking(), which will return a
14710 // %G_IO_ERROR_WOULD_BLOCK error rather than blocking.
14712 // has occurred on @stream, this will result in
14713 // g_pollable_input_stream_is_readable() returning %TRUE, and the
14714 // next attempt to read will return the error.
14715 // RETURNS: %TRUE if @stream is readable, %FALSE if not. If an error
14716 int is_readable() {
14717 return g_pollable_input_stream_is_readable(&this);
14720 // Attempts to read up to @size bytes from @stream into @buffer, as
14721 // with g_input_stream_read(). If @stream is not currently readable,
14722 // this will immediately return %G_IO_ERROR_WOULD_BLOCK, and you can
14723 // use g_pollable_input_stream_create_source() to create a #GSource
14724 // that will be triggered when @stream is readable.
14726 // Note that since this method never blocks, you cannot actually
14727 // use @cancellable to cancel it. However, it will return an error
14728 // if @cancellable has already been cancelled when you call, which
14729 // may happen if you call this method after a source triggers due
14730 // to having been cancelled.
14732 // %G_IO_ERROR_WOULD_BLOCK).
14733 // RETURNS: the number of bytes read, or -1 on error (including
14734 // <buffer>: a buffer to read data into (which should be at least @size bytes long).
14735 // <size>: the number of bytes you want to read
14736 // <cancellable>: a #GCancellable, or %NULL
14737 ssize_t read_nonblocking(void* buffer, size_t size, Cancellable* cancellable, GLib2.Error** error=null) {
14738 return g_pollable_input_stream_read_nonblocking(&this, buffer, size, cancellable, error);
14743 // The interface for pollable input streams.
14745 // The default implementation of @can_poll always returns %TRUE.
14747 // The default implementation of @read_nonblocking calls
14748 // g_pollable_input_stream_is_readable(), and then calls
14749 // g_input_stream_read() if it returns %TRUE. This means you only need
14750 // to override it if it is possible that your @is_readable
14751 // implementation may return %TRUE when the stream is not actually
14752 // readable.
14753 struct PollableInputStreamInterface /* Version 2.28 */ {
14754 GObject2.TypeInterface g_iface;
14755 // RETURNS: %TRUE if @stream is pollable, %FALSE if not.
14756 extern (C) int function (PollableInputStream* stream) can_poll;
14757 // RETURNS: %TRUE if @stream is readable, %FALSE if not. If an error
14758 extern (C) int function (PollableInputStream* stream) is_readable;
14760 // RETURNS: a new #GSource
14761 // <cancellable>: a #GCancellable, or %NULL
14762 extern (C) GLib2.Source* /*new*/ function (PollableInputStream* stream, Cancellable* cancellable=null) create_source;
14764 // RETURNS: the number of bytes read, or -1 on error (including
14765 // <buffer>: a buffer to read data into (which should be at least @size bytes long).
14766 // <size>: the number of bytes you want to read
14767 extern (C) ssize_t function (PollableInputStream* stream, void* buffer, size_t size, GLib2.Error** error=null) read_nonblocking;
14771 // #GPollableOutputStream is implemented by #GOutputStream<!-- -->s that
14772 // can be polled for readiness to write. This can be used when
14773 // interfacing with a non-GIO API that expects
14774 // UNIX-file-descriptor-style asynchronous I/O rather than GIO-style.
14775 struct PollableOutputStream /* Version 2.28 */ {
14777 // Checks if @stream is actually pollable. Some classes may implement
14778 // #GPollableOutputStream but have only certain instances of that
14779 // class be pollable. If this method returns %FALSE, then the behavior
14780 // of other #GPollableOutputStream methods is undefined.
14782 // For any given stream, the value returned by this method is constant;
14783 // a stream cannot switch from pollable to non-pollable or vice versa.
14784 // RETURNS: %TRUE if @stream is pollable, %FALSE if not.
14785 int can_poll() {
14786 return g_pollable_output_stream_can_poll(&this);
14789 // Unintrospectable method: create_source() / g_pollable_output_stream_create_source()
14790 // Creates a #GSource that triggers when @stream can be written, or
14791 // @cancellable is triggered or an error occurs. The callback on the
14792 // source is of the #GPollableSourceFunc type.
14794 // As with g_pollable_output_stream_is_writable(), it is possible that
14795 // the stream may not actually be writable even after the source
14796 // triggers, so you should use g_pollable_output_stream_write_nonblocking()
14797 // rather than g_output_stream_write() from the callback.
14798 // RETURNS: a new #GSource
14799 // <cancellable>: a #GCancellable, or %NULL
14800 GLib2.Source* /*new*/ create_source(Cancellable* cancellable=null) {
14801 return g_pollable_output_stream_create_source(&this, cancellable);
14804 // Checks if @stream can be written.
14806 // Note that some stream types may not be able to implement this 100%
14807 // reliably, and it is possible that a call to g_output_stream_write()
14808 // after this returns %TRUE would still block. To guarantee
14809 // non-blocking behavior, you should always use
14810 // g_pollable_output_stream_write_nonblocking(), which will return a
14811 // %G_IO_ERROR_WOULD_BLOCK error rather than blocking.
14813 // has occurred on @stream, this will result in
14814 // g_pollable_output_stream_is_writable() returning %TRUE, and the
14815 // next attempt to write will return the error.
14816 // RETURNS: %TRUE if @stream is writable, %FALSE if not. If an error
14817 int is_writable() {
14818 return g_pollable_output_stream_is_writable(&this);
14821 // Attempts to write up to @size bytes from @buffer to @stream, as
14822 // with g_output_stream_write(). If @stream is not currently writable,
14823 // this will immediately return %G_IO_ERROR_WOULD_BLOCK, and you can
14824 // use g_pollable_output_stream_create_source() to create a #GSource
14825 // that will be triggered when @stream is writable.
14827 // Note that since this method never blocks, you cannot actually
14828 // use @cancellable to cancel it. However, it will return an error
14829 // if @cancellable has already been cancelled when you call, which
14830 // may happen if you call this method after a source triggers due
14831 // to having been cancelled.
14833 // %G_IO_ERROR_WOULD_BLOCK).
14834 // RETURNS: the number of bytes written, or -1 on error (including
14835 // <buffer>: a buffer to write data from
14836 // <size>: the number of bytes you want to write
14837 // <cancellable>: a #GCancellable, or %NULL
14838 ssize_t write_nonblocking(ubyte* buffer, size_t size, Cancellable* cancellable, GLib2.Error** error=null) {
14839 return g_pollable_output_stream_write_nonblocking(&this, buffer, size, cancellable, error);
14844 // The interface for pollable output streams.
14846 // The default implementation of @can_poll always returns %TRUE.
14848 // The default implementation of @write_nonblocking calls
14849 // g_pollable_output_stream_is_writable(), and then calls
14850 // g_output_stream_write() if it returns %TRUE. This means you only
14851 // need to override it if it is possible that your @is_writable
14852 // implementation may return %TRUE when the stream is not actually
14853 // writable.
14854 struct PollableOutputStreamInterface /* Version 2.28 */ {
14855 GObject2.TypeInterface g_iface;
14856 // RETURNS: %TRUE if @stream is pollable, %FALSE if not.
14857 extern (C) int function (PollableOutputStream* stream) can_poll;
14858 // RETURNS: %TRUE if @stream is writable, %FALSE if not. If an error
14859 extern (C) int function (PollableOutputStream* stream) is_writable;
14861 // RETURNS: a new #GSource
14862 // <cancellable>: a #GCancellable, or %NULL
14863 extern (C) GLib2.Source* /*new*/ function (PollableOutputStream* stream, Cancellable* cancellable=null) create_source;
14865 // RETURNS: the number of bytes written, or -1 on error (including
14866 // <buffer>: a buffer to write data from
14867 // <size>: the number of bytes you want to write
14868 extern (C) ssize_t function (PollableOutputStream* stream, ubyte* buffer, size_t size, GLib2.Error** error=null) write_nonblocking;
14872 // This is the function type of the callback used for the #GSource
14873 // returned by g_pollable_input_stream_create_source() and
14874 // g_pollable_output_stream_create_source().
14875 // RETURNS: it should return %FALSE if the source should be removed.
14876 // <pollable_stream>: the #GPollableInputStream or #GPollableOutputStream
14877 // <user_data>: data passed in by the user.
14878 extern (C) alias int function (GObject2.Object* pollable_stream, void* user_data) PollableSourceFunc;
14881 // A #GProxy handles connecting to a remote host via a given type of
14882 // proxy server. It is implemented by the 'gio-proxy' extension point.
14883 // The extensions are named after their proxy protocol name. As an
14884 // example, a SOCKS5 proxy implementation can be retrieved with the
14885 // name 'socks5' using the function
14886 // g_io_extension_point_get_extension_by_name().
14887 struct Proxy /* Version 2.26 */ {
14889 // Lookup "gio-proxy" extension point for a proxy implementation that supports
14890 // specified protocol.
14892 // is not supported.
14893 // RETURNS: return a #GProxy or NULL if protocol
14894 // <protocol>: the proxy protocol name (e.g. http, socks, etc)
14895 static Proxy* /*new*/ get_default_for_protocol(char* protocol) {
14896 return g_proxy_get_default_for_protocol(protocol);
14899 // Given @connection to communicate with a proxy (eg, a
14900 // #GSocketConnection that is connected to the proxy server), this
14901 // does the necessary handshake to connect to @proxy_address, and if
14902 // required, wraps the #GIOStream to handle proxy payload.
14904 // be the same as @connection, in which case a reference
14905 // will be added.
14906 // RETURNS: a #GIOStream that will replace @connection. This might
14907 // <connection>: a #GIOStream
14908 // <proxy_address>: a #GProxyAddress
14909 // <cancellable>: a #GCancellable
14910 IOStream* /*new*/ connect(IOStream* connection, ProxyAddress* proxy_address, Cancellable* cancellable, GLib2.Error** error=null) {
14911 return g_proxy_connect(&this, connection, proxy_address, cancellable, error);
14914 // Asynchronous version of g_proxy_connect().
14915 // <connection>: a #GIOStream
14916 // <proxy_address>: a #GProxyAddress
14917 // <cancellable>: a #GCancellable
14918 // <callback>: a #GAsyncReadyCallback
14919 // <user_data>: callback data
14920 void connect_async(IOStream* connection, ProxyAddress* proxy_address, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
14921 g_proxy_connect_async(&this, connection, proxy_address, cancellable, callback, user_data);
14924 // See g_proxy_connect().
14925 // RETURNS: a #GIOStream.
14926 // <result>: a #GAsyncResult
14927 IOStream* /*new*/ connect_finish(AsyncResult* result, GLib2.Error** error=null) {
14928 return g_proxy_connect_finish(&this, result, error);
14931 // Some proxy protocols expect to be passed a hostname, which they
14932 // will resolve to an IP address themselves. Others, like SOCKS4, do
14933 // not allow this. This function will return %FALSE if @proxy is
14934 // implementing such a protocol. When %FALSE is returned, the caller
14935 // should resolve the destination hostname first, and then pass a
14936 // #GProxyAddress containing the stringified IP address to
14937 // g_proxy_connect() or g_proxy_connect_async().
14938 // RETURNS: %TRUE if hostname resolution is supported.
14939 int supports_hostname() {
14940 return g_proxy_supports_hostname(&this);
14944 // Support for proxied #GInetSocketAddress.
14945 struct ProxyAddress /* : InetSocketAddress */ /* Version 2.26 */ {
14946 alias parent_instance this;
14947 alias parent_instance super_;
14948 alias parent_instance inetsocketaddress;
14949 InetSocketAddress parent_instance;
14950 private ProxyAddressPrivate* priv;
14953 // Creates a new #GProxyAddress for @inetaddr with @protocol that should
14954 // tunnel through @dest_hostname and @dest_port.
14955 // RETURNS: a new #GProxyAddress
14956 // <inetaddr>: The proxy server #GInetAddress.
14957 // <port>: The proxy server port.
14958 // <protocol>: The proxy protocol to support, in lower case (e.g. socks, http).
14959 // <dest_hostname>: The destination hostname the the proxy should tunnel to.
14960 // <dest_port>: The destination port to tunnel to.
14961 // <username>: The username to authenticate to the proxy server (or %NULL).
14962 // <password>: The password to authenticate to the proxy server (or %NULL).
14963 static ProxyAddress* /*new*/ new_(InetAddress* inetaddr, ushort port, char* protocol, char* dest_hostname, ushort dest_port, char* username=null, char* password=null) {
14964 return g_proxy_address_new(inetaddr, port, protocol, dest_hostname, dest_port, username, password);
14967 // Gets @proxy's destination hostname.
14968 // RETURNS: the @proxy's destination hostname
14969 char* get_destination_hostname() {
14970 return g_proxy_address_get_destination_hostname(&this);
14973 // Gets @proxy's destination port.
14974 // RETURNS: the @proxy's destination port
14975 ushort get_destination_port() {
14976 return g_proxy_address_get_destination_port(&this);
14979 // Gets @proxy's password.
14980 // RETURNS: the @proxy's password
14981 char* get_password() {
14982 return g_proxy_address_get_password(&this);
14985 // Gets @proxy's protocol.
14986 // RETURNS: the @proxy's protocol
14987 char* get_protocol() {
14988 return g_proxy_address_get_protocol(&this);
14991 // Gets @proxy's username.
14992 // RETURNS: the @proxy's username
14993 char* get_username() {
14994 return g_proxy_address_get_username(&this);
14998 struct ProxyAddressClass {
14999 InetSocketAddressClass parent_class;
15003 // A subclass of #GSocketAddressEnumerator that takes another address
15004 // enumerator and wraps its results in #GProxyAddress<!-- -->es as
15005 // directed by the default #GProxyResolver.
15006 struct ProxyAddressEnumerator /* : SocketAddressEnumerator */ {
15007 alias parent_instance this;
15008 alias parent_instance super_;
15009 alias parent_instance socketaddressenumerator;
15010 SocketAddressEnumerator parent_instance;
15011 ProxyAddressEnumeratorPrivate* priv;
15014 struct ProxyAddressEnumeratorClass {
15015 SocketAddressEnumeratorClass parent_class;
15016 extern (C) void function () _g_reserved1;
15017 extern (C) void function () _g_reserved2;
15018 extern (C) void function () _g_reserved3;
15019 extern (C) void function () _g_reserved4;
15020 extern (C) void function () _g_reserved5;
15021 extern (C) void function () _g_reserved6;
15022 extern (C) void function () _g_reserved7;
15025 struct ProxyAddressEnumeratorPrivate {
15028 struct ProxyAddressPrivate {
15031 // Provides an interface for handling proxy connection and payload.
15032 struct ProxyInterface /* Version 2.26 */ {
15033 GObject2.TypeInterface g_iface;
15035 // RETURNS: a #GIOStream that will replace @connection. This might
15036 // <connection>: a #GIOStream
15037 // <proxy_address>: a #GProxyAddress
15038 // <cancellable>: a #GCancellable
15039 extern (C) IOStream* /*new*/ function (Proxy* proxy, IOStream* connection, ProxyAddress* proxy_address, Cancellable* cancellable, GLib2.Error** error=null) connect;
15041 // <connection>: a #GIOStream
15042 // <proxy_address>: a #GProxyAddress
15043 // <cancellable>: a #GCancellable
15044 // <callback>: a #GAsyncReadyCallback
15045 // <user_data>: callback data
15046 extern (C) void function (Proxy* proxy, IOStream* connection, ProxyAddress* proxy_address, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) connect_async;
15048 // RETURNS: a #GIOStream.
15049 // <result>: a #GAsyncResult
15050 extern (C) IOStream* /*new*/ function (Proxy* proxy, AsyncResult* result, GLib2.Error** error=null) connect_finish;
15051 // RETURNS: %TRUE if hostname resolution is supported.
15052 extern (C) int function (Proxy* proxy) supports_hostname;
15056 // #GProxyResolver provides synchronous and asynchronous network proxy
15057 // resolution. #GProxyResolver is used within #GSocketClient through
15058 // the method g_socket_connectable_proxy_enumerate().
15059 struct ProxyResolver {
15061 // Gets the default #GProxyResolver for the system.
15062 // RETURNS: the default #GProxyResolver.
15063 static ProxyResolver* get_default() {
15064 return g_proxy_resolver_get_default();
15067 // Checks if @resolver can be used on this system. (This is used
15068 // internally; g_proxy_resolver_get_default() will only return a proxy
15069 // resolver that returns %TRUE for this method.)
15070 // RETURNS: %TRUE if @resolver is supported.
15071 int is_supported() {
15072 return g_proxy_resolver_is_supported(&this);
15075 // Looks into the system proxy configuration to determine what proxy,
15076 // if any, to use to connect to @uri. The returned proxy URIs are of the
15077 // form <literal>&lt;protocol&gt;://[user[:password]@]host:port</literal>
15078 // or <literal>direct://</literal>, where &lt;protocol&gt; could be
15079 // http, rtsp, socks or other proxying protocol.
15081 // If you don't know what network protocol is being used on the
15082 // socket, you should use <literal>none</literal> as the URI protocol.
15083 // In this case, the resolver might still return a generic proxy type
15084 // (such as SOCKS), but would not return protocol-specific proxy types
15085 // (such as http).
15087 // <literal>direct://</literal> is used when no proxy is needed.
15088 // Direct connection should not be attempted unless it is part of the
15089 // returned array of proxies.
15091 // NULL-terminated array of proxy URIs. Must be freed
15092 // with g_strfreev().
15093 // RETURNS: A
15094 // <uri>: a URI representing the destination to connect to
15095 // <cancellable>: a #GCancellable, or %NULL
15096 char** /*new*/ lookup(char* uri, Cancellable* cancellable, GLib2.Error** error=null) {
15097 return g_proxy_resolver_lookup(&this, uri, cancellable, error);
15100 // Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more
15101 // details.
15102 // <uri>: a URI representing the destination to connect to
15103 // <cancellable>: a #GCancellable, or %NULL
15104 // <callback>: callback to call after resolution completes
15105 // <user_data>: data for @callback
15106 void lookup_async(char* uri, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
15107 g_proxy_resolver_lookup_async(&this, uri, cancellable, callback, user_data);
15110 // Call this function to obtain the array of proxy URIs when
15111 // g_proxy_resolver_lookup_async() is complete. See
15112 // g_proxy_resolver_lookup() for more details.
15114 // NULL-terminated array of proxy URIs. Must be freed
15115 // with g_strfreev().
15116 // RETURNS: A
15117 // <result>: the result passed to your #GAsyncReadyCallback
15118 char** /*new*/ lookup_finish(AsyncResult* result, GLib2.Error** error=null) {
15119 return g_proxy_resolver_lookup_finish(&this, result, error);
15123 struct ProxyResolverInterface {
15124 GObject2.TypeInterface g_iface;
15125 // RETURNS: %TRUE if @resolver is supported.
15126 extern (C) int function (ProxyResolver* resolver) is_supported;
15128 // RETURNS: A
15129 // <uri>: a URI representing the destination to connect to
15130 // <cancellable>: a #GCancellable, or %NULL
15131 extern (C) char** /*new*/ function (ProxyResolver* resolver, char* uri, Cancellable* cancellable, GLib2.Error** error=null) lookup;
15133 // <uri>: a URI representing the destination to connect to
15134 // <cancellable>: a #GCancellable, or %NULL
15135 // <callback>: callback to call after resolution completes
15136 // <user_data>: data for @callback
15137 extern (C) void function (ProxyResolver* resolver, char* uri, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) lookup_async;
15139 // RETURNS: A
15140 // <result>: the result passed to your #GAsyncReadyCallback
15141 extern (C) char** /*new*/ function (ProxyResolver* resolver, AsyncResult* result, GLib2.Error** error=null) lookup_finish;
15145 // Unintrospectable callback: ReallocFunc() / ()
15146 // Changes the size of the memory block pointed to by @data to
15147 // @size bytes.
15149 // The function should have the same semantics as realloc().
15150 // RETURNS: a pointer to the reallocated memory
15151 // <data>: memory block to reallocate
15152 // <size>: size to reallocate @data to
15153 extern (C) alias void* function (void* data, size_t size) ReallocFunc;
15156 // #GResolver provides cancellable synchronous and asynchronous DNS
15157 // resolution, for hostnames (g_resolver_lookup_by_address(),
15158 // g_resolver_lookup_by_name() and their async variants) and SRV
15159 // (service) records (g_resolver_lookup_service()).
15161 // #GNetworkAddress and #GNetworkService provide wrappers around
15162 // #GResolver functionality that also implement #GSocketConnectable,
15163 // making it easy to connect to a remote host/service.
15164 struct Resolver /* : GObject.Object */ {
15165 alias parent_instance this;
15166 alias parent_instance super_;
15167 alias parent_instance object;
15168 GObject2.Object parent_instance;
15169 ResolverPrivate* priv;
15172 // Unintrospectable function: free_addresses() / g_resolver_free_addresses()
15173 // Frees @addresses (which should be the return value from
15174 // g_resolver_lookup_by_name() or g_resolver_lookup_by_name_finish()).
15175 // (This is a convenience method; you can also simply free the results
15176 // by hand.)
15177 // <addresses>: a #GList of #GInetAddress
15178 static void free_addresses(GLib2.List* addresses) {
15179 g_resolver_free_addresses(addresses);
15182 // Unintrospectable function: free_targets() / g_resolver_free_targets()
15183 // Frees @targets (which should be the return value from
15184 // g_resolver_lookup_service() or g_resolver_lookup_service_finish()).
15185 // (This is a convenience method; you can also simply free the
15186 // results by hand.)
15187 // <targets>: a #GList of #GSrvTarget
15188 static void free_targets(GLib2.List* targets) {
15189 g_resolver_free_targets(targets);
15192 // Gets the default #GResolver. You should unref it when you are done
15193 // with it. #GResolver may use its reference count as a hint about how
15194 // many threads/processes, etc it should allocate for concurrent DNS
15195 // resolutions.
15196 // RETURNS: the default #GResolver.
15197 static Resolver* /*new*/ get_default() {
15198 return g_resolver_get_default();
15201 // Synchronously reverse-resolves @address to determine its
15202 // associated hostname.
15204 // If the DNS resolution fails, @error (if non-%NULL) will be set to
15205 // a value from #GResolverError.
15207 // If @cancellable is non-%NULL, it can be used to cancel the
15208 // operation, in which case @error (if non-%NULL) will be set to
15209 // %G_IO_ERROR_CANCELLED.
15211 // form), or %NULL on error.
15212 // RETURNS: a hostname (either ASCII-only, or in ASCII-encoded
15213 // <address>: the address to reverse-resolve
15214 // <cancellable>: a #GCancellable, or %NULL
15215 char* /*new*/ lookup_by_address(InetAddress* address, Cancellable* cancellable, GLib2.Error** error=null) {
15216 return g_resolver_lookup_by_address(&this, address, cancellable, error);
15219 // Begins asynchronously reverse-resolving @address to determine its
15220 // associated hostname, and eventually calls @callback, which must
15221 // call g_resolver_lookup_by_address_finish() to get the final result.
15222 // <address>: the address to reverse-resolve
15223 // <cancellable>: a #GCancellable, or %NULL
15224 // <callback>: callback to call after resolution completes
15225 // <user_data>: data for @callback
15226 void lookup_by_address_async(InetAddress* address, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
15227 g_resolver_lookup_by_address_async(&this, address, cancellable, callback, user_data);
15230 // Retrieves the result of a previous call to
15231 // g_resolver_lookup_by_address_async().
15233 // If the DNS resolution failed, @error (if non-%NULL) will be set to
15234 // a value from #GResolverError. If the operation was cancelled,
15235 // @error will be set to %G_IO_ERROR_CANCELLED.
15237 // form), or %NULL on error.
15238 // RETURNS: a hostname (either ASCII-only, or in ASCII-encoded
15239 // <result>: the result passed to your #GAsyncReadyCallback
15240 char* /*new*/ lookup_by_address_finish(AsyncResult* result, GLib2.Error** error=null) {
15241 return g_resolver_lookup_by_address_finish(&this, result, error);
15244 // Synchronously resolves @hostname to determine its associated IP
15245 // address(es). @hostname may be an ASCII-only or UTF-8 hostname, or
15246 // the textual form of an IP address (in which case this just becomes
15247 // a wrapper around g_inet_address_new_from_string()).
15249 // On success, g_resolver_lookup_by_name() will return a #GList of
15250 // #GInetAddress, sorted in order of preference and guaranteed to not
15251 // contain duplicates. That is, if using the result to connect to
15252 // @hostname, you should attempt to connect to the first address
15253 // first, then the second if the first fails, etc. If you are using
15254 // the result to listen on a socket, it is appropriate to add each
15255 // result using e.g. g_socket_listener_add_address().
15257 // If the DNS resolution fails, @error (if non-%NULL) will be set to a
15258 // value from #GResolverError.
15260 // If @cancellable is non-%NULL, it can be used to cancel the
15261 // operation, in which case @error (if non-%NULL) will be set to
15262 // %G_IO_ERROR_CANCELLED.
15264 // If you are planning to connect to a socket on the resolved IP
15265 // address, it may be easier to create a #GNetworkAddress and use its
15266 // #GSocketConnectable interface.
15268 // of #GInetAddress, or %NULL on error. You
15269 // must unref each of the addresses and free the list when you are
15270 // done with it. (You can use g_resolver_free_addresses() to do this.)
15271 // RETURNS: a #GList
15272 // <hostname>: the hostname to look up
15273 // <cancellable>: a #GCancellable, or %NULL
15274 GLib2.List* /*new*/ lookup_by_name(char* hostname, Cancellable* cancellable, GLib2.Error** error=null) {
15275 return g_resolver_lookup_by_name(&this, hostname, cancellable, error);
15278 // Begins asynchronously resolving @hostname to determine its
15279 // associated IP address(es), and eventually calls @callback, which
15280 // must call g_resolver_lookup_by_name_finish() to get the result.
15281 // See g_resolver_lookup_by_name() for more details.
15282 // <hostname>: the hostname to look up the address of
15283 // <cancellable>: a #GCancellable, or %NULL
15284 // <callback>: callback to call after resolution completes
15285 // <user_data>: data for @callback
15286 void lookup_by_name_async(char* hostname, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
15287 g_resolver_lookup_by_name_async(&this, hostname, cancellable, callback, user_data);
15290 // Retrieves the result of a call to
15291 // g_resolver_lookup_by_name_async().
15293 // If the DNS resolution failed, @error (if non-%NULL) will be set to
15294 // a value from #GResolverError. If the operation was cancelled,
15295 // @error will be set to %G_IO_ERROR_CANCELLED.
15297 // of #GInetAddress, or %NULL on error. See g_resolver_lookup_by_name()
15298 // for more details.
15299 // RETURNS: a #GList
15300 // <result>: the result passed to your #GAsyncReadyCallback
15301 GLib2.List* /*new*/ lookup_by_name_finish(AsyncResult* result, GLib2.Error** error=null) {
15302 return g_resolver_lookup_by_name_finish(&this, result, error);
15305 // Synchronously performs a DNS SRV lookup for the given @service and
15306 // @protocol in the given @domain and returns an array of #GSrvTarget.
15307 // @domain may be an ASCII-only or UTF-8 hostname. Note also that the
15308 // @service and @protocol arguments <emphasis>do not</emphasis>
15309 // include the leading underscore that appears in the actual DNS
15310 // entry.
15312 // On success, g_resolver_lookup_service() will return a #GList of
15313 // #GSrvTarget, sorted in order of preference. (That is, you should
15314 // attempt to connect to the first target first, then the second if
15315 // the first fails, etc.)
15317 // If the DNS resolution fails, @error (if non-%NULL) will be set to
15318 // a value from #GResolverError.
15320 // If @cancellable is non-%NULL, it can be used to cancel the
15321 // operation, in which case @error (if non-%NULL) will be set to
15322 // %G_IO_ERROR_CANCELLED.
15324 // If you are planning to connect to the service, it is usually easier
15325 // to create a #GNetworkService and use its #GSocketConnectable
15326 // interface.
15328 // or %NULL on error. You must free each of the targets and the list when you are
15329 // done with it. (You can use g_resolver_free_targets() to do this.)
15330 // RETURNS: a #GList of #GSrvTarget,
15331 // <service>: the service type to look up (eg, "ldap")
15332 // <protocol>: the networking protocol to use for @service (eg, "tcp")
15333 // <domain>: the DNS domain to look up the service in
15334 // <cancellable>: a #GCancellable, or %NULL
15335 GLib2.List* /*new*/ lookup_service(char* service, char* protocol, char* domain, Cancellable* cancellable, GLib2.Error** error=null) {
15336 return g_resolver_lookup_service(&this, service, protocol, domain, cancellable, error);
15339 // Begins asynchronously performing a DNS SRV lookup for the given
15340 // @service and @protocol in the given @domain, and eventually calls
15341 // @callback, which must call g_resolver_lookup_service_finish() to
15342 // get the final result. See g_resolver_lookup_service() for more
15343 // details.
15344 // <service>: the service type to look up (eg, "ldap")
15345 // <protocol>: the networking protocol to use for @service (eg, "tcp")
15346 // <domain>: the DNS domain to look up the service in
15347 // <cancellable>: a #GCancellable, or %NULL
15348 // <callback>: callback to call after resolution completes
15349 // <user_data>: data for @callback
15350 void lookup_service_async(char* service, char* protocol, char* domain, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
15351 g_resolver_lookup_service_async(&this, service, protocol, domain, cancellable, callback, user_data);
15354 // Retrieves the result of a previous call to
15355 // g_resolver_lookup_service_async().
15357 // If the DNS resolution failed, @error (if non-%NULL) will be set to
15358 // a value from #GResolverError. If the operation was cancelled,
15359 // @error will be set to %G_IO_ERROR_CANCELLED.
15361 // or %NULL on error. See g_resolver_lookup_service() for more details.
15362 // RETURNS: a #GList of #GSrvTarget,
15363 // <result>: the result passed to your #GAsyncReadyCallback
15364 GLib2.List* /*new*/ lookup_service_finish(AsyncResult* result, GLib2.Error** error=null) {
15365 return g_resolver_lookup_service_finish(&this, result, error);
15368 // Sets @resolver to be the application's default resolver (reffing
15369 // @resolver, and unreffing the previous default resolver, if any).
15370 // Future calls to g_resolver_get_default() will return this resolver.
15372 // This can be used if an application wants to perform any sort of DNS
15373 // caching or "pinning"; it can implement its own #GResolver that
15374 // calls the original default resolver for DNS operations, and
15375 // implements its own cache policies on top of that, and then set
15376 // itself as the default resolver for all later code to use.
15377 void set_default() {
15378 g_resolver_set_default(&this);
15381 // Emitted when the resolver notices that the system resolver
15382 // configuration has changed.
15383 extern (C) alias static void function (Resolver* this_, void* user_data=null) signal_reload;
15385 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
15386 return super_.signal_connect!name(cb, data, cf);
15389 ulong signal_connect(string name:"reload", CB:signal_reload)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
15390 return signal_connect_data(&this, cast(char*)"reload",
15391 cast(GObject2.Callback)cb, data, null, cf);
15395 struct ResolverClass {
15396 GObject2.ObjectClass parent_class;
15397 extern (C) void function (Resolver* resolver) reload;
15399 // RETURNS: a #GList
15400 // <hostname>: the hostname to look up
15401 // <cancellable>: a #GCancellable, or %NULL
15402 extern (C) GLib2.List* /*new*/ function (Resolver* resolver, char* hostname, Cancellable* cancellable, GLib2.Error** error=null) lookup_by_name;
15404 // <hostname>: the hostname to look up the address of
15405 // <cancellable>: a #GCancellable, or %NULL
15406 // <callback>: callback to call after resolution completes
15407 // <user_data>: data for @callback
15408 extern (C) void function (Resolver* resolver, char* hostname, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) lookup_by_name_async;
15410 // RETURNS: a #GList
15411 // <result>: the result passed to your #GAsyncReadyCallback
15412 extern (C) GLib2.List* /*new*/ function (Resolver* resolver, AsyncResult* result, GLib2.Error** error=null) lookup_by_name_finish;
15414 // RETURNS: a hostname (either ASCII-only, or in ASCII-encoded
15415 // <address>: the address to reverse-resolve
15416 // <cancellable>: a #GCancellable, or %NULL
15417 extern (C) char* /*new*/ function (Resolver* resolver, InetAddress* address, Cancellable* cancellable, GLib2.Error** error=null) lookup_by_address;
15419 // <address>: the address to reverse-resolve
15420 // <cancellable>: a #GCancellable, or %NULL
15421 // <callback>: callback to call after resolution completes
15422 // <user_data>: data for @callback
15423 extern (C) void function (Resolver* resolver, InetAddress* address, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) lookup_by_address_async;
15425 // RETURNS: a hostname (either ASCII-only, or in ASCII-encoded
15426 // <result>: the result passed to your #GAsyncReadyCallback
15427 extern (C) char* /*new*/ function (Resolver* resolver, AsyncResult* result, GLib2.Error** error=null) lookup_by_address_finish;
15428 // Unintrospectable functionp: lookup_service() / ()
15429 extern (C) GLib2.List* function (Resolver* resolver, char* rrname, Cancellable* cancellable, GLib2.Error** error=null) lookup_service;
15430 extern (C) void function (Resolver* resolver, char* rrname, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) lookup_service_async;
15432 // RETURNS: a #GList of #GSrvTarget,
15433 // <result>: the result passed to your #GAsyncReadyCallback
15434 extern (C) GLib2.List* /*new*/ function (Resolver* resolver, AsyncResult* result, GLib2.Error** error=null) lookup_service_finish;
15435 extern (C) void function () _g_reserved1;
15436 extern (C) void function () _g_reserved2;
15437 extern (C) void function () _g_reserved3;
15438 extern (C) void function () _g_reserved4;
15439 extern (C) void function () _g_reserved5;
15440 extern (C) void function () _g_reserved6;
15444 // An error code used with %G_RESOLVER_ERROR in a #GError returned
15445 // from a #GResolver routine.
15446 enum ResolverError /* Version 2.22 */ {
15447 NOT_FOUND = 0,
15448 TEMPORARY_FAILURE = 1,
15449 INTERNAL = 2
15451 struct ResolverPrivate {
15455 // #GSeekable is implemented by streams (implementations of
15456 // #GInputStream or #GOutputStream) that support seeking.
15457 struct Seekable {
15459 // Tests if the stream supports the #GSeekableIface.
15460 // RETURNS: %TRUE if @seekable can be seeked. %FALSE otherwise.
15461 int can_seek() {
15462 return g_seekable_can_seek(&this);
15465 // Tests if the stream can be truncated.
15466 // RETURNS: %TRUE if the stream can be truncated, %FALSE otherwise.
15467 int can_truncate() {
15468 return g_seekable_can_truncate(&this);
15471 // Seeks in the stream by the given @offset, modified by @type.
15473 // If @cancellable is not %NULL, then the operation can be cancelled by
15474 // triggering the cancellable object from another thread. If the operation
15475 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
15477 // has occurred, this function will return %FALSE and set @error
15478 // appropriately if present.
15479 // RETURNS: %TRUE if successful. If an error
15480 // <offset>: a #goffset.
15481 // <type>: a #GSeekType.
15482 // <cancellable>: optional #GCancellable object, %NULL to ignore.
15483 int seek(long offset, GLib2.SeekType type, Cancellable* cancellable, GLib2.Error** error=null) {
15484 return g_seekable_seek(&this, offset, type, cancellable, error);
15487 // Tells the current position within the stream.
15488 // RETURNS: the offset from the beginning of the buffer.
15489 long tell() {
15490 return g_seekable_tell(&this);
15493 // Truncates a stream with a given #offset.
15495 // If @cancellable is not %NULL, then the operation can be cancelled by
15496 // triggering the cancellable object from another thread. If the operation
15497 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
15498 // operation was partially finished when the operation was cancelled the
15499 // partial result will be returned, without an error.
15501 // has occurred, this function will return %FALSE and set @error
15502 // appropriately if present.
15503 // RETURNS: %TRUE if successful. If an error
15504 // <offset>: a #goffset.
15505 // <cancellable>: optional #GCancellable object, %NULL to ignore.
15506 int truncate(long offset, Cancellable* cancellable, GLib2.Error** error=null) {
15507 return g_seekable_truncate(&this, offset, cancellable, error);
15511 // Provides an interface for implementing seekable functionality on I/O Streams.
15512 struct SeekableIface {
15513 GObject2.TypeInterface g_iface;
15514 // RETURNS: the offset from the beginning of the buffer.
15515 extern (C) long function (Seekable* seekable) tell;
15516 // RETURNS: %TRUE if @seekable can be seeked. %FALSE otherwise.
15517 extern (C) int function (Seekable* seekable) can_seek;
15519 // RETURNS: %TRUE if successful. If an error
15520 // <offset>: a #goffset.
15521 // <type>: a #GSeekType.
15522 // <cancellable>: optional #GCancellable object, %NULL to ignore.
15523 extern (C) int function (Seekable* seekable, long offset, GLib2.SeekType type, Cancellable* cancellable, GLib2.Error** error=null) seek;
15524 // RETURNS: %TRUE if the stream can be truncated, %FALSE otherwise.
15525 extern (C) int function (Seekable* seekable) can_truncate;
15527 // RETURNS: %TRUE if successful. If an error
15528 // <offset>: a #goffset.
15529 // <cancellable>: optional #GCancellable object, %NULL to ignore.
15530 extern (C) int function (Seekable* seekable, long offset, Cancellable* cancellable, GLib2.Error** error=null) truncate_fn;
15534 // The #GSettings class provides a convenient API for storing and retrieving
15535 // application settings.
15537 // Reads and writes can be considered to be non-blocking. Reading
15538 // settings with #GSettings is typically extremely fast: on
15539 // approximately the same order of magnitude (but slower than) a
15540 // #GHashTable lookup. Writing settings is also extremely fast in terms
15541 // of time to return to your application, but can be extremely expensive
15542 // for other threads and other processes. Many settings backends
15543 // (including dconf) have lazy initialisation which means in the common
15544 // case of the user using their computer without modifying any settings
15545 // a lot of work can be avoided. For dconf, the D-Bus service doesn't
15546 // even need to be started in this case. For this reason, you should
15547 // only ever modify #GSettings keys in response to explicit user action.
15548 // Particular care should be paid to ensure that modifications are not
15549 // made during startup -- for example, when setting the initial value
15550 // of preferences widgets. The built-in g_settings_bind() functionality
15551 // is careful not to write settings in response to notify signals as a
15552 // result of modifications that it makes to widgets.
15554 // When creating a GSettings instance, you have to specify a schema
15555 // that describes the keys in your settings and their types and default
15556 // values, as well as some other information.
15558 // Normally, a schema has as fixed path that determines where the settings
15559 // are stored in the conceptual global tree of settings. However, schemas
15560 // can also be 'relocatable', i.e. not equipped with a fixed path. This is
15561 // useful e.g. when the schema describes an 'account', and you want to be
15562 // able to store a arbitrary number of accounts.
15564 // Unlike other configuration systems (like GConf), GSettings does not
15565 // restrict keys to basic types like strings and numbers. GSettings stores
15566 // values as #GVariant, and allows any #GVariantType for keys. Key names
15567 // are restricted to lowercase characters, numbers and '-'. Furthermore,
15568 // the names must begin with a lowercase character, must not end
15569 // with a '-', and must not contain consecutive dashes.
15571 // Similar to GConf, the default values in GSettings schemas can be
15572 // localized, but the localized values are stored in gettext catalogs
15573 // and looked up with the domain that is specified in the
15574 // <tag class="attribute">gettext-domain</tag> attribute of the
15575 // <tag class="starttag">schemalist</tag> or <tag class="starttag">schema</tag>
15576 // elements and the category that is specified in the l10n attribute of the
15577 // <tag class="starttag">key</tag> element.
15579 // GSettings uses schemas in a compact binary form that is created
15580 // by the <link linkend="glib-compile-schemas">glib-compile-schemas</link>
15581 // utility. The input is a schema description in an XML format that can be
15582 // described by the following DTD:
15583 // |[<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/gschema.dtd"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include>]|
15585 // glib-compile-schemas expects schema files to have the extension <filename>.gschema.xml</filename>
15587 // At runtime, schemas are identified by their id (as specified
15588 // in the <tag class="attribute">id</tag> attribute of the
15589 // <tag class="starttag">schema</tag> element). The
15590 // convention for schema ids is to use a dotted name, similar in
15591 // style to a D-Bus bus name, e.g. "org.gnome.SessionManager". In particular,
15592 // if the settings are for a specific service that owns a D-Bus bus name,
15593 // the D-Bus bus name and schema id should match. For schemas which deal
15594 // with settings not associated with one named application, the id should
15595 // not use StudlyCaps, e.g. "org.gnome.font-rendering".
15597 // In addition to #GVariant types, keys can have types that have enumerated
15598 // types. These can be described by a <tag class="starttag">choice</tag>,
15599 // <tag class="starttag">enum</tag> or <tag class="starttag">flags</tag> element, see
15600 // <xref linkend="schema-enumerated"/>. The underlying type of
15601 // such a key is string, but you can use g_settings_get_enum(),
15602 // g_settings_set_enum(), g_settings_get_flags(), g_settings_set_flags()
15603 // access the numeric values corresponding to the string value of enum
15604 // and flags keys.
15606 // <example id="schema-default-values"><title>Default values</title>
15607 // <programlisting><![CDATA[
15608 // <schemalist>
15609 // <schema id="org.gtk.Test" path="/tests/" gettext-domain="test">
15611 // <key name="greeting" type="s">
15612 // <default l10n="messages">"Hello, earthlings"</default>
15613 // <summary>A greeting</summary>
15614 // <description>
15615 // Greeting of the invading martians
15616 // </description>
15617 // </key>
15619 // <key name="box" type="(ii)">
15620 // <default>(20,30)</default>
15621 // </key>
15623 // </schema>
15624 // </schemalist>
15625 // ]]></programlisting></example>
15627 // <example id="schema-enumerated"><title>Ranges, choices and enumerated types</title>
15628 // <programlisting><![CDATA[
15629 // <schemalist>
15631 // <enum id="org.gtk.Test.myenum">
15632 // <value nick="first" value="1"/>
15633 // <value nick="second" value="2"/>
15634 // </enum>
15636 // <flags id="org.gtk.Test.myflags">
15637 // <value nick="flag1" value="1"/>
15638 // <value nick="flag2" value="2"/>
15639 // <value nick="flag3" value="4"/>
15640 // </flags>
15642 // <schema id="org.gtk.Test">
15644 // <key name="key-with-range" type="i">
15645 // <range min="1" max="100"/>
15646 // <default>10</default>
15647 // </key>
15649 // <key name="key-with-choices" type="s">
15650 // <choices>
15651 // <choice value='Elisabeth'/>
15652 // <choice value='Annabeth'/>
15653 // <choice value='Joe'/>
15654 // </choices>
15655 // <aliases>
15656 // <alias value='Anna' target='Annabeth'/>
15657 // <alias value='Beth' target='Elisabeth'/>
15658 // </aliases>
15659 // <default>'Joe'</default>
15660 // </key>
15662 // <key name='enumerated-key' enum='org.gtk.Test.myenum'>
15663 // <default>'first'</default>
15664 // </key>
15666 // <key name='flags-key' flags='org.gtk.Test.myflags'>
15667 // <default>["flag1",flag2"]</default>
15668 // </key>
15669 // </schema>
15670 // </schemalist>
15671 // ]]></programlisting></example>
15673 // <refsect2>
15674 // <title>Vendor overrides</title>
15675 // <para>
15676 // Default values are defined in the schemas that get installed by
15677 // an application. Sometimes, it is necessary for a vendor or distributor
15678 // to adjust these defaults. Since patching the XML source for the schema
15679 // is inconvenient and error-prone,
15680 // <link linkend="glib-compile-schemas">glib-compile-schemas</link> reads
15681 // so-called 'vendor override' files. These are keyfiles in the same
15682 // directory as the XML schema sources which can override default values.
15683 // The schema id serves as the group name in the key file, and the values
15684 // are expected in serialized GVariant form, as in the following example:
15685 // <informalexample><programlisting>
15686 // [org.gtk.Example]
15687 // key1='string'
15688 // key2=1.5
15689 // </programlisting></informalexample>
15690 // </para>
15691 // <para>
15692 // glib-compile-schemas expects schema files to have the extension
15693 // <filename>.gschema.override</filename>
15694 // </para>
15695 // </refsect2>
15697 // <refsect2>
15698 // <title>Binding</title>
15699 // <para>
15700 // A very convenient feature of GSettings lets you bind #GObject properties
15701 // directly to settings, using g_settings_bind(). Once a GObject property
15702 // has been bound to a setting, changes on either side are automatically
15703 // propagated to the other side. GSettings handles details like
15704 // mapping between GObject and GVariant types, and preventing infinite
15705 // cycles.
15706 // </para>
15707 // <para>
15708 // This makes it very easy to hook up a preferences dialog to the
15709 // underlying settings. To make this even more convenient, GSettings
15710 // looks for a boolean property with the name "sensitivity" and
15711 // automatically binds it to the writability of the bound setting.
15712 // If this 'magic' gets in the way, it can be suppressed with the
15713 // #G_SETTINGS_BIND_NO_SENSITIVITY flag.
15714 // </para>
15715 // </refsect2>
15716 struct Settings /* : GObject.Object */ {
15717 alias parent_instance this;
15718 alias parent_instance super_;
15719 alias parent_instance object;
15720 GObject2.Object parent_instance;
15721 SettingsPrivate* priv;
15724 // Creates a new #GSettings object with a given schema.
15726 // Signals on the newly created #GSettings object will be dispatched
15727 // via the thread-default #GMainContext in effect at the time of the
15728 // call to g_settings_new(). The new #GSettings will hold a reference
15729 // on the context. See g_main_context_push_thread_default().
15730 // RETURNS: a new #GSettings object
15731 // <schema>: the name of the schema
15732 static Settings* /*new*/ new_(char* schema) {
15733 return g_settings_new(schema);
15736 // Creates a new #GSettings object with a given schema and backend.
15738 // Creating a #GSettings object with a different backend allows accessing
15739 // settings from a database other than the usual one. For example, it may make
15740 // sense to pass a backend corresponding to the "defaults" settings database on
15741 // the system to get a settings object that modifies the system default
15742 // settings instead of the settings for this user.
15743 // RETURNS: a new #GSettings object
15744 // <schema>: the name of the schema
15745 // <backend>: the #GSettingsBackend to use
15746 static Settings* /*new*/ new_with_backend(char* schema, SettingsBackend* backend) {
15747 return g_settings_new_with_backend(schema, backend);
15750 // Creates a new #GSettings object with a given schema, backend and
15751 // path.
15753 // This is a mix of g_settings_new_with_backend() and
15754 // g_settings_new_with_path().
15755 // RETURNS: a new #GSettings object
15756 // <schema>: the name of the schema
15757 // <backend>: the #GSettingsBackend to use
15758 // <path>: the path to use
15759 static Settings* /*new*/ new_with_backend_and_path(char* schema, SettingsBackend* backend, char* path) {
15760 return g_settings_new_with_backend_and_path(schema, backend, path);
15763 // Creates a new #GSettings object with a given schema and path.
15765 // You only need to do this if you want to directly create a settings
15766 // object with a schema that doesn't have a specified path of its own.
15767 // That's quite rare.
15769 // It is a programmer error to call this function for a schema that
15770 // has an explicitly specified path.
15771 // RETURNS: a new #GSettings object
15772 // <schema>: the name of the schema
15773 // <path>: the path to use
15774 static Settings* /*new*/ new_with_path(char* schema, char* path) {
15775 return g_settings_new_with_path(schema, path);
15778 // Gets a list of the relocatable #GSettings schemas installed on the
15779 // system. These are schemas that do not provide their own path. It is
15780 // usual to instantiate these schemas directly, but if you want to you
15781 // can use g_settings_new_with_path() to specify the path.
15783 // The output of this function, tTaken together with the output of
15784 // g_settings_list_schemas() represents the complete list of all
15785 // installed schemas.
15787 // #GSettings schemas that are available. The list must not be
15788 // modified or freed.
15789 // RETURNS: a list of relocatable
15790 static char** list_relocatable_schemas() {
15791 return g_settings_list_relocatable_schemas();
15794 // Gets a list of the #GSettings schemas installed on the system. The
15795 // returned list is exactly the list of schemas for which you may call
15796 // g_settings_new() without adverse effects.
15798 // This function does not list the schemas that do not provide their own
15799 // paths (ie: schemas for which you must use
15800 // g_settings_new_with_path()). See
15801 // g_settings_list_relocatable_schemas() for that.
15803 // schemas that are available. The list must not be modified or
15804 // freed.
15805 // RETURNS: a list of #GSettings
15806 static char** list_schemas() {
15807 return g_settings_list_schemas();
15810 // Ensures that all pending operations for the given are complete for
15811 // the default backend.
15813 // Writes made to a #GSettings are handled asynchronously. For this
15814 // reason, it is very unlikely that the changes have it to disk by the
15815 // time g_settings_set() returns.
15817 // This call will block until all of the writes have made it to the
15818 // backend. Since the mainloop is not running, no change notifications
15819 // will be dispatched during this call (but some may be queued by the
15820 // time the call is done).
15821 static void sync() {
15822 g_settings_sync();
15825 // Removes an existing binding for @property on @object.
15827 // Note that bindings are automatically removed when the
15828 // object is finalized, so it is rarely necessary to call this
15829 // function.
15830 // <object>: the object
15831 // <property>: the property whose binding is removed
15832 static void unbind(void* object, char* property) {
15833 g_settings_unbind(object, property);
15836 // Applies any changes that have been made to the settings. This
15837 // function does nothing unless @settings is in 'delay-apply' mode;
15838 // see g_settings_delay(). In the normal case settings are always
15839 // applied immediately.
15840 void apply() {
15841 g_settings_apply(&this);
15844 // Create a binding between the @key in the @settings object
15845 // and the property @property of @object.
15847 // The binding uses the default GIO mapping functions to map
15848 // between the settings and property values. These functions
15849 // handle booleans, numeric types and string types in a
15850 // straightforward way. Use g_settings_bind_with_mapping() if
15851 // you need a custom mapping, or map between types that are not
15852 // supported by the default mapping functions.
15854 // Unless the @flags include %G_SETTINGS_BIND_NO_SENSITIVITY, this
15855 // function also establishes a binding between the writability of
15856 // @key and the "sensitive" property of @object (if @object has
15857 // a boolean property by that name). See g_settings_bind_writable()
15858 // for more details about writable bindings.
15860 // Note that the lifecycle of the binding is tied to the object,
15861 // and that you can have only one binding per object property.
15862 // If you bind the same property twice on the same object, the second
15863 // binding overrides the first one.
15864 // <key>: the key to bind
15865 // <object>: a #GObject
15866 // <property>: the name of the property to bind
15867 // <flags>: flags for the binding
15868 void bind(char* key, GObject2.Object* object, char* property, SettingsBindFlags flags) {
15869 g_settings_bind(&this, key, object, property, flags);
15872 // Unintrospectable method: bind_with_mapping() / g_settings_bind_with_mapping()
15873 // Create a binding between the @key in the @settings object
15874 // and the property @property of @object.
15876 // The binding uses the provided mapping functions to map between
15877 // settings and property values.
15879 // Note that the lifecycle of the binding is tied to the object,
15880 // and that you can have only one binding per object property.
15881 // If you bind the same property twice on the same object, the second
15882 // binding overrides the first one.
15883 // <key>: the key to bind
15884 // <object>: a #GObject
15885 // <property>: the name of the property to bind
15886 // <flags>: flags for the binding
15887 // <get_mapping>: a function that gets called to convert values from @settings to @object, or %NULL to use the default GIO mapping
15888 // <set_mapping>: a function that gets called to convert values from @object to @settings, or %NULL to use the default GIO mapping
15889 // <user_data>: data that gets passed to @get_mapping and @set_mapping
15890 // <destroy>: #GDestroyNotify function for @user_data
15891 void bind_with_mapping(char* key, GObject2.Object* object, char* property, SettingsBindFlags flags, SettingsBindGetMapping get_mapping, SettingsBindSetMapping set_mapping, void* user_data, GLib2.DestroyNotify destroy) {
15892 g_settings_bind_with_mapping(&this, key, object, property, flags, get_mapping, set_mapping, user_data, destroy);
15895 // Create a binding between the writability of @key in the
15896 // @settings object and the property @property of @object.
15897 // The property must be boolean; "sensitive" or "visible"
15898 // properties of widgets are the most likely candidates.
15900 // Writable bindings are always uni-directional; changes of the
15901 // writability of the setting will be propagated to the object
15902 // property, not the other way.
15904 // When the @inverted argument is %TRUE, the binding inverts the
15905 // value as it passes from the setting to the object, i.e. @property
15906 // will be set to %TRUE if the key is <emphasis>not</emphasis>
15907 // writable.
15909 // Note that the lifecycle of the binding is tied to the object,
15910 // and that you can have only one binding per object property.
15911 // If you bind the same property twice on the same object, the second
15912 // binding overrides the first one.
15913 // <key>: the key to bind
15914 // <object>: a #GObject
15915 // <property>: the name of a boolean property to bind
15916 // <inverted>: whether to 'invert' the value
15917 void bind_writable(char* key, GObject2.Object* object, char* property, int inverted) {
15918 g_settings_bind_writable(&this, key, object, property, inverted);
15921 // Changes the #GSettings object into 'delay-apply' mode. In this
15922 // mode, changes to @settings are not immediately propagated to the
15923 // backend, but kept locally until g_settings_apply() is called.
15924 void delay() {
15925 g_settings_delay(&this);
15928 // Unintrospectable method: get() / g_settings_get()
15929 // Gets the value that is stored at @key in @settings.
15931 // A convenience function that combines g_settings_get_value() with
15932 // g_variant_get().
15934 // It is a programmer error to give a @key that isn't contained in the
15935 // schema for @settings or for the #GVariantType of @format to mismatch
15936 // the type given in the schema.
15937 // <key>: the key to get the value for
15938 // <format>: a #GVariant format string
15939 /+ Not available -- variadic methods unsupported - use the C function directly.
15940 alias g_settings_get get; // Variadic
15943 // Gets the value that is stored at @key in @settings.
15945 // A convenience variant of g_settings_get() for booleans.
15947 // It is a programmer error to give a @key that isn't specified as
15948 // having a boolean type in the schema for @settings.
15949 // RETURNS: a boolean
15950 // <key>: the key to get the value for
15951 int get_boolean(char* key) {
15952 return g_settings_get_boolean(&this, key);
15955 // Creates a 'child' settings object which has a base path of
15956 // <replaceable>base-path</replaceable>/@name, where
15957 // <replaceable>base-path</replaceable> is the base path of @settings.
15959 // The schema for the child settings object must have been declared
15960 // in the schema of @settings using a <tag class="starttag">child</tag> element.
15961 // RETURNS: a 'child' settings object
15962 // <name>: the name of the 'child' schema
15963 Settings* /*new*/ get_child(char* name) {
15964 return g_settings_get_child(&this, name);
15967 // Gets the value that is stored at @key in @settings.
15969 // A convenience variant of g_settings_get() for doubles.
15971 // It is a programmer error to give a @key that isn't specified as
15972 // having a 'double' type in the schema for @settings.
15973 // RETURNS: a double
15974 // <key>: the key to get the value for
15975 double get_double(char* key) {
15976 return g_settings_get_double(&this, key);
15979 // Gets the value that is stored in @settings for @key and converts it
15980 // to the enum value that it represents.
15982 // In order to use this function the type of the value must be a string
15983 // and it must be marked in the schema file as an enumerated type.
15985 // It is a programmer error to give a @key that isn't contained in the
15986 // schema for @settings or is not marked as an enumerated type.
15988 // If the value stored in the configuration database is not a valid
15989 // value for the enumerated type then this function will return the
15990 // default value.
15991 // RETURNS: the enum value
15992 // <key>: the key to get the value for
15993 int get_enum(char* key) {
15994 return g_settings_get_enum(&this, key);
15997 // Gets the value that is stored in @settings for @key and converts it
15998 // to the flags value that it represents.
16000 // In order to use this function the type of the value must be an array
16001 // of strings and it must be marked in the schema file as an flags type.
16003 // It is a programmer error to give a @key that isn't contained in the
16004 // schema for @settings or is not marked as a flags type.
16006 // If the value stored in the configuration database is not a valid
16007 // value for the flags type then this function will return the default
16008 // value.
16009 // RETURNS: the flags value
16010 // <key>: the key to get the value for
16011 uint get_flags(char* key) {
16012 return g_settings_get_flags(&this, key);
16015 // Returns whether the #GSettings object has any unapplied
16016 // changes. This can only be the case if it is in 'delayed-apply' mode.
16017 // RETURNS: %TRUE if @settings has unapplied changes
16018 int get_has_unapplied() {
16019 return g_settings_get_has_unapplied(&this);
16022 // Gets the value that is stored at @key in @settings.
16024 // A convenience variant of g_settings_get() for 32-bit integers.
16026 // It is a programmer error to give a @key that isn't specified as
16027 // having a int32 type in the schema for @settings.
16028 // RETURNS: an integer
16029 // <key>: the key to get the value for
16030 int get_int(char* key) {
16031 return g_settings_get_int(&this, key);
16034 // Gets the value that is stored at @key in @settings, subject to
16035 // application-level validation/mapping.
16037 // You should use this function when the application needs to perform
16038 // some processing on the value of the key (for example, parsing). The
16039 // @mapping function performs that processing. If the function
16040 // indicates that the processing was unsuccessful (due to a parse error,
16041 // for example) then the mapping is tried again with another value.
16042 // This allows a robust 'fall back to defaults' behaviour to be
16043 // implemented somewhat automatically.
16045 // The first value that is tried is the user's setting for the key. If
16046 // the mapping function fails to map this value, other values may be
16047 // tried in an unspecified order (system or site defaults, translated
16048 // schema default values, untranslated schema default values, etc).
16050 // If the mapping function fails for all possible values, one additional
16051 // attempt is made: the mapping function is called with a %NULL value.
16052 // If the mapping function still indicates failure at this point then
16053 // the application will be aborted.
16055 // The result parameter for the @mapping function is pointed to a
16056 // #gpointer which is initially set to %NULL. The same pointer is given
16057 // to each invocation of @mapping. The final value of that #gpointer is
16058 // what is returned by this function. %NULL is valid; it is returned
16059 // just as any other value would be.
16060 // RETURNS: the result, which may be %NULL
16061 // <key>: the key to get the value for
16062 // <mapping>: the function to map the value in the settings database to the value used by the application
16063 // <user_data>: user data for @mapping
16064 void* /*new*/ get_mapped(char* key, SettingsGetMapping mapping, void* user_data) {
16065 return g_settings_get_mapped(&this, key, mapping, user_data);
16068 // Queries the range of a key.
16070 // This function will return a #GVariant that fully describes the range
16071 // of values that are valid for @key.
16073 // The type of #GVariant returned is <literal>(sv)</literal>. The
16074 // string describes the type of range restriction in effect. The type
16075 // and meaning of the value contained in the variant depends on the
16076 // string.
16078 // If the string is <literal>'type'</literal> then the variant contains
16079 // an empty array. The element type of that empty array is the expected
16080 // type of value and all values of that type are valid.
16082 // If the string is <literal>'enum'</literal> then the variant contains
16083 // an array enumerating the possible values. Each item in the array is
16084 // a possible valid value and no other values are valid.
16086 // If the string is <literal>'flags'</literal> then the variant contains
16087 // an array. Each item in the array is a value that may appear zero or
16088 // one times in an array to be used as the value for this key. For
16089 // example, if the variant contained the array <literal>['x',
16090 // 'y']</literal> then the valid values for the key would be
16091 // <literal>[]</literal>, <literal>['x']</literal>,
16092 // <literal>['y']</literal>, <literal>['x', 'y']</literal> and
16093 // <literal>['y', 'x']</literal>.
16095 // Finally, if the string is <literal>'range'</literal> then the variant
16096 // contains a pair of like-typed values -- the minimum and maximum
16097 // permissible values for this key.
16099 // This information should not be used by normal programs. It is
16100 // considered to be a hint for introspection purposes. Normal programs
16101 // should already know what is permitted by their own schema. The
16102 // format may change in any way in the future -- but particularly, new
16103 // forms may be added to the possibilities described above.
16105 // It is a programmer error to give a @key that isn't contained in the
16106 // schema for @settings.
16108 // You should free the returned value with g_variant_unref() when it is
16109 // no longer needed.
16110 // RETURNS: a #GVariant describing the range
16111 // <key>: the key to query the range of
16112 GLib2.Variant* /*new*/ get_range(char* key) {
16113 return g_settings_get_range(&this, key);
16116 // Gets the value that is stored at @key in @settings.
16118 // A convenience variant of g_settings_get() for strings.
16120 // It is a programmer error to give a @key that isn't specified as
16121 // having a string type in the schema for @settings.
16122 // RETURNS: a newly-allocated string
16123 // <key>: the key to get the value for
16124 char* /*new*/ get_string(char* key) {
16125 return g_settings_get_string(&this, key);
16128 // A convenience variant of g_settings_get() for string arrays.
16130 // It is a programmer error to give a @key that isn't specified as
16131 // having an array of strings type in the schema for @settings.
16132 // RETURNS: a newly-allocated, %NULL-terminated array of strings, the value that is stored at @key in @settings.
16133 // <key>: the key to get the value for
16134 char** /*new*/ get_strv(char* key) {
16135 return g_settings_get_strv(&this, key);
16138 // Gets the value that is stored at @key in @settings.
16140 // A convenience variant of g_settings_get() for 32-bit unsigned
16141 // integers.
16143 // It is a programmer error to give a @key that isn't specified as
16144 // having a uint32 type in the schema for @settings.
16145 // RETURNS: an unsigned integer
16146 // <key>: the key to get the value for
16147 uint get_uint(char* key) {
16148 return g_settings_get_uint(&this, key);
16151 // Gets the value that is stored in @settings for @key.
16153 // It is a programmer error to give a @key that isn't contained in the
16154 // schema for @settings.
16155 // RETURNS: a new #GVariant
16156 // <key>: the key to get the value for
16157 GLib2.Variant* /*new*/ get_value(char* key) {
16158 return g_settings_get_value(&this, key);
16161 // Finds out if a key can be written or not
16162 // RETURNS: %TRUE if the key @name is writable
16163 // <name>: the name of a key
16164 int is_writable(char* name) {
16165 return g_settings_is_writable(&this, name);
16168 // Gets the list of children on @settings.
16170 // The list is exactly the list of strings for which it is not an error
16171 // to call g_settings_get_child().
16173 // For GSettings objects that are lists, this value can change at any
16174 // time and you should connect to the "children-changed" signal to watch
16175 // for those changes. Note that there is a race condition here: you may
16176 // request a child after listing it only for it to have been destroyed
16177 // in the meantime. For this reason, g_settings_get_child() may return
16178 // %NULL even for a child that was listed by this function.
16180 // For GSettings objects that are not lists, you should probably not be
16181 // calling this function from "normal" code (since you should already
16182 // know what children are in your schema). This function may still be
16183 // useful there for introspection reasons, however.
16185 // You should free the return value with g_strfreev() when you are done
16186 // with it.
16187 // RETURNS: a list of the children on @settings
16188 char** /*new*/ list_children() {
16189 return g_settings_list_children(&this);
16192 // Introspects the list of keys on @settings.
16194 // You should probably not be calling this function from "normal" code
16195 // (since you should already know what keys are in your schema). This
16196 // function is intended for introspection reasons.
16198 // You should free the return value with g_strfreev() when you are done
16199 // with it.
16200 // RETURNS: a list of the keys on @settings
16201 char** /*new*/ list_keys() {
16202 return g_settings_list_keys(&this);
16205 // Checks if the given @value is of the correct type and within the
16206 // permitted range for @key.
16208 // This API is not intended to be used by normal programs -- they should
16209 // already know what is permitted by their own schemas. This API is
16210 // meant to be used by programs such as editors or commandline tools.
16212 // It is a programmer error to give a @key that isn't contained in the
16213 // schema for @settings.
16214 // RETURNS: %TRUE if @value is valid for @key
16215 // <key>: the key to check
16216 // <value>: the value to check
16217 int range_check(char* key, GLib2.Variant* value) {
16218 return g_settings_range_check(&this, key, value);
16221 // Resets @key to its default value.
16223 // This call resets the key, as much as possible, to its default value.
16224 // That might the value specified in the schema or the one set by the
16225 // administrator.
16226 // <key>: the name of a key
16227 void reset(char* key) {
16228 g_settings_reset(&this, key);
16231 // Reverts all non-applied changes to the settings. This function
16232 // does nothing unless @settings is in 'delay-apply' mode; see
16233 // g_settings_delay(). In the normal case settings are always applied
16234 // immediately.
16236 // Change notifications will be emitted for affected keys.
16237 void revert() {
16238 g_settings_revert(&this);
16241 // Unintrospectable method: set() / g_settings_set()
16242 // Sets @key in @settings to @value.
16244 // A convenience function that combines g_settings_set_value() with
16245 // g_variant_new().
16247 // It is a programmer error to give a @key that isn't contained in the
16248 // schema for @settings or for the #GVariantType of @format to mismatch
16249 // the type given in the schema.
16250 // RETURNS: %TRUE if setting the key succeeded, %FALSE if the key was not writable
16251 // <key>: the name of the key to set
16252 // <format>: a #GVariant format string
16253 /+ Not available -- variadic methods unsupported - use the C function directly.
16254 alias g_settings_set set; // Variadic
16257 // Sets @key in @settings to @value.
16259 // A convenience variant of g_settings_set() for booleans.
16261 // It is a programmer error to give a @key that isn't specified as
16262 // having a boolean type in the schema for @settings.
16263 // RETURNS: %TRUE if setting the key succeeded, %FALSE if the key was not writable
16264 // <key>: the name of the key to set
16265 // <value>: the value to set it to
16266 int set_boolean(char* key, int value) {
16267 return g_settings_set_boolean(&this, key, value);
16270 // Sets @key in @settings to @value.
16272 // A convenience variant of g_settings_set() for doubles.
16274 // It is a programmer error to give a @key that isn't specified as
16275 // having a 'double' type in the schema for @settings.
16276 // RETURNS: %TRUE if setting the key succeeded, %FALSE if the key was not writable
16277 // <key>: the name of the key to set
16278 // <value>: the value to set it to
16279 int set_double(char* key, double value) {
16280 return g_settings_set_double(&this, key, value);
16283 // Looks up the enumerated type nick for @value and writes it to @key,
16284 // within @settings.
16286 // It is a programmer error to give a @key that isn't contained in the
16287 // schema for @settings or is not marked as an enumerated type, or for
16288 // @value not to be a valid value for the named type.
16290 // After performing the write, accessing @key directly with
16291 // g_settings_get_string() will return the 'nick' associated with
16292 // @value.
16293 // RETURNS: %TRUE, if the set succeeds
16294 // <key>: a key, within @settings
16295 // <value>: an enumerated value
16296 int set_enum(char* key, int value) {
16297 return g_settings_set_enum(&this, key, value);
16300 // Looks up the flags type nicks for the bits specified by @value, puts
16301 // them in an array of strings and writes the array to @key, within
16302 // @settings.
16304 // It is a programmer error to give a @key that isn't contained in the
16305 // schema for @settings or is not marked as a flags type, or for @value
16306 // to contain any bits that are not value for the named type.
16308 // After performing the write, accessing @key directly with
16309 // g_settings_get_strv() will return an array of 'nicks'; one for each
16310 // bit in @value.
16311 // RETURNS: %TRUE, if the set succeeds
16312 // <key>: a key, within @settings
16313 // <value>: a flags value
16314 int set_flags(char* key, uint value) {
16315 return g_settings_set_flags(&this, key, value);
16318 // Sets @key in @settings to @value.
16320 // A convenience variant of g_settings_set() for 32-bit integers.
16322 // It is a programmer error to give a @key that isn't specified as
16323 // having a int32 type in the schema for @settings.
16324 // RETURNS: %TRUE if setting the key succeeded, %FALSE if the key was not writable
16325 // <key>: the name of the key to set
16326 // <value>: the value to set it to
16327 int set_int(char* key, int value) {
16328 return g_settings_set_int(&this, key, value);
16331 // Sets @key in @settings to @value.
16333 // A convenience variant of g_settings_set() for strings.
16335 // It is a programmer error to give a @key that isn't specified as
16336 // having a string type in the schema for @settings.
16337 // RETURNS: %TRUE if setting the key succeeded, %FALSE if the key was not writable
16338 // <key>: the name of the key to set
16339 // <value>: the value to set it to
16340 int set_string(char* key, char* value) {
16341 return g_settings_set_string(&this, key, value);
16344 // Sets @key in @settings to @value.
16346 // A convenience variant of g_settings_set() for string arrays. If
16347 // @value is %NULL, then @key is set to be the empty array.
16349 // It is a programmer error to give a @key that isn't specified as
16350 // having an array of strings type in the schema for @settings.
16351 // RETURNS: %TRUE if setting the key succeeded, %FALSE if the key was not writable
16352 // <key>: the name of the key to set
16353 // <value>: the value to set it to, or %NULL
16354 int set_strv(char* key, char** value=null) {
16355 return g_settings_set_strv(&this, key, value);
16358 // Sets @key in @settings to @value.
16360 // A convenience variant of g_settings_set() for 32-bit unsigned
16361 // integers.
16363 // It is a programmer error to give a @key that isn't specified as
16364 // having a uint32 type in the schema for @settings.
16365 // RETURNS: %TRUE if setting the key succeeded, %FALSE if the key was not writable
16366 // <key>: the name of the key to set
16367 // <value>: the value to set it to
16368 int set_uint(char* key, uint value) {
16369 return g_settings_set_uint(&this, key, value);
16372 // Sets @key in @settings to @value.
16374 // It is a programmer error to give a @key that isn't contained in the
16375 // schema for @settings or for @value to have the incorrect type, per
16376 // the schema.
16378 // If @value is floating then this function consumes the reference.
16379 // RETURNS: %TRUE if setting the key succeeded, %FALSE if the key was not writable
16380 // <key>: the name of the key to set
16381 // <value>: a #GVariant of the correct type
16382 int set_value(char* key, GLib2.Variant* value) {
16383 return g_settings_set_value(&this, key, value);
16386 // The "change-event" signal is emitted once per change event that
16387 // affects this settings object. You should connect to this signal
16388 // only if you are interested in viewing groups of changes before they
16389 // are split out into multiple emissions of the "changed" signal.
16390 // For most use cases it is more appropriate to use the "changed" signal.
16392 // In the event that the change event applies to one or more specified
16393 // keys, @keys will be an array of #GQuark of length @n_keys. In the
16394 // event that the change event applies to the #GSettings object as a
16395 // whole (ie: potentially every key has been changed) then @keys will
16396 // be %NULL and @n_keys will be 0.
16398 // The default handler for this signal invokes the "changed" signal
16399 // for each affected key. If any other connected handler returns
16400 // %TRUE then this default functionality will be suppressed.
16401 // RETURNS: %TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
16402 // <keys>: an array of #GQuark<!-- -->s for the changed keys, or %NULL
16403 // <n_keys>: the length of the @keys array, or 0
16404 extern (C) alias static c_int function (Settings* this_, GLib2.Quark* keys, int n_keys, void* user_data=null) signal_change_event;
16406 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
16407 return super_.signal_connect!name(cb, data, cf);
16410 ulong signal_connect(string name:"change-event", CB:signal_change_event)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
16411 return signal_connect_data(&this, cast(char*)"change-event",
16412 cast(GObject2.Callback)cb, data, null, cf);
16415 // The "changed" signal is emitted when a key has potentially changed.
16416 // You should call one of the g_settings_get() calls to check the new
16417 // value.
16419 // This signal supports detailed connections. You can connect to the
16420 // detailed signal "changed::x" in order to only receive callbacks
16421 // when key "x" changes.
16422 // <key>: the name of the key that changed
16423 extern (C) alias static void function (Settings* this_, char* key, void* user_data=null) signal_changed;
16424 ulong signal_connect(string name:"changed", CB:signal_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
16425 return signal_connect_data(&this, cast(char*)"changed",
16426 cast(GObject2.Callback)cb, data, null, cf);
16429 // The "writable-change-event" signal is emitted once per writability
16430 // change event that affects this settings object. You should connect
16431 // to this signal if you are interested in viewing groups of changes
16432 // before they are split out into multiple emissions of the
16433 // "writable-changed" signal. For most use cases it is more
16434 // appropriate to use the "writable-changed" signal.
16436 // In the event that the writability change applies only to a single
16437 // key, @key will be set to the #GQuark for that key. In the event
16438 // that the writability change affects the entire settings object,
16439 // @key will be 0.
16441 // The default handler for this signal invokes the "writable-changed"
16442 // and "changed" signals for each affected key. This is done because
16443 // changes in writability might also imply changes in value (if for
16444 // example, a new mandatory setting is introduced). If any other
16445 // connected handler returns %TRUE then this default functionality
16446 // will be suppressed.
16447 // RETURNS: %TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
16448 // <key>: the quark of the key, or 0
16449 extern (C) alias static c_int function (Settings* this_, c_uint key, void* user_data=null) signal_writable_change_event;
16450 ulong signal_connect(string name:"writable-change-event", CB:signal_writable_change_event)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
16451 return signal_connect_data(&this, cast(char*)"writable-change-event",
16452 cast(GObject2.Callback)cb, data, null, cf);
16455 // The "writable-changed" signal is emitted when the writability of a
16456 // key has potentially changed. You should call
16457 // g_settings_is_writable() in order to determine the new status.
16459 // This signal supports detailed connections. You can connect to the
16460 // detailed signal "writable-changed::x" in order to only receive
16461 // callbacks when the writability of "x" changes.
16462 // <key>: the key
16463 extern (C) alias static void function (Settings* this_, char* key, void* user_data=null) signal_writable_changed;
16464 ulong signal_connect(string name:"writable-changed", CB:signal_writable_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
16465 return signal_connect_data(&this, cast(char*)"writable-changed",
16466 cast(GObject2.Callback)cb, data, null, cf);
16471 // The #GSettingsBackend interface defines a generic interface for
16472 // non-strictly-typed data that is stored in a hierarchy. To implement
16473 // an alternative storage backend for #GSettings, you need to implement
16474 // the #GSettingsBackend interface and then make it implement the
16475 // extension point #G_SETTINGS_BACKEND_EXTENSION_POINT_NAME.
16477 // The interface defines methods for reading and writing values, a
16478 // method for determining if writing of certain values will fail
16479 // (lockdown) and a change notification mechanism.
16481 // The semantics of the interface are very precisely defined and
16482 // implementations must carefully adhere to the expectations of
16483 // callers that are documented on each of the interface methods.
16485 // Some of the GSettingsBackend functions accept or return a #GTree.
16486 // These trees always have strings as keys and #GVariant as values.
16487 // g_settings_backend_create_tree() is a convenience function to create
16488 // suitable trees.
16490 // <note><para>
16491 // The #GSettingsBackend API is exported to allow third-party
16492 // implementations, but does not carry the same stability guarantees
16493 // as the public GIO API. For this reason, you have to define the
16494 // C preprocessor symbol #G_SETTINGS_ENABLE_BACKEND before including
16495 // <filename>gio/gsettingsbackend.h</filename>
16496 // </para></note>
16497 struct SettingsBackend {
16501 // Flags used when creating a binding. These flags determine in which
16502 // direction the binding works. The default is to synchronize in both
16503 // directions.
16504 enum SettingsBindFlags {
16505 DEFAULT = 0,
16506 GET = 1,
16507 SET = 2,
16508 NO_SENSITIVITY = 4,
16509 GET_NO_CHANGES = 8,
16510 INVERT_BOOLEAN = 16
16513 // The type for the function that is used to convert from #GSettings to
16514 // an object property. The @value is already initialized to hold values
16515 // of the appropriate type.
16516 // RETURNS: %TRUE if the conversion succeeded, %FALSE in case of an error
16517 // <value>: return location for the property value
16518 // <variant>: the #GVariant
16519 // <user_data>: user data that was specified when the binding was created
16520 extern (C) alias int function (GObject2.Value* value, GLib2.Variant* variant, void* user_data) SettingsBindGetMapping;
16523 // The type for the function that is used to convert an object property
16524 // value to a #GVariant for storing it in #GSettings.
16525 // RETURNS: a new #GVariant holding the data from @value, or %NULL in case of an error
16526 // <value>: a #GValue containing the property value to map
16527 // <expected_type>: the #GVariantType to create
16528 // <user_data>: user data that was specified when the binding was created
16529 extern (C) alias GLib2.Variant* /*new*/ function (GObject2.Value* value, GLib2.VariantType* expected_type, void* user_data) SettingsBindSetMapping;
16531 struct SettingsClass {
16532 GObject2.ObjectClass parent_class;
16533 extern (C) void function (Settings* settings, char* key) writable_changed;
16534 extern (C) void function (Settings* settings, char* key) changed;
16535 extern (C) int function (Settings* settings, GLib2.Quark key) writable_change_event;
16536 extern (C) int function (Settings* settings, GLib2.Quark* keys, int n_keys) change_event;
16537 void*[20] padding;
16541 // The type of the function that is used to convert from a value stored
16542 // in a #GSettings to a value that is useful to the application.
16544 // If the value is successfully mapped, the result should be stored at
16545 // @result and %TRUE returned. If mapping fails (for example, if @value
16546 // is not in the right format) then %FALSE should be returned.
16548 // If @value is %NULL then it means that the mapping function is being
16549 // given a "last chance" to successfully return a valid value. %TRUE
16550 // must be returned in this case.
16551 // RETURNS: %TRUE if the conversion succeeded, %FALSE in case of an error
16552 // <value>: the #GVariant to map, or %NULL
16553 // <result>: the result of the mapping
16554 // <user_data>: the user data that was passed to g_settings_get_mapped()
16555 extern (C) alias int function (GLib2.Variant* value, /*out*/ void** result, void* user_data) SettingsGetMapping;
16557 struct SettingsPrivate {
16561 // A #GSimpleAction is the obvious simple implementation of the #GAction
16562 // interface. This is the easiest way to create an action for purposes of
16563 // adding it to a #GSimpleActionGroup.
16565 // See also #GtkAction.
16566 struct SimpleAction /* : GObject.Object */ {
16567 alias method_parent this;
16568 alias method_parent super_;
16569 alias method_parent object;
16570 GObject2.Object method_parent;
16573 // Creates a new action.
16575 // The created action is stateless. See g_simple_action_new_stateful().
16576 // RETURNS: a new #GSimpleAction
16577 // <name>: the name of the action
16578 // <parameter_type>: the type of parameter to the activate function
16579 static SimpleAction* /*new*/ new_(char* name, GLib2.VariantType* parameter_type=null) {
16580 return g_simple_action_new(name, parameter_type);
16583 // Creates a new stateful action.
16585 // @state is the initial state of the action. All future state values
16586 // must have the same #GVariantType as the initial state.
16588 // If the @state GVariant is floating, it is consumed.
16589 // RETURNS: a new #GSimpleAction
16590 // <name>: the name of the action
16591 // <parameter_type>: the type of the parameter to the activate function
16592 // <state>: the initial state of the action
16593 static SimpleAction* /*new*/ new_stateful(char* name, GLib2.VariantType* parameter_type, GLib2.Variant* state) {
16594 return g_simple_action_new_stateful(name, parameter_type, state);
16597 // Sets the action as enabled or not.
16599 // An action must be enabled in order to be activated or in order to
16600 // have its state changed from outside callers.
16602 // This should only be called by the implementor of the action. Users
16603 // of the action should not attempt to modify its enabled flag.
16604 // <enabled>: whether the action is enabled
16605 void set_enabled(int enabled) {
16606 g_simple_action_set_enabled(&this, enabled);
16609 // Sets the state of the action.
16611 // This directly updates the 'state' property to the given value.
16613 // This should only be called by the implementor of the action. Users
16614 // of the action should not attempt to directly modify the 'state'
16615 // property. Instead, they should call g_action_change_state() to
16616 // request the change.
16617 // <value>: the new #GVariant for the state
16618 void set_state(GLib2.Variant* value) {
16619 g_simple_action_set_state(&this, value);
16622 // Indicates that the action was just activated.
16624 // @parameter will always be of the expected type. In the event that
16625 // an incorrect type was given, no signal will be emitted.
16626 // <parameter>: the parameter to the activation
16627 extern (C) alias static void function (SimpleAction* this_, GLib2.Variant* parameter=null, void* user_data=null) signal_activate;
16629 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
16630 return super_.signal_connect!name(cb, data, cf);
16633 ulong signal_connect(string name:"activate", CB:signal_activate)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
16634 return signal_connect_data(&this, cast(char*)"activate",
16635 cast(GObject2.Callback)cb, data, null, cf);
16638 // Indicates that the action just received a request to change its
16639 // state.
16641 // @value will always be of the correct state type. In the event that
16642 // an incorrect type was given, no signal will be emitted.
16644 // If no handler is connected to this signal then the default
16645 // behaviour is to call g_simple_action_set_state() to set the state
16646 // to the requested value. If you connect a signal handler then no
16647 // default action is taken. If the state should change then you must
16648 // call g_simple_action_set_state() from the handler.
16650 // <example>
16651 // <title>Example 'change-state' handler</title>
16652 // <programlisting>
16653 // static void
16654 // change_volume_state (GSimpleAction *action,
16655 // GVariant *value,
16656 // gpointer user_data)
16657 // {
16658 // gint requested;
16660 // requested = g_variant_get_int32 (value);
16662 // // Volume only goes from 0 to 10
16663 // if (0 <= requested && requested <= 10)
16664 // g_simple_action_set_state (action, value);
16665 // }
16666 // </programlisting>
16667 // </example>
16669 // The handler need not set the state to the requested value. It
16670 // could set it to any value at all, or take some other action.
16671 // <value>: the requested value for the state
16672 extern (C) alias static void function (SimpleAction* this_, GLib2.Variant* value=null, void* user_data=null) signal_change_state;
16673 ulong signal_connect(string name:"change-state", CB:signal_change_state)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
16674 return signal_connect_data(&this, cast(char*)"change-state",
16675 cast(GObject2.Callback)cb, data, null, cf);
16680 // #GSimpleActionGroup is a hash table filled with #GAction objects,
16681 // implementing the #GActionGroup interface.
16682 struct SimpleActionGroup /* : GObject.Object */ /* Version 2.28 */ {
16683 alias parent_instance this;
16684 alias parent_instance super_;
16685 alias parent_instance object;
16686 GObject2.Object parent_instance;
16687 private SimpleActionGroupPrivate* priv;
16690 // Creates a new, empty, #GSimpleActionGroup.
16691 // RETURNS: a new #GSimpleActionGroup
16692 static SimpleActionGroup* /*new*/ new_() {
16693 return g_simple_action_group_new();
16696 // A convenience function for creating multiple #GSimpleAction instances
16697 // and adding them to the action group.
16699 // Each action is constructed as per one #GActionEntry.
16701 // <example>
16702 // <title>Using g_simple_action_group_add_entries()</title>
16703 // <programlisting>
16704 // static void
16705 // activate_quit (GSimpleAction *simple,
16706 // GVariant *parameter,
16707 // gpointer user_data)
16708 // {
16709 // exit (0);
16710 // }
16712 // static void
16713 // activate_print_string (GSimpleAction *simple,
16714 // GVariant *parameter,
16715 // gpointer user_data)
16716 // {
16717 // g_print ("%s\n", g_variant_get_string (parameter, NULL));
16718 // }
16720 // static GActionGroup *
16721 // create_action_group (void)
16722 // {
16723 // const GActionEntry entries[] = {
16724 // { "quit", activate_quit },
16725 // { "print-string", activate_print_string, "s" }
16726 // };
16727 // GSimpleActionGroup *group;
16729 // group = g_simple_action_group_new ();
16730 // g_simple_action_group_add_entries (group, entries, G_N_ELEMENTS (entries), NULL);
16732 // return G_ACTION_GROUP (group);
16733 // }
16734 // </programlisting>
16735 // </example>
16736 // <entries>: a pointer to the first item in an array of #GActionEntry structs
16737 // <n_entries>: the length of @entries, or -1
16738 // <user_data>: the user data for signal connections
16739 void add_entries(ActionEntry* entries, int n_entries, void* user_data) {
16740 g_simple_action_group_add_entries(&this, entries, n_entries, user_data);
16743 // Adds an action to the action group.
16745 // If the action group already contains an action with the same name as
16746 // @action then the old action is dropped from the group.
16748 // The action group takes its own reference on @action.
16749 // <action>: a #GAction
16750 void insert(Action* action) {
16751 g_simple_action_group_insert(&this, action);
16754 // Looks up the action with the name @action_name in the group.
16756 // If no such action exists, returns %NULL.
16757 // RETURNS: a #GAction, or %NULL
16758 // <action_name>: the name of an action
16759 Action* lookup(char* action_name) {
16760 return g_simple_action_group_lookup(&this, action_name);
16763 // Removes the named action from the action group.
16765 // If no action of this name is in the group then nothing happens.
16766 // <action_name>: the name of the action
16767 void remove(char* action_name) {
16768 g_simple_action_group_remove(&this, action_name);
16772 struct SimpleActionGroupClass {
16773 private GObject2.ObjectClass parent_class;
16774 private void*[12] padding;
16777 struct SimpleActionGroupPrivate {
16781 // Implements #GAsyncResult for simple cases. Most of the time, this
16782 // will be all an application needs, and will be used transparently.
16783 // Because of this, #GSimpleAsyncResult is used throughout GIO for
16784 // handling asynchronous functions.
16786 // GSimpleAsyncResult handles #GAsyncReadyCallback<!-- -->s, error
16787 // reporting, operation cancellation and the final state of an operation,
16788 // completely transparent to the application. Results can be returned
16789 // as a pointer e.g. for functions that return data that is collected
16790 // asynchronously, a boolean value for checking the success or failure
16791 // of an operation, or a #gssize for operations which return the number
16792 // of bytes modified by the operation; all of the simple return cases
16793 // are covered.
16795 // Most of the time, an application will not need to know of the details
16796 // of this API; it is handled transparently, and any necessary operations
16797 // are handled by #GAsyncResult's interface. However, if implementing a
16798 // new GIO module, for writing language bindings, or for complex
16799 // applications that need better control of how asynchronous operations
16800 // are completed, it is important to understand this functionality.
16802 // GSimpleAsyncResults are tagged with the calling function to ensure
16803 // that asynchronous functions and their finishing functions are used
16804 // together correctly.
16806 // To create a new #GSimpleAsyncResult, call g_simple_async_result_new().
16807 // If the result needs to be created for a #GError, use
16808 // g_simple_async_result_new_from_error() or
16809 // g_simple_async_result_new_take_error(). If a #GError is not available
16810 // (e.g. the asynchronous operation's doesn't take a #GError argument),
16811 // but the result still needs to be created for an error condition, use
16812 // g_simple_async_result_new_error() (or g_simple_async_result_set_error_va()
16813 // if your application or binding requires passing a variable argument list
16814 // directly), and the error can then be propagated through the use of
16815 // g_simple_async_result_propagate_error().
16817 // An asynchronous operation can be made to ignore a cancellation event by
16818 // calling g_simple_async_result_set_handle_cancellation() with a
16819 // #GSimpleAsyncResult for the operation and %FALSE. This is useful for
16820 // operations that are dangerous to cancel, such as close (which would
16821 // cause a leak if cancelled before being run).
16823 // GSimpleAsyncResult can integrate into GLib's event loop, #GMainLoop,
16824 // or it can use #GThread<!-- -->s if available.
16825 // g_simple_async_result_complete() will finish an I/O task directly
16826 // from the point where it is called. g_simple_async_result_complete_in_idle()
16827 // will finish it from an idle handler in the <link
16828 // linkend="g-main-context-push-thread-default">thread-default main
16829 // context</link>. g_simple_async_result_run_in_thread() will run the
16830 // job in a separate thread and then deliver the result to the
16831 // thread-default main context.
16833 // To set the results of an asynchronous function,
16834 // g_simple_async_result_set_op_res_gpointer(),
16835 // g_simple_async_result_set_op_res_gboolean(), and
16836 // g_simple_async_result_set_op_res_gssize()
16837 // are provided, setting the operation's result to a gpointer, gboolean, or
16838 // gssize, respectively.
16840 // Likewise, to get the result of an asynchronous function,
16841 // g_simple_async_result_get_op_res_gpointer(),
16842 // g_simple_async_result_get_op_res_gboolean(), and
16843 // g_simple_async_result_get_op_res_gssize() are
16844 // provided, getting the operation's result as a gpointer, gboolean, and
16845 // gssize, respectively.
16847 // For the details of the requirements implementations must respect, see
16848 // #GAsyncResult. A typical implementation of an asynchronous operation
16849 // using GSimpleAsyncResult looks something like this:
16851 // |[
16852 // static void
16853 // baked_cb (Cake *cake,
16854 // gpointer user_data)
16855 // {
16856 // /&ast; In this example, this callback is not given a reference to the cake, so
16857 // &ast; the GSimpleAsyncResult has to take a reference to it.
16858 // &ast;/
16859 // GSimpleAsyncResult *result = user_data;
16861 // if (cake == NULL)
16862 // g_simple_async_result_set_error (result,
16863 // BAKER_ERRORS,
16864 // BAKER_ERROR_NO_FLOUR,
16865 // "Go to the supermarket");
16866 // else
16867 // g_simple_async_result_set_op_res_gpointer (result,
16868 // g_object_ref (cake),
16869 // g_object_unref);
16872 // /&ast; In this example, we assume that baked_cb is called as a callback from
16873 // &ast; the mainloop, so it's safe to complete the operation synchronously here.
16874 // &ast; If, however, _baker_prepare_cake () might call its callback without
16875 // &ast; first returning to the mainloop — inadvisable, but some APIs do so —
16876 // &ast; we would need to use g_simple_async_result_complete_in_idle().
16877 // &ast;/
16878 // g_simple_async_result_complete (result);
16879 // g_object_unref (result);
16880 // }
16882 // void
16883 // baker_bake_cake_async (Baker *self,
16884 // guint radius,
16885 // GAsyncReadyCallback callback,
16886 // gpointer user_data)
16887 // {
16888 // GSimpleAsyncResult *simple;
16889 // Cake *cake;
16891 // if (radius < 3)
16892 // {
16893 // g_simple_async_report_error_in_idle (G_OBJECT (self),
16894 // callback,
16895 // user_data,
16896 // BAKER_ERRORS,
16897 // BAKER_ERROR_TOO_SMALL,
16898 // "%ucm radius cakes are silly",
16899 // radius);
16900 // return;
16901 // }
16903 // simple = g_simple_async_result_new (G_OBJECT (self),
16904 // callback,
16905 // user_data,
16906 // baker_bake_cake_async);
16907 // cake = _baker_get_cached_cake (self, radius);
16909 // if (cake != NULL)
16910 // {
16911 // g_simple_async_result_set_op_res_gpointer (simple,
16912 // g_object_ref (cake),
16913 // g_object_unref);
16914 // g_simple_async_result_complete_in_idle (simple);
16915 // g_object_unref (simple);
16916 // /&ast; Drop the reference returned by _baker_get_cached_cake(); the
16917 // &ast; GSimpleAsyncResult has taken its own reference.
16918 // &ast;/
16919 // g_object_unref (cake);
16920 // return;
16921 // }
16923 // _baker_prepare_cake (self, radius, baked_cb, simple);
16924 // }
16926 // Cake *
16927 // baker_bake_cake_finish (Baker *self,
16928 // GAsyncResult *result,
16929 // GError **error)
16930 // {
16931 // GSimpleAsyncResult *simple;
16932 // Cake *cake;
16934 // g_return_val_if_fail (g_simple_async_result_is_valid (result,
16935 // G_OBJECT (self),
16936 // baker_bake_cake_async),
16937 // NULL);
16939 // simple = (GSimpleAsyncResult *) result;
16941 // if (g_simple_async_result_propagate_error (simple, error))
16942 // return NULL;
16944 // cake = CAKE (g_simple_async_result_get_op_res_gpointer (simple));
16945 // return g_object_ref (cake);
16946 // }
16947 // ]|
16948 struct SimpleAsyncResult /* : GObject.Object */ {
16949 alias method_parent this;
16950 alias method_parent super_;
16951 alias method_parent object;
16952 GObject2.Object method_parent;
16955 // Creates a #GSimpleAsyncResult.
16956 // RETURNS: a #GSimpleAsyncResult.
16957 // <source_object>: a #GObject, or %NULL.
16958 // <callback>: a #GAsyncReadyCallback.
16959 // <user_data>: user data passed to @callback.
16960 // <source_tag>: the asynchronous function.
16961 static SimpleAsyncResult* /*new*/ new_(GObject2.Object* source_object, AsyncReadyCallback callback, void* user_data, void* source_tag) {
16962 return g_simple_async_result_new(source_object, callback, user_data, source_tag);
16965 // Unintrospectable constructor: new_error() / g_simple_async_result_new_error()
16966 // Creates a new #GSimpleAsyncResult with a set error.
16967 // RETURNS: a #GSimpleAsyncResult.
16968 // <source_object>: a #GObject, or %NULL.
16969 // <callback>: a #GAsyncReadyCallback.
16970 // <user_data>: user data passed to @callback.
16971 // <domain>: a #GQuark.
16972 // <code>: an error code.
16973 // <format>: a string with format characters.
16974 alias g_simple_async_result_new_error new_error; // Variadic
16976 // Creates a #GSimpleAsyncResult from an error condition.
16977 // RETURNS: a #GSimpleAsyncResult.
16978 // <source_object>: a #GObject, or %NULL.
16979 // <callback>: a #GAsyncReadyCallback.
16980 // <user_data>: user data passed to @callback.
16981 // <error>: a #GError
16982 static SimpleAsyncResult* /*new*/ new_from_error(GObject2.Object* source_object, AsyncReadyCallback callback, void* user_data, GLib2.Error* error) {
16983 return g_simple_async_result_new_from_error(source_object, callback, user_data, error);
16986 // Unintrospectable constructor: new_take_error() / g_simple_async_result_new_take_error()
16987 // Creates a #GSimpleAsyncResult from an error condition, and takes over the
16988 // caller's ownership of @error, so the caller does not need to free it anymore.
16989 // RETURNS: a #GSimpleAsyncResult
16990 // <source_object>: a #GObject, or %NULL
16991 // <callback>: a #GAsyncReadyCallback
16992 // <user_data>: user data passed to @callback
16993 // <error>: a #GError
16994 static SimpleAsyncResult* /*new*/ new_take_error(GObject2.Object* source_object, AsyncReadyCallback callback, void* user_data, GLib2.Error* error) {
16995 return g_simple_async_result_new_take_error(source_object, callback, user_data, error);
16998 // Ensures that the data passed to the _finish function of an async
16999 // operation is consistent. Three checks are performed.
17001 // First, @result is checked to ensure that it is really a
17002 // #GSimpleAsyncResult. Second, @source is checked to ensure that it
17003 // matches the source object of @result. Third, @source_tag is
17004 // checked to ensure that it is either %NULL (as it is when the result was
17005 // created by g_simple_async_report_error_in_idle() or
17006 // g_simple_async_report_gerror_in_idle()) or equal to the
17007 // @source_tag argument given to g_simple_async_result_new() (which, by
17008 // convention, is a pointer to the _async function corresponding to the
17009 // _finish function from which this function is called).
17010 // RETURNS: #TRUE if all checks passed or #FALSE if any failed.
17011 // <result>: the #GAsyncResult passed to the _finish function.
17012 // <source>: the #GObject passed to the _finish function.
17013 // <source_tag>: the asynchronous function.
17014 static int is_valid(AsyncResult* result, GObject2.Object* source, void* source_tag) {
17015 return g_simple_async_result_is_valid(result, source, source_tag);
17018 // Completes an asynchronous I/O job immediately. Must be called in
17019 // the thread where the asynchronous result was to be delivered, as it
17020 // invokes the callback directly. If you are in a different thread use
17021 // g_simple_async_result_complete_in_idle().
17023 // Calling this function takes a reference to @simple for as long as
17024 // is needed to complete the call.
17025 void complete() {
17026 g_simple_async_result_complete(&this);
17029 // Completes an asynchronous function in an idle handler in the <link
17030 // linkend="g-main-context-push-thread-default">thread-default main
17031 // loop</link> of the thread that @simple was initially created in.
17033 // Calling this function takes a reference to @simple for as long as
17034 // is needed to complete the call.
17035 void complete_in_idle() {
17036 g_simple_async_result_complete_in_idle(&this);
17039 // Gets the operation result boolean from within the asynchronous result.
17041 // if the operation's result was %FALSE.
17042 // RETURNS: %TRUE if the operation's result was %TRUE, %FALSE
17043 int get_op_res_gboolean() {
17044 return g_simple_async_result_get_op_res_gboolean(&this);
17047 // Unintrospectable method: get_op_res_gpointer() / g_simple_async_result_get_op_res_gpointer()
17048 // Gets a pointer result as returned by the asynchronous function.
17049 // RETURNS: a pointer from the result.
17050 void* get_op_res_gpointer() {
17051 return g_simple_async_result_get_op_res_gpointer(&this);
17054 // Gets a gssize from the asynchronous result.
17055 // RETURNS: a gssize returned from the asynchronous function.
17056 ssize_t get_op_res_gssize() {
17057 return g_simple_async_result_get_op_res_gssize(&this);
17060 // Unintrospectable method: get_source_tag() / g_simple_async_result_get_source_tag()
17061 // Gets the source tag for the #GSimpleAsyncResult.
17062 // RETURNS: a #gpointer to the source object for the #GSimpleAsyncResult.
17063 void* get_source_tag() {
17064 return g_simple_async_result_get_source_tag(&this);
17067 // Propagates an error from within the simple asynchronous result to
17068 // a given destination.
17069 // RETURNS: %TRUE if the error was propagated to @dest. %FALSE otherwise.
17070 int propagate_error(GLib2.Error** error=null) {
17071 return g_simple_async_result_propagate_error(&this, error);
17074 // Unintrospectable method: run_in_thread() / g_simple_async_result_run_in_thread()
17075 // Runs the asynchronous job in a separate thread and then calls
17076 // g_simple_async_result_complete_in_idle() on @simple to return
17077 // the result to the appropriate main loop.
17079 // Calling this function takes a reference to @simple for as long as
17080 // is needed to run the job and report its completion.
17081 // <func>: a #GSimpleAsyncThreadFunc.
17082 // <io_priority>: the io priority of the request.
17083 // <cancellable>: optional #GCancellable object, %NULL to ignore.
17084 void run_in_thread(SimpleAsyncThreadFunc func, int io_priority, Cancellable* cancellable=null) {
17085 g_simple_async_result_run_in_thread(&this, func, io_priority, cancellable);
17088 // Unintrospectable method: set_error() / g_simple_async_result_set_error()
17089 // Sets an error within the asynchronous result without a #GError.
17090 // <domain>: a #GQuark (usually #G_IO_ERROR).
17091 // <code>: an error code.
17092 // <format>: a formatted error reporting string.
17093 /+ Not available -- variadic methods unsupported - use the C function directly.
17094 alias g_simple_async_result_set_error set_error; // Variadic
17097 // Unintrospectable method: set_error_va() / g_simple_async_result_set_error_va()
17098 // Sets an error within the asynchronous result without a #GError.
17099 // Unless writing a binding, see g_simple_async_result_set_error().
17100 // <domain>: a #GQuark (usually #G_IO_ERROR).
17101 // <code>: an error code.
17102 // <format>: a formatted error reporting string.
17103 // <args>: va_list of arguments.
17104 void set_error_va(GLib2.Quark domain, int code, char* format, va_list args) {
17105 g_simple_async_result_set_error_va(&this, domain, code, format, args);
17108 // Sets the result from a #GError.
17109 // <error>: #GError.
17110 void set_from_error(GLib2.Error* error) {
17111 g_simple_async_result_set_from_error(&this, error);
17114 // Sets whether to handle cancellation within the asynchronous operation.
17115 // <handle_cancellation>: a #gboolean.
17116 void set_handle_cancellation(int handle_cancellation) {
17117 g_simple_async_result_set_handle_cancellation(&this, handle_cancellation);
17120 // Sets the operation result to a boolean within the asynchronous result.
17121 // <op_res>: a #gboolean.
17122 void set_op_res_gboolean(int op_res) {
17123 g_simple_async_result_set_op_res_gboolean(&this, op_res);
17126 // Unintrospectable method: set_op_res_gpointer() / g_simple_async_result_set_op_res_gpointer()
17127 // Sets the operation result within the asynchronous result to a pointer.
17128 // <op_res>: a pointer result from an asynchronous function.
17129 // <destroy_op_res>: a #GDestroyNotify function.
17130 void set_op_res_gpointer(void* op_res, GLib2.DestroyNotify destroy_op_res) {
17131 g_simple_async_result_set_op_res_gpointer(&this, op_res, destroy_op_res);
17134 // Sets the operation result within the asynchronous result to
17135 // the given @op_res.
17136 // <op_res>: a #gssize.
17137 void set_op_res_gssize(ssize_t op_res) {
17138 g_simple_async_result_set_op_res_gssize(&this, op_res);
17141 // Unintrospectable method: take_error() / g_simple_async_result_take_error()
17142 // Sets the result from @error, and takes over the caller's ownership
17143 // of @error, so the caller does not need to free it any more.
17144 // <error>: a #GError
17145 void take_error(GLib2.Error* error) {
17146 g_simple_async_result_take_error(&this, error);
17150 struct SimpleAsyncResultClass {
17154 // Simple thread function that runs an asynchronous operation and
17155 // checks for cancellation.
17156 // <res>: a #GSimpleAsyncResult.
17157 // <object>: a #GObject.
17158 // <cancellable>: optional #GCancellable object, %NULL to ignore.
17159 extern (C) alias void function (SimpleAsyncResult* res, GObject2.Object* object, Cancellable* cancellable=null) SimpleAsyncThreadFunc;
17162 // #GSimplePermission is a trivial implementation of #GPermission that
17163 // represents a permission that is either always or never allowed. The
17164 // value is given at construction and doesn't change.
17166 // Calling request or release will result in errors.
17167 struct SimplePermission /* : Permission */ {
17168 alias method_parent this;
17169 alias method_parent super_;
17170 alias method_parent permission;
17171 Permission method_parent;
17174 // Creates a new #GPermission instance that represents an action that is
17175 // either always or never allowed.
17176 // RETURNS: the #GSimplePermission, as a #GPermission
17177 // <allowed>: %TRUE if the action is allowed
17178 static SimplePermission* /*new*/ new_(int allowed) {
17179 return g_simple_permission_new(allowed);
17184 // A #GSocket is a low-level networking primitive. It is a more or less
17185 // direct mapping of the BSD socket API in a portable GObject based API.
17186 // It supports both the UNIX socket implementations and winsock2 on Windows.
17188 // #GSocket is the platform independent base upon which the higher level
17189 // network primitives are based. Applications are not typically meant to
17190 // use it directly, but rather through classes like #GSocketClient,
17191 // #GSocketService and #GSocketConnection. However there may be cases where
17192 // direct use of #GSocket is useful.
17194 // #GSocket implements the #GInitable interface, so if it is manually constructed
17195 // by e.g. g_object_new() you must call g_initable_init() and check the
17196 // results before using the object. This is done automatically in
17197 // g_socket_new() and g_socket_new_from_fd(), so these functions can return
17198 // %NULL.
17200 // Sockets operate in two general modes, blocking or non-blocking. When
17201 // in blocking mode all operations block until the requested operation
17202 // is finished or there is an error. In non-blocking mode all calls that
17203 // would block return immediately with a %G_IO_ERROR_WOULD_BLOCK error.
17204 // To know when a call would successfully run you can call g_socket_condition_check(),
17205 // or g_socket_condition_wait(). You can also use g_socket_create_source() and
17206 // attach it to a #GMainContext to get callbacks when I/O is possible.
17207 // Note that all sockets are always set to non blocking mode in the system, and
17208 // blocking mode is emulated in GSocket.
17210 // When working in non-blocking mode applications should always be able to
17211 // handle getting a %G_IO_ERROR_WOULD_BLOCK error even when some other
17212 // function said that I/O was possible. This can easily happen in case
17213 // of a race condition in the application, but it can also happen for other
17214 // reasons. For instance, on Windows a socket is always seen as writable
17215 // until a write returns %G_IO_ERROR_WOULD_BLOCK.
17217 // #GSocket<!-- -->s can be either connection oriented or datagram based.
17218 // For connection oriented types you must first establish a connection by
17219 // either connecting to an address or accepting a connection from another
17220 // address. For connectionless socket types the target/source address is
17221 // specified or received in each I/O operation.
17223 // All socket file descriptors are set to be close-on-exec.
17225 // Note that creating a #GSocket causes the signal %SIGPIPE to be
17226 // ignored for the remainder of the program. If you are writing a
17227 // command-line utility that uses #GSocket, you may need to take into
17228 // account the fact that your program will not automatically be killed
17229 // if it tries to write to %stdout after it has been closed.
17230 struct Socket /* : GObject.Object */ /* Version 2.22 */ {
17231 alias parent_instance this;
17232 alias parent_instance super_;
17233 alias parent_instance object;
17234 GObject2.Object parent_instance;
17235 SocketPrivate* priv;
17238 // Creates a new #GSocket with the defined family, type and protocol.
17239 // If @protocol is 0 (%G_SOCKET_PROTOCOL_DEFAULT) the default protocol type
17240 // for the family and type is used.
17242 // The @protocol is a family and type specific int that specifies what
17243 // kind of protocol to use. #GSocketProtocol lists several common ones.
17244 // Many families only support one protocol, and use 0 for this, others
17245 // support several and using 0 means to use the default protocol for
17246 // the family and type.
17248 // The protocol id is passed directly to the operating
17249 // system, so you can use protocols not listed in #GSocketProtocol if you
17250 // know the protocol number used for it.
17252 // Free the returned object with g_object_unref().
17253 // RETURNS: a #GSocket or %NULL on error.
17254 // <family>: the socket family to use, e.g. %G_SOCKET_FAMILY_IPV4.
17255 // <type>: the socket type to use.
17256 // <protocol>: the id of the protocol to use, or 0 for default.
17257 static Socket* /*new*/ new_(SocketFamily family, SocketType type, SocketProtocol protocol, GLib2.Error** error=null) {
17258 return g_socket_new(family, type, protocol, error);
17261 // Creates a new #GSocket from a native file descriptor
17262 // or winsock SOCKET handle.
17264 // This reads all the settings from the file descriptor so that
17265 // all properties should work. Note that the file descriptor
17266 // will be set to non-blocking mode, independent on the blocking
17267 // mode of the #GSocket.
17269 // Free the returned object with g_object_unref().
17270 // RETURNS: a #GSocket or %NULL on error.
17271 // <fd>: a native socket file descriptor.
17272 static Socket* /*new*/ new_from_fd(int fd, GLib2.Error** error=null) {
17273 return g_socket_new_from_fd(fd, error);
17276 // Accept incoming connections on a connection-based socket. This removes
17277 // the first outstanding connection request from the listening socket and
17278 // creates a #GSocket object for it.
17280 // The @socket must be bound to a local address with g_socket_bind() and
17281 // must be listening for incoming connections (g_socket_listen()).
17283 // If there are no outstanding connections then the operation will block
17284 // or return %G_IO_ERROR_WOULD_BLOCK if non-blocking I/O is enabled.
17285 // To be notified of an incoming connection, wait for the %G_IO_IN condition.
17287 // Free the returned object with g_object_unref().
17288 // RETURNS: a new #GSocket, or %NULL on error.
17289 // <cancellable>: a %GCancellable or %NULL
17290 Socket* /*new*/ accept(Cancellable* cancellable, GLib2.Error** error=null) {
17291 return g_socket_accept(&this, cancellable, error);
17294 // When a socket is created it is attached to an address family, but it
17295 // doesn't have an address in this family. g_socket_bind() assigns the
17296 // address (sometimes called name) of the socket.
17298 // It is generally required to bind to a local address before you can
17299 // receive connections. (See g_socket_listen() and g_socket_accept() ).
17300 // In certain situations, you may also want to bind a socket that will be
17301 // used to initiate connections, though this is not normally required.
17303 // @allow_reuse should be %TRUE for server sockets (sockets that you will
17304 // eventually call g_socket_accept() on), and %FALSE for client sockets.
17305 // (Specifically, if it is %TRUE, then g_socket_bind() will set the
17306 // %SO_REUSEADDR flag on the socket, allowing it to bind @address even if
17307 // that address was previously used by another socket that has not yet been
17308 // fully cleaned-up by the kernel. Failing to set this flag on a server
17309 // socket may cause the bind call to return %G_IO_ERROR_ADDRESS_IN_USE if
17310 // the server program is stopped and then immediately restarted.)
17311 // RETURNS: %TRUE on success, %FALSE on error.
17312 // <address>: a #GSocketAddress specifying the local address.
17313 // <allow_reuse>: whether to allow reusing this address
17314 int bind(SocketAddress* address, int allow_reuse, GLib2.Error** error=null) {
17315 return g_socket_bind(&this, address, allow_reuse, error);
17318 // Checks and resets the pending connect error for the socket.
17319 // This is used to check for errors when g_socket_connect() is
17320 // used in non-blocking mode.
17321 // RETURNS: %TRUE if no error, %FALSE otherwise, setting @error to the error
17322 int check_connect_result(GLib2.Error** error=null) {
17323 return g_socket_check_connect_result(&this, error);
17326 // Closes the socket, shutting down any active connection.
17328 // Closing a socket does not wait for all outstanding I/O operations
17329 // to finish, so the caller should not rely on them to be guaranteed
17330 // to complete even if the close returns with no error.
17332 // Once the socket is closed, all other operations will return
17333 // %G_IO_ERROR_CLOSED. Closing a socket multiple times will not
17334 // return an error.
17336 // Sockets will be automatically closed when the last reference
17337 // is dropped, but you might want to call this function to make sure
17338 // resources are released as early as possible.
17340 // Beware that due to the way that TCP works, it is possible for
17341 // recently-sent data to be lost if either you close a socket while the
17342 // %G_IO_IN condition is set, or else if the remote connection tries to
17343 // send something to you after you close the socket but before it has
17344 // finished reading all of the data you sent. There is no easy generic
17345 // way to avoid this problem; the easiest fix is to design the network
17346 // protocol such that the client will never send data "out of turn".
17347 // Another solution is for the server to half-close the connection by
17348 // calling g_socket_shutdown() with only the @shutdown_write flag set,
17349 // and then wait for the client to notice this and close its side of the
17350 // connection, after which the server can safely call g_socket_close().
17351 // (This is what #GTcpConnection does if you call
17352 // g_tcp_connection_set_graceful_disconnect(). But of course, this
17353 // only works if the client will close its connection after the server
17354 // does.)
17355 // RETURNS: %TRUE on success, %FALSE on error
17356 int close(GLib2.Error** error=null) {
17357 return g_socket_close(&this, error);
17360 // Checks on the readiness of @socket to perform operations.
17361 // The operations specified in @condition are checked for and masked
17362 // against the currently-satisfied conditions on @socket. The result
17363 // is returned.
17365 // Note that on Windows, it is possible for an operation to return
17366 // %G_IO_ERROR_WOULD_BLOCK even immediately after
17367 // g_socket_condition_check() has claimed that the socket is ready for
17368 // writing. Rather than calling g_socket_condition_check() and then
17369 // writing to the socket if it succeeds, it is generally better to
17370 // simply try writing to the socket right away, and try again later if
17371 // the initial attempt returns %G_IO_ERROR_WOULD_BLOCK.
17373 // It is meaningless to specify %G_IO_ERR or %G_IO_HUP in condition;
17374 // these conditions will always be set in the output if they are true.
17376 // This call never blocks.
17377 // RETURNS: the @GIOCondition mask of the current state
17378 // <condition>: a #GIOCondition mask to check
17379 GLib2.IOCondition condition_check(GLib2.IOCondition condition) {
17380 return g_socket_condition_check(&this, condition);
17383 // Waits for @condition to become true on @socket. When the condition
17384 // is met, %TRUE is returned.
17386 // If @cancellable is cancelled before the condition is met, or if the
17387 // socket has a timeout set and it is reached before the condition is
17388 // met, then %FALSE is returned and @error, if non-%NULL, is set to
17389 // the appropriate value (%G_IO_ERROR_CANCELLED or
17390 // %G_IO_ERROR_TIMED_OUT).
17391 // RETURNS: %TRUE if the condition was met, %FALSE otherwise
17392 // <condition>: a #GIOCondition mask to wait for
17393 // <cancellable>: a #GCancellable, or %NULL
17394 int condition_wait(GLib2.IOCondition condition, Cancellable* cancellable, GLib2.Error** error=null) {
17395 return g_socket_condition_wait(&this, condition, cancellable, error);
17398 // Connect the socket to the specified remote address.
17400 // For connection oriented socket this generally means we attempt to make
17401 // a connection to the @address. For a connection-less socket it sets
17402 // the default address for g_socket_send() and discards all incoming datagrams
17403 // from other sources.
17405 // Generally connection oriented sockets can only connect once, but
17406 // connection-less sockets can connect multiple times to change the
17407 // default address.
17409 // If the connect call needs to do network I/O it will block, unless
17410 // non-blocking I/O is enabled. Then %G_IO_ERROR_PENDING is returned
17411 // and the user can be notified of the connection finishing by waiting
17412 // for the G_IO_OUT condition. The result of the connection must then be
17413 // checked with g_socket_check_connect_result().
17414 // RETURNS: %TRUE if connected, %FALSE on error.
17415 // <address>: a #GSocketAddress specifying the remote address.
17416 // <cancellable>: a %GCancellable or %NULL
17417 int connect(SocketAddress* address, Cancellable* cancellable, GLib2.Error** error=null) {
17418 return g_socket_connect(&this, address, cancellable, error);
17421 // Creates a #GSocketConnection subclass of the right type for
17422 // @socket.
17423 // RETURNS: a #GSocketConnection
17424 SocketConnection* /*new*/ connection_factory_create_connection() {
17425 return g_socket_connection_factory_create_connection(&this);
17428 // Unintrospectable method: create_source() / g_socket_create_source()
17429 // Creates a %GSource that can be attached to a %GMainContext to monitor
17430 // for the availibility of the specified @condition on the socket.
17432 // The callback on the source is of the #GSocketSourceFunc type.
17434 // It is meaningless to specify %G_IO_ERR or %G_IO_HUP in @condition;
17435 // these conditions will always be reported output if they are true.
17437 // @cancellable if not %NULL can be used to cancel the source, which will
17438 // cause the source to trigger, reporting the current condition (which
17439 // is likely 0 unless cancellation happened at the same time as a
17440 // condition change). You can check for this in the callback using
17441 // g_cancellable_is_cancelled().
17443 // If @socket has a timeout set, and it is reached before @condition
17444 // occurs, the source will then trigger anyway, reporting %G_IO_IN or
17445 // %G_IO_OUT depending on @condition. However, @socket will have been
17446 // marked as having had a timeout, and so the next #GSocket I/O method
17447 // you call will then fail with a %G_IO_ERROR_TIMED_OUT.
17448 // RETURNS: a newly allocated %GSource, free with g_source_unref().
17449 // <condition>: a #GIOCondition mask to monitor
17450 // <cancellable>: a %GCancellable or %NULL
17451 GLib2.Source* /*new*/ create_source(GLib2.IOCondition condition, Cancellable* cancellable=null) {
17452 return g_socket_create_source(&this, condition, cancellable);
17455 // Gets the blocking mode of the socket. For details on blocking I/O,
17456 // see g_socket_set_blocking().
17457 // RETURNS: %TRUE if blocking I/O is used, %FALSE otherwise.
17458 int get_blocking() {
17459 return g_socket_get_blocking(&this);
17462 // Returns the credentials of the foreign process connected to this
17463 // socket, if any (e.g. it is only supported for %G_SOCKET_FAMILY_UNIX
17464 // sockets).
17466 // If this operation isn't supported on the OS, the method fails with
17467 // the %G_IO_ERROR_NOT_SUPPORTED error. On Linux this is implemented
17468 // by reading the %SO_PEERCRED option on the underlying socket.
17470 // Other ways to obtain credentials from a foreign peer includes the
17471 // #GUnixCredentialsMessage type and
17472 // g_unix_connection_send_credentials() /
17473 // g_unix_connection_receive_credentials() functions.
17475 // that must be freed with g_object_unref().
17476 // RETURNS: %NULL if @error is set, otherwise a #GCredentials object
17477 Credentials* /*new*/ get_credentials(GLib2.Error** error=null) {
17478 return g_socket_get_credentials(&this, error);
17481 // Gets the socket family of the socket.
17482 // RETURNS: a #GSocketFamily
17483 SocketFamily get_family() {
17484 return g_socket_get_family(&this);
17487 // Returns the underlying OS socket object. On unix this
17488 // is a socket file descriptor, and on windows this is
17489 // a Winsock2 SOCKET handle. This may be useful for
17490 // doing platform specific or otherwise unusual operations
17491 // on the socket.
17492 // RETURNS: the file descriptor of the socket.
17493 int get_fd() {
17494 return g_socket_get_fd(&this);
17497 // Gets the keepalive mode of the socket. For details on this,
17498 // see g_socket_set_keepalive().
17499 // RETURNS: %TRUE if keepalive is active, %FALSE otherwise.
17500 int get_keepalive() {
17501 return g_socket_get_keepalive(&this);
17504 // Gets the listen backlog setting of the socket. For details on this,
17505 // see g_socket_set_listen_backlog().
17506 // RETURNS: the maximum number of pending connections.
17507 int get_listen_backlog() {
17508 return g_socket_get_listen_backlog(&this);
17511 // Try to get the local address of a bound socket. This is only
17512 // useful if the socket has been bound to a local address,
17513 // either explicitly or implicitly when connecting.
17515 // Free the returned object with g_object_unref().
17516 // RETURNS: a #GSocketAddress or %NULL on error.
17517 SocketAddress* /*new*/ get_local_address(GLib2.Error** error=null) {
17518 return g_socket_get_local_address(&this, error);
17521 // Gets the socket protocol id the socket was created with.
17522 // In case the protocol is unknown, -1 is returned.
17523 // RETURNS: a protocol id, or -1 if unknown
17524 SocketProtocol get_protocol() {
17525 return g_socket_get_protocol(&this);
17528 // Try to get the remove address of a connected socket. This is only
17529 // useful for connection oriented sockets that have been connected.
17531 // Free the returned object with g_object_unref().
17532 // RETURNS: a #GSocketAddress or %NULL on error.
17533 SocketAddress* /*new*/ get_remote_address(GLib2.Error** error=null) {
17534 return g_socket_get_remote_address(&this, error);
17537 // Gets the socket type of the socket.
17538 // RETURNS: a #GSocketType
17539 SocketType get_socket_type() {
17540 return g_socket_get_socket_type(&this);
17543 // Gets the timeout setting of the socket. For details on this, see
17544 // g_socket_set_timeout().
17545 // RETURNS: the timeout in seconds
17546 uint get_timeout() {
17547 return g_socket_get_timeout(&this);
17550 // Checks whether a socket is closed.
17551 // RETURNS: %TRUE if socket is closed, %FALSE otherwise
17552 int is_closed() {
17553 return g_socket_is_closed(&this);
17556 // Check whether the socket is connected. This is only useful for
17557 // connection-oriented sockets.
17558 // RETURNS: %TRUE if socket is connected, %FALSE otherwise.
17559 int is_connected() {
17560 return g_socket_is_connected(&this);
17563 // Marks the socket as a server socket, i.e. a socket that is used
17564 // to accept incoming requests using g_socket_accept().
17566 // Before calling this the socket must be bound to a local address using
17567 // g_socket_bind().
17569 // To set the maximum amount of outstanding clients, use
17570 // g_socket_set_listen_backlog().
17571 // RETURNS: %TRUE on success, %FALSE on error.
17572 int listen(GLib2.Error** error=null) {
17573 return g_socket_listen(&this, error);
17576 // Receive data (up to @size bytes) from a socket. This is mainly used by
17577 // connection-oriented sockets; it is identical to g_socket_receive_from()
17578 // with @address set to %NULL.
17580 // For %G_SOCKET_TYPE_DATAGRAM and %G_SOCKET_TYPE_SEQPACKET sockets,
17581 // g_socket_receive() will always read either 0 or 1 complete messages from
17582 // the socket. If the received message is too large to fit in @buffer, then
17583 // the data beyond @size bytes will be discarded, without any explicit
17584 // indication that this has occurred.
17586 // For %G_SOCKET_TYPE_STREAM sockets, g_socket_receive() can return any
17587 // number of bytes, up to @size. If more than @size bytes have been
17588 // received, the additional data will be returned in future calls to
17589 // g_socket_receive().
17591 // If the socket is in blocking mode the call will block until there
17592 // is some data to receive, the connection is closed, or there is an
17593 // error. If there is no data available and the socket is in
17594 // non-blocking mode, a %G_IO_ERROR_WOULD_BLOCK error will be
17595 // returned. To be notified when data is available, wait for the
17596 // %G_IO_IN condition.
17598 // On error -1 is returned and @error is set accordingly.
17600 // the peer, or -1 on error
17601 // RETURNS: Number of bytes read, or 0 if the connection was closed by
17602 // <buffer>: a buffer to read data into (which should be at least @size bytes long).
17603 // <size>: the number of bytes you want to read from the socket
17604 // <cancellable>: a %GCancellable or %NULL
17605 ssize_t receive(char* buffer, size_t size, Cancellable* cancellable, GLib2.Error** error=null) {
17606 return g_socket_receive(&this, buffer, size, cancellable, error);
17609 // Receive data (up to @size bytes) from a socket.
17611 // If @address is non-%NULL then @address will be set equal to the
17612 // source address of the received packet.
17613 // @address is owned by the caller.
17615 // See g_socket_receive() for additional information.
17617 // the peer, or -1 on error
17618 // RETURNS: Number of bytes read, or 0 if the connection was closed by
17619 // <address>: a pointer to a #GSocketAddress pointer, or %NULL
17620 // <buffer>: a buffer to read data into (which should be at least @size bytes long).
17621 // <size>: the number of bytes you want to read from the socket
17622 // <cancellable>: a %GCancellable or %NULL
17623 ssize_t receive_from(SocketAddress** address, char* buffer, size_t size, Cancellable* cancellable, GLib2.Error** error=null) {
17624 return g_socket_receive_from(&this, address, buffer, size, cancellable, error);
17627 // Receive data from a socket. This is the most complicated and
17628 // fully-featured version of this call. For easier use, see
17629 // g_socket_receive() and g_socket_receive_from().
17631 // If @address is non-%NULL then @address will be set equal to the
17632 // source address of the received packet.
17633 // @address is owned by the caller.
17635 // @vector must point to an array of #GInputVector structs and
17636 // @num_vectors must be the length of this array. These structs
17637 // describe the buffers that received data will be scattered into.
17638 // If @num_vectors is -1, then @vectors is assumed to be terminated
17639 // by a #GInputVector with a %NULL buffer pointer.
17641 // As a special case, if @num_vectors is 0 (in which case, @vectors
17642 // may of course be %NULL), then a single byte is received and
17643 // discarded. This is to facilitate the common practice of sending a
17644 // single '\0' byte for the purposes of transferring ancillary data.
17646 // @messages, if non-%NULL, will be set to point to a newly-allocated
17647 // array of #GSocketControlMessage instances or %NULL if no such
17648 // messages was received. These correspond to the control messages
17649 // received from the kernel, one #GSocketControlMessage per message
17650 // from the kernel. This array is %NULL-terminated and must be freed
17651 // by the caller using g_free() after calling g_object_unref() on each
17652 // element. If @messages is %NULL, any control messages received will
17653 // be discarded.
17655 // @num_messages, if non-%NULL, will be set to the number of control
17656 // messages received.
17658 // If both @messages and @num_messages are non-%NULL, then
17659 // @num_messages gives the number of #GSocketControlMessage instances
17660 // in @messages (ie: not including the %NULL terminator).
17662 // @flags is an in/out parameter. The commonly available arguments
17663 // for this are available in the #GSocketMsgFlags enum, but the
17664 // values there are the same as the system values, and the flags
17665 // are passed in as-is, so you can pass in system-specific flags too
17666 // (and g_socket_receive_message() may pass system-specific flags out).
17668 // As with g_socket_receive(), data may be discarded if @socket is
17669 // %G_SOCKET_TYPE_DATAGRAM or %G_SOCKET_TYPE_SEQPACKET and you do not
17670 // provide enough buffer space to read a complete message. You can pass
17671 // %G_SOCKET_MSG_PEEK in @flags to peek at the current message without
17672 // removing it from the receive queue, but there is no portable way to find
17673 // out the length of the message other than by reading it into a
17674 // sufficiently-large buffer.
17676 // If the socket is in blocking mode the call will block until there
17677 // is some data to receive, the connection is closed, or there is an
17678 // error. If there is no data available and the socket is in
17679 // non-blocking mode, a %G_IO_ERROR_WOULD_BLOCK error will be
17680 // returned. To be notified when data is available, wait for the
17681 // %G_IO_IN condition.
17683 // On error -1 is returned and @error is set accordingly.
17685 // the peer, or -1 on error
17686 // RETURNS: Number of bytes read, or 0 if the connection was closed by
17687 // <address>: a pointer to a #GSocketAddress pointer, or %NULL
17688 // <vectors>: an array of #GInputVector structs
17689 // <num_vectors>: the number of elements in @vectors, or -1
17690 // <messages>: a pointer which may be filled with an array of #GSocketControlMessages, or %NULL
17691 // <num_messages>: a pointer which will be filled with the number of elements in @messages, or %NULL
17692 // <flags>: a pointer to an int containing #GSocketMsgFlags flags
17693 // <cancellable>: a %GCancellable or %NULL
17694 ssize_t receive_message(SocketAddress** address, InputVector* vectors, int num_vectors, SocketControlMessage*** messages, int* num_messages, int* flags, Cancellable* cancellable, GLib2.Error** error=null) {
17695 return g_socket_receive_message(&this, address, vectors, num_vectors, messages, num_messages, flags, cancellable, error);
17698 // This behaves exactly the same as g_socket_receive(), except that
17699 // the choice of blocking or non-blocking behavior is determined by
17700 // the @blocking argument rather than by @socket's properties.
17702 // the peer, or -1 on error
17703 // RETURNS: Number of bytes read, or 0 if the connection was closed by
17704 // <buffer>: a buffer to read data into (which should be at least @size bytes long).
17705 // <size>: the number of bytes you want to read from the socket
17706 // <blocking>: whether to do blocking or non-blocking I/O
17707 // <cancellable>: a %GCancellable or %NULL
17708 ssize_t receive_with_blocking(char* buffer, size_t size, int blocking, Cancellable* cancellable, GLib2.Error** error=null) {
17709 return g_socket_receive_with_blocking(&this, buffer, size, blocking, cancellable, error);
17712 // Tries to send @size bytes from @buffer on the socket. This is
17713 // mainly used by connection-oriented sockets; it is identical to
17714 // g_socket_send_to() with @address set to %NULL.
17716 // If the socket is in blocking mode the call will block until there is
17717 // space for the data in the socket queue. If there is no space available
17718 // and the socket is in non-blocking mode a %G_IO_ERROR_WOULD_BLOCK error
17719 // will be returned. To be notified when space is available, wait for the
17720 // %G_IO_OUT condition. Note though that you may still receive
17721 // %G_IO_ERROR_WOULD_BLOCK from g_socket_send() even if you were previously
17722 // notified of a %G_IO_OUT condition. (On Windows in particular, this is
17723 // very common due to the way the underlying APIs work.)
17725 // On error -1 is returned and @error is set accordingly.
17727 // on error
17728 // RETURNS: Number of bytes written (which may be less than @size), or -1
17729 // <buffer>: the buffer containing the data to send.
17730 // <size>: the number of bytes to send
17731 // <cancellable>: a %GCancellable or %NULL
17732 ssize_t send(char* buffer, size_t size, Cancellable* cancellable, GLib2.Error** error=null) {
17733 return g_socket_send(&this, buffer, size, cancellable, error);
17736 // Send data to @address on @socket. This is the most complicated and
17737 // fully-featured version of this call. For easier use, see
17738 // g_socket_send() and g_socket_send_to().
17740 // If @address is %NULL then the message is sent to the default receiver
17741 // (set by g_socket_connect()).
17743 // @vectors must point to an array of #GOutputVector structs and
17744 // @num_vectors must be the length of this array. (If @num_vectors is -1,
17745 // then @vectors is assumed to be terminated by a #GOutputVector with a
17746 // %NULL buffer pointer.) The #GOutputVector structs describe the buffers
17747 // that the sent data will be gathered from. Using multiple
17748 // #GOutputVector<!-- -->s is more memory-efficient than manually copying
17749 // data from multiple sources into a single buffer, and more
17750 // network-efficient than making multiple calls to g_socket_send().
17752 // @messages, if non-%NULL, is taken to point to an array of @num_messages
17753 // #GSocketControlMessage instances. These correspond to the control
17754 // messages to be sent on the socket.
17755 // If @num_messages is -1 then @messages is treated as a %NULL-terminated
17756 // array.
17758 // @flags modify how the message is sent. The commonly available arguments
17759 // for this are available in the #GSocketMsgFlags enum, but the
17760 // values there are the same as the system values, and the flags
17761 // are passed in as-is, so you can pass in system-specific flags too.
17763 // If the socket is in blocking mode the call will block until there is
17764 // space for the data in the socket queue. If there is no space available
17765 // and the socket is in non-blocking mode a %G_IO_ERROR_WOULD_BLOCK error
17766 // will be returned. To be notified when space is available, wait for the
17767 // %G_IO_OUT condition. Note though that you may still receive
17768 // %G_IO_ERROR_WOULD_BLOCK from g_socket_send() even if you were previously
17769 // notified of a %G_IO_OUT condition. (On Windows in particular, this is
17770 // very common due to the way the underlying APIs work.)
17772 // On error -1 is returned and @error is set accordingly.
17774 // on error
17775 // RETURNS: Number of bytes written (which may be less than @size), or -1
17776 // <address>: a #GSocketAddress, or %NULL
17777 // <vectors>: an array of #GOutputVector structs
17778 // <num_vectors>: the number of elements in @vectors, or -1
17779 // <messages>: a pointer to an array of #GSocketControlMessages, or %NULL.
17780 // <num_messages>: number of elements in @messages, or -1.
17781 // <flags>: an int containing #GSocketMsgFlags flags
17782 // <cancellable>: a %GCancellable or %NULL
17783 ssize_t send_message(SocketAddress* address, OutputVector* vectors, int num_vectors, SocketControlMessage** messages, int num_messages, int flags, Cancellable* cancellable, GLib2.Error** error=null) {
17784 return g_socket_send_message(&this, address, vectors, num_vectors, messages, num_messages, flags, cancellable, error);
17787 // Tries to send @size bytes from @buffer to @address. If @address is
17788 // %NULL then the message is sent to the default receiver (set by
17789 // g_socket_connect()).
17791 // See g_socket_send() for additional information.
17793 // on error
17794 // RETURNS: Number of bytes written (which may be less than @size), or -1
17795 // <address>: a #GSocketAddress, or %NULL
17796 // <buffer>: the buffer containing the data to send.
17797 // <size>: the number of bytes to send
17798 // <cancellable>: a %GCancellable or %NULL
17799 ssize_t send_to(SocketAddress* address, char* buffer, size_t size, Cancellable* cancellable, GLib2.Error** error=null) {
17800 return g_socket_send_to(&this, address, buffer, size, cancellable, error);
17803 // This behaves exactly the same as g_socket_send(), except that
17804 // the choice of blocking or non-blocking behavior is determined by
17805 // the @blocking argument rather than by @socket's properties.
17807 // on error
17808 // RETURNS: Number of bytes written (which may be less than @size), or -1
17809 // <buffer>: the buffer containing the data to send.
17810 // <size>: the number of bytes to send
17811 // <blocking>: whether to do blocking or non-blocking I/O
17812 // <cancellable>: a %GCancellable or %NULL
17813 ssize_t send_with_blocking(char* buffer, size_t size, int blocking, Cancellable* cancellable, GLib2.Error** error=null) {
17814 return g_socket_send_with_blocking(&this, buffer, size, blocking, cancellable, error);
17817 // Sets the blocking mode of the socket. In blocking mode
17818 // all operations block until they succeed or there is an error. In
17819 // non-blocking mode all functions return results immediately or
17820 // with a %G_IO_ERROR_WOULD_BLOCK error.
17822 // All sockets are created in blocking mode. However, note that the
17823 // platform level socket is always non-blocking, and blocking mode
17824 // is a GSocket level feature.
17825 // <blocking>: Whether to use blocking I/O or not.
17826 void set_blocking(int blocking) {
17827 g_socket_set_blocking(&this, blocking);
17830 // Sets or unsets the %SO_KEEPALIVE flag on the underlying socket. When
17831 // this flag is set on a socket, the system will attempt to verify that the
17832 // remote socket endpoint is still present if a sufficiently long period of
17833 // time passes with no data being exchanged. If the system is unable to
17834 // verify the presence of the remote endpoint, it will automatically close
17835 // the connection.
17837 // This option is only functional on certain kinds of sockets. (Notably,
17838 // %G_SOCKET_PROTOCOL_TCP sockets.)
17840 // The exact time between pings is system- and protocol-dependent, but will
17841 // normally be at least two hours. Most commonly, you would set this flag
17842 // on a server socket if you want to allow clients to remain idle for long
17843 // periods of time, but also want to ensure that connections are eventually
17844 // garbage-collected if clients crash or become unreachable.
17845 // <keepalive>: Value for the keepalive flag
17846 void set_keepalive(int keepalive) {
17847 g_socket_set_keepalive(&this, keepalive);
17850 // Sets the maximum number of outstanding connections allowed
17851 // when listening on this socket. If more clients than this are
17852 // connecting to the socket and the application is not handling them
17853 // on time then the new connections will be refused.
17855 // Note that this must be called before g_socket_listen() and has no
17856 // effect if called after that.
17857 // <backlog>: the maximum number of pending connections.
17858 void set_listen_backlog(int backlog) {
17859 g_socket_set_listen_backlog(&this, backlog);
17862 // Sets the time in seconds after which I/O operations on @socket will
17863 // time out if they have not yet completed.
17865 // On a blocking socket, this means that any blocking #GSocket
17866 // operation will time out after @timeout seconds of inactivity,
17867 // returning %G_IO_ERROR_TIMED_OUT.
17869 // On a non-blocking socket, calls to g_socket_condition_wait() will
17870 // also fail with %G_IO_ERROR_TIMED_OUT after the given time. Sources
17871 // created with g_socket_create_source() will trigger after
17872 // @timeout seconds of inactivity, with the requested condition
17873 // set, at which point calling g_socket_receive(), g_socket_send(),
17874 // g_socket_check_connect_result(), etc, will fail with
17875 // %G_IO_ERROR_TIMED_OUT.
17877 // If @timeout is 0 (the default), operations will never time out
17878 // on their own.
17880 // Note that if an I/O operation is interrupted by a signal, this may
17881 // cause the timeout to be reset.
17882 // <timeout>: the timeout for @socket, in seconds, or 0 for none
17883 void set_timeout(uint timeout) {
17884 g_socket_set_timeout(&this, timeout);
17887 // Shut down part of a full-duplex connection.
17889 // If @shutdown_read is %TRUE then the receiving side of the connection
17890 // is shut down, and further reading is disallowed.
17892 // If @shutdown_write is %TRUE then the sending side of the connection
17893 // is shut down, and further writing is disallowed.
17895 // It is allowed for both @shutdown_read and @shutdown_write to be %TRUE.
17897 // One example where this is used is graceful disconnect for TCP connections
17898 // where you close the sending side, then wait for the other side to close
17899 // the connection, thus ensuring that the other side saw all sent data.
17900 // RETURNS: %TRUE on success, %FALSE on error
17901 // <shutdown_read>: whether to shut down the read side
17902 // <shutdown_write>: whether to shut down the write side
17903 int shutdown(int shutdown_read, int shutdown_write, GLib2.Error** error=null) {
17904 return g_socket_shutdown(&this, shutdown_read, shutdown_write, error);
17907 // Checks if a socket is capable of speaking IPv4.
17909 // IPv4 sockets are capable of speaking IPv4. On some operating systems
17910 // and under some combinations of circumstances IPv6 sockets are also
17911 // capable of speaking IPv4. See RFC 3493 section 3.7 for more
17912 // information.
17914 // No other types of sockets are currently considered as being capable
17915 // of speaking IPv4.
17916 // RETURNS: %TRUE if this socket can be used with IPv4.
17917 int speaks_ipv4() {
17918 return g_socket_speaks_ipv4(&this);
17923 // #GSocketAddress is the equivalent of <type>struct sockaddr</type>
17924 // in the BSD sockets API. This is an abstract class; use
17925 // #GInetSocketAddress for internet sockets, or #GUnixSocketAddress
17926 // for UNIX domain sockets.
17927 struct SocketAddress /* : GObject.Object */ {
17928 alias parent_instance this;
17929 alias parent_instance super_;
17930 alias parent_instance object;
17931 GObject2.Object parent_instance;
17934 // Creates a #GSocketAddress subclass corresponding to the native
17935 // <type>struct sockaddr</type> @native.
17937 // otherwise %NULL.
17938 // RETURNS: a new #GSocketAddress if @native could successfully be converted,
17939 // <native>: a pointer to a <type>struct sockaddr</type>
17940 // <len>: the size of the memory location pointed to by @native
17941 static SocketAddress* /*new*/ new_from_native(void* native, size_t len) {
17942 return g_socket_address_new_from_native(native, len);
17945 // Gets the socket family type of @address.
17946 // RETURNS: the socket family type of @address.
17947 SocketFamily get_family() {
17948 return g_socket_address_get_family(&this);
17951 // Gets the size of @address's native <type>struct sockaddr</type>.
17952 // You can use this to allocate memory to pass to
17953 // g_socket_address_to_native().
17955 // @address represents
17956 // RETURNS: the size of the native <type>struct sockaddr</type> that
17957 ssize_t get_native_size() {
17958 return g_socket_address_get_native_size(&this);
17961 // Converts a #GSocketAddress to a native <type>struct
17962 // sockaddr</type>, which can be passed to low-level functions like
17963 // connect() or bind().
17965 // If not enough space is available, a %G_IO_ERROR_NO_SPACE error is
17966 // returned. If the address type is not known on the system
17967 // then a %G_IO_ERROR_NOT_SUPPORTED error is returned.
17968 // RETURNS: %TRUE if @dest was filled in, %FALSE on error
17969 // <dest>: a pointer to a memory location that will contain the native <type>struct sockaddr</type>.
17970 // <destlen>: the size of @dest. Must be at least as large as g_socket_address_get_native_size().
17971 int to_native(void* dest, size_t destlen, GLib2.Error** error=null) {
17972 return g_socket_address_to_native(&this, dest, destlen, error);
17976 struct SocketAddressClass {
17977 GObject2.ObjectClass parent_class;
17978 // RETURNS: the socket family type of @address.
17979 extern (C) SocketFamily function (SocketAddress* address) get_family;
17980 // RETURNS: the size of the native <type>struct sockaddr</type> that
17981 extern (C) ssize_t function (SocketAddress* address) get_native_size;
17983 // RETURNS: %TRUE if @dest was filled in, %FALSE on error
17984 // <dest>: a pointer to a memory location that will contain the native <type>struct sockaddr</type>.
17985 // <destlen>: the size of @dest. Must be at least as large as g_socket_address_get_native_size().
17986 extern (C) int function (SocketAddress* address, void* dest, size_t destlen, GLib2.Error** error=null) to_native;
17990 // Enumerator type for objects that contain or generate
17991 // #GSocketAddress<!-- -->es.
17992 struct SocketAddressEnumerator /* : GObject.Object */ {
17993 alias parent_instance this;
17994 alias parent_instance super_;
17995 alias parent_instance object;
17996 GObject2.Object parent_instance;
17999 // Retrieves the next #GSocketAddress from @enumerator. Note that this
18000 // may block for some amount of time. (Eg, a #GNetworkAddress may need
18001 // to do a DNS lookup before it can return an address.) Use
18002 // g_socket_address_enumerator_next_async() if you need to avoid
18003 // blocking.
18005 // If @enumerator is expected to yield addresses, but for some reason
18006 // is unable to (eg, because of a DNS error), then the first call to
18007 // g_socket_address_enumerator_next() will return an appropriate error
18008 // in *@error. However, if the first call to
18009 // g_socket_address_enumerator_next() succeeds, then any further
18010 // internal errors (other than @cancellable being triggered) will be
18011 // ignored.
18013 // error (in which case *@error will be set) or if there are no
18014 // more addresses.
18015 // RETURNS: a #GSocketAddress (owned by the caller), or %NULL on
18016 // <cancellable>: optional #GCancellable object, %NULL to ignore.
18017 SocketAddress* /*new*/ next(Cancellable* cancellable, GLib2.Error** error=null) {
18018 return g_socket_address_enumerator_next(&this, cancellable, error);
18021 // Asynchronously retrieves the next #GSocketAddress from @enumerator
18022 // and then calls @callback, which must call
18023 // g_socket_address_enumerator_next_finish() to get the result.
18024 // <cancellable>: optional #GCancellable object, %NULL to ignore.
18025 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
18026 // <user_data>: the data to pass to callback function
18027 void next_async(Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
18028 g_socket_address_enumerator_next_async(&this, cancellable, callback, user_data);
18031 // Retrieves the result of a completed call to
18032 // g_socket_address_enumerator_next_async(). See
18033 // g_socket_address_enumerator_next() for more information about
18034 // error handling.
18036 // error (in which case *@error will be set) or if there are no
18037 // more addresses.
18038 // RETURNS: a #GSocketAddress (owned by the caller), or %NULL on
18039 // <result>: a #GAsyncResult
18040 SocketAddress* /*new*/ next_finish(AsyncResult* result, GLib2.Error** error=null) {
18041 return g_socket_address_enumerator_next_finish(&this, result, error);
18045 struct SocketAddressEnumeratorClass {
18046 GObject2.ObjectClass parent_class;
18048 // RETURNS: a #GSocketAddress (owned by the caller), or %NULL on
18049 // <cancellable>: optional #GCancellable object, %NULL to ignore.
18050 extern (C) SocketAddress* /*new*/ function (SocketAddressEnumerator* enumerator, Cancellable* cancellable, GLib2.Error** error=null) next;
18052 // <cancellable>: optional #GCancellable object, %NULL to ignore.
18053 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
18054 // <user_data>: the data to pass to callback function
18055 extern (C) void function (SocketAddressEnumerator* enumerator, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) next_async;
18057 // RETURNS: a #GSocketAddress (owned by the caller), or %NULL on
18058 // <result>: a #GAsyncResult
18059 extern (C) SocketAddress* /*new*/ function (SocketAddressEnumerator* enumerator, AsyncResult* result, GLib2.Error** error=null) next_finish;
18062 struct SocketClass {
18063 GObject2.ObjectClass parent_class;
18064 extern (C) void function () _g_reserved1;
18065 extern (C) void function () _g_reserved2;
18066 extern (C) void function () _g_reserved3;
18067 extern (C) void function () _g_reserved4;
18068 extern (C) void function () _g_reserved5;
18069 extern (C) void function () _g_reserved6;
18070 extern (C) void function () _g_reserved7;
18071 extern (C) void function () _g_reserved8;
18072 extern (C) void function () _g_reserved9;
18073 extern (C) void function () _g_reserved10;
18077 // #GSocketClient is a high-level utility class for connecting to a
18078 // network host using a connection oriented socket type.
18080 // You create a #GSocketClient object, set any options you want, and then
18081 // call a sync or async connect operation, which returns a #GSocketConnection
18082 // subclass on success.
18084 // The type of the #GSocketConnection object returned depends on the type of
18085 // the underlying socket that is in use. For instance, for a TCP/IP connection
18086 // it will be a #GTcpConnection.
18087 struct SocketClient /* : GObject.Object */ /* Version 2.22 */ {
18088 alias parent_instance this;
18089 alias parent_instance super_;
18090 alias parent_instance object;
18091 GObject2.Object parent_instance;
18092 SocketClientPrivate* priv;
18095 // Creates a new #GSocketClient with the default options.
18097 // Free the returned object with g_object_unref().
18098 // RETURNS: a #GSocketClient.
18099 static SocketClient* /*new*/ new_() {
18100 return g_socket_client_new();
18103 // Enable proxy protocols to be handled by the application. When the
18104 // indicated proxy protocol is returned by the #GProxyResolver,
18105 // #GSocketClient will consider this protocol as supported but will
18106 // not try to find a #GProxy instance to handle handshaking. The
18107 // application must check for this case by calling
18108 // g_socket_connection_get_remote_address() on the returned
18109 // #GSocketConnection, and seeing if it's a #GProxyAddress of the
18110 // appropriate type, to determine whether or not it needs to handle
18111 // the proxy handshaking itself.
18113 // This should be used for proxy protocols that are dialects of
18114 // another protocol such as HTTP proxy. It also allows cohabitation of
18115 // proxy protocols that are reused between protocols. A good example
18116 // is HTTP. It can be used to proxy HTTP, FTP and Gopher and can also
18117 // be use as generic socket proxy through the HTTP CONNECT method.
18118 // <protocol>: The proxy protocol
18119 void add_application_proxy(char* protocol) {
18120 g_socket_client_add_application_proxy(&this, protocol);
18123 // Tries to resolve the @connectable and make a network connection to it.
18125 // Upon a successful connection, a new #GSocketConnection is constructed
18126 // and returned. The caller owns this new object and must drop their
18127 // reference to it when finished with it.
18129 // The type of the #GSocketConnection object returned depends on the type of
18130 // the underlying socket that is used. For instance, for a TCP/IP connection
18131 // it will be a #GTcpConnection.
18133 // The socket created will be the same family as the address that the
18134 // @connectable resolves to, unless family is set with g_socket_client_set_family()
18135 // or indirectly via g_socket_client_set_local_address(). The socket type
18136 // defaults to %G_SOCKET_TYPE_STREAM but can be set with
18137 // g_socket_client_set_socket_type().
18139 // If a local address is specified with g_socket_client_set_local_address() the
18140 // socket will be bound to this address before connecting.
18141 // RETURNS: a #GSocketConnection on success, %NULL on error.
18142 // <connectable>: a #GSocketConnectable specifying the remote address.
18143 // <cancellable>: optional #GCancellable object, %NULL to ignore.
18144 SocketConnection* /*new*/ connect(SocketConnectable* connectable, Cancellable* cancellable, GLib2.Error** error=null) {
18145 return g_socket_client_connect(&this, connectable, cancellable, error);
18148 // This is the asynchronous version of g_socket_client_connect().
18150 // When the operation is finished @callback will be
18151 // called. You can then call g_socket_client_connect_finish() to get
18152 // the result of the operation.
18153 // <connectable>: a #GSocketConnectable specifying the remote address.
18154 // <cancellable>: a #GCancellable, or %NULL
18155 // <callback>: a #GAsyncReadyCallback
18156 // <user_data>: user data for the callback
18157 void connect_async(SocketConnectable* connectable, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
18158 g_socket_client_connect_async(&this, connectable, cancellable, callback, user_data);
18161 // Finishes an async connect operation. See g_socket_client_connect_async()
18162 // RETURNS: a #GSocketConnection on success, %NULL on error.
18163 // <result>: a #GAsyncResult.
18164 SocketConnection* /*new*/ connect_finish(AsyncResult* result, GLib2.Error** error=null) {
18165 return g_socket_client_connect_finish(&this, result, error);
18168 // This is a helper function for g_socket_client_connect().
18170 // Attempts to create a TCP connection to the named host.
18172 // @host_and_port may be in any of a number of recognized formats; an IPv6
18173 // address, an IPv4 address, or a domain name (in which case a DNS
18174 // lookup is performed). Quoting with [] is supported for all address
18175 // types. A port override may be specified in the usual way with a
18176 // colon. Ports may be given as decimal numbers or symbolic names (in
18177 // which case an /etc/services lookup is performed).
18179 // If no port override is given in @host_and_port then @default_port will be
18180 // used as the port number to connect to.
18182 // In general, @host_and_port is expected to be provided by the user (allowing
18183 // them to give the hostname, and a port override if necessary) and
18184 // @default_port is expected to be provided by the application.
18186 // In the case that an IP address is given, a single connection
18187 // attempt is made. In the case that a name is given, multiple
18188 // connection attempts may be made, in turn and according to the
18189 // number of address records in DNS, until a connection succeeds.
18191 // Upon a successful connection, a new #GSocketConnection is constructed
18192 // and returned. The caller owns this new object and must drop their
18193 // reference to it when finished with it.
18195 // In the event of any failure (DNS error, service not found, no hosts
18196 // connectable) %NULL is returned and @error (if non-%NULL) is set
18197 // accordingly.
18198 // RETURNS: a #GSocketConnection on success, %NULL on error.
18199 // <host_and_port>: the name and optionally port of the host to connect to
18200 // <default_port>: the default port to connect to
18201 // <cancellable>: a #GCancellable, or %NULL
18202 SocketConnection* /*new*/ connect_to_host(char* host_and_port, ushort default_port, Cancellable* cancellable, GLib2.Error** error=null) {
18203 return g_socket_client_connect_to_host(&this, host_and_port, default_port, cancellable, error);
18206 // This is the asynchronous version of g_socket_client_connect_to_host().
18208 // When the operation is finished @callback will be
18209 // called. You can then call g_socket_client_connect_to_host_finish() to get
18210 // the result of the operation.
18211 // <host_and_port>: the name and optionally the port of the host to connect to
18212 // <default_port>: the default port to connect to
18213 // <cancellable>: a #GCancellable, or %NULL
18214 // <callback>: a #GAsyncReadyCallback
18215 // <user_data>: user data for the callback
18216 void connect_to_host_async(char* host_and_port, ushort default_port, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
18217 g_socket_client_connect_to_host_async(&this, host_and_port, default_port, cancellable, callback, user_data);
18220 // Finishes an async connect operation. See g_socket_client_connect_to_host_async()
18221 // RETURNS: a #GSocketConnection on success, %NULL on error.
18222 // <result>: a #GAsyncResult.
18223 SocketConnection* /*new*/ connect_to_host_finish(AsyncResult* result, GLib2.Error** error=null) {
18224 return g_socket_client_connect_to_host_finish(&this, result, error);
18227 // Attempts to create a TCP connection to a service.
18229 // This call looks up the SRV record for @service at @domain for the
18230 // "tcp" protocol. It then attempts to connect, in turn, to each of
18231 // the hosts providing the service until either a connection succeeds
18232 // or there are no hosts remaining.
18234 // Upon a successful connection, a new #GSocketConnection is constructed
18235 // and returned. The caller owns this new object and must drop their
18236 // reference to it when finished with it.
18238 // In the event of any failure (DNS error, service not found, no hosts
18239 // connectable) %NULL is returned and @error (if non-%NULL) is set
18240 // accordingly.
18241 // RETURNS: a #GSocketConnection if successful, or %NULL on error
18242 // <domain>: a domain name
18243 // <service>: the name of the service to connect to
18244 // <cancellable>: a #GCancellable, or %NULL
18245 SocketConnection* /*new*/ connect_to_service(char* domain, char* service, Cancellable* cancellable, GLib2.Error** error=null) {
18246 return g_socket_client_connect_to_service(&this, domain, service, cancellable, error);
18249 // This is the asynchronous version of
18250 // g_socket_client_connect_to_service().
18251 // <domain>: a domain name
18252 // <service>: the name of the service to connect to
18253 // <cancellable>: a #GCancellable, or %NULL
18254 // <callback>: a #GAsyncReadyCallback
18255 // <user_data>: user data for the callback
18256 void connect_to_service_async(char* domain, char* service, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
18257 g_socket_client_connect_to_service_async(&this, domain, service, cancellable, callback, user_data);
18260 // Finishes an async connect operation. See g_socket_client_connect_to_service_async()
18261 // RETURNS: a #GSocketConnection on success, %NULL on error.
18262 // <result>: a #GAsyncResult.
18263 SocketConnection* /*new*/ connect_to_service_finish(AsyncResult* result, GLib2.Error** error=null) {
18264 return g_socket_client_connect_to_service_finish(&this, result, error);
18267 // This is a helper function for g_socket_client_connect().
18269 // Attempts to create a TCP connection with a network URI.
18271 // @uri may be any valid URI containing an "authority" (hostname/port)
18272 // component. If a port is not specified in the URI, @default_port
18273 // will be used. TLS will be negotiated if #GSocketClient:tls is %TRUE.
18274 // (#GSocketClient does not know to automatically assume TLS for
18275 // certain URI schemes.)
18277 // Using this rather than g_socket_client_connect() or
18278 // g_socket_client_connect_to_host() allows #GSocketClient to
18279 // determine when to use application-specific proxy protocols.
18281 // Upon a successful connection, a new #GSocketConnection is constructed
18282 // and returned. The caller owns this new object and must drop their
18283 // reference to it when finished with it.
18285 // In the event of any failure (DNS error, service not found, no hosts
18286 // connectable) %NULL is returned and @error (if non-%NULL) is set
18287 // accordingly.
18288 // RETURNS: a #GSocketConnection on success, %NULL on error.
18289 // <uri>: A network URI
18290 // <default_port>: the default port to connect to
18291 // <cancellable>: a #GCancellable, or %NULL
18292 SocketConnection* /*new*/ connect_to_uri(char* uri, ushort default_port, Cancellable* cancellable, GLib2.Error** error=null) {
18293 return g_socket_client_connect_to_uri(&this, uri, default_port, cancellable, error);
18296 // This is the asynchronous version of g_socket_client_connect_to_uri().
18298 // When the operation is finished @callback will be
18299 // called. You can then call g_socket_client_connect_to_uri_finish() to get
18300 // the result of the operation.
18301 // <uri>: a network uri
18302 // <default_port>: the default port to connect to
18303 // <cancellable>: a #GCancellable, or %NULL
18304 // <callback>: a #GAsyncReadyCallback
18305 // <user_data>: user data for the callback
18306 void connect_to_uri_async(char* uri, ushort default_port, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
18307 g_socket_client_connect_to_uri_async(&this, uri, default_port, cancellable, callback, user_data);
18310 // Finishes an async connect operation. See g_socket_client_connect_to_uri_async()
18311 // RETURNS: a #GSocketConnection on success, %NULL on error.
18312 // <result>: a #GAsyncResult.
18313 SocketConnection* /*new*/ connect_to_uri_finish(AsyncResult* result, GLib2.Error** error=null) {
18314 return g_socket_client_connect_to_uri_finish(&this, result, error);
18317 // Gets the proxy enable state; see g_socket_client_set_enable_proxy()
18318 // RETURNS: whether proxying is enabled
18319 int get_enable_proxy() {
18320 return g_socket_client_get_enable_proxy(&this);
18323 // Gets the socket family of the socket client.
18325 // See g_socket_client_set_family() for details.
18326 // RETURNS: a #GSocketFamily
18327 SocketFamily get_family() {
18328 return g_socket_client_get_family(&this);
18331 // Gets the local address of the socket client.
18333 // See g_socket_client_set_local_address() for details.
18334 // RETURNS: a #GSocketAddress or %NULL. Do not free.
18335 SocketAddress* get_local_address() {
18336 return g_socket_client_get_local_address(&this);
18339 // Gets the protocol name type of the socket client.
18341 // See g_socket_client_set_protocol() for details.
18342 // RETURNS: a #GSocketProtocol
18343 SocketProtocol get_protocol() {
18344 return g_socket_client_get_protocol(&this);
18347 // Gets the socket type of the socket client.
18349 // See g_socket_client_set_socket_type() for details.
18350 // RETURNS: a #GSocketFamily
18351 SocketType get_socket_type() {
18352 return g_socket_client_get_socket_type(&this);
18355 // Gets the I/O timeout time for sockets created by @client.
18357 // See g_socket_client_set_timeout() for details.
18358 // RETURNS: the timeout in seconds
18359 uint get_timeout() {
18360 return g_socket_client_get_timeout(&this);
18363 // Gets whether @client creates TLS connections. See
18364 // g_socket_client_set_tls() for details.
18365 // RETURNS: whether @client uses TLS
18366 int get_tls() {
18367 return g_socket_client_get_tls(&this);
18370 // Gets the TLS validation flags used creating TLS connections via
18371 // @client.
18372 // RETURNS: the TLS validation flags
18373 TlsCertificateFlags get_tls_validation_flags() {
18374 return g_socket_client_get_tls_validation_flags(&this);
18377 // Sets whether or not @client attempts to make connections via a
18378 // proxy server. When enabled (the default), #GSocketClient will use a
18379 // #GProxyResolver to determine if a proxy protocol such as SOCKS is
18380 // needed, and automatically do the necessary proxy negotiation.
18381 // <enable>: whether to enable proxies
18382 void set_enable_proxy(int enable) {
18383 g_socket_client_set_enable_proxy(&this, enable);
18386 // Sets the socket family of the socket client.
18387 // If this is set to something other than %G_SOCKET_FAMILY_INVALID
18388 // then the sockets created by this object will be of the specified
18389 // family.
18391 // This might be useful for instance if you want to force the local
18392 // connection to be an ipv4 socket, even though the address might
18393 // be an ipv6 mapped to ipv4 address.
18394 // <family>: a #GSocketFamily
18395 void set_family(SocketFamily family) {
18396 g_socket_client_set_family(&this, family);
18399 // Sets the local address of the socket client.
18400 // The sockets created by this object will bound to the
18401 // specified address (if not %NULL) before connecting.
18403 // This is useful if you want to ensure that the local
18404 // side of the connection is on a specific port, or on
18405 // a specific interface.
18406 // <address>: a #GSocketAddress, or %NULL
18407 void set_local_address(SocketAddress* address) {
18408 g_socket_client_set_local_address(&this, address);
18411 // Sets the protocol of the socket client.
18412 // The sockets created by this object will use of the specified
18413 // protocol.
18415 // If @protocol is %0 that means to use the default
18416 // protocol for the socket family and type.
18417 // <protocol>: a #GSocketProtocol
18418 void set_protocol(SocketProtocol protocol) {
18419 g_socket_client_set_protocol(&this, protocol);
18422 // Sets the socket type of the socket client.
18423 // The sockets created by this object will be of the specified
18424 // type.
18426 // It doesn't make sense to specify a type of %G_SOCKET_TYPE_DATAGRAM,
18427 // as GSocketClient is used for connection oriented services.
18428 // <type>: a #GSocketType
18429 void set_socket_type(SocketType type) {
18430 g_socket_client_set_socket_type(&this, type);
18433 // Sets the I/O timeout for sockets created by @client. @timeout is a
18434 // time in seconds, or 0 for no timeout (the default).
18436 // The timeout value affects the initial connection attempt as well,
18437 // so setting this may cause calls to g_socket_client_connect(), etc,
18438 // to fail with %G_IO_ERROR_TIMED_OUT.
18439 // <timeout>: the timeout
18440 void set_timeout(uint timeout) {
18441 g_socket_client_set_timeout(&this, timeout);
18444 // Sets whether @client creates TLS (aka SSL) connections. If @tls is
18445 // %TRUE, @client will wrap its connections in a #GTlsClientConnection
18446 // and perform a TLS handshake when connecting.
18448 // Note that since #GSocketClient must return a #GSocketConnection,
18449 // but #GTlsClientConnection is not a #GSocketConnection, this
18450 // actually wraps the resulting #GTlsClientConnection in a
18451 // #GTcpWrapperConnection when returning it. You can use
18452 // g_tcp_wrapper_connection_get_base_io_stream() on the return value
18453 // to extract the #GTlsClientConnection.
18454 // <tls>: whether to use TLS
18455 void set_tls(int tls) {
18456 g_socket_client_set_tls(&this, tls);
18459 // Sets the TLS validation flags used when creating TLS connections
18460 // via @client. The default value is %G_TLS_CERTIFICATE_VALIDATE_ALL.
18461 // <flags>: the validation flags
18462 void set_tls_validation_flags(TlsCertificateFlags flags) {
18463 g_socket_client_set_tls_validation_flags(&this, flags);
18467 struct SocketClientClass {
18468 GObject2.ObjectClass parent_class;
18469 extern (C) void function () _g_reserved1;
18470 extern (C) void function () _g_reserved2;
18471 extern (C) void function () _g_reserved3;
18472 extern (C) void function () _g_reserved4;
18473 extern (C) void function () _g_reserved5;
18476 struct SocketClientPrivate {
18480 // Objects that describe one or more potential socket endpoints
18481 // implement #GSocketConnectable. Callers can then use
18482 // g_socket_connectable_enumerate() to get a #GSocketAddressEnumerator
18483 // to try out each socket address in turn until one succeeds, as shown
18484 // in the sample code below.
18486 // |[
18487 // MyConnectionType *
18488 // connect_to_host (const char *hostname,
18489 // guint16 port,
18490 // GCancellable *cancellable,
18491 // GError **error)
18492 // {
18493 // MyConnection *conn = NULL;
18494 // GSocketConnectable *addr;
18495 // GSocketAddressEnumerator *enumerator;
18496 // GSocketAddress *sockaddr;
18497 // GError *conn_error = NULL;
18499 // addr = g_network_address_new ("www.gnome.org", 80);
18500 // enumerator = g_socket_connectable_enumerate (addr);
18501 // g_object_unref (addr);
18503 // /<!-- -->* Try each sockaddr until we succeed. Record the first
18504 // * connection error, but not any further ones (since they'll probably
18505 // * be basically the same as the first).
18506 // *<!-- -->/
18507 // while (!conn && (sockaddr = g_socket_address_enumerator_next (enumerator, cancellable, error))
18508 // {
18509 // conn = connect_to_sockaddr (sockaddr, conn_error ? NULL : &conn_error);
18510 // g_object_unref (sockaddr);
18511 // }
18512 // g_object_unref (enumerator);
18514 // if (conn)
18515 // {
18516 // if (conn_error)
18517 // {
18518 // /<!-- -->* We couldn't connect to the first address, but we succeeded
18519 // * in connecting to a later address.
18520 // *<!-- -->/
18521 // g_error_free (conn_error);
18522 // }
18523 // return conn;
18524 // }
18525 // else if (error)
18526 // {
18527 // /<!-- -->* Either the initial lookup failed, or else the caller
18528 // * cancelled us.
18529 // *<!-- -->/
18530 // if (conn_error)
18531 // g_error_free (conn_error);
18532 // return NULL;
18533 // }
18534 // else
18535 // {
18536 // g_error_propagate (error, conn_error);
18537 // return NULL;
18538 // }
18539 // }
18540 // ]|
18541 struct SocketConnectable {
18543 // Creates a #GSocketAddressEnumerator for @connectable.
18544 // RETURNS: a new #GSocketAddressEnumerator.
18545 SocketAddressEnumerator* /*new*/ enumerate() {
18546 return g_socket_connectable_enumerate(&this);
18549 // Creates a #GSocketAddressEnumerator for @connectable that will
18550 // return #GProxyAddress<!-- -->es for addresses that you must connect
18551 // to via a proxy.
18553 // If @connectable does not implement
18554 // g_socket_connectable_proxy_enumerate(), this will fall back to
18555 // calling g_socket_connectable_enumerate().
18556 // RETURNS: a new #GSocketAddressEnumerator.
18557 SocketAddressEnumerator* /*new*/ proxy_enumerate() {
18558 return g_socket_connectable_proxy_enumerate(&this);
18563 // Provides an interface for returning a #GSocketAddressEnumerator
18564 // and #GProxyAddressEnumerator
18565 struct SocketConnectableIface {
18566 GObject2.TypeInterface g_iface;
18567 // RETURNS: a new #GSocketAddressEnumerator.
18568 extern (C) SocketAddressEnumerator* /*new*/ function (SocketConnectable* connectable) enumerate;
18569 // RETURNS: a new #GSocketAddressEnumerator.
18570 extern (C) SocketAddressEnumerator* /*new*/ function (SocketConnectable* connectable) proxy_enumerate;
18574 // #GSocketConnection is a #GIOStream for a connected socket. They
18575 // can be created either by #GSocketClient when connecting to a host,
18576 // or by #GSocketListener when accepting a new client.
18578 // The type of the #GSocketConnection object returned from these calls
18579 // depends on the type of the underlying socket that is in use. For
18580 // instance, for a TCP/IP connection it will be a #GTcpConnection.
18582 // Choosing what type of object to construct is done with the socket
18583 // connection factory, and it is possible for 3rd parties to register
18584 // custom socket connection types for specific combination of socket
18585 // family/type/protocol using g_socket_connection_factory_register_type().
18586 struct SocketConnection /* : IOStream */ /* Version 2.22 */ {
18587 alias parent_instance this;
18588 alias parent_instance super_;
18589 alias parent_instance iostream;
18590 IOStream parent_instance;
18591 SocketConnectionPrivate* priv;
18594 // Looks up the #GType to be used when creating socket connections on
18595 // sockets with the specified @family, @type and @protocol_id.
18597 // If no type is registered, the #GSocketConnection base type is returned.
18598 // RETURNS: a #GType
18599 // <family>: a #GSocketFamily
18600 // <type>: a #GSocketType
18601 // <protocol_id>: a protocol id
18602 static Type factory_lookup_type(SocketFamily family, SocketType type, int protocol_id) {
18603 return g_socket_connection_factory_lookup_type(family, type, protocol_id);
18606 // Looks up the #GType to be used when creating socket connections on
18607 // sockets with the specified @family, @type and @protocol.
18609 // If no type is registered, the #GSocketConnection base type is returned.
18610 // <g_type>: a #GType, inheriting from %G_TYPE_SOCKET_CONNECTION
18611 // <family>: a #GSocketFamily
18612 // <type>: a #GSocketType
18613 // <protocol>: a protocol id
18614 static void factory_register_type(Type g_type, SocketFamily family, SocketType type, int protocol) {
18615 g_socket_connection_factory_register_type(g_type, family, type, protocol);
18618 // Try to get the local address of a socket connection.
18620 // Free the returned object with g_object_unref().
18621 // RETURNS: a #GSocketAddress or %NULL on error.
18622 SocketAddress* /*new*/ get_local_address(GLib2.Error** error=null) {
18623 return g_socket_connection_get_local_address(&this, error);
18626 // Try to get the remote address of a socket connection.
18628 // Free the returned object with g_object_unref().
18629 // RETURNS: a #GSocketAddress or %NULL on error.
18630 SocketAddress* /*new*/ get_remote_address(GLib2.Error** error=null) {
18631 return g_socket_connection_get_remote_address(&this, error);
18634 // Gets the underlying #GSocket object of the connection.
18635 // This can be useful if you want to do something unusual on it
18636 // not supported by the #GSocketConnection APIs.
18637 // RETURNS: a #GSocketAddress or %NULL on error.
18638 Socket* get_socket() {
18639 return g_socket_connection_get_socket(&this);
18643 struct SocketConnectionClass {
18644 IOStreamClass parent_class;
18645 extern (C) void function () _g_reserved1;
18646 extern (C) void function () _g_reserved2;
18647 extern (C) void function () _g_reserved3;
18648 extern (C) void function () _g_reserved4;
18649 extern (C) void function () _g_reserved5;
18650 extern (C) void function () _g_reserved6;
18653 struct SocketConnectionPrivate {
18657 // A #GSocketControlMessage is a special-purpose utility message that
18658 // can be sent to or received from a #GSocket. These types of
18659 // messages are often called "ancillary data".
18661 // The message can represent some sort of special instruction to or
18662 // information from the socket or can represent a special kind of
18663 // transfer to the peer (for example, sending a file description over
18664 // a UNIX socket).
18666 // These messages are sent with g_socket_send_message() and received
18667 // with g_socket_receive_message().
18669 // To extend the set of control message that can be sent, subclass this
18670 // class and override the get_size, get_level, get_type and serialize
18671 // methods.
18673 // To extend the set of control messages that can be received, subclass
18674 // this class and implement the deserialize method. Also, make sure your
18675 // class is registered with the GType typesystem before calling
18676 // g_socket_receive_message() to read such a message.
18677 struct SocketControlMessage /* : GObject.Object */ {
18678 alias parent_instance this;
18679 alias parent_instance super_;
18680 alias parent_instance object;
18681 GObject2.Object parent_instance;
18682 SocketControlMessagePrivate* priv;
18685 // Tries to deserialize a socket control message of a given
18686 // @level and @type. This will ask all known (to GType) subclasses
18687 // of #GSocketControlMessage if they can understand this kind
18688 // of message and if so deserialize it into a #GSocketControlMessage.
18690 // If there is no implementation for this kind of control message, %NULL
18691 // will be returned.
18692 // RETURNS: the deserialized message or %NULL
18693 // <level>: a socket level
18694 // <type>: a socket control message type for the given @level
18695 // <size>: the size of the data in bytes
18696 // <data>: pointer to the message data
18697 static SocketControlMessage* /*new*/ deserialize(int level, int type, size_t size, void* data) {
18698 return g_socket_control_message_deserialize(level, type, size, data);
18701 // Returns the "level" (i.e. the originating protocol) of the control message.
18702 // This is often SOL_SOCKET.
18703 // RETURNS: an integer describing the level
18704 int get_level() {
18705 return g_socket_control_message_get_level(&this);
18708 // Returns the protocol specific type of the control message.
18709 // For instance, for UNIX fd passing this would be SCM_RIGHTS.
18710 // RETURNS: an integer describing the type of control message
18711 int get_msg_type() {
18712 return g_socket_control_message_get_msg_type(&this);
18715 // Returns the space required for the control message, not including
18716 // headers or alignment.
18717 // RETURNS: The number of bytes required.
18718 size_t get_size() {
18719 return g_socket_control_message_get_size(&this);
18722 // Converts the data in the message to bytes placed in the
18723 // message.
18725 // @data is guaranteed to have enough space to fit the size
18726 // returned by g_socket_control_message_get_size() on this
18727 // object.
18728 // <data>: A buffer to write data to
18729 void serialize(void* data) {
18730 g_socket_control_message_serialize(&this, data);
18734 struct SocketControlMessageClass {
18735 GObject2.ObjectClass parent_class;
18736 // RETURNS: The number of bytes required.
18737 extern (C) size_t function (SocketControlMessage* message) get_size;
18738 // RETURNS: an integer describing the level
18739 extern (C) int function (SocketControlMessage* message) get_level;
18740 extern (C) int function (SocketControlMessage* message) get_type;
18741 // <data>: A buffer to write data to
18742 extern (C) void function (SocketControlMessage* message, void* data) serialize;
18743 // Unintrospectable functionp: deserialize() / ()
18744 extern (C) SocketControlMessage* function (int level, int type, size_t size, void* data) deserialize;
18745 extern (C) void function () _g_reserved1;
18746 extern (C) void function () _g_reserved2;
18747 extern (C) void function () _g_reserved3;
18748 extern (C) void function () _g_reserved4;
18749 extern (C) void function () _g_reserved5;
18752 struct SocketControlMessagePrivate {
18756 // The protocol family of a #GSocketAddress. (These values are
18757 // identical to the system defines %AF_INET, %AF_INET6 and %AF_UNIX,
18758 // if available.)
18759 enum SocketFamily /* Version 2.22 */ {
18760 INVALID = 0,
18761 UNIX = 1,
18762 IPV4 = 2,
18763 IPV6 = 10
18766 // A #GSocketListener is an object that keeps track of a set
18767 // of server sockets and helps you accept sockets from any of the
18768 // socket, either sync or async.
18770 // If you want to implement a network server, also look at #GSocketService
18771 // and #GThreadedSocketService which are subclass of #GSocketListener
18772 // that makes this even easier.
18773 struct SocketListener /* : GObject.Object */ {
18774 alias parent_instance this;
18775 alias parent_instance super_;
18776 alias parent_instance object;
18777 GObject2.Object parent_instance;
18778 SocketListenerPrivate* priv;
18781 // Creates a new #GSocketListener with no sockets to listen for.
18782 // New listeners can be added with e.g. g_socket_listener_add_address()
18783 // or g_socket_listener_add_inet_port().
18784 // RETURNS: a new #GSocketListener.
18785 static SocketListener* /*new*/ new_() {
18786 return g_socket_listener_new();
18789 // Blocks waiting for a client to connect to any of the sockets added
18790 // to the listener. Returns a #GSocketConnection for the socket that was
18791 // accepted.
18793 // If @source_object is not %NULL it will be filled out with the source
18794 // object specified when the corresponding socket or address was added
18795 // to the listener.
18797 // If @cancellable is not %NULL, then the operation can be cancelled by
18798 // triggering the cancellable object from another thread. If the operation
18799 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
18800 // RETURNS: a #GSocketConnection on success, %NULL on error.
18801 // <source_object>: location where #GObject pointer will be stored, or %NULL
18802 // <cancellable>: optional #GCancellable object, %NULL to ignore.
18803 SocketConnection* /*new*/ accept(/*out*/ GObject2.Object** source_object, Cancellable* cancellable, GLib2.Error** error=null) {
18804 return g_socket_listener_accept(&this, source_object, cancellable, error);
18807 // This is the asynchronous version of g_socket_listener_accept().
18809 // When the operation is finished @callback will be
18810 // called. You can then call g_socket_listener_accept_socket()
18811 // to get the result of the operation.
18812 // <cancellable>: a #GCancellable, or %NULL
18813 // <callback>: a #GAsyncReadyCallback
18814 // <user_data>: user data for the callback
18815 void accept_async(Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
18816 g_socket_listener_accept_async(&this, cancellable, callback, user_data);
18819 // Finishes an async accept operation. See g_socket_listener_accept_async()
18820 // RETURNS: a #GSocketConnection on success, %NULL on error.
18821 // <result>: a #GAsyncResult.
18822 // <source_object>: Optional #GObject identifying this source
18823 SocketConnection* /*new*/ accept_finish(AsyncResult* result, /*out*/ GObject2.Object** source_object, GLib2.Error** error=null) {
18824 return g_socket_listener_accept_finish(&this, result, source_object, error);
18827 // Blocks waiting for a client to connect to any of the sockets added
18828 // to the listener. Returns the #GSocket that was accepted.
18830 // If you want to accept the high-level #GSocketConnection, not a #GSocket,
18831 // which is often the case, then you should use g_socket_listener_accept()
18832 // instead.
18834 // If @source_object is not %NULL it will be filled out with the source
18835 // object specified when the corresponding socket or address was added
18836 // to the listener.
18838 // If @cancellable is not %NULL, then the operation can be cancelled by
18839 // triggering the cancellable object from another thread. If the operation
18840 // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
18841 // RETURNS: a #GSocket on success, %NULL on error.
18842 // <source_object>: location where #GObject pointer will be stored, or %NULL.
18843 // <cancellable>: optional #GCancellable object, %NULL to ignore.
18844 Socket* /*new*/ accept_socket(/*out*/ GObject2.Object** source_object, Cancellable* cancellable, GLib2.Error** error=null) {
18845 return g_socket_listener_accept_socket(&this, source_object, cancellable, error);
18848 // This is the asynchronous version of g_socket_listener_accept_socket().
18850 // When the operation is finished @callback will be
18851 // called. You can then call g_socket_listener_accept_socket_finish()
18852 // to get the result of the operation.
18853 // <cancellable>: a #GCancellable, or %NULL
18854 // <callback>: a #GAsyncReadyCallback
18855 // <user_data>: user data for the callback
18856 void accept_socket_async(Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
18857 g_socket_listener_accept_socket_async(&this, cancellable, callback, user_data);
18860 // Finishes an async accept operation. See g_socket_listener_accept_socket_async()
18861 // RETURNS: a #GSocket on success, %NULL on error.
18862 // <result>: a #GAsyncResult.
18863 // <source_object>: Optional #GObject identifying this source
18864 Socket* /*new*/ accept_socket_finish(AsyncResult* result, /*out*/ GObject2.Object** source_object, GLib2.Error** error=null) {
18865 return g_socket_listener_accept_socket_finish(&this, result, source_object, error);
18868 // Creates a socket of type @type and protocol @protocol, binds
18869 // it to @address and adds it to the set of sockets we're accepting
18870 // sockets from.
18872 // Note that adding an IPv6 address, depending on the platform,
18873 // may or may not result in a listener that also accepts IPv4
18874 // connections. For more deterministic behavior, see
18875 // g_socket_listener_add_inet_port().
18877 // @source_object will be passed out in the various calls
18878 // to accept to identify this particular source, which is
18879 // useful if you're listening on multiple addresses and do
18880 // different things depending on what address is connected to.
18882 // If successful and @effective_address is non-%NULL then it will
18883 // be set to the address that the binding actually occurred at. This
18884 // is helpful for determining the port number that was used for when
18885 // requesting a binding to port 0 (ie: "any port"). This address, if
18886 // requested, belongs to the caller and must be freed.
18887 // RETURNS: %TRUE on success, %FALSE on error.
18888 // <address>: a #GSocketAddress
18889 // <type>: a #GSocketType
18890 // <protocol>: a #GSocketProtocol
18891 // <source_object>: Optional #GObject identifying this source
18892 // <effective_address>: location to store the address that was bound to, or %NULL.
18893 int add_address(SocketAddress* address, SocketType type, SocketProtocol protocol, GObject2.Object* source_object, /*out*/ SocketAddress** effective_address, GLib2.Error** error=null) {
18894 return g_socket_listener_add_address(&this, address, type, protocol, source_object, effective_address, error);
18897 // Listens for TCP connections on any available port number for both
18898 // IPv6 and IPv4 (if each is available).
18900 // This is useful if you need to have a socket for incoming connections
18901 // but don't care about the specific port number.
18903 // @source_object will be passed out in the various calls
18904 // to accept to identify this particular source, which is
18905 // useful if you're listening on multiple addresses and do
18906 // different things depending on what address is connected to.
18907 // RETURNS: the port number, or 0 in case of failure.
18908 // <source_object>: Optional #GObject identifying this source
18909 ushort add_any_inet_port(GObject2.Object* source_object, GLib2.Error** error=null) {
18910 return g_socket_listener_add_any_inet_port(&this, source_object, error);
18913 // Helper function for g_socket_listener_add_address() that
18914 // creates a TCP/IP socket listening on IPv4 and IPv6 (if
18915 // supported) on the specified port on all interfaces.
18917 // @source_object will be passed out in the various calls
18918 // to accept to identify this particular source, which is
18919 // useful if you're listening on multiple addresses and do
18920 // different things depending on what address is connected to.
18921 // RETURNS: %TRUE on success, %FALSE on error.
18922 // <port>: an IP port number (non-zero)
18923 // <source_object>: Optional #GObject identifying this source
18924 int add_inet_port(ushort port, GObject2.Object* source_object, GLib2.Error** error=null) {
18925 return g_socket_listener_add_inet_port(&this, port, source_object, error);
18928 // Adds @socket to the set of sockets that we try to accept
18929 // new clients from. The socket must be bound to a local
18930 // address and listened to.
18932 // @source_object will be passed out in the various calls
18933 // to accept to identify this particular source, which is
18934 // useful if you're listening on multiple addresses and do
18935 // different things depending on what address is connected to.
18936 // RETURNS: %TRUE on success, %FALSE on error.
18937 // <socket>: a listening #GSocket
18938 // <source_object>: Optional #GObject identifying this source
18939 int add_socket(Socket* socket, GObject2.Object* source_object, GLib2.Error** error=null) {
18940 return g_socket_listener_add_socket(&this, socket, source_object, error);
18942 // Closes all the sockets in the listener.
18943 void close() {
18944 g_socket_listener_close(&this);
18947 // Sets the listen backlog on the sockets in the listener.
18949 // See g_socket_set_listen_backlog() for details
18950 // <listen_backlog>: an integer
18951 void set_backlog(int listen_backlog) {
18952 g_socket_listener_set_backlog(&this, listen_backlog);
18956 struct SocketListenerClass {
18957 GObject2.ObjectClass parent_class;
18958 extern (C) void function (SocketListener* listener) changed;
18959 extern (C) void function () _g_reserved1;
18960 extern (C) void function () _g_reserved2;
18961 extern (C) void function () _g_reserved3;
18962 extern (C) void function () _g_reserved4;
18963 extern (C) void function () _g_reserved5;
18964 extern (C) void function () _g_reserved6;
18967 struct SocketListenerPrivate {
18971 // Flags used in g_socket_receive_message() and g_socket_send_message().
18972 // The flags listed in the enum are some commonly available flags, but the
18973 // values used for them are the same as on the platform, and any other flags
18974 // are passed in/out as is. So to use a platform specific flag, just include
18975 // the right system header and pass in the flag.
18976 enum SocketMsgFlags /* Version 2.22 */ {
18977 NONE = 0,
18978 OOB = 1,
18979 PEEK = 2,
18980 DONTROUTE = 4
18982 struct SocketPrivate {
18986 // A protocol identifier is specified when creating a #GSocket, which is a
18987 // family/type specific identifier, where 0 means the default protocol for
18988 // the particular family/type.
18990 // This enum contains a set of commonly available and used protocols. You
18991 // can also pass any other identifiers handled by the platform in order to
18992 // use protocols not listed here.
18993 enum SocketProtocol /* Version 2.22 */ {
18994 UNKNOWN = -1,
18995 DEFAULT = 0,
18996 TCP = 6,
18997 UDP = 17,
18998 SCTP = 132
19001 // A #GSocketService is an object that represents a service that
19002 // is provided to the network or over local sockets. When a new
19003 // connection is made to the service the #GSocketService::incoming
19004 // signal is emitted.
19006 // A #GSocketService is a subclass of #GSocketListener and you need
19007 // to add the addresses you want to accept connections on with the
19008 // #GSocketListener APIs.
19010 // There are two options for implementing a network service based on
19011 // #GSocketService. The first is to create the service using
19012 // g_socket_service_new() and to connect to the #GSocketService::incoming
19013 // signal. The second is to subclass #GSocketService and override the
19014 // default signal handler implementation.
19016 // In either case, the handler must immediately return, or else it
19017 // will block additional incoming connections from being serviced.
19018 // If you are interested in writing connection handlers that contain
19019 // blocking code then see #GThreadedSocketService.
19021 // The socket service runs on the main loop in the main thread, and is
19022 // not threadsafe in general. However, the calls to start and stop
19023 // the service are threadsafe so these can be used from threads that
19024 // handle incoming clients.
19025 struct SocketService /* : SocketListener */ /* Version 2.22 */ {
19026 alias parent_instance this;
19027 alias parent_instance super_;
19028 alias parent_instance socketlistener;
19029 SocketListener parent_instance;
19030 SocketServicePrivate* priv;
19033 // Creates a new #GSocketService with no sockets to listen for.
19034 // New listeners can be added with e.g. g_socket_listener_add_address()
19035 // or g_socket_listener_add_inet_port().
19036 // RETURNS: a new #GSocketService.
19037 static SocketService* /*new*/ new_() {
19038 return g_socket_service_new();
19041 // Check whether the service is active or not. An active
19042 // service will accept new clients that connect, while
19043 // a non-active service will let connecting clients queue
19044 // up until the service is started.
19045 // RETURNS: %TRUE if the service is active, %FALSE otherwise
19046 int is_active() {
19047 return g_socket_service_is_active(&this);
19050 // Starts the service, i.e. start accepting connections
19051 // from the added sockets when the mainloop runs.
19053 // This call is threadsafe, so it may be called from a thread
19054 // handling an incoming client request.
19055 void start() {
19056 g_socket_service_start(&this);
19059 // Stops the service, i.e. stops accepting connections
19060 // from the added sockets when the mainloop runs.
19062 // This call is threadsafe, so it may be called from a thread
19063 // handling an incoming client request.
19064 void stop() {
19065 g_socket_service_stop(&this);
19068 // The ::incoming signal is emitted when a new incoming connection
19069 // to @service needs to be handled. The handler must initiate the
19070 // handling of @connection, but may not block; in essence,
19071 // asynchronous operations must be used.
19073 // @connection will be unreffed once the signal handler returns,
19074 // so you need to ref it yourself if you are planning to use it.
19075 // RETURNS: %TRUE to stop other handlers from being called
19076 // <connection>: a new #GSocketConnection object
19077 // <source_object>: the source_object passed to g_socket_listener_add_address()
19078 extern (C) alias static c_int function (SocketService* this_, SocketConnection* connection, GObject2.Object* source_object, void* user_data=null) signal_incoming;
19080 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
19081 return super_.signal_connect!name(cb, data, cf);
19084 ulong signal_connect(string name:"incoming", CB:signal_incoming)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
19085 return signal_connect_data(&this, cast(char*)"incoming",
19086 cast(GObject2.Callback)cb, data, null, cf);
19090 struct SocketServiceClass {
19091 SocketListenerClass parent_class;
19092 extern (C) int function (SocketService* service, SocketConnection* connection, GObject2.Object* source_object) incoming;
19093 extern (C) void function () _g_reserved1;
19094 extern (C) void function () _g_reserved2;
19095 extern (C) void function () _g_reserved3;
19096 extern (C) void function () _g_reserved4;
19097 extern (C) void function () _g_reserved5;
19098 extern (C) void function () _g_reserved6;
19101 struct SocketServicePrivate {
19105 // This is the function type of the callback used for the #GSource
19106 // returned by g_socket_create_source().
19107 // RETURNS: it should return %FALSE if the source should be removed.
19108 // <socket>: the #GSocket
19109 // <condition>: the current condition at the source fired.
19110 // <user_data>: data passed in by the user.
19111 extern (C) alias int function (Socket* socket, GLib2.IOCondition condition, void* user_data) SocketSourceFunc;
19114 // Flags used when creating a #GSocket. Some protocols may not implement
19115 // all the socket types.
19116 enum SocketType /* Version 2.22 */ {
19117 INVALID = 0,
19118 STREAM = 1,
19119 DATAGRAM = 2,
19120 SEQPACKET = 3
19123 // SRV (service) records are used by some network protocols to provide
19124 // service-specific aliasing and load-balancing. For example, XMPP
19125 // (Jabber) uses SRV records to locate the XMPP server for a domain;
19126 // rather than connecting directly to "example.com" or assuming a
19127 // specific server hostname like "xmpp.example.com", an XMPP client
19128 // would look up the "xmpp-client" SRV record for "example.com", and
19129 // then connect to whatever host was pointed to by that record.
19131 // You can use g_resolver_lookup_service() or
19132 // g_resolver_lookup_service_async() to find the #GSrvTarget<!-- -->s
19133 // for a given service. However, if you are simply planning to connect
19134 // to the remote service, you can use #GNetworkService's
19135 // #GSocketConnectable interface and not need to worry about
19136 // #GSrvTarget at all.
19137 struct SrvTarget {
19139 // Creates a new #GSrvTarget with the given parameters.
19141 // You should not need to use this; normally #GSrvTarget<!-- -->s are
19142 // created by #GResolver.
19143 // RETURNS: a new #GSrvTarget.
19144 // <hostname>: the host that the service is running on
19145 // <port>: the port that the service is running on
19146 // <priority>: the target's priority
19147 // <weight>: the target's weight
19148 static SrvTarget* /*new*/ new_(char* hostname, ushort port, ushort priority, ushort weight) {
19149 return g_srv_target_new(hostname, port, priority, weight);
19152 // Copies @target
19153 // RETURNS: a copy of @target
19154 SrvTarget* /*new*/ copy() {
19155 return g_srv_target_copy(&this);
19157 // Frees @target
19158 void free() {
19159 g_srv_target_free(&this);
19162 // Gets @target's hostname (in ASCII form; if you are going to present
19163 // this to the user, you should use g_hostname_is_ascii_encoded() to
19164 // check if it contains encoded Unicode segments, and use
19165 // g_hostname_to_unicode() to convert it if it does.)
19166 // RETURNS: @target's hostname
19167 char* get_hostname() {
19168 return g_srv_target_get_hostname(&this);
19171 // Gets @target's port
19172 // RETURNS: @target's port
19173 ushort get_port() {
19174 return g_srv_target_get_port(&this);
19177 // Gets @target's priority. You should not need to look at this;
19178 // #GResolver already sorts the targets according to the algorithm in
19179 // RFC 2782.
19180 // RETURNS: @target's priority
19181 ushort get_priority() {
19182 return g_srv_target_get_priority(&this);
19185 // Gets @target's weight. You should not need to look at this;
19186 // #GResolver already sorts the targets according to the algorithm in
19187 // RFC 2782.
19188 // RETURNS: @target's weight
19189 ushort get_weight() {
19190 return g_srv_target_get_weight(&this);
19193 // Unintrospectable function: list_sort() / g_srv_target_list_sort()
19194 // Sorts @targets in place according to the algorithm in RFC 2782.
19195 // RETURNS: the head of the sorted list.
19196 // <targets>: a #GList of #GSrvTarget
19197 static GLib2.List* /*new*/ list_sort(GLib2.List* targets) {
19198 return g_srv_target_list_sort(targets);
19202 enum TLS_BACKEND_EXTENSION_POINT_NAME = "gio-tls-backend";
19203 enum TLS_DATABASE_PURPOSE_AUTHENTICATE_CLIENT = "1.3.6.1.5.5.7.3.2";
19204 enum TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER = "1.3.6.1.5.5.7.3.1";
19206 // This is the subclass of #GSocketConnection that is created
19207 // for TCP/IP sockets.
19208 struct TcpConnection /* : SocketConnection */ /* Version 2.22 */ {
19209 alias parent_instance this;
19210 alias parent_instance super_;
19211 alias parent_instance socketconnection;
19212 SocketConnection parent_instance;
19213 TcpConnectionPrivate* priv;
19216 // Checks if graceful disconnects are used. See
19217 // g_tcp_connection_set_graceful_disconnect().
19218 // RETURNS: %TRUE if graceful disconnect is used on close, %FALSE otherwise
19219 int get_graceful_disconnect() {
19220 return g_tcp_connection_get_graceful_disconnect(&this);
19223 // This enabled graceful disconnects on close. A graceful disconnect
19224 // means that we signal the receiving end that the connection is terminated
19225 // and wait for it to close the connection before closing the connection.
19227 // A graceful disconnect means that we can be sure that we successfully sent
19228 // all the outstanding data to the other end, or get an error reported.
19229 // However, it also means we have to wait for all the data to reach the
19230 // other side and for it to acknowledge this by closing the socket, which may
19231 // take a while. For this reason it is disabled by default.
19232 // <graceful_disconnect>: Whether to do graceful disconnects or not
19233 void set_graceful_disconnect(int graceful_disconnect) {
19234 g_tcp_connection_set_graceful_disconnect(&this, graceful_disconnect);
19238 struct TcpConnectionClass {
19239 SocketConnectionClass parent_class;
19242 struct TcpConnectionPrivate {
19246 // A #GTcpWrapperConnection can be used to wrap a #GIOStream that is
19247 // based on a #GSocket, but which is not actually a
19248 // #GSocketConnection. This is used by #GSocketClient so that it can
19249 // always return a #GSocketConnection, even when the connection it has
19250 // actually created is not directly a #GSocketConnection.
19251 struct TcpWrapperConnection /* : TcpConnection */ {
19252 alias parent_instance this;
19253 alias parent_instance super_;
19254 alias parent_instance tcpconnection;
19255 TcpConnection parent_instance;
19256 TcpWrapperConnectionPrivate* priv;
19259 // Wraps @base_io_stream and @socket together as a #GSocketConnection.
19260 // RETURNS: the new #GSocketConnection.
19261 // <base_io_stream>: the #GIOStream to wrap
19262 // <socket>: the #GSocket associated with @base_io_stream
19263 static TcpWrapperConnection* /*new*/ new_(IOStream* base_io_stream, Socket* socket) {
19264 return g_tcp_wrapper_connection_new(base_io_stream, socket);
19267 // Get's @conn's base #GIOStream
19268 // RETURNS: @conn's base #GIOStream
19269 IOStream* get_base_io_stream() {
19270 return g_tcp_wrapper_connection_get_base_io_stream(&this);
19274 struct TcpWrapperConnectionClass {
19275 TcpConnectionClass parent_class;
19278 struct TcpWrapperConnectionPrivate {
19282 // #GThemedIcon is an implementation of #GIcon that supports icon themes.
19283 // #GThemedIcon contains a list of all of the icons present in an icon
19284 // theme, so that icons can be looked up quickly. #GThemedIcon does
19285 // not provide actual pixmaps for icons, just the icon names.
19286 // Ideally something like gtk_icon_theme_choose_icon() should be used to
19287 // resolve the list of names so that fallback icons work nicely with
19288 // themes that inherit other themes.
19289 struct ThemedIcon /* : GObject.Object */ {
19290 alias method_parent this;
19291 alias method_parent super_;
19292 alias method_parent object;
19293 GObject2.Object method_parent;
19296 // Creates a new themed icon for @iconname.
19297 // RETURNS: a new #GThemedIcon.
19298 // <iconname>: a string containing an icon name.
19299 static Icon* /*new*/ new_(char* iconname) {
19300 return g_themed_icon_new(iconname);
19303 // Creates a new themed icon for @iconnames.
19304 // RETURNS: a new #GThemedIcon
19305 // <iconnames>: an array of strings containing icon names.
19306 // <len>: the length of the @iconnames array, or -1 if @iconnames is %NULL-terminated
19307 static Icon* /*new*/ new_from_names(char** iconnames, int len) {
19308 return g_themed_icon_new_from_names(iconnames, len);
19311 // Creates a new themed icon for @iconname, and all the names
19312 // that can be created by shortening @iconname at '-' characters.
19314 // In the following example, @icon1 and @icon2 are equivalent:
19315 // |[
19316 // const char *names[] = {
19317 // "gnome-dev-cdrom-audio",
19318 // "gnome-dev-cdrom",
19319 // "gnome-dev",
19320 // "gnome"
19321 // };
19323 // icon1 = g_themed_icon_new_from_names (names, 4);
19324 // icon2 = g_themed_icon_new_with_default_fallbacks ("gnome-dev-cdrom-audio");
19325 // ]|
19326 // RETURNS: a new #GThemedIcon.
19327 // <iconname>: a string containing an icon name
19328 static Icon* /*new*/ new_with_default_fallbacks(char* iconname) {
19329 return g_themed_icon_new_with_default_fallbacks(iconname);
19332 // Append a name to the list of icons from within @icon.
19334 // <note><para>
19335 // Note that doing so invalidates the hash computed by prior calls
19336 // to g_icon_hash().
19337 // </para></note>
19338 // <iconname>: name of icon to append to list of icons from within @icon.
19339 void append_name(char* iconname) {
19340 g_themed_icon_append_name(&this, iconname);
19343 // Gets the names of icons from within @icon.
19344 // RETURNS: a list of icon names.
19345 char** get_names() {
19346 return g_themed_icon_get_names(&this);
19349 // Prepend a name to the list of icons from within @icon.
19351 // <note><para>
19352 // Note that doing so invalidates the hash computed by prior calls
19353 // to g_icon_hash().
19354 // </para></note>
19355 // <iconname>: name of icon to prepend to list of icons from within @icon.
19356 void prepend_name(char* iconname) {
19357 g_themed_icon_prepend_name(&this, iconname);
19361 struct ThemedIconClass {
19365 // A #GThreadedSocketService is a simple subclass of #GSocketService
19366 // that handles incoming connections by creating a worker thread and
19367 // dispatching the connection to it by emitting the
19368 // #GThreadedSocketService::run signal in the new thread.
19370 // The signal handler may perform blocking IO and need not return
19371 // until the connection is closed.
19373 // The service is implemented using a thread pool, so there is a
19374 // limited amount of threads available to serve incoming requests.
19375 // The service automatically stops the #GSocketService from accepting
19376 // new connections when all threads are busy.
19378 // As with #GSocketService, you may connect to #GThreadedSocketService::run,
19379 // or subclass and override the default handler.
19380 struct ThreadedSocketService /* : SocketService */ /* Version 2.22 */ {
19381 alias parent_instance this;
19382 alias parent_instance super_;
19383 alias parent_instance socketservice;
19384 SocketService parent_instance;
19385 ThreadedSocketServicePrivate* priv;
19388 // Creates a new #GThreadedSocketService with no listeners. Listeners
19389 // must be added with one of the #GSocketListener "add" methods.
19390 // RETURNS: a new #GSocketService.
19391 // <max_threads>: the maximal number of threads to execute concurrently handling incoming clients, -1 means no limit
19392 static ThreadedSocketService* /*new*/ new_(int max_threads) {
19393 return g_threaded_socket_service_new(max_threads);
19396 // The ::run signal is emitted in a worker thread in response to an
19397 // incoming connection. This thread is dedicated to handling
19398 // @connection and may perform blocking IO. The signal handler need
19399 // not return until the connection is closed.
19400 // RETURNS: %TRUE to stop further signal handlers from being called
19401 // <connection>: a new #GSocketConnection object.
19402 // <source_object>: the source_object passed to g_socket_listener_add_address().
19403 extern (C) alias static c_int function (ThreadedSocketService* this_, SocketConnection* connection, GObject2.Object* source_object, void* user_data=null) signal_run;
19405 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
19406 return super_.signal_connect!name(cb, data, cf);
19409 ulong signal_connect(string name:"run", CB:signal_run)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
19410 return signal_connect_data(&this, cast(char*)"run",
19411 cast(GObject2.Callback)cb, data, null, cf);
19415 struct ThreadedSocketServiceClass {
19416 SocketServiceClass parent_class;
19417 extern (C) int function (ThreadedSocketService* service, SocketConnection* connection, GObject2.Object* source_object) run;
19418 extern (C) void function () _g_reserved1;
19419 extern (C) void function () _g_reserved2;
19420 extern (C) void function () _g_reserved3;
19421 extern (C) void function () _g_reserved4;
19422 extern (C) void function () _g_reserved5;
19425 struct ThreadedSocketServicePrivate {
19428 // The client authentication mode for a #GTlsServerConnection.
19429 enum TlsAuthenticationMode /* Version 2.28 */ {
19430 NONE = 0,
19431 REQUESTED = 1,
19432 REQUIRED = 2
19434 struct TlsBackend /* Version 2.28 */ {
19436 // Gets the default #GTlsBackend for the system.
19437 // RETURNS: a #GTlsBackend
19438 static TlsBackend* get_default() {
19439 return g_tls_backend_get_default();
19442 // Gets the #GType of @backend's #GTlsCertificate implementation.
19444 // implementation.
19445 // RETURNS: the #GType of @backend's #GTlsCertificate
19446 Type get_certificate_type() {
19447 return g_tls_backend_get_certificate_type(&this);
19450 // Gets the #GType of @backend's #GTlsClientConnection implementation.
19452 // implementation.
19453 // RETURNS: the #GType of @backend's #GTlsClientConnection
19454 Type get_client_connection_type() {
19455 return g_tls_backend_get_client_connection_type(&this);
19458 // Gets the default #GTlsDatabase used to verify TLS connections.
19460 // unreffed when done.
19461 // RETURNS: the default database, which should be
19462 TlsDatabase* /*new*/ get_default_database() {
19463 return g_tls_backend_get_default_database(&this);
19466 // Gets the #GTyep of @backend's #GTlsFileDatabase implementation.
19467 // RETURNS: the #GType of backend's #GTlsFileDatabase implementation.
19468 Type get_file_database_type() {
19469 return g_tls_backend_get_file_database_type(&this);
19472 // Gets the #GType of @backend's #GTlsServerConnection implementation.
19474 // implementation.
19475 // RETURNS: the #GType of @backend's #GTlsServerConnection
19476 Type get_server_connection_type() {
19477 return g_tls_backend_get_server_connection_type(&this);
19480 // Checks if TLS is supported; if this returns %FALSE for the default
19481 // #GTlsBackend, it means no "real" TLS backend is available.
19482 // RETURNS: whether or not TLS is supported
19483 int supports_tls() {
19484 return g_tls_backend_supports_tls(&this);
19488 // Provides an interface for describing TLS-related types.
19489 struct TlsBackendInterface /* Version 2.28 */ {
19490 GObject2.TypeInterface g_iface;
19491 // RETURNS: whether or not TLS is supported
19492 extern (C) int function (TlsBackend* backend) supports_tls;
19493 extern (C) Type function () get_certificate_type;
19494 extern (C) Type function () get_client_connection_type;
19495 extern (C) Type function () get_server_connection_type;
19496 extern (C) Type function () get_file_database_type;
19497 // RETURNS: the default database, which should be
19498 extern (C) TlsDatabase* /*new*/ function (TlsBackend* backend) get_default_database;
19502 // A certificate used for TLS authentication and encryption.
19503 // This can represent either a public key only (eg, the certificate
19504 // received by a client from a server), or the combination of
19505 // a public key and a private key (which is needed when acting as a
19506 // #GTlsServerConnection).
19507 struct TlsCertificate /* : GObject.Object */ /* Version 2.28 */ {
19508 alias parent_instance this;
19509 alias parent_instance super_;
19510 alias parent_instance object;
19511 GObject2.Object parent_instance;
19512 TlsCertificatePrivate* priv;
19515 // Creates a #GTlsCertificate from the PEM-encoded data in @file. If
19516 // @file cannot be read or parsed, the function will return %NULL and
19517 // set @error. Otherwise, this behaves like g_tls_certificate_new().
19518 // RETURNS: the new certificate, or %NULL on error
19519 // <file>: file containing a PEM-encoded certificate to import
19520 static TlsCertificate* /*new*/ new_from_file(char* file, GLib2.Error** error=null) {
19521 return g_tls_certificate_new_from_file(file, error);
19524 // Creates a #GTlsCertificate from the PEM-encoded data in @cert_file
19525 // and @key_file. If either file cannot be read or parsed, the
19526 // function will return %NULL and set @error. Otherwise, this behaves
19527 // like g_tls_certificate_new().
19528 // RETURNS: the new certificate, or %NULL on error
19529 // <cert_file>: file containing a PEM-encoded certificate to import
19530 // <key_file>: file containing a PEM-encoded private key to import
19531 static TlsCertificate* /*new*/ new_from_files(char* cert_file, char* key_file, GLib2.Error** error=null) {
19532 return g_tls_certificate_new_from_files(cert_file, key_file, error);
19535 // Creates a new #GTlsCertificate from the PEM-encoded data in @data.
19536 // If @data includes both a certificate and a private key, then the
19537 // returned certificate will include the private key data as well.
19539 // If @data includes multiple certificates, only the first one will be
19540 // parsed.
19541 // RETURNS: the new certificate, or %NULL if @data is invalid
19542 // <data>: PEM-encoded certificate data
19543 // <length>: the length of @data, or -1 if it's 0-terminated.
19544 static TlsCertificate* /*new*/ new_from_pem(char* data, ssize_t length, GLib2.Error** error=null) {
19545 return g_tls_certificate_new_from_pem(data, length, error);
19548 // Creates one or more #GTlsCertificate<!-- -->s from the PEM-encoded
19549 // data in @file. If @file cannot be read or parsed, the function will
19550 // return %NULL and set @error. If @file does not contain any
19551 // PEM-encoded certificates, this will return an empty list and not
19552 // set @error.
19554 // #GList containing #GTlsCertificate objects. You must free the list
19555 // and its contents when you are done with it.
19556 // RETURNS: a
19557 // <file>: file containing PEM-encoded certificates to import
19558 static GLib2.List* /*new*/ list_new_from_file(char* file, GLib2.Error** error=null) {
19559 return g_tls_certificate_list_new_from_file(file, error);
19562 // Gets the #GTlsCertificate representing @cert's issuer, if known
19564 // or %NULL if @cert is self-signed or signed with an unknown
19565 // certificate.
19566 // RETURNS: The certificate of @cert's issuer,
19567 TlsCertificate* get_issuer() {
19568 return g_tls_certificate_get_issuer(&this);
19571 // This verifies @cert and returns a set of #GTlsCertificateFlags
19572 // indicating any problems found with it. This can be used to verify a
19573 // certificate outside the context of making a connection, or to
19574 // check a certificate against a CA that is not part of the system
19575 // CA database.
19577 // If @identity is not %NULL, @cert's name(s) will be compared against
19578 // it, and %G_TLS_CERTIFICATE_BAD_IDENTITY will be set in the return
19579 // value if it does not match. If @identity is %NULL, that bit will
19580 // never be set in the return value.
19582 // If @trusted_ca is not %NULL, then @cert (or one of the certificates
19583 // in its chain) must be signed by it, or else
19584 // %G_TLS_CERTIFICATE_UNKNOWN_CA will be set in the return value. If
19585 // @trusted_ca is %NULL, that bit will never be set in the return
19586 // value.
19588 // (All other #GTlsCertificateFlags values will always be set or unset
19589 // as appropriate.)
19590 // RETURNS: the appropriate #GTlsCertificateFlags
19591 // <identity>: the expected peer identity
19592 // <trusted_ca>: the certificate of a trusted authority
19593 TlsCertificateFlags verify(SocketConnectable* identity=null, TlsCertificate* trusted_ca=null) {
19594 return g_tls_certificate_verify(&this, identity, trusted_ca);
19598 struct TlsCertificateClass {
19599 GObject2.ObjectClass parent_class;
19601 // RETURNS: the appropriate #GTlsCertificateFlags
19602 // <identity>: the expected peer identity
19603 // <trusted_ca>: the certificate of a trusted authority
19604 extern (C) TlsCertificateFlags function (TlsCertificate* cert, SocketConnectable* identity=null, TlsCertificate* trusted_ca=null) verify;
19605 private void*[8] padding;
19609 // A set of flags describing TLS certification validation. This can be
19610 // used to set which validation steps to perform (eg, with
19611 // g_tls_client_connection_set_validation_flags()), or to describe why
19612 // a particular certificate was rejected (eg, in
19613 // #GTlsConnection::accept-certificate).
19614 enum TlsCertificateFlags /* Version 2.28 */ {
19615 UNKNOWN_CA = 1,
19616 BAD_IDENTITY = 2,
19617 NOT_ACTIVATED = 4,
19618 EXPIRED = 8,
19619 REVOKED = 16,
19620 INSECURE = 32,
19621 GENERIC_ERROR = 64,
19622 VALIDATE_ALL = 127
19624 struct TlsCertificatePrivate {
19628 // #GTlsClientConnection is the client-side subclass of
19629 // #GTlsConnection, representing a client-side TLS connection.
19630 struct TlsClientConnection /* Version 2.28 */ {
19632 // Creates a new #GTlsClientConnection wrapping @base_io_stream (which
19633 // must have pollable input and output streams) which is assumed to
19634 // communicate with the server identified by @server_identity.
19635 // RETURNS: the new #GTlsClientConnection, or %NULL on error
19636 // <base_io_stream>: the #GIOStream to wrap
19637 // <server_identity>: the expected identity of the server
19638 static IOStream* /*new*/ new_(IOStream* base_io_stream, SocketConnectable* server_identity, GLib2.Error** error=null) {
19639 return g_tls_client_connection_new(base_io_stream, server_identity, error);
19642 // Gets the list of distinguished names of the Certificate Authorities
19643 // that the server will accept certificates from. This will be set
19644 // during the TLS handshake if the server requests a certificate.
19645 // Otherwise, it will be %NULL.
19647 // Each item in the list is a #GByteArray which contains the complete
19648 // subject DN of the certificate authority.
19650 // CA DNs. You should unref each element with g_byte_array_unref() and then
19651 // the free the list with g_list_free().
19652 // RETURNS: the list of
19653 GLib2.List* /*new*/ get_accepted_cas() {
19654 return g_tls_client_connection_get_accepted_cas(&this);
19657 // Gets @conn's expected server identity
19659 // expected server identity, or %NULL if the expected identity is not
19660 // known.
19661 // RETURNS: a #GSocketConnectable describing the
19662 SocketConnectable* get_server_identity() {
19663 return g_tls_client_connection_get_server_identity(&this);
19666 // Gets whether @conn will use SSL 3.0 rather than the
19667 // highest-supported version of TLS; see
19668 // g_tls_client_connection_set_use_ssl3().
19669 // RETURNS: whether @conn will use SSL 3.0
19670 int get_use_ssl3() {
19671 return g_tls_client_connection_get_use_ssl3(&this);
19674 // Gets @conn's validation flags
19675 // RETURNS: the validation flags
19676 TlsCertificateFlags get_validation_flags() {
19677 return g_tls_client_connection_get_validation_flags(&this);
19680 // Sets @conn's expected server identity, which is used both to tell
19681 // servers on virtual hosts which certificate to present, and also
19682 // to let @conn know what name to look for in the certificate when
19683 // performing %G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled.
19684 // <identity>: a #GSocketConnectable describing the expected server identity
19685 void set_server_identity(SocketConnectable* identity) {
19686 g_tls_client_connection_set_server_identity(&this, identity);
19689 // If @use_ssl3 is %TRUE, this forces @conn to use SSL 3.0 rather than
19690 // trying to properly negotiate the right version of TLS or SSL to use.
19691 // This can be used when talking to servers that do not implement the
19692 // fallbacks correctly and which will therefore fail to handshake with
19693 // a "modern" TLS handshake attempt.
19694 // <use_ssl3>: whether to use SSL 3.0
19695 void set_use_ssl3(int use_ssl3) {
19696 g_tls_client_connection_set_use_ssl3(&this, use_ssl3);
19699 // Sets @conn's validation flags, to override the default set of
19700 // checks performed when validating a server certificate. By default,
19701 // %G_TLS_CERTIFICATE_VALIDATE_ALL is used.
19702 // <flags>: the #GTlsCertificateFlags to use
19703 void set_validation_flags(TlsCertificateFlags flags) {
19704 g_tls_client_connection_set_validation_flags(&this, flags);
19708 struct TlsClientConnectionInterface {
19709 GObject2.TypeInterface g_iface;
19713 // #GTlsConnection is the base TLS connection class type, which wraps
19714 // a #GIOStream and provides TLS encryption on top of it. Its
19715 // subclasses, #GTlsClientConnection and #GTlsServerConnection,
19716 // implement client-side and server-side TLS, respectively.
19717 struct TlsConnection /* : IOStream */ /* Version 2.28 */ {
19718 alias parent_instance this;
19719 alias parent_instance super_;
19720 alias parent_instance iostream;
19721 IOStream parent_instance;
19722 TlsConnectionPrivate* priv;
19725 // Used by #GTlsConnection implementations to emit the
19726 // #GTlsConnection::accept-certificate signal.
19728 // %TRUE to accept @peer_cert
19729 // RETURNS: %TRUE if one of the signal handlers has returned
19730 // <peer_cert>: the peer's #GTlsCertificate
19731 // <errors>: the problems with @peer_cert
19732 int emit_accept_certificate(TlsCertificate* peer_cert, TlsCertificateFlags errors) {
19733 return g_tls_connection_emit_accept_certificate(&this, peer_cert, errors);
19736 // Gets @conn's certificate, as set by
19737 // g_tls_connection_set_certificate().
19738 // RETURNS: @conn's certificate, or %NULL
19739 TlsCertificate* get_certificate() {
19740 return g_tls_connection_get_certificate(&this);
19743 // Gets the certificate database that @conn uses to verify
19744 // peer certificates. See g_tls_connection_set_database().
19745 // RETURNS: the certificate database that @conn uses or %NULL
19746 TlsDatabase* get_database() {
19747 return g_tls_connection_get_database(&this);
19750 // Get the object that will be used to interact with the user. It will be used
19751 // for things like prompting the user for passwords. If %NULL is returned, then
19752 // no user interaction will occur for this connection.
19753 // RETURNS: The interaction object.
19754 TlsInteraction* get_interaction() {
19755 return g_tls_connection_get_interaction(&this);
19758 // Gets @conn's peer's certificate after the handshake has completed.
19759 // (It is not set during the emission of
19760 // #GTlsConnection::accept-certificate.)
19761 // RETURNS: @conn's peer's certificate, or %NULL
19762 TlsCertificate* get_peer_certificate() {
19763 return g_tls_connection_get_peer_certificate(&this);
19766 // Gets the errors associated with validating @conn's peer's
19767 // certificate, after the handshake has completed. (It is not set
19768 // during the emission of #GTlsConnection::accept-certificate.)
19769 // RETURNS: @conn's peer's certificate errors
19770 TlsCertificateFlags get_peer_certificate_errors() {
19771 return g_tls_connection_get_peer_certificate_errors(&this);
19774 // Gets @conn rehandshaking mode. See
19775 // g_tls_connection_set_rehandshake_mode() for details.
19776 // RETURNS: @conn's rehandshaking mode
19777 TlsRehandshakeMode get_rehandshake_mode() {
19778 return g_tls_connection_get_rehandshake_mode(&this);
19781 // Tests whether or not @conn expects a proper TLS close notification
19782 // when the connection is closed. See
19783 // g_tls_connection_set_require_close_notify() for details.
19785 // notification.
19786 // RETURNS: %TRUE if @conn requires a proper TLS close
19787 int get_require_close_notify() {
19788 return g_tls_connection_get_require_close_notify(&this);
19791 // Gets whether @conn uses the system certificate database to verify
19792 // peer certificates. See g_tls_connection_set_use_system_certdb().
19793 // RETURNS: whether @conn uses the system certificate database
19794 int get_use_system_certdb() {
19795 return g_tls_connection_get_use_system_certdb(&this);
19798 // Attempts a TLS handshake on @conn.
19800 // On the client side, it is never necessary to call this method;
19801 // although the connection needs to perform a handshake after
19802 // connecting (or after sending a "STARTTLS"-type command) and may
19803 // need to rehandshake later if the server requests it,
19804 // #GTlsConnection will handle this for you automatically when you try
19805 // to send or receive data on the connection. However, you can call
19806 // g_tls_connection_handshake() manually if you want to know for sure
19807 // whether the initial handshake succeeded or failed (as opposed to
19808 // just immediately trying to write to @conn's output stream, in which
19809 // case if it fails, it may not be possible to tell if it failed
19810 // before or after completing the handshake).
19812 // Likewise, on the server side, although a handshake is necessary at
19813 // the beginning of the communication, you do not need to call this
19814 // function explicitly unless you want clearer error reporting.
19815 // However, you may call g_tls_connection_handshake() later on to
19816 // renegotiate parameters (encryption methods, etc) with the client.
19818 // #GTlsConnection::accept_certificate may be emitted during the
19819 // handshake.
19820 // RETURNS: success or failure
19821 // <cancellable>: a #GCancellable, or %NULL
19822 int handshake(Cancellable* cancellable, GLib2.Error** error=null) {
19823 return g_tls_connection_handshake(&this, cancellable, error);
19826 // Asynchronously performs a TLS handshake on @conn. See
19827 // g_tls_connection_handshake() for more information.
19828 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
19829 // <cancellable>: a #GCancellable, or %NULL
19830 // <callback>: callback to call when the handshake is complete
19831 // <user_data>: the data to pass to the callback function
19832 void handshake_async(int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
19833 g_tls_connection_handshake_async(&this, io_priority, cancellable, callback, user_data);
19836 // Finish an asynchronous TLS handshake operation. See
19837 // g_tls_connection_handshake() for more information.
19839 // case @error will be set.
19840 // RETURNS: %TRUE on success, %FALSE on failure, in which
19841 // <result>: a #GAsyncResult.
19842 int handshake_finish(AsyncResult* result, GLib2.Error** error=null) {
19843 return g_tls_connection_handshake_finish(&this, result, error);
19846 // This sets the certificate that @conn will present to its peer
19847 // during the TLS handshake. For a #GTlsServerConnection, it is
19848 // mandatory to set this, and that will normally be done at construct
19849 // time.
19851 // For a #GTlsClientConnection, this is optional. If a handshake fails
19852 // with %G_TLS_ERROR_CERTIFICATE_REQUIRED, that means that the server
19853 // requires a certificate, and if you try connecting again, you should
19854 // call this method first. You can call
19855 // g_tls_client_connection_get_accepted_cas() on the failed connection
19856 // to get a list of Certificate Authorities that the server will
19857 // accept certificates from.
19859 // (It is also possible that a server will allow the connection with
19860 // or without a certificate; in that case, if you don't provide a
19861 // certificate, you can tell that the server requested one by the fact
19862 // that g_tls_client_connection_get_accepted_cas() will return
19863 // non-%NULL.)
19864 // <certificate>: the certificate to use for @conn
19865 void set_certificate(TlsCertificate* certificate) {
19866 g_tls_connection_set_certificate(&this, certificate);
19869 // Sets the certificate database that is used to verify peer certificates.
19870 // This is set to the default database by default. See
19871 // g_tls_backend_get_default_database(). If set to %NULL, then
19872 // peer certificate validation will always set the
19873 // %G_TLS_CERTIFICATE_UNKNOWN_CA error (meaning
19874 // #GTlsConnection::accept-certificate will always be emitted on
19875 // client-side connections, unless that bit is not set in
19876 // #GTlsClientConnection:validation-flags).
19877 // <database>: a #GTlsDatabase
19878 void set_database(TlsDatabase* database) {
19879 g_tls_connection_set_database(&this, database);
19882 // Set the object that will be used to interact with the user. It will be used
19883 // for things like prompting the user for passwords.
19885 // The @interaction argument will normally be a derived subclass of
19886 // #GTlsInteraction. %NULL can also be provided if no user interaction
19887 // should occur for this connection.
19888 // <interaction>: an interaction object, or %NULL
19889 void set_interaction(TlsInteraction* interaction=null) {
19890 g_tls_connection_set_interaction(&this, interaction);
19893 // Sets how @conn behaves with respect to rehandshaking requests.
19895 // %G_TLS_REHANDSHAKE_NEVER means that it will never agree to
19896 // rehandshake after the initial handshake is complete. (For a client,
19897 // this means it will refuse rehandshake requests from the server, and
19898 // for a server, this means it will close the connection with an error
19899 // if the client attempts to rehandshake.)
19901 // %G_TLS_REHANDSHAKE_SAFELY means that the connection will allow a
19902 // rehandshake only if the other end of the connection supports the
19903 // TLS <literal>renegotiation_info</literal> extension. This is the
19904 // default behavior, but means that rehandshaking will not work
19905 // against older implementations that do not support that extension.
19907 // %G_TLS_REHANDSHAKE_UNSAFELY means that the connection will allow
19908 // rehandshaking even without the
19909 // <literal>renegotiation_info</literal> extension. On the server side
19910 // in particular, this is not recommended, since it leaves the server
19911 // open to certain attacks. However, this mode is necessary if you
19912 // need to allow renegotiation with older client software.
19913 // <mode>: the rehandshaking mode
19914 void set_rehandshake_mode(TlsRehandshakeMode mode) {
19915 g_tls_connection_set_rehandshake_mode(&this, mode);
19918 // Sets whether or not @conn expects a proper TLS close notification
19919 // before the connection is closed. If this is %TRUE (the default),
19920 // then @conn will expect to receive a TLS close notification from its
19921 // peer before the connection is closed, and will return a
19922 // %G_TLS_ERROR_EOF error if the connection is closed without proper
19923 // notification (since this may indicate a network error, or
19924 // man-in-the-middle attack).
19926 // In some protocols, the application will know whether or not the
19927 // connection was closed cleanly based on application-level data
19928 // (because the application-level data includes a length field, or is
19929 // somehow self-delimiting); in this case, the close notify is
19930 // redundant and sometimes omitted. (TLS 1.1 explicitly allows this;
19931 // in TLS 1.0 it is technically an error, but often done anyway.) You
19932 // can use g_tls_connection_set_require_close_notify() to tell @conn
19933 // to allow an "unannounced" connection close, in which case the close
19934 // will show up as a 0-length read, as in a non-TLS
19935 // #GSocketConnection, and it is up to the application to check that
19936 // the data has been fully received.
19938 // Note that this only affects the behavior when the peer closes the
19939 // connection; when the application calls g_io_stream_close() itself
19940 // on @conn, this will send a close notification regardless of the
19941 // setting of this property. If you explicitly want to do an unclean
19942 // close, you can close @conn's #GTlsConnection:base-io-stream rather
19943 // than closing @conn itself.
19944 // <require_close_notify>: whether or not to require close notification
19945 void set_require_close_notify(int require_close_notify) {
19946 g_tls_connection_set_require_close_notify(&this, require_close_notify);
19949 // Sets whether @conn uses the system certificate database to verify
19950 // peer certificates. This is %TRUE by default. If set to %FALSE, then
19951 // peer certificate validation will always set the
19952 // %G_TLS_CERTIFICATE_UNKNOWN_CA error (meaning
19953 // #GTlsConnection::accept-certificate will always be emitted on
19954 // client-side connections, unless that bit is not set in
19955 // #GTlsClientConnection:validation-flags).
19956 // <use_system_certdb>: whether to use the system certificate database
19957 void set_use_system_certdb(int use_system_certdb) {
19958 g_tls_connection_set_use_system_certdb(&this, use_system_certdb);
19961 // Emitted during the TLS handshake after the peer certificate has
19962 // been received. You can examine @peer_cert's certification path by
19963 // calling g_tls_certificate_get_issuer() on it.
19965 // For a client-side connection, @peer_cert is the server's
19966 // certificate, and the signal will only be emitted if the
19967 // certificate was not acceptable according to @conn's
19968 // #GTlsClientConnection:validation_flags. If you would like the
19969 // certificate to be accepted despite @errors, return %TRUE from the
19970 // signal handler. Otherwise, if no handler accepts the certificate,
19971 // the handshake will fail with %G_TLS_ERROR_BAD_CERTIFICATE.
19973 // For a server-side connection, @peer_cert is the certificate
19974 // presented by the client, if this was requested via the server's
19975 // #GTlsServerConnection:authentication_mode. On the server side,
19976 // the signal is always emitted when the client presents a
19977 // certificate, and the certificate will only be accepted if a
19978 // handler returns %TRUE.
19980 // Note that if this signal is emitted as part of asynchronous I/O
19981 // in the main thread, then you should not attempt to interact with
19982 // the user before returning from the signal handler. If you want to
19983 // let the user decide whether or not to accept the certificate, you
19984 // would have to return %FALSE from the signal handler on the first
19985 // attempt, and then after the connection attempt returns a
19986 // %G_TLS_ERROR_HANDSHAKE, you can interact with the user, and if
19987 // the user decides to accept the certificate, remember that fact,
19988 // create a new connection, and return %TRUE from the signal handler
19989 // the next time.
19991 // If you are doing I/O in another thread, you do not
19992 // need to worry about this, and can simply block in the signal
19993 // handler until the UI thread returns an answer.
19995 // immediately end the signal emission). %FALSE to allow the signal
19996 // emission to continue, which will cause the handshake to fail if
19997 // no one else overrides it.
19998 // RETURNS: %TRUE to accept @peer_cert (which will also
19999 // <peer_cert>: the peer's #GTlsCertificate
20000 // <errors>: the problems with @peer_cert.
20001 extern (C) alias static c_int function (TlsConnection* this_, TlsCertificate* peer_cert, TlsCertificateFlags* errors, void* user_data=null) signal_accept_certificate;
20003 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
20004 return super_.signal_connect!name(cb, data, cf);
20007 ulong signal_connect(string name:"accept-certificate", CB:signal_accept_certificate)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
20008 return signal_connect_data(&this, cast(char*)"accept-certificate",
20009 cast(GObject2.Callback)cb, data, null, cf);
20013 struct TlsConnectionClass {
20014 IOStreamClass parent_class;
20015 extern (C) int function (TlsConnection* connection, TlsCertificate* peer_cert, TlsCertificateFlags errors) accept_certificate;
20017 // RETURNS: success or failure
20018 // <cancellable>: a #GCancellable, or %NULL
20019 extern (C) int function (TlsConnection* conn, Cancellable* cancellable, GLib2.Error** error=null) handshake;
20021 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the request.
20022 // <cancellable>: a #GCancellable, or %NULL
20023 // <callback>: callback to call when the handshake is complete
20024 // <user_data>: the data to pass to the callback function
20025 extern (C) void function (TlsConnection* conn, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) handshake_async;
20027 // RETURNS: %TRUE on success, %FALSE on failure, in which
20028 // <result>: a #GAsyncResult.
20029 extern (C) int function (TlsConnection* conn, AsyncResult* result, GLib2.Error** error=null) handshake_finish;
20030 private void*[8] padding;
20033 struct TlsConnectionPrivate {
20037 // #GTlsDatabase is used to lookup certificates and other information
20038 // from a certificate or key store. It is an abstract base class which
20039 // TLS library specific subtypes override.
20041 // Most common client applications will not directly interact with
20042 // #GTlsDatabase. It is used internally by #GTlsConnection.
20043 struct TlsDatabase /* : GObject.Object */ /* Version 2.30 */ {
20044 alias parent_instance this;
20045 alias parent_instance super_;
20046 alias parent_instance object;
20047 GObject2.Object parent_instance;
20048 TlsDatabasePrivate* priv;
20051 // Create a handle string for the certificate. The database will only be able
20052 // to create a handle for certificates that originate from the database. In
20053 // cases where the database cannot create a handle for a certificate, %NULL
20054 // will be returned.
20056 // This handle should be stable across various instances of the application,
20057 // and between applications. If a certificate is modified in the database,
20058 // then it is not guaranteed that this handle will continue to point to it.
20059 // RETURNS: a newly allocated string containing the handle.
20060 // <certificate>: certificate for which to create a handle.
20061 char* /*new*/ create_certificate_handle(TlsCertificate* certificate) {
20062 return g_tls_database_create_certificate_handle(&this, certificate);
20065 // Lookup a certificate by its handle.
20067 // The handle should have been created by calling g_tls_database_create_handle()
20068 // on a #GTlsDatabase object of the same TLS backend. The handle is designed
20069 // to remain valid across instantiations of the database.
20071 // If the handle is no longer valid, or does not point to a certificate in
20072 // this database, then %NULL will be returned.
20074 // This function can block, use g_tls_database_lookup_certificate_for_handle_async() to perform
20075 // the lookup operation asynchronously.
20077 // #GTlsCertificate, or %NULL. Use g_object_unref() to release the certificate.
20078 // RETURNS: a newly allocated
20079 // <handle>: a certificate handle
20080 // <interaction>: used to interact with the user if necessary
20081 // <flags>: Flags which affect the lookup.
20082 // <cancellable>: a #GCancellable, or %NULL
20083 TlsCertificate* /*new*/ lookup_certificate_for_handle(char* handle, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
20084 return g_tls_database_lookup_certificate_for_handle(&this, handle, interaction, flags, cancellable, error);
20087 // Asynchronously lookup a certificate by its handle in the database. See
20088 // g_tls_database_lookup_handle() for more information.
20089 // <handle>: a certificate handle
20090 // <interaction>: used to interact with the user if necessary
20091 // <flags>: Flags which affect the lookup.
20092 // <cancellable>: a #GCancellable, or %NULL
20093 // <callback>: callback to call when the operation completes
20094 // <user_data>: the data to pass to the callback function
20095 void lookup_certificate_for_handle_async(char* handle, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
20096 g_tls_database_lookup_certificate_for_handle_async(&this, handle, interaction, flags, cancellable, callback, user_data);
20099 // Finish an asynchronous lookup of a certificate by its handle. See
20100 // g_tls_database_lookup_handle() for more information.
20102 // If the handle is no longer valid, or does not point to a certificate in
20103 // this database, then %NULL will be returned.
20105 // Use g_object_unref() to release the certificate.
20106 // RETURNS: a newly allocated #GTlsCertificate object.
20107 // <result>: a #GAsyncResult.
20108 TlsCertificate* /*new*/ lookup_certificate_for_handle_finish(AsyncResult* result, GLib2.Error** error=null) {
20109 return g_tls_database_lookup_certificate_for_handle_finish(&this, result, error);
20112 // Lookup the issuer of @certificate in the database.
20114 // The %issuer property
20115 // of @certificate is not modified, and the two certificates are not hooked
20116 // into a chain.
20118 // This function can block, use g_tls_database_lookup_certificate_issuer_async() to perform
20119 // the lookup operation asynchronously.
20121 // or %NULL. Use g_object_unref() to release the certificate.
20122 // RETURNS: a newly allocated issuer #GTlsCertificate,
20123 // <certificate>: a #GTlsCertificate
20124 // <interaction>: used to interact with the user if necessary
20125 // <flags>: flags which affect the lookup operation
20126 // <cancellable>: a #GCancellable, or %NULL
20127 TlsCertificate* /*new*/ lookup_certificate_issuer(TlsCertificate* certificate, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
20128 return g_tls_database_lookup_certificate_issuer(&this, certificate, interaction, flags, cancellable, error);
20131 // Asynchronously lookup the issuer of @certificate in the database. See
20132 // g_tls_database_lookup_certificate_issuer() for more information.
20133 // <certificate>: a #GTlsCertificate
20134 // <interaction>: used to interact with the user if necessary
20135 // <flags>: flags which affect the lookup operation
20136 // <cancellable>: a #GCancellable, or %NULL
20137 // <callback>: callback to call when the operation completes
20138 // <user_data>: the data to pass to the callback function
20139 void lookup_certificate_issuer_async(TlsCertificate* certificate, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
20140 g_tls_database_lookup_certificate_issuer_async(&this, certificate, interaction, flags, cancellable, callback, user_data);
20143 // Finish an asynchronous lookup issuer operation. See
20144 // g_tls_database_lookup_certificate_issuer() for more information.
20146 // or %NULL. Use g_object_unref() to release the certificate.
20147 // RETURNS: a newly allocated issuer #GTlsCertificate,
20148 // <result>: a #GAsyncResult.
20149 TlsCertificate* /*new*/ lookup_certificate_issuer_finish(AsyncResult* result, GLib2.Error** error=null) {
20150 return g_tls_database_lookup_certificate_issuer_finish(&this, result, error);
20153 // Unintrospectable method: lookup_certificates_issued_by() / g_tls_database_lookup_certificates_issued_by()
20154 // Lookup certificates issued by this issuer in the database.
20156 // This function can block, use g_tls_database_lookup_certificates_issued_by_async() to perform
20157 // the lookup operation asynchronously.
20159 // Use g_object_unref() on each certificate, and g_list_free() on the release the list.
20160 // RETURNS: a newly allocated list of #GTlsCertificate objects.
20161 // <issuer_raw_dn>: a #GByteArray which holds the DER encoded issuer DN.
20162 // <interaction>: used to interact with the user if necessary
20163 // <flags>: Flags which affect the lookup operation.
20164 // <cancellable>: a #GCancellable, or %NULL
20165 GLib2.List* /*new*/ lookup_certificates_issued_by(ByteArray* issuer_raw_dn, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
20166 return g_tls_database_lookup_certificates_issued_by(&this, issuer_raw_dn, interaction, flags, cancellable, error);
20169 // Asynchronously lookup certificates issued by this issuer in the database. See
20170 // g_tls_database_lookup_certificates_issued_by() for more information.
20172 // The database may choose to hold a reference to the issuer byte array for the duration
20173 // of of this asynchronous operation. The byte array should not be modified during
20174 // this time.
20175 // <issuer_raw_dn>: a #GByteArray which holds the DER encoded issuer DN.
20176 // <interaction>: used to interact with the user if necessary
20177 // <flags>: Flags which affect the lookup operation.
20178 // <cancellable>: a #GCancellable, or %NULL
20179 // <callback>: callback to call when the operation completes
20180 // <user_data>: the data to pass to the callback function
20181 void lookup_certificates_issued_by_async(ByteArray* issuer_raw_dn, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
20182 g_tls_database_lookup_certificates_issued_by_async(&this, issuer_raw_dn, interaction, flags, cancellable, callback, user_data);
20185 // Unintrospectable method: lookup_certificates_issued_by_finish() / g_tls_database_lookup_certificates_issued_by_finish()
20186 // Finish an asynchronous lookup of certificates. See
20187 // g_tls_database_lookup_certificates_issued_by() for more information.
20189 // Use g_object_unref() on each certificate, and g_list_free() on the release the list.
20190 // RETURNS: a newly allocated list of #GTlsCertificate objects.
20191 // <result>: a #GAsyncResult.
20192 GLib2.List* /*new*/ lookup_certificates_issued_by_finish(AsyncResult* result, GLib2.Error** error=null) {
20193 return g_tls_database_lookup_certificates_issued_by_finish(&this, result, error);
20196 // Verify's a certificate chain after looking up and adding any missing
20197 // certificates to the chain.
20199 // @chain is a chain of #GTlsCertificate objects each pointing to the next
20200 // certificate in the chain by its %issuer property. The chain may initially
20201 // consist of one or more certificates. After the verification process is
20202 // complete, @chain may be modified by adding missing certificates, or removing
20203 // extra certificates. If a certificate anchor was found, then it is added to
20204 // the @chain.
20206 // @purpose describes the purpose (or usage) for which the certificate
20207 // is being used. Typically @purpose will be set to #G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER
20208 // which means that the certificate is being used to authenticate a server
20209 // (and we are acting as the client).
20211 // The @identity is used to check for pinned certificates (trust exceptions)
20212 // in the database. These will override the normal verification process on a
20213 // host by host basis.
20215 // Currently there are no @flags, and %G_TLS_DATABASE_VERIFY_NONE should be
20216 // used.
20218 // This function can block, use g_tls_database_verify_chain_async() to perform
20219 // the verification operation asynchronously.
20221 // result of verification.
20222 // RETURNS: the appropriate #GTlsCertificateFlags which represents the
20223 // <chain>: a #GTlsCertificate chain
20224 // <purpose>: the purpose that this certificate chain will be used for.
20225 // <identity>: the expected peer identity
20226 // <interaction>: used to interact with the user if necessary
20227 // <flags>: additional verify flags
20228 // <cancellable>: a #GCancellable, or %NULL
20229 TlsCertificateFlags verify_chain(TlsCertificate* chain, char* purpose, SocketConnectable* identity, TlsInteraction* interaction, TlsDatabaseVerifyFlags flags, Cancellable* cancellable, GLib2.Error** error=null) {
20230 return g_tls_database_verify_chain(&this, chain, purpose, identity, interaction, flags, cancellable, error);
20233 // Asynchronously verify's a certificate chain after looking up and adding
20234 // any missing certificates to the chain. See g_tls_database_verify_chain()
20235 // for more information.
20236 // <chain>: a #GTlsCertificate chain
20237 // <purpose>: the purpose that this certificate chain will be used for.
20238 // <identity>: the expected peer identity
20239 // <interaction>: used to interact with the user if necessary
20240 // <flags>: additional verify flags
20241 // <cancellable>: a #GCancellable, or %NULL
20242 // <callback>: callback to call when the operation completes
20243 // <user_data>: the data to pass to the callback function
20244 void verify_chain_async(TlsCertificate* chain, char* purpose, SocketConnectable* identity, TlsInteraction* interaction, TlsDatabaseVerifyFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
20245 g_tls_database_verify_chain_async(&this, chain, purpose, identity, interaction, flags, cancellable, callback, user_data);
20248 // Finish an asynchronous verify chain operation. See
20249 // g_tls_database_verify_chain() for more information. *
20250 // result of verification.
20251 // RETURNS: the appropriate #GTlsCertificateFlags which represents the
20252 // <result>: a #GAsyncResult.
20253 TlsCertificateFlags verify_chain_finish(AsyncResult* result, GLib2.Error** error=null) {
20254 return g_tls_database_verify_chain_finish(&this, result, error);
20258 struct TlsDatabaseClass {
20259 GObject2.ObjectClass parent_class;
20261 // RETURNS: the appropriate #GTlsCertificateFlags which represents the
20262 // <chain>: a #GTlsCertificate chain
20263 // <purpose>: the purpose that this certificate chain will be used for.
20264 // <identity>: the expected peer identity
20265 // <interaction>: used to interact with the user if necessary
20266 // <flags>: additional verify flags
20267 // <cancellable>: a #GCancellable, or %NULL
20268 extern (C) TlsCertificateFlags function (TlsDatabase* self, TlsCertificate* chain, char* purpose, SocketConnectable* identity, TlsInteraction* interaction, TlsDatabaseVerifyFlags flags, Cancellable* cancellable, GLib2.Error** error=null) verify_chain;
20270 // <chain>: a #GTlsCertificate chain
20271 // <purpose>: the purpose that this certificate chain will be used for.
20272 // <identity>: the expected peer identity
20273 // <interaction>: used to interact with the user if necessary
20274 // <flags>: additional verify flags
20275 // <cancellable>: a #GCancellable, or %NULL
20276 // <callback>: callback to call when the operation completes
20277 // <user_data>: the data to pass to the callback function
20278 extern (C) void function (TlsDatabase* self, TlsCertificate* chain, char* purpose, SocketConnectable* identity, TlsInteraction* interaction, TlsDatabaseVerifyFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) verify_chain_async;
20280 // RETURNS: the appropriate #GTlsCertificateFlags which represents the
20281 // <result>: a #GAsyncResult.
20282 extern (C) TlsCertificateFlags function (TlsDatabase* self, AsyncResult* result, GLib2.Error** error=null) verify_chain_finish;
20284 // RETURNS: a newly allocated string containing the handle.
20285 // <certificate>: certificate for which to create a handle.
20286 extern (C) char* /*new*/ function (TlsDatabase* self, TlsCertificate* certificate) create_certificate_handle;
20288 // RETURNS: a newly allocated
20289 // <handle>: a certificate handle
20290 // <interaction>: used to interact with the user if necessary
20291 // <flags>: Flags which affect the lookup.
20292 // <cancellable>: a #GCancellable, or %NULL
20293 extern (C) TlsCertificate* /*new*/ function (TlsDatabase* self, char* handle, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, GLib2.Error** error=null) lookup_certificate_for_handle;
20295 // <handle>: a certificate handle
20296 // <interaction>: used to interact with the user if necessary
20297 // <flags>: Flags which affect the lookup.
20298 // <cancellable>: a #GCancellable, or %NULL
20299 // <callback>: callback to call when the operation completes
20300 // <user_data>: the data to pass to the callback function
20301 extern (C) void function (TlsDatabase* self, char* handle, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) lookup_certificate_for_handle_async;
20303 // RETURNS: a newly allocated #GTlsCertificate object.
20304 // <result>: a #GAsyncResult.
20305 extern (C) TlsCertificate* /*new*/ function (TlsDatabase* self, AsyncResult* result, GLib2.Error** error=null) lookup_certificate_for_handle_finish;
20307 // RETURNS: a newly allocated issuer #GTlsCertificate,
20308 // <certificate>: a #GTlsCertificate
20309 // <interaction>: used to interact with the user if necessary
20310 // <flags>: flags which affect the lookup operation
20311 // <cancellable>: a #GCancellable, or %NULL
20312 extern (C) TlsCertificate* /*new*/ function (TlsDatabase* self, TlsCertificate* certificate, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, GLib2.Error** error=null) lookup_certificate_issuer;
20314 // <certificate>: a #GTlsCertificate
20315 // <interaction>: used to interact with the user if necessary
20316 // <flags>: flags which affect the lookup operation
20317 // <cancellable>: a #GCancellable, or %NULL
20318 // <callback>: callback to call when the operation completes
20319 // <user_data>: the data to pass to the callback function
20320 extern (C) void function (TlsDatabase* self, TlsCertificate* certificate, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) lookup_certificate_issuer_async;
20322 // RETURNS: a newly allocated issuer #GTlsCertificate,
20323 // <result>: a #GAsyncResult.
20324 extern (C) TlsCertificate* /*new*/ function (TlsDatabase* self, AsyncResult* result, GLib2.Error** error=null) lookup_certificate_issuer_finish;
20326 // Unintrospectable functionp: lookup_certificates_issued_by() / ()
20328 // RETURNS: a newly allocated list of #GTlsCertificate objects.
20329 // <issuer_raw_dn>: a #GByteArray which holds the DER encoded issuer DN.
20330 // <interaction>: used to interact with the user if necessary
20331 // <flags>: Flags which affect the lookup operation.
20332 // <cancellable>: a #GCancellable, or %NULL
20333 extern (C) GLib2.List* /*new*/ function (TlsDatabase* self, ByteArray* issuer_raw_dn, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, GLib2.Error** error=null) lookup_certificates_issued_by;
20335 // <issuer_raw_dn>: a #GByteArray which holds the DER encoded issuer DN.
20336 // <interaction>: used to interact with the user if necessary
20337 // <flags>: Flags which affect the lookup operation.
20338 // <cancellable>: a #GCancellable, or %NULL
20339 // <callback>: callback to call when the operation completes
20340 // <user_data>: the data to pass to the callback function
20341 extern (C) void function (TlsDatabase* self, ByteArray* issuer_raw_dn, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) lookup_certificates_issued_by_async;
20343 // Unintrospectable functionp: lookup_certificates_issued_by_finish() / ()
20345 // RETURNS: a newly allocated list of #GTlsCertificate objects.
20346 // <result>: a #GAsyncResult.
20347 extern (C) GLib2.List* /*new*/ function (TlsDatabase* self, AsyncResult* result, GLib2.Error** error=null) lookup_certificates_issued_by_finish;
20348 private void*[16] padding;
20352 // Flags for g_tls_database_lookup_handle(), g_tls_database_lookup_issuer(),
20353 // and g_tls_database_lookup_issued().
20354 enum TlsDatabaseLookupFlags /* Version 2.30 */ {
20355 NONE = 0,
20356 KEYPAIR = 1
20358 struct TlsDatabasePrivate {
20361 // Flags for g_tls_database_verify_chain().
20362 enum TlsDatabaseVerifyFlags /* Version 2.30 */ {
20363 NONE = 0
20366 // An error code used with %G_TLS_ERROR in a #GError returned from a
20367 // TLS-related routine.
20368 enum TlsError /* Version 2.28 */ {
20369 UNAVAILABLE = 0,
20370 MISC = 1,
20371 BAD_CERTIFICATE = 2,
20372 NOT_TLS = 3,
20373 HANDSHAKE = 4,
20374 CERTIFICATE_REQUIRED = 5,
20375 EOF = 6
20378 // #GTlsFileDatabase is implemented by #GTlsDatabase objects which load
20379 // their certificate information from a file. It is in interface which
20380 // TLS library specific subtypes implement.
20381 struct TlsFileDatabase /* Version 2.30 */ {
20383 // Creates a new #GTlsFileDatabase which uses anchor certificate authorities
20384 // in @anchors to verify certificate chains.
20386 // The certificates in @anchors must be PEM encoded.
20387 // RETURNS: the new #GTlsFileDatabase, or %NULL on error
20388 // <anchors>: filename of anchor certificate authorities.
20389 static TlsDatabase* /*new*/ new_(char* anchors, GLib2.Error** error=null) {
20390 return g_tls_file_database_new(anchors, error);
20394 // Provides an interface for #GTlsFileDatabase implementations.
20395 struct TlsFileDatabaseInterface {
20396 GObject2.TypeInterface g_iface;
20397 private void*[8] padding;
20401 // #GTlsInteraction provides a mechanism for the TLS connection and database
20402 // code to interact with the user. It can be used to ask the user for passwords.
20404 // To use a #GTlsInteraction with a TLS connection use
20405 // g_tls_connection_set_interaction().
20407 // Callers should instantiate a derived class that implements the various
20408 // interaction methods to show the required dialogs.
20410 // Callers should use the 'invoke' functions like
20411 // g_tls_interaction_invoke_ask_password() to run interaction methods. These
20412 // functions make sure that the interaction is invoked in the main loop
20413 // and not in the current thread, if the current thread is not running the
20414 // main loop.
20416 // Derived classes can choose to implement whichever interactions methods they'd
20417 // like to support by overriding those virtual methods in their class
20418 // initialization function. Any interactions not implemented will return
20419 // %G_TLS_INTERACTION_UNHANDLED. If a derived class implements an async method,
20420 // it must also implement the corresponding finish method.
20421 struct TlsInteraction /* : GObject.Object */ /* Version 2.30 */ {
20422 alias parent_instance this;
20423 alias parent_instance super_;
20424 alias parent_instance object;
20425 GObject2.Object parent_instance;
20426 private TlsInteractionPrivate* priv;
20429 // Run synchronous interaction to ask the user for a password. In general,
20430 // g_tls_interaction_invoke_ask_password() should be used instead of this
20431 // function.
20433 // Derived subclasses usually implement a password prompt, although they may
20434 // also choose to provide a password from elsewhere. The @password value will
20435 // be filled in and then @callback will be called. Alternatively the user may
20436 // abort this password request, which will usually abort the TLS connection.
20438 // If the interaction is cancelled by the cancellation object, or by the
20439 // user then %G_TLS_INTERACTION_FAILED will be returned with an error that
20440 // contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may
20441 // not support immediate cancellation.
20442 // RETURNS: The status of the ask password interaction.
20443 // <password>: a #GTlsPassword object
20444 // <cancellable>: an optional #GCancellable cancellation object
20445 TlsInteractionResult ask_password(TlsPassword* password, Cancellable* cancellable, GLib2.Error** error=null) {
20446 return g_tls_interaction_ask_password(&this, password, cancellable, error);
20449 // Run asynchronous interaction to ask the user for a password. In general,
20450 // g_tls_interaction_invoke_ask_password() should be used instead of this
20451 // function.
20453 // Derived subclasses usually implement a password prompt, although they may
20454 // also choose to provide a password from elsewhere. The @password value will
20455 // be filled in and then @callback will be called. Alternatively the user may
20456 // abort this password request, which will usually abort the TLS connection.
20458 // If the interaction is cancelled by the cancellation object, or by the
20459 // user then %G_TLS_INTERACTION_FAILED will be returned with an error that
20460 // contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may
20461 // not support immediate cancellation.
20463 // Certain implementations may not support immediate cancellation.
20464 // <password>: a #GTlsPassword object
20465 // <cancellable>: an optional #GCancellable cancellation object
20466 // <callback>: will be called when the interaction completes
20467 // <user_data>: data to pass to the @callback
20468 void ask_password_async(TlsPassword* password, Cancellable* cancellable=null, AsyncReadyCallback callback=null, void* user_data=null) {
20469 g_tls_interaction_ask_password_async(&this, password, cancellable, callback, user_data);
20472 // Complete an ask password user interaction request. This should be once
20473 // the g_tls_interaction_ask_password_async() completion callback is called.
20475 // If %G_TLS_INTERACTION_HANDLED is returned, then the #GTlsPassword passed
20476 // to g_tls_interaction_ask_password() will have its password filled in.
20478 // If the interaction is cancelled by the cancellation object, or by the
20479 // user then %G_TLS_INTERACTION_FAILED will be returned with an error that
20480 // contains a %G_IO_ERROR_CANCELLED error code.
20481 // RETURNS: The status of the ask password interaction.
20482 // <result>: the result passed to the callback
20483 TlsInteractionResult ask_password_finish(AsyncResult* result, GLib2.Error** error=null) {
20484 return g_tls_interaction_ask_password_finish(&this, result, error);
20487 // Invoke the interaction to ask the user for a password. It invokes this
20488 // interaction in the main loop, specifically the #GMainContext returned by
20489 // g_main_context_get_thread_default() when the interaction is created. This
20490 // is called by called by #GTlsConnection or #GTlsDatabase to ask the user
20491 // for a password.
20493 // Derived subclasses usually implement a password prompt, although they may
20494 // also choose to provide a password from elsewhere. The @password value will
20495 // be filled in and then @callback will be called. Alternatively the user may
20496 // abort this password request, which will usually abort the TLS connection.
20498 // The implementation can either be a synchronous (eg: modal dialog) or an
20499 // asynchronous one (eg: modeless dialog). This function will take care of
20500 // calling which ever one correctly.
20502 // If the interaction is cancelled by the cancellation object, or by the
20503 // user then %G_TLS_INTERACTION_FAILED will be returned with an error that
20504 // contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may
20505 // not support immediate cancellation.
20506 // RETURNS: The status of the ask password interaction.
20507 // <password>: a #GTlsPassword object
20508 // <cancellable>: an optional #GCancellable cancellation object
20509 TlsInteractionResult invoke_ask_password(TlsPassword* password, Cancellable* cancellable, GLib2.Error** error=null) {
20510 return g_tls_interaction_invoke_ask_password(&this, password, cancellable, error);
20515 // The class for #GTlsInteraction. Derived classes implement the various
20516 // virtual interaction methods to handle TLS interactions.
20518 // Derived classes can choose to implement whichever interactions methods they'd
20519 // like to support by overriding those virtual methods in their class
20520 // initialization function. If a derived class implements an async method,
20521 // it must also implement the corresponding finish method.
20523 // The synchronous interaction methods should implement to display modal dialogs,
20524 // and the asynchronous methods to display modeless dialogs.
20526 // If the user cancels an interaction, then the result should be
20527 // %G_TLS_INTERACTION_FAILED and the error should be set with a domain of
20528 // %G_IO_ERROR and code of %G_IO_ERROR_CANCELLED.
20529 struct TlsInteractionClass /* Version 2.30 */ {
20530 private GObject2.ObjectClass parent_class;
20532 // RETURNS: The status of the ask password interaction.
20533 // <password>: a #GTlsPassword object
20534 // <cancellable>: an optional #GCancellable cancellation object
20535 extern (C) TlsInteractionResult function (TlsInteraction* interaction, TlsPassword* password, Cancellable* cancellable, GLib2.Error** error=null) ask_password;
20537 // <password>: a #GTlsPassword object
20538 // <cancellable>: an optional #GCancellable cancellation object
20539 // <callback>: will be called when the interaction completes
20540 // <user_data>: data to pass to the @callback
20541 extern (C) void function (TlsInteraction* interaction, TlsPassword* password, Cancellable* cancellable=null, AsyncReadyCallback callback=null, void* user_data=null) ask_password_async;
20543 // RETURNS: The status of the ask password interaction.
20544 // <result>: the result passed to the callback
20545 extern (C) TlsInteractionResult function (TlsInteraction* interaction, AsyncResult* result, GLib2.Error** error=null) ask_password_finish;
20546 private void*[24] padding;
20549 struct TlsInteractionPrivate {
20553 // #GTlsInteractionResult is returned by various functions in #GTlsInteraction
20554 // when finishing an interaction request.
20555 enum TlsInteractionResult /* Version 2.30 */ {
20556 UNHANDLED = 0,
20557 HANDLED = 1,
20558 FAILED = 2
20560 // Holds a password used in TLS.
20561 struct TlsPassword /* : GObject.Object */ /* Version 2.30 */ {
20562 alias parent_instance this;
20563 alias parent_instance super_;
20564 alias parent_instance object;
20565 GObject2.Object parent_instance;
20566 TlsPasswordPrivate* priv;
20569 // Create a new #GTlsPassword object.
20570 // RETURNS: The newly allocated password object
20571 // <flags>: the password flags
20572 // <description>: description of what the password is for
20573 static TlsPassword* /*new*/ new_(TlsPasswordFlags flags, char* description) {
20574 return g_tls_password_new(flags, description);
20577 // Get a description string about what the password will be used for.
20578 // RETURNS: The description of the password.
20579 char* get_description() {
20580 return g_tls_password_get_description(&this);
20583 // Get flags about the password.
20584 // RETURNS: The flags about the password.
20585 TlsPasswordFlags get_flags() {
20586 return g_tls_password_get_flags(&this);
20589 // Get the password value. If @length is not %NULL then it will be filled
20590 // in with the length of the password value.
20591 // RETURNS: The password value owned by the password object.
20592 // <length>: location to place the length of the password.
20593 ubyte* get_value(size_t* length=null) {
20594 return g_tls_password_get_value(&this, length);
20597 // Get a user readable translated warning. Usually this warning is a
20598 // representation of the password flags returned from
20599 // g_tls_password_get_flags().
20600 // RETURNS: The warning.
20601 char* get_warning() {
20602 return g_tls_password_get_warning(&this);
20605 // Set a description string about what the password will be used for.
20606 // <description>: The description of the password
20607 void set_description(char* description) {
20608 g_tls_password_set_description(&this, description);
20611 // Set flags about the password.
20612 // <flags>: The flags about the password
20613 void set_flags(TlsPasswordFlags flags) {
20614 g_tls_password_set_flags(&this, flags);
20617 // Set the value for this password. The @value will be copied by the password
20618 // object.
20620 // Specify the @length, for a non-null-terminated password. Pass -1 as
20621 // @length if using a null-terminated password, and @length will be calculated
20622 // automatically.
20623 // <value>: the new password value
20624 // <length>: the length of the password, or -1
20625 void set_value(ubyte* value, ssize_t length) {
20626 g_tls_password_set_value(&this, value, length);
20629 // Provide the value for this password.
20631 // The @value will be owned by the password object, and later freed using
20632 // the @destroy function callback.
20634 // Specify the @length, for a non-null-terminated password. Pass -1 as
20635 // @length if using a null-terminated password, and @length will be calculated
20636 // automatically.
20637 // <value>: the value for the password
20638 // <length>: the length of the password, or -1
20639 // <destroy>: a function to use to free the password.
20640 void set_value_full(ubyte* value, ssize_t length, GLib2.DestroyNotify destroy=null) {
20641 g_tls_password_set_value_full(&this, value, length, destroy);
20644 // Set a user readable translated warning. Usually this warning is a
20645 // representation of the password flags returned from
20646 // g_tls_password_get_flags().
20647 // <warning>: The user readable warning
20648 void set_warning(char* warning) {
20649 g_tls_password_set_warning(&this, warning);
20653 struct TlsPasswordClass {
20654 GObject2.ObjectClass parent_class;
20656 // RETURNS: The password value owned by the password object.
20657 // <length>: location to place the length of the password.
20658 extern (C) ubyte* function (TlsPassword* password, size_t* length=null) get_value;
20659 extern (C) void function (TlsPassword* password, ubyte* value, ssize_t length, GLib2.DestroyNotify destroy) set_value;
20660 extern (C) char* function (TlsPassword* password) get_default_warning;
20661 private void*[4] padding;
20664 // Various flags for the password.
20665 enum TlsPasswordFlags /* Version 2.30 */ {
20666 NONE = 0,
20667 RETRY = 2,
20668 MANY_TRIES = 4,
20669 FINAL_TRY = 8
20671 struct TlsPasswordPrivate {
20675 // When to allow rehandshaking. See
20676 // g_tls_connection_set_rehandshake_mode().
20677 enum TlsRehandshakeMode /* Version 2.28 */ {
20678 NEVER = 0,
20679 SAFELY = 1,
20680 UNSAFELY = 2
20683 // #GTlsServerConnection is the server-side subclass of #GTlsConnection,
20684 // representing a server-side TLS connection.
20685 struct TlsServerConnection /* Version 2.28 */ {
20687 // Creates a new #GTlsServerConnection wrapping @base_io_stream (which
20688 // must have pollable input and output streams).
20689 // RETURNS: the new #GTlsServerConnection, or %NULL on error
20690 // <base_io_stream>: the #GIOStream to wrap
20691 // <certificate>: the default server certificate, or %NULL
20692 static IOStream* /*new*/ new_(IOStream* base_io_stream, TlsCertificate* certificate, GLib2.Error** error=null) {
20693 return g_tls_server_connection_new(base_io_stream, certificate, error);
20697 struct TlsServerConnectionInterface {
20698 GObject2.TypeInterface g_iface;
20702 // This is the subclass of #GSocketConnection that is created
20703 // for UNIX domain sockets.
20705 // It contains functions to do some of the UNIX socket specific
20706 // functionality like passing file descriptors.
20708 // Note that <filename>&lt;gio/gunixconnection.h&gt;</filename> belongs to
20709 // the UNIX-specific GIO interfaces, thus you have to use the
20710 // <filename>gio-unix-2.0.pc</filename> pkg-config file when using it.
20711 struct UnixConnection /* : SocketConnection */ {
20712 alias parent_instance this;
20713 alias parent_instance super_;
20714 alias parent_instance socketconnection;
20715 SocketConnection parent_instance;
20716 UnixConnectionPrivate* priv;
20719 // Receives credentials from the sending end of the connection. The
20720 // sending end has to call g_unix_connection_send_credentials() (or
20721 // similar) for this to work.
20723 // As well as reading the credentials this also reads (and discards) a
20724 // single byte from the stream, as this is required for credentials
20725 // passing to work on some implementations.
20727 // Other ways to exchange credentials with a foreign peer includes the
20728 // #GUnixCredentialsMessage type and g_socket_get_credentials() function.
20730 // g_object_unref()), %NULL if @error is set.
20731 // RETURNS: Received credentials on success (free with
20732 // <cancellable>: A #GCancellable or %NULL.
20733 Credentials* /*new*/ receive_credentials(Cancellable* cancellable, GLib2.Error** error=null) {
20734 return g_unix_connection_receive_credentials(&this, cancellable, error);
20737 // Receives a file descriptor from the sending end of the connection.
20738 // The sending end has to call g_unix_connection_send_fd() for this
20739 // to work.
20741 // As well as reading the fd this also reads a single byte from the
20742 // stream, as this is required for fd passing to work on some
20743 // implementations.
20744 // RETURNS: a file descriptor on success, -1 on error.
20745 // <cancellable>: optional #GCancellable object, %NULL to ignore
20746 int receive_fd(Cancellable* cancellable, GLib2.Error** error=null) {
20747 return g_unix_connection_receive_fd(&this, cancellable, error);
20750 // Passes the credentials of the current user the receiving side
20751 // of the connection. The receiving end has to call
20752 // g_unix_connection_receive_credentials() (or similar) to accept the
20753 // credentials.
20755 // As well as sending the credentials this also writes a single NUL
20756 // byte to the stream, as this is required for credentials passing to
20757 // work on some implementations.
20759 // Other ways to exchange credentials with a foreign peer includes the
20760 // #GUnixCredentialsMessage type and g_socket_get_credentials() function.
20761 // RETURNS: %TRUE on success, %FALSE if @error is set.
20762 // <cancellable>: A #GCancellable or %NULL.
20763 int send_credentials(Cancellable* cancellable, GLib2.Error** error=null) {
20764 return g_unix_connection_send_credentials(&this, cancellable, error);
20767 // Passes a file descriptor to the receiving side of the
20768 // connection. The receiving end has to call g_unix_connection_receive_fd()
20769 // to accept the file descriptor.
20771 // As well as sending the fd this also writes a single byte to the
20772 // stream, as this is required for fd passing to work on some
20773 // implementations.
20774 // RETURNS: a %TRUE on success, %NULL on error.
20775 // <fd>: a file descriptor
20776 // <cancellable>: optional #GCancellable object, %NULL to ignore.
20777 int send_fd(int fd, Cancellable* cancellable, GLib2.Error** error=null) {
20778 return g_unix_connection_send_fd(&this, fd, cancellable, error);
20782 struct UnixConnectionClass {
20783 SocketConnectionClass parent_class;
20786 struct UnixConnectionPrivate {
20790 // This #GSocketControlMessage contains a #GCredentials instance. It
20791 // may be sent using g_socket_send_message() and received using
20792 // g_socket_receive_message() over UNIX sockets (ie: sockets in the
20793 // %G_SOCKET_FAMILY_UNIX family).
20795 // For an easier way to send and receive credentials over
20796 // stream-oriented UNIX sockets, see
20797 // g_unix_connection_send_credentials() and
20798 // g_unix_connection_receive_credentials(). To receive credentials of
20799 // a foreign process connected to a socket, use
20800 // g_socket_get_credentials().
20801 struct UnixCredentialsMessage /* : SocketControlMessage */ /* Version 2.26 */ {
20802 alias parent_instance this;
20803 alias parent_instance super_;
20804 alias parent_instance socketcontrolmessage;
20805 SocketControlMessage parent_instance;
20806 UnixCredentialsMessagePrivate* priv;
20809 // Creates a new #GUnixCredentialsMessage with credentials matching the current processes.
20810 // RETURNS: a new #GUnixCredentialsMessage
20811 static UnixCredentialsMessage* /*new*/ new_() {
20812 return g_unix_credentials_message_new();
20815 // Creates a new #GUnixCredentialsMessage holding @credentials.
20816 // RETURNS: a new #GUnixCredentialsMessage
20817 // <credentials>: A #GCredentials object.
20818 static UnixCredentialsMessage* /*new*/ new_with_credentials(Credentials* credentials) {
20819 return g_unix_credentials_message_new_with_credentials(credentials);
20822 // Checks if passing #GCredentials on a #GSocket is supported on this platform.
20823 // RETURNS: %TRUE if supported, %FALSE otherwise
20824 static int is_supported() {
20825 return g_unix_credentials_message_is_supported();
20828 // Gets the credentials stored in @message.
20829 // RETURNS: A #GCredentials instance. Do not free, it is owned by @message.
20830 Credentials* get_credentials() {
20831 return g_unix_credentials_message_get_credentials(&this);
20835 // Class structure for #GUnixCredentialsMessage.
20836 struct UnixCredentialsMessageClass /* Version 2.26 */ {
20837 SocketControlMessageClass parent_class;
20838 extern (C) void function () _g_reserved1;
20839 extern (C) void function () _g_reserved2;
20842 struct UnixCredentialsMessagePrivate {
20846 // A #GUnixFDList contains a list of file descriptors. It owns the file
20847 // descriptors that it contains, closing them when finalized.
20849 // It may be wrapped in a #GUnixFDMessage and sent over a #GSocket in
20850 // the %G_SOCKET_ADDRESS_UNIX family by using g_socket_send_message()
20851 // and received using g_socket_receive_message().
20853 // Note that <filename>&lt;gio/gunixfdlist.h&gt;</filename> belongs to
20854 // the UNIX-specific GIO interfaces, thus you have to use the
20855 // <filename>gio-unix-2.0.pc</filename> pkg-config file when using it.
20856 struct UnixFDList /* : GObject.Object */ {
20857 alias parent_instance this;
20858 alias parent_instance super_;
20859 alias parent_instance object;
20860 GObject2.Object parent_instance;
20861 UnixFDListPrivate* priv;
20864 // Creates a new #GUnixFDList containing no file descriptors.
20865 // RETURNS: a new #GUnixFDList
20866 static UnixFDList* /*new*/ new_() {
20867 return g_unix_fd_list_new();
20870 // Creates a new #GUnixFDList containing the file descriptors given in
20871 // @fds. The file descriptors become the property of the new list and
20872 // may no longer be used by the caller. The array itself is owned by
20873 // the caller.
20875 // Each file descriptor in the array should be set to close-on-exec.
20877 // If @n_fds is -1 then @fds must be terminated with -1.
20878 // RETURNS: a new #GUnixFDList
20879 // <fds>: the initial list of file descriptors
20880 // <n_fds>: the length of #fds, or -1
20881 static UnixFDList* /*new*/ new_from_array(int* fds, int n_fds) {
20882 return g_unix_fd_list_new_from_array(fds, n_fds);
20885 // Adds a file descriptor to @list.
20887 // The file descriptor is duplicated using dup(). You keep your copy
20888 // of the descriptor and the copy contained in @list will be closed
20889 // when @list is finalized.
20891 // A possible cause of failure is exceeding the per-process or
20892 // system-wide file descriptor limit.
20894 // The index of the file descriptor in the list is returned. If you use
20895 // this index with g_unix_fd_list_get() then you will receive back a
20896 // duplicated copy of the same file descriptor.
20898 // (and @error is set)
20899 // RETURNS: the index of the appended fd in case of success, else -1
20900 // <fd>: a valid open file descriptor
20901 int append(int fd, GLib2.Error** error=null) {
20902 return g_unix_fd_list_append(&this, fd, error);
20905 // Gets a file descriptor out of @list.
20907 // @index_ specifies the index of the file descriptor to get. It is a
20908 // programmer error for @index_ to be out of range; see
20909 // g_unix_fd_list_get_length().
20911 // The file descriptor is duplicated using dup() and set as
20912 // close-on-exec before being returned. You must call close() on it
20913 // when you are done.
20915 // A possible cause of failure is exceeding the per-process or
20916 // system-wide file descriptor limit.
20917 // RETURNS: the file descriptor, or -1 in case of error
20918 // <index_>: the index into the list
20919 int get(int index_, GLib2.Error** error=null) {
20920 return g_unix_fd_list_get(&this, index_, error);
20923 // Gets the length of @list (ie: the number of file descriptors
20924 // contained within).
20925 // RETURNS: the length of @list
20926 int get_length() {
20927 return g_unix_fd_list_get_length(&this);
20930 // Returns the array of file descriptors that is contained in this
20931 // object.
20933 // After this call, the descriptors remain the property of @list. The
20934 // caller must not close them and must not free the array. The array is
20935 // valid only until @list is changed in any way.
20937 // If @length is non-%NULL then it is set to the number of file
20938 // descriptors in the returned array. The returned array is also
20939 // terminated with -1.
20941 // This function never returns %NULL. In case there are no file
20942 // descriptors contained in @list, an empty array is returned.
20944 // descriptors
20945 // RETURNS: an array of file
20946 // <length>: pointer to the length of the returned array, or %NULL
20947 int* peek_fds(/*out*/ int* length=null) {
20948 return g_unix_fd_list_peek_fds(&this, length);
20951 // Returns the array of file descriptors that is contained in this
20952 // object.
20954 // After this call, the descriptors are no longer contained in
20955 // @list. Further calls will return an empty list (unless more
20956 // descriptors have been added).
20958 // The return result of this function must be freed with g_free().
20959 // The caller is also responsible for closing all of the file
20960 // descriptors. The file descriptors in the array are set to
20961 // close-on-exec.
20963 // If @length is non-%NULL then it is set to the number of file
20964 // descriptors in the returned array. The returned array is also
20965 // terminated with -1.
20967 // This function never returns %NULL. In case there are no file
20968 // descriptors contained in @list, an empty array is returned.
20970 // descriptors
20971 // RETURNS: an array of file
20972 // <length>: pointer to the length of the returned array, or %NULL
20973 int* /*new*/ steal_fds(/*out*/ int* length=null) {
20974 return g_unix_fd_list_steal_fds(&this, length);
20978 struct UnixFDListClass {
20979 GObject2.ObjectClass parent_class;
20980 extern (C) void function () _g_reserved1;
20981 extern (C) void function () _g_reserved2;
20982 extern (C) void function () _g_reserved3;
20983 extern (C) void function () _g_reserved4;
20984 extern (C) void function () _g_reserved5;
20987 struct UnixFDListPrivate {
20991 // This #GSocketControlMessage contains a #GUnixFDList.
20992 // It may be sent using g_socket_send_message() and received using
20993 // g_socket_receive_message() over UNIX sockets (ie: sockets in the
20994 // %G_SOCKET_ADDRESS_UNIX family). The file descriptors are copied
20995 // between processes by the kernel.
20997 // For an easier way to send and receive file descriptors over
20998 // stream-oriented UNIX sockets, see g_unix_connection_send_fd() and
20999 // g_unix_connection_receive_fd().
21001 // Note that <filename>&lt;gio/gunixfdmessage.h&gt;</filename> belongs to
21002 // the UNIX-specific GIO interfaces, thus you have to use the
21003 // <filename>gio-unix-2.0.pc</filename> pkg-config file when using it.
21004 struct UnixFDMessage /* : SocketControlMessage */ {
21005 alias parent_instance this;
21006 alias parent_instance super_;
21007 alias parent_instance socketcontrolmessage;
21008 SocketControlMessage parent_instance;
21009 UnixFDMessagePrivate* priv;
21012 // Creates a new #GUnixFDMessage containing an empty file descriptor
21013 // list.
21014 // RETURNS: a new #GUnixFDMessage
21015 static UnixFDMessage* /*new*/ new_() {
21016 return g_unix_fd_message_new();
21019 // Creates a new #GUnixFDMessage containing @list.
21020 // RETURNS: a new #GUnixFDMessage
21021 // <fd_list>: a #GUnixFDList
21022 static UnixFDMessage* /*new*/ new_with_fd_list(UnixFDList* fd_list) {
21023 return g_unix_fd_message_new_with_fd_list(fd_list);
21026 // Adds a file descriptor to @message.
21028 // The file descriptor is duplicated using dup(). You keep your copy
21029 // of the descriptor and the copy contained in @message will be closed
21030 // when @message is finalized.
21032 // A possible cause of failure is exceeding the per-process or
21033 // system-wide file descriptor limit.
21034 // RETURNS: %TRUE in case of success, else %FALSE (and @error is set)
21035 // <fd>: a valid open file descriptor
21036 int append_fd(int fd, GLib2.Error** error=null) {
21037 return g_unix_fd_message_append_fd(&this, fd, error);
21040 // Gets the #GUnixFDList contained in @message. This function does not
21041 // return a reference to the caller, but the returned list is valid for
21042 // the lifetime of @message.
21043 // RETURNS: the #GUnixFDList from @message
21044 UnixFDList* get_fd_list() {
21045 return g_unix_fd_message_get_fd_list(&this);
21048 // Returns the array of file descriptors that is contained in this
21049 // object.
21051 // After this call, the descriptors are no longer contained in
21052 // @message. Further calls will return an empty list (unless more
21053 // descriptors have been added).
21055 // The return result of this function must be freed with g_free().
21056 // The caller is also responsible for closing all of the file
21057 // descriptors.
21059 // If @length is non-%NULL then it is set to the number of file
21060 // descriptors in the returned array. The returned array is also
21061 // terminated with -1.
21063 // This function never returns %NULL. In case there are no file
21064 // descriptors contained in @message, an empty array is returned.
21066 // descriptors
21067 // RETURNS: an array of file
21068 // <length>: pointer to the length of the returned array, or %NULL
21069 int* /*new*/ steal_fds(/*out*/ int* length=null) {
21070 return g_unix_fd_message_steal_fds(&this, length);
21074 struct UnixFDMessageClass {
21075 SocketControlMessageClass parent_class;
21076 extern (C) void function () _g_reserved1;
21077 extern (C) void function () _g_reserved2;
21080 struct UnixFDMessagePrivate {
21084 // #GUnixInputStream implements #GInputStream for reading from a
21085 // UNIX file descriptor, including asynchronous operations. The file
21086 // descriptor must be selectable, so it doesn't work with opened files.
21088 // Note that <filename>&lt;gio/gunixinputstream.h&gt;</filename> belongs
21089 // to the UNIX-specific GIO interfaces, thus you have to use the
21090 // <filename>gio-unix-2.0.pc</filename> pkg-config file when using it.
21091 struct UnixInputStream /* : InputStream */ {
21092 alias parent_instance this;
21093 alias parent_instance super_;
21094 alias parent_instance inputstream;
21095 InputStream parent_instance;
21096 private UnixInputStreamPrivate* priv;
21099 // Creates a new #GUnixInputStream for the given @fd.
21101 // If @close_fd is %TRUE, the file descriptor will be closed
21102 // when the stream is closed.
21103 // RETURNS: a new #GUnixInputStream
21104 // <fd>: a UNIX file descriptor
21105 // <close_fd>: %TRUE to close the file descriptor when done
21106 static UnixInputStream* /*new*/ new_(int fd, int close_fd) {
21107 return g_unix_input_stream_new(fd, close_fd);
21110 // Returns whether the file descriptor of @stream will be
21111 // closed when the stream is closed.
21112 // RETURNS: %TRUE if the file descriptor is closed when done
21113 int get_close_fd() {
21114 return g_unix_input_stream_get_close_fd(&this);
21117 // Return the UNIX file descriptor that the stream reads from.
21118 // RETURNS: The file descriptor of @stream
21119 int get_fd() {
21120 return g_unix_input_stream_get_fd(&this);
21123 // Sets whether the file descriptor of @stream shall be closed
21124 // when the stream is closed.
21125 // <close_fd>: %TRUE to close the file descriptor when done
21126 void set_close_fd(int close_fd) {
21127 g_unix_input_stream_set_close_fd(&this, close_fd);
21131 struct UnixInputStreamClass {
21132 InputStreamClass parent_class;
21133 extern (C) void function () _g_reserved1;
21134 extern (C) void function () _g_reserved2;
21135 extern (C) void function () _g_reserved3;
21136 extern (C) void function () _g_reserved4;
21137 extern (C) void function () _g_reserved5;
21140 struct UnixInputStreamPrivate {
21144 // Defines a Unix mount entry (e.g. <filename>/media/cdrom</filename>).
21145 // This corresponds roughly to a mtab entry.
21146 struct UnixMountEntry {
21149 // Watches #GUnixMount<!-- -->s for changes.
21150 struct UnixMountMonitor /* : GObject.Object */ {
21151 alias method_parent this;
21152 alias method_parent super_;
21153 alias method_parent object;
21154 GObject2.Object method_parent;
21157 // Gets a new #GUnixMountMonitor. The default rate limit for which the
21158 // monitor will report consecutive changes for the mount and mount
21159 // point entry files is the default for a #GFileMonitor. Use
21160 // g_unix_mount_monitor_set_rate_limit() to change this.
21161 // RETURNS: a #GUnixMountMonitor.
21162 static UnixMountMonitor* /*new*/ new_() {
21163 return g_unix_mount_monitor_new();
21166 // Sets the rate limit to which the @mount_monitor will report
21167 // consecutive change events to the mount and mount point entry files.
21168 // <limit_msec>: a integer with the limit in milliseconds to poll for changes.
21169 void set_rate_limit(int limit_msec) {
21170 g_unix_mount_monitor_set_rate_limit(&this, limit_msec);
21172 // Emitted when the unix mount points have changed.
21173 extern (C) alias static void function (UnixMountMonitor* this_, void* user_data=null) signal_mountpoints_changed;
21175 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
21176 return super_.signal_connect!name(cb, data, cf);
21179 ulong signal_connect(string name:"mountpoints-changed", CB:signal_mountpoints_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
21180 return signal_connect_data(&this, cast(char*)"mountpoints-changed",
21181 cast(GObject2.Callback)cb, data, null, cf);
21183 // Emitted when the unix mounts have changed.
21184 extern (C) alias static void function (UnixMountMonitor* this_, void* user_data=null) signal_mounts_changed;
21185 ulong signal_connect(string name:"mounts-changed", CB:signal_mounts_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
21186 return signal_connect_data(&this, cast(char*)"mounts-changed",
21187 cast(GObject2.Callback)cb, data, null, cf);
21191 struct UnixMountMonitorClass {
21195 // Defines a Unix mount point (e.g. <filename>/dev</filename>).
21196 // This corresponds roughly to a fstab entry.
21197 struct UnixMountPoint {
21199 // Compares two unix mount points.
21201 // or less than @mount2, respectively.
21202 // RETURNS: 1, 0 or -1 if @mount1 is greater than, equal to,
21203 // <mount2>: a #GUnixMount.
21204 int compare(UnixMountPoint* mount2) {
21205 return g_unix_mount_point_compare(&this, mount2);
21207 // Frees a unix mount point.
21208 void free() {
21209 g_unix_mount_point_free(&this);
21212 // Gets the device path for a unix mount point.
21213 // RETURNS: a string containing the device path.
21214 char* get_device_path() {
21215 return g_unix_mount_point_get_device_path(&this);
21218 // Gets the file system type for the mount point.
21219 // RETURNS: a string containing the file system type.
21220 char* get_fs_type() {
21221 return g_unix_mount_point_get_fs_type(&this);
21224 // Gets the mount path for a unix mount point.
21225 // RETURNS: a string containing the mount path.
21226 char* get_mount_path() {
21227 return g_unix_mount_point_get_mount_path(&this);
21230 // Guesses whether a Unix mount point can be ejected.
21231 // RETURNS: %TRUE if @mount_point is deemed to be ejectable.
21232 int guess_can_eject() {
21233 return g_unix_mount_point_guess_can_eject(&this);
21236 // Guesses the icon of a Unix mount point.
21237 // RETURNS: a #GIcon
21238 Icon* /*new*/ guess_icon() {
21239 return g_unix_mount_point_guess_icon(&this);
21242 // Guesses the name of a Unix mount point.
21243 // The result is a translated string.
21245 // be freed with g_free()
21246 // RETURNS: A newly allocated string that must
21247 char* /*new*/ guess_name() {
21248 return g_unix_mount_point_guess_name(&this);
21251 // Checks if a unix mount point is a loopback device.
21252 // RETURNS: %TRUE if the mount point is a loopback. %FALSE otherwise.
21253 int is_loopback() {
21254 return g_unix_mount_point_is_loopback(&this);
21257 // Checks if a unix mount point is read only.
21258 // RETURNS: %TRUE if a mount point is read only.
21259 int is_readonly() {
21260 return g_unix_mount_point_is_readonly(&this);
21263 // Checks if a unix mount point is mountable by the user.
21264 // RETURNS: %TRUE if the mount point is user mountable.
21265 int is_user_mountable() {
21266 return g_unix_mount_point_is_user_mountable(&this);
21271 // #GUnixOutputStream implements #GOutputStream for writing to a
21272 // UNIX file descriptor, including asynchronous operations. The file
21273 // descriptor must be selectable, so it doesn't work with opened files.
21275 // Note that <filename>&lt;gio/gunixoutputstream.h&gt;</filename> belongs
21276 // to the UNIX-specific GIO interfaces, thus you have to use the
21277 // <filename>gio-unix-2.0.pc</filename> pkg-config file when using it.
21278 struct UnixOutputStream /* : OutputStream */ {
21279 alias parent_instance this;
21280 alias parent_instance super_;
21281 alias parent_instance outputstream;
21282 OutputStream parent_instance;
21283 private UnixOutputStreamPrivate* priv;
21286 // Creates a new #GUnixOutputStream for the given @fd.
21288 // If @close_fd, is %TRUE, the file descriptor will be closed when
21289 // the output stream is destroyed.
21290 // RETURNS: a new #GOutputStream
21291 // <fd>: a UNIX file descriptor
21292 // <close_fd>: %TRUE to close the file descriptor when done
21293 static UnixOutputStream* /*new*/ new_(int fd, int close_fd) {
21294 return g_unix_output_stream_new(fd, close_fd);
21297 // Returns whether the file descriptor of @stream will be
21298 // closed when the stream is closed.
21299 // RETURNS: %TRUE if the file descriptor is closed when done
21300 int get_close_fd() {
21301 return g_unix_output_stream_get_close_fd(&this);
21304 // Return the UNIX file descriptor that the stream writes to.
21305 // RETURNS: The file descriptor of @stream
21306 int get_fd() {
21307 return g_unix_output_stream_get_fd(&this);
21310 // Sets whether the file descriptor of @stream shall be closed
21311 // when the stream is closed.
21312 // <close_fd>: %TRUE to close the file descriptor when done
21313 void set_close_fd(int close_fd) {
21314 g_unix_output_stream_set_close_fd(&this, close_fd);
21318 struct UnixOutputStreamClass {
21319 OutputStreamClass parent_class;
21320 extern (C) void function () _g_reserved1;
21321 extern (C) void function () _g_reserved2;
21322 extern (C) void function () _g_reserved3;
21323 extern (C) void function () _g_reserved4;
21324 extern (C) void function () _g_reserved5;
21327 struct UnixOutputStreamPrivate {
21331 // Support for UNIX-domain (also known as local) sockets.
21333 // UNIX domain sockets are generally visible in the filesystem.
21334 // However, some systems support abstract socket names which are not
21335 // visible in the filesystem and not affected by the filesystem
21336 // permissions, visibility, etc. Currently this is only supported
21337 // under Linux. If you attempt to use abstract sockets on other
21338 // systems, function calls may return %G_IO_ERROR_NOT_SUPPORTED
21339 // errors. You can use g_unix_socket_address_abstract_names_supported()
21340 // to see if abstract names are supported.
21342 // Note that <filename>&lt;gio/gunixsocketaddress.h&gt;</filename> belongs to
21343 // the UNIX-specific GIO interfaces, thus you have to use the
21344 // <filename>gio-unix-2.0.pc</filename> pkg-config file when using it.
21345 struct UnixSocketAddress /* : SocketAddress */ {
21346 alias parent_instance this;
21347 alias parent_instance super_;
21348 alias parent_instance socketaddress;
21349 SocketAddress parent_instance;
21350 private UnixSocketAddressPrivate* priv;
21353 // Creates a new #GUnixSocketAddress for @path.
21355 // To create abstract socket addresses, on systems that support that,
21356 // use g_unix_socket_address_new_abstract().
21357 // RETURNS: a new #GUnixSocketAddress
21358 // <path>: the socket path
21359 static UnixSocketAddress* /*new*/ new_(char* path) {
21360 return g_unix_socket_address_new(path);
21363 // Creates a new %G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED
21364 // #GUnixSocketAddress for @path.
21365 // RETURNS: a new #GUnixSocketAddress
21366 // <path>: the abstract name
21367 // <path_len>: the length of @path, or -1
21368 static UnixSocketAddress* /*new*/ new_abstract(char* path, int path_len) {
21369 return g_unix_socket_address_new_abstract(path, path_len);
21372 // Creates a new #GUnixSocketAddress of type @type with name @path.
21374 // If @type is %G_UNIX_SOCKET_ADDRESS_PATH, this is equivalent to
21375 // calling g_unix_socket_address_new().
21377 // If @path_type is %G_UNIX_SOCKET_ADDRESS_ABSTRACT, then @path_len
21378 // bytes of @path will be copied to the socket's path, and only those
21379 // bytes will be considered part of the name. (If @path_len is -1,
21380 // then @path is assumed to be NUL-terminated.) For example, if @path
21381 // was "test", then calling g_socket_address_get_native_size() on the
21382 // returned socket would return 7 (2 bytes of overhead, 1 byte for the
21383 // abstract-socket indicator byte, and 4 bytes for the name "test").
21385 // If @path_type is %G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED, then
21386 // @path_len bytes of @path will be copied to the socket's path, the
21387 // rest of the path will be padded with 0 bytes, and the entire
21388 // zero-padded buffer will be considered the name. (As above, if
21389 // @path_len is -1, then @path is assumed to be NUL-terminated.) In
21390 // this case, g_socket_address_get_native_size() will always return
21391 // the full size of a <literal>struct sockaddr_un</literal>, although
21392 // g_unix_socket_address_get_path_len() will still return just the
21393 // length of @path.
21395 // %G_UNIX_SOCKET_ADDRESS_ABSTRACT is preferred over
21396 // %G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED for new programs. Of course,
21397 // when connecting to a server created by another process, you must
21398 // use the appropriate type corresponding to how that process created
21399 // its listening socket.
21400 // RETURNS: a new #GUnixSocketAddress
21401 // <path>: the name
21402 // <path_len>: the length of @path, or -1
21403 // <type>: a #GUnixSocketAddressType
21404 static UnixSocketAddress* /*new*/ new_with_type(char* path, int path_len, UnixSocketAddressType type) {
21405 return g_unix_socket_address_new_with_type(path, path_len, type);
21408 // Checks if abstract unix domain socket names are supported.
21409 // RETURNS: %TRUE if supported, %FALSE otherwise
21410 static int abstract_names_supported() {
21411 return g_unix_socket_address_abstract_names_supported();
21414 // Gets @address's type.
21415 // RETURNS: a #GUnixSocketAddressType
21416 UnixSocketAddressType get_address_type() {
21417 return g_unix_socket_address_get_address_type(&this);
21420 // Tests if @address is abstract.
21421 // RETURNS: %TRUE if the address is abstract, %FALSE otherwise
21422 int get_is_abstract() {
21423 return g_unix_socket_address_get_is_abstract(&this);
21426 // Gets @address's path, or for abstract sockets the "name".
21428 // Guaranteed to be zero-terminated, but an abstract socket
21429 // may contain embedded zeros, and thus you should use
21430 // g_unix_socket_address_get_path_len() to get the true length
21431 // of this string.
21432 // RETURNS: the path for @address
21433 char* get_path() {
21434 return g_unix_socket_address_get_path(&this);
21437 // Gets the length of @address's path.
21439 // For details, see g_unix_socket_address_get_path().
21440 // RETURNS: the length of the path
21441 size_t get_path_len() {
21442 return g_unix_socket_address_get_path_len(&this);
21446 struct UnixSocketAddressClass {
21447 SocketAddressClass parent_class;
21450 struct UnixSocketAddressPrivate {
21454 // The type of name used by a #GUnixSocketAddress.
21455 // %G_UNIX_SOCKET_ADDRESS_PATH indicates a traditional unix domain
21456 // socket bound to a filesystem path. %G_UNIX_SOCKET_ADDRESS_ANONYMOUS
21457 // indicates a socket not bound to any name (eg, a client-side socket,
21458 // or a socket created with socketpair()).
21460 // For abstract sockets, there are two incompatible ways of naming
21461 // them; the man pages suggest using the entire <literal>struct
21462 // sockaddr_un</literal> as the name, padding the unused parts of the
21463 // %sun_path field with zeroes; this corresponds to
21464 // %G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED. However, many programs
21465 // instead just use a portion of %sun_path, and pass an appropriate
21466 // smaller length to bind() or connect(). This is
21467 // %G_UNIX_SOCKET_ADDRESS_ABSTRACT.
21468 enum UnixSocketAddressType /* Version 2.26 */ {
21469 INVALID = 0,
21470 ANONYMOUS = 1,
21471 PATH = 2,
21472 ABSTRACT = 3,
21473 ABSTRACT_PADDED = 4
21475 enum VFS_EXTENSION_POINT_NAME = "gio-vfs";
21476 enum VOLUME_IDENTIFIER_KIND_HAL_UDI = "hal-udi";
21477 enum VOLUME_IDENTIFIER_KIND_LABEL = "label";
21478 enum VOLUME_IDENTIFIER_KIND_NFS_MOUNT = "nfs-mount";
21479 enum VOLUME_IDENTIFIER_KIND_UNIX_DEVICE = "unix-device";
21480 enum VOLUME_IDENTIFIER_KIND_UUID = "uuid";
21481 enum VOLUME_MONITOR_EXTENSION_POINT_NAME = "gio-volume-monitor";
21482 // Entry point for using GIO functionality.
21483 struct Vfs /* : GObject.Object */ {
21484 alias parent_instance this;
21485 alias parent_instance super_;
21486 alias parent_instance object;
21487 GObject2.Object parent_instance;
21490 // Gets the default #GVfs for the system.
21491 // RETURNS: a #GVfs.
21492 static Vfs* get_default() {
21493 return g_vfs_get_default();
21496 // Gets the local #GVfs for the system.
21497 // RETURNS: a #GVfs.
21498 static Vfs* get_local() {
21499 return g_vfs_get_local();
21502 // Gets a #GFile for @path.
21504 // Free the returned object with g_object_unref().
21505 // RETURNS: a #GFile.
21506 // <path>: a string containing a VFS path.
21507 File* /*new*/ get_file_for_path(char* path) {
21508 return g_vfs_get_file_for_path(&this, path);
21511 // Gets a #GFile for @uri.
21513 // This operation never fails, but the returned object
21514 // might not support any I/O operation if the URI
21515 // is malformed or if the URI scheme is not supported.
21517 // Free the returned object with g_object_unref().
21518 // RETURNS: a #GFile.
21519 // <uri>: a string containing a URI
21520 File* /*new*/ get_file_for_uri(char* uri) {
21521 return g_vfs_get_file_for_uri(&this, uri);
21524 // Gets a list of URI schemes supported by @vfs.
21526 // The returned array belongs to GIO and must
21527 // not be freed or modified.
21528 // RETURNS: a %NULL-terminated array of strings.
21529 char** get_supported_uri_schemes() {
21530 return g_vfs_get_supported_uri_schemes(&this);
21533 // Checks if the VFS is active.
21534 // RETURNS: %TRUE if construction of the @vfs was successful and it is now active.
21535 int is_active() {
21536 return g_vfs_is_active(&this);
21539 // This operation never fails, but the returned object might
21540 // not support any I/O operations if the @parse_name cannot
21541 // be parsed by the #GVfs module.
21543 // Free the returned object with g_object_unref().
21544 // RETURNS: a #GFile for the given @parse_name.
21545 // <parse_name>: a string to be parsed by the VFS module.
21546 File* /*new*/ parse_name(char* parse_name) {
21547 return g_vfs_parse_name(&this, parse_name);
21551 struct VfsClass {
21552 GObject2.ObjectClass parent_class;
21553 // RETURNS: %TRUE if construction of the @vfs was successful and it is now active.
21554 extern (C) int function (Vfs* vfs) is_active;
21556 // RETURNS: a #GFile.
21557 // <path>: a string containing a VFS path.
21558 extern (C) File* /*new*/ function (Vfs* vfs, char* path) get_file_for_path;
21560 // RETURNS: a #GFile.
21561 // <uri>: a string containing a URI
21562 extern (C) File* /*new*/ function (Vfs* vfs, char* uri) get_file_for_uri;
21563 // RETURNS: a %NULL-terminated array of strings.
21564 extern (C) char** function (Vfs* vfs) get_supported_uri_schemes;
21566 // RETURNS: a #GFile for the given @parse_name.
21567 // <parse_name>: a string to be parsed by the VFS module.
21568 extern (C) File* /*new*/ function (Vfs* vfs, char* parse_name) parse_name;
21569 extern (C) void function (Vfs* vfs, char* filename, ulong device, FileAttributeMatcher* attribute_matcher, FileInfo* info, Cancellable* cancellable, void** extra_data, GLib2.DestroyNotify* free_extra_data) local_file_add_info;
21570 extern (C) void function (Vfs* vfs, FileAttributeInfoList* list) add_writable_namespaces;
21571 extern (C) int function (Vfs* vfs, char* filename, FileInfo* info, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error=null) local_file_set_attributes;
21572 extern (C) void function (Vfs* vfs, char* filename) local_file_removed;
21573 extern (C) void function (Vfs* vfs, char* source, char* dest) local_file_moved;
21574 extern (C) void function () _g_reserved1;
21575 extern (C) void function () _g_reserved2;
21576 extern (C) void function () _g_reserved3;
21577 extern (C) void function () _g_reserved4;
21578 extern (C) void function () _g_reserved5;
21579 extern (C) void function () _g_reserved6;
21580 extern (C) void function () _g_reserved7;
21584 // The #GVolume interface represents user-visible objects that can be
21585 // mounted. Note, when porting from GnomeVFS, #GVolume is the moral
21586 // equivalent of #GnomeVFSDrive.
21588 // Mounting a #GVolume instance is an asynchronous operation. For more
21589 // information about asynchronous operations, see #GAsyncReady and
21590 // #GSimpleAsyncReady. To mount a #GVolume, first call
21591 // g_volume_mount() with (at least) the #GVolume instance, optionally
21592 // a #GMountOperation object and a #GAsyncReadyCallback.
21594 // Typically, one will only want to pass %NULL for the
21595 // #GMountOperation if automounting all volumes when a desktop session
21596 // starts since it's not desirable to put up a lot of dialogs asking
21597 // for credentials.
21599 // The callback will be fired when the operation has resolved (either
21600 // with success or failure), and a #GAsyncReady structure will be
21601 // passed to the callback. That callback should then call
21602 // g_volume_mount_finish() with the #GVolume instance and the
21603 // #GAsyncReady data to see if the operation was completed
21604 // successfully. If an @error is present when g_volume_mount_finish()
21605 // is called, then it will be filled with any error information.
21607 // <para id="volume-identifier">
21608 // It is sometimes necessary to directly access the underlying
21609 // operating system object behind a volume (e.g. for passing a volume
21610 // to an application via the commandline). For this purpose, GIO
21611 // allows to obtain an 'identifier' for the volume. There can be
21612 // different kinds of identifiers, such as Hal UDIs, filesystem labels,
21613 // traditional Unix devices (e.g. <filename>/dev/sda2</filename>),
21614 // uuids. GIO uses predefind strings as names for the different kinds
21615 // of identifiers: #G_VOLUME_IDENTIFIER_KIND_HAL_UDI,
21616 // #G_VOLUME_IDENTIFIER_KIND_LABEL, etc. Use g_volume_get_identifier()
21617 // to obtain an identifier for a volume.
21618 // </para>
21620 // Note that #G_VOLUME_IDENTIFIER_KIND_HAL_UDI will only be available
21621 // when the gvfs hal volume monitor is in use. Other volume monitors
21622 // will generally be able to provide the #G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE
21623 // identifier, which can be used to obtain a hal device by means of
21624 // libhal_manger_find_device_string_match().
21625 struct Volume {
21627 // Checks if a volume can be ejected.
21628 // RETURNS: %TRUE if the @volume can be ejected. %FALSE otherwise.
21629 int can_eject() {
21630 return g_volume_can_eject(&this);
21633 // Checks if a volume can be mounted.
21634 // RETURNS: %TRUE if the @volume can be mounted. %FALSE otherwise.
21635 int can_mount() {
21636 return g_volume_can_mount(&this);
21639 // Ejects a volume. This is an asynchronous operation, and is
21640 // finished by calling g_volume_eject_finish() with the @volume
21641 // and #GAsyncResult returned in the @callback.
21642 // <flags>: flags affecting the unmount if required for eject
21643 // <cancellable>: optional #GCancellable object, %NULL to ignore.
21644 // <callback>: a #GAsyncReadyCallback, or %NULL.
21645 // <user_data>: user data that gets passed to @callback
21646 void eject(MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
21647 g_volume_eject(&this, flags, cancellable, callback, user_data);
21650 // Finishes ejecting a volume. If any errors occurred during the operation,
21651 // @error will be set to contain the errors and %FALSE will be returned.
21652 // RETURNS: %TRUE, %FALSE if operation failed.
21653 // <result>: a #GAsyncResult.
21654 int eject_finish(AsyncResult* result, GLib2.Error** error=null) {
21655 return g_volume_eject_finish(&this, result, error);
21658 // Ejects a volume. This is an asynchronous operation, and is
21659 // finished by calling g_volume_eject_with_operation_finish() with the @volume
21660 // and #GAsyncResult data returned in the @callback.
21661 // <flags>: flags affecting the unmount if required for eject
21662 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
21663 // <cancellable>: optional #GCancellable object, %NULL to ignore.
21664 // <callback>: a #GAsyncReadyCallback, or %NULL.
21665 // <user_data>: user data passed to @callback.
21666 void eject_with_operation(MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
21667 g_volume_eject_with_operation(&this, flags, mount_operation, cancellable, callback, user_data);
21670 // Finishes ejecting a volume. If any errors occurred during the operation,
21671 // @error will be set to contain the errors and %FALSE will be returned.
21672 // RETURNS: %TRUE if the volume was successfully ejected. %FALSE otherwise.
21673 // <result>: a #GAsyncResult.
21674 int eject_with_operation_finish(AsyncResult* result, GLib2.Error** error=null) {
21675 return g_volume_eject_with_operation_finish(&this, result, error);
21678 // Gets the kinds of <link linkend="volume-identifier">identifiers</link>
21679 // that @volume has. Use g_volume_get_identifer() to obtain
21680 // the identifiers themselves.
21682 // of strings containing kinds of identifiers. Use g_strfreev() to free.
21683 // RETURNS: a %NULL-terminated array
21684 char** /*new*/ enumerate_identifiers() {
21685 return g_volume_enumerate_identifiers(&this);
21688 // Gets the activation root for a #GVolume if it is known ahead of
21689 // mount time. Returns %NULL otherwise. If not %NULL and if @volume
21690 // is mounted, then the result of g_mount_get_root() on the
21691 // #GMount object obtained from g_volume_get_mount() will always
21692 // either be equal or a prefix of what this function returns. In
21693 // other words, in code
21695 // <programlisting>
21696 // GMount *mount;
21697 // GFile *mount_root
21698 // GFile *volume_activation_root;
21700 // mount = g_volume_get_mount (volume); /&ast; mounted, so never NULL &ast;/
21701 // mount_root = g_mount_get_root (mount);
21702 // volume_activation_root = g_volume_get_activation_root(volume); /&ast; assume not NULL &ast;/
21703 // </programlisting>
21705 // then the expression
21707 // <programlisting>
21708 // (g_file_has_prefix (volume_activation_root, mount_root) ||
21709 // </programlisting>
21711 // will always be %TRUE.
21713 // Activation roots are typically used in #GVolumeMonitor
21714 // implementations to find the underlying mount to shadow, see
21715 // g_mount_is_shadowed() for more details.
21717 // g_object_unref() to free.
21718 // RETURNS: the activation root of @volume or %NULL. Use
21719 File* /*new*/ get_activation_root() {
21720 return g_volume_get_activation_root(&this);
21723 // Gets the drive for the @volume.
21725 // The returned object should be unreffed with g_object_unref()
21726 // when no longer needed.
21727 // RETURNS: a #GDrive or %NULL if @volume is not associated with a drive.
21728 Drive* /*new*/ get_drive() {
21729 return g_volume_get_drive(&this);
21732 // Gets the icon for @volume.
21734 // The returned object should be unreffed with g_object_unref()
21735 // when no longer needed.
21736 // RETURNS: a #GIcon.
21737 Icon* /*new*/ get_icon() {
21738 return g_volume_get_icon(&this);
21741 // Gets the identifier of the given kind for @volume.
21742 // See the <link linkend="volume-identifier">introduction</link>
21743 // for more information about volume identifiers.
21745 // requested identfier, or %NULL if the #GVolume
21746 // doesn't have this kind of identifier
21747 // RETURNS: a newly allocated string containing the
21748 // <kind>: the kind of identifier to return
21749 char* /*new*/ get_identifier(char* kind) {
21750 return g_volume_get_identifier(&this, kind);
21753 // Gets the mount for the @volume.
21755 // The returned object should be unreffed with g_object_unref()
21756 // when no longer needed.
21757 // RETURNS: a #GMount or %NULL if @volume isn't mounted.
21758 Mount* /*new*/ get_mount() {
21759 return g_volume_get_mount(&this);
21762 // Gets the name of @volume.
21764 // be freed with g_free() when no longer needed.
21765 // RETURNS: the name for the given @volume. The returned string should
21766 char* /*new*/ get_name() {
21767 return g_volume_get_name(&this);
21770 // Gets the UUID for the @volume. The reference is typically based on
21771 // the file system UUID for the volume in question and should be
21772 // considered an opaque string. Returns %NULL if there is no UUID
21773 // available.
21775 // The returned string should be freed with g_free()
21776 // when no longer needed.
21777 // RETURNS: the UUID for @volume or %NULL if no UUID can be computed.
21778 char* /*new*/ get_uuid() {
21779 return g_volume_get_uuid(&this);
21782 // Mounts a volume. This is an asynchronous operation, and is
21783 // finished by calling g_volume_mount_finish() with the @volume
21784 // and #GAsyncResult returned in the @callback.
21785 // <flags>: flags affecting the operation
21786 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
21787 // <cancellable>: optional #GCancellable object, %NULL to ignore.
21788 // <callback>: a #GAsyncReadyCallback, or %NULL.
21789 // <user_data>: user data that gets passed to @callback
21790 void mount(MountMountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
21791 g_volume_mount(&this, flags, mount_operation, cancellable, callback, user_data);
21794 // Finishes mounting a volume. If any errors occurred during the operation,
21795 // @error will be set to contain the errors and %FALSE will be returned.
21797 // If the mount operation succeeded, g_volume_get_mount() on @volume
21798 // is guaranteed to return the mount right after calling this
21799 // function; there's no need to listen for the 'mount-added' signal on
21800 // #GVolumeMonitor.
21801 // RETURNS: %TRUE, %FALSE if operation failed.
21802 // <result>: a #GAsyncResult
21803 int mount_finish(AsyncResult* result, GLib2.Error** error=null) {
21804 return g_volume_mount_finish(&this, result, error);
21807 // Returns whether the volume should be automatically mounted.
21808 // RETURNS: %TRUE if the volume should be automatically mounted.
21809 int should_automount() {
21810 return g_volume_should_automount(&this);
21812 // Emitted when the volume has been changed.
21813 extern (C) alias static void function (Volume* this_, void* user_data=null) signal_changed;
21815 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
21816 return super_.signal_connect!name(cb, data, cf);
21819 ulong signal_connect(string name:"changed", CB:signal_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
21820 return signal_connect_data(&this, cast(char*)"changed",
21821 cast(GObject2.Callback)cb, data, null, cf);
21824 // This signal is emitted when the #GVolume have been removed. If
21825 // the recipient is holding references to the object they should
21826 // release them so the object can be finalized.
21827 extern (C) alias static void function (Volume* this_, void* user_data=null) signal_removed;
21828 ulong signal_connect(string name:"removed", CB:signal_removed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
21829 return signal_connect_data(&this, cast(char*)"removed",
21830 cast(GObject2.Callback)cb, data, null, cf);
21834 // Interface for implementing operations for mountable volumes.
21835 struct VolumeIface {
21836 GObject2.TypeInterface g_iface;
21837 extern (C) void function (Volume* volume) changed;
21838 extern (C) void function (Volume* volume) removed;
21839 // RETURNS: the name for the given @volume. The returned string should
21840 extern (C) char* /*new*/ function (Volume* volume) get_name;
21841 // RETURNS: a #GIcon.
21842 extern (C) Icon* /*new*/ function (Volume* volume) get_icon;
21843 // RETURNS: the UUID for @volume or %NULL if no UUID can be computed.
21844 extern (C) char* /*new*/ function (Volume* volume) get_uuid;
21845 // RETURNS: a #GDrive or %NULL if @volume is not associated with a drive.
21846 extern (C) Drive* /*new*/ function (Volume* volume) get_drive;
21847 // RETURNS: a #GMount or %NULL if @volume isn't mounted.
21848 extern (C) Mount* /*new*/ function (Volume* volume) get_mount;
21849 // RETURNS: %TRUE if the @volume can be mounted. %FALSE otherwise.
21850 extern (C) int function (Volume* volume) can_mount;
21851 // RETURNS: %TRUE if the @volume can be ejected. %FALSE otherwise.
21852 extern (C) int function (Volume* volume) can_eject;
21854 // <flags>: flags affecting the operation
21855 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
21856 // <cancellable>: optional #GCancellable object, %NULL to ignore.
21857 // <callback>: a #GAsyncReadyCallback, or %NULL.
21858 // <user_data>: user data that gets passed to @callback
21859 extern (C) void function (Volume* volume, MountMountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) mount_fn;
21861 // RETURNS: %TRUE, %FALSE if operation failed.
21862 // <result>: a #GAsyncResult
21863 extern (C) int function (Volume* volume, AsyncResult* result, GLib2.Error** error=null) mount_finish;
21865 // <flags>: flags affecting the unmount if required for eject
21866 // <cancellable>: optional #GCancellable object, %NULL to ignore.
21867 // <callback>: a #GAsyncReadyCallback, or %NULL.
21868 // <user_data>: user data that gets passed to @callback
21869 extern (C) void function (Volume* volume, MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) eject;
21871 // RETURNS: %TRUE, %FALSE if operation failed.
21872 // <result>: a #GAsyncResult.
21873 extern (C) int function (Volume* volume, AsyncResult* result, GLib2.Error** error=null) eject_finish;
21875 // RETURNS: a newly allocated string containing the
21876 // <kind>: the kind of identifier to return
21877 extern (C) char* /*new*/ function (Volume* volume, char* kind) get_identifier;
21878 // RETURNS: a %NULL-terminated array
21879 extern (C) char** /*new*/ function (Volume* volume) enumerate_identifiers;
21880 // RETURNS: %TRUE if the volume should be automatically mounted.
21881 extern (C) int function (Volume* volume) should_automount;
21882 // RETURNS: the activation root of @volume or %NULL. Use
21883 extern (C) File* /*new*/ function (Volume* volume) get_activation_root;
21885 // <flags>: flags affecting the unmount if required for eject
21886 // <mount_operation>: a #GMountOperation or %NULL to avoid user interaction.
21887 // <cancellable>: optional #GCancellable object, %NULL to ignore.
21888 // <callback>: a #GAsyncReadyCallback, or %NULL.
21889 // <user_data>: user data passed to @callback.
21890 extern (C) void function (Volume* volume, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) eject_with_operation;
21892 // RETURNS: %TRUE if the volume was successfully ejected. %FALSE otherwise.
21893 // <result>: a #GAsyncResult.
21894 extern (C) int function (Volume* volume, AsyncResult* result, GLib2.Error** error=null) eject_with_operation_finish;
21898 // #GVolumeMonitor is for listing the user interesting devices and volumes
21899 // on the computer. In other words, what a file selector or file manager
21900 // would show in a sidebar.
21902 // #GVolumeMonitor is not <link
21903 // linkend="g-main-context-push-thread-default">thread-default-context
21904 // aware</link>, and so should not be used other than from the main
21905 // thread, with no thread-default-context active.
21906 struct VolumeMonitor /* : GObject.Object */ {
21907 alias parent_instance this;
21908 alias parent_instance super_;
21909 alias parent_instance object;
21910 GObject2.Object parent_instance;
21911 private void* priv;
21914 // This function should be called by any #GVolumeMonitor
21915 // implementation when a new #GMount object is created that is not
21916 // associated with a #GVolume object. It must be called just before
21917 // emitting the @mount_added signal.
21919 // If the return value is not %NULL, the caller must associate the
21920 // returned #GVolume object with the #GMount. This involves returning
21921 // it in its g_mount_get_volume() implementation. The caller must
21922 // also listen for the "removed" signal on the returned object
21923 // and give up its reference when handling that signal
21925 // Similary, if implementing g_volume_monitor_adopt_orphan_mount(),
21926 // the implementor must take a reference to @mount and return it in
21927 // its g_volume_get_mount() implemented. Also, the implementor must
21928 // listen for the "unmounted" signal on @mount and give up its
21929 // reference upon handling that signal.
21931 // There are two main use cases for this function.
21933 // One is when implementing a user space file system driver that reads
21934 // blocks of a block device that is already represented by the native
21935 // volume monitor (for example a CD Audio file system driver). Such
21936 // a driver will generate its own #GMount object that needs to be
21937 // associated with the #GVolume object that represents the volume.
21939 // The other is for implementing a #GVolumeMonitor whose sole purpose
21940 // is to return #GVolume objects representing entries in the users
21941 // "favorite servers" list or similar.
21943 // if no wants to adopt the #GMount.
21945 // implementations should instead create shadow mounts with the URI of
21946 // the mount they intend to adopt. See the proxy volume monitor in
21947 // gvfs for an example of this. Also see g_mount_is_shadowed(),
21948 // g_mount_shadow() and g_mount_unshadow() functions.
21949 // RETURNS: the #GVolume object that is the parent for @mount or %NULL
21950 // <mount>: a #GMount object to find a parent for
21951 static Volume* /*new*/ adopt_orphan_mount(Mount* mount) {
21952 return g_volume_monitor_adopt_orphan_mount(mount);
21955 // Gets the volume monitor used by gio.
21957 // g_object_unref() when done with it.
21958 // RETURNS: a reference to the #GVolumeMonitor used by gio. Call
21959 static VolumeMonitor* /*new*/ get() {
21960 return g_volume_monitor_get();
21963 // Gets a list of drives connected to the system.
21965 // The returned list should be freed with g_list_free(), after
21966 // its elements have been unreffed with g_object_unref().
21967 // RETURNS: a #GList of connected #GDrive objects.
21968 GLib2.List* /*new*/ get_connected_drives() {
21969 return g_volume_monitor_get_connected_drives(&this);
21972 // Finds a #GMount object by its UUID (see g_mount_get_uuid())
21974 // Free the returned object with g_object_unref().
21975 // RETURNS: a #GMount or %NULL if no such mount is available.
21976 // <uuid>: the UUID to look for
21977 Mount* /*new*/ get_mount_for_uuid(char* uuid) {
21978 return g_volume_monitor_get_mount_for_uuid(&this, uuid);
21981 // Gets a list of the mounts on the system.
21983 // The returned list should be freed with g_list_free(), after
21984 // its elements have been unreffed with g_object_unref().
21985 // RETURNS: a #GList of #GMount objects.
21986 GLib2.List* /*new*/ get_mounts() {
21987 return g_volume_monitor_get_mounts(&this);
21990 // Finds a #GVolume object by its UUID (see g_volume_get_uuid())
21992 // Free the returned object with g_object_unref().
21993 // RETURNS: a #GVolume or %NULL if no such volume is available.
21994 // <uuid>: the UUID to look for
21995 Volume* /*new*/ get_volume_for_uuid(char* uuid) {
21996 return g_volume_monitor_get_volume_for_uuid(&this, uuid);
21999 // Gets a list of the volumes on the system.
22001 // The returned list should be freed with g_list_free(), after
22002 // its elements have been unreffed with g_object_unref().
22003 // RETURNS: a #GList of #GVolume objects.
22004 GLib2.List* /*new*/ get_volumes() {
22005 return g_volume_monitor_get_volumes(&this);
22008 // Emitted when a drive changes.
22009 // <drive>: the drive that changed
22010 extern (C) alias static void function (VolumeMonitor* this_, Drive* drive, void* user_data=null) signal_drive_changed;
22012 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
22013 return super_.signal_connect!name(cb, data, cf);
22016 ulong signal_connect(string name:"drive-changed", CB:signal_drive_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
22017 return signal_connect_data(&this, cast(char*)"drive-changed",
22018 cast(GObject2.Callback)cb, data, null, cf);
22021 // Emitted when a drive is connected to the system.
22022 // <drive>: a #GDrive that was connected.
22023 extern (C) alias static void function (VolumeMonitor* this_, Drive* drive, void* user_data=null) signal_drive_connected;
22024 ulong signal_connect(string name:"drive-connected", CB:signal_drive_connected)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
22025 return signal_connect_data(&this, cast(char*)"drive-connected",
22026 cast(GObject2.Callback)cb, data, null, cf);
22029 // Emitted when a drive is disconnected from the system.
22030 // <drive>: a #GDrive that was disconnected.
22031 extern (C) alias static void function (VolumeMonitor* this_, Drive* drive, void* user_data=null) signal_drive_disconnected;
22032 ulong signal_connect(string name:"drive-disconnected", CB:signal_drive_disconnected)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
22033 return signal_connect_data(&this, cast(char*)"drive-disconnected",
22034 cast(GObject2.Callback)cb, data, null, cf);
22037 // Emitted when the eject button is pressed on @drive.
22038 // <drive>: the drive where the eject button was pressed
22039 extern (C) alias static void function (VolumeMonitor* this_, Drive* drive, void* user_data=null) signal_drive_eject_button;
22040 ulong signal_connect(string name:"drive-eject-button", CB:signal_drive_eject_button)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
22041 return signal_connect_data(&this, cast(char*)"drive-eject-button",
22042 cast(GObject2.Callback)cb, data, null, cf);
22045 // Emitted when the stop button is pressed on @drive.
22046 // <drive>: the drive where the stop button was pressed
22047 extern (C) alias static void function (VolumeMonitor* this_, Drive* drive, void* user_data=null) signal_drive_stop_button;
22048 ulong signal_connect(string name:"drive-stop-button", CB:signal_drive_stop_button)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
22049 return signal_connect_data(&this, cast(char*)"drive-stop-button",
22050 cast(GObject2.Callback)cb, data, null, cf);
22053 // Emitted when a mount is added.
22054 // <mount>: a #GMount that was added.
22055 extern (C) alias static void function (VolumeMonitor* this_, Mount* mount, void* user_data=null) signal_mount_added;
22056 ulong signal_connect(string name:"mount-added", CB:signal_mount_added)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
22057 return signal_connect_data(&this, cast(char*)"mount-added",
22058 cast(GObject2.Callback)cb, data, null, cf);
22061 // Emitted when a mount changes.
22062 // <mount>: a #GMount that changed.
22063 extern (C) alias static void function (VolumeMonitor* this_, Mount* mount, void* user_data=null) signal_mount_changed;
22064 ulong signal_connect(string name:"mount-changed", CB:signal_mount_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
22065 return signal_connect_data(&this, cast(char*)"mount-changed",
22066 cast(GObject2.Callback)cb, data, null, cf);
22069 // Emitted when a mount is about to be removed.
22070 // <mount>: a #GMount that is being unmounted.
22071 extern (C) alias static void function (VolumeMonitor* this_, Mount* mount, void* user_data=null) signal_mount_pre_unmount;
22072 ulong signal_connect(string name:"mount-pre-unmount", CB:signal_mount_pre_unmount)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
22073 return signal_connect_data(&this, cast(char*)"mount-pre-unmount",
22074 cast(GObject2.Callback)cb, data, null, cf);
22077 // Emitted when a mount is removed.
22078 // <mount>: a #GMount that was removed.
22079 extern (C) alias static void function (VolumeMonitor* this_, Mount* mount, void* user_data=null) signal_mount_removed;
22080 ulong signal_connect(string name:"mount-removed", CB:signal_mount_removed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
22081 return signal_connect_data(&this, cast(char*)"mount-removed",
22082 cast(GObject2.Callback)cb, data, null, cf);
22085 // Emitted when a mountable volume is added to the system.
22086 // <volume>: a #GVolume that was added.
22087 extern (C) alias static void function (VolumeMonitor* this_, Volume* volume, void* user_data=null) signal_volume_added;
22088 ulong signal_connect(string name:"volume-added", CB:signal_volume_added)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
22089 return signal_connect_data(&this, cast(char*)"volume-added",
22090 cast(GObject2.Callback)cb, data, null, cf);
22093 // Emitted when mountable volume is changed.
22094 // <volume>: a #GVolume that changed.
22095 extern (C) alias static void function (VolumeMonitor* this_, Volume* volume, void* user_data=null) signal_volume_changed;
22096 ulong signal_connect(string name:"volume-changed", CB:signal_volume_changed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
22097 return signal_connect_data(&this, cast(char*)"volume-changed",
22098 cast(GObject2.Callback)cb, data, null, cf);
22101 // Emitted when a mountable volume is removed from the system.
22102 // <volume>: a #GVolume that was removed.
22103 extern (C) alias static void function (VolumeMonitor* this_, Volume* volume, void* user_data=null) signal_volume_removed;
22104 ulong signal_connect(string name:"volume-removed", CB:signal_volume_removed)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
22105 return signal_connect_data(&this, cast(char*)"volume-removed",
22106 cast(GObject2.Callback)cb, data, null, cf);
22110 struct VolumeMonitorClass {
22111 GObject2.ObjectClass parent_class;
22112 extern (C) void function (VolumeMonitor* volume_monitor, Volume* volume) volume_added;
22113 extern (C) void function (VolumeMonitor* volume_monitor, Volume* volume) volume_removed;
22114 extern (C) void function (VolumeMonitor* volume_monitor, Volume* volume) volume_changed;
22115 extern (C) void function (VolumeMonitor* volume_monitor, Mount* mount) mount_added;
22116 extern (C) void function (VolumeMonitor* volume_monitor, Mount* mount) mount_removed;
22117 extern (C) void function (VolumeMonitor* volume_monitor, Mount* mount) mount_pre_unmount;
22118 extern (C) void function (VolumeMonitor* volume_monitor, Mount* mount) mount_changed;
22119 extern (C) void function (VolumeMonitor* volume_monitor, Drive* drive) drive_connected;
22120 extern (C) void function (VolumeMonitor* volume_monitor, Drive* drive) drive_disconnected;
22121 extern (C) void function (VolumeMonitor* volume_monitor, Drive* drive) drive_changed;
22122 extern (C) int function () is_supported;
22123 // RETURNS: a #GList of connected #GDrive objects.
22124 extern (C) GLib2.List* /*new*/ function (VolumeMonitor* volume_monitor) get_connected_drives;
22125 // RETURNS: a #GList of #GVolume objects.
22126 extern (C) GLib2.List* /*new*/ function (VolumeMonitor* volume_monitor) get_volumes;
22127 // RETURNS: a #GList of #GMount objects.
22128 extern (C) GLib2.List* /*new*/ function (VolumeMonitor* volume_monitor) get_mounts;
22130 // RETURNS: a #GVolume or %NULL if no such volume is available.
22131 // <uuid>: the UUID to look for
22132 extern (C) Volume* /*new*/ function (VolumeMonitor* volume_monitor, char* uuid) get_volume_for_uuid;
22134 // RETURNS: a #GMount or %NULL if no such mount is available.
22135 // <uuid>: the UUID to look for
22136 extern (C) Mount* /*new*/ function (VolumeMonitor* volume_monitor, char* uuid) get_mount_for_uuid;
22137 // Unintrospectable functionp: adopt_orphan_mount() / ()
22138 extern (C) Volume* function (Mount* mount, VolumeMonitor* volume_monitor) adopt_orphan_mount;
22139 extern (C) void function (VolumeMonitor* volume_monitor, Drive* drive) drive_eject_button;
22140 extern (C) void function (VolumeMonitor* volume_monitor, Drive* drive) drive_stop_button;
22141 extern (C) void function () _g_reserved1;
22142 extern (C) void function () _g_reserved2;
22143 extern (C) void function () _g_reserved3;
22144 extern (C) void function () _g_reserved4;
22145 extern (C) void function () _g_reserved5;
22146 extern (C) void function () _g_reserved6;
22149 // Zlib decompression
22150 struct ZlibCompressor /* : GObject.Object */ {
22151 alias method_parent this;
22152 alias method_parent super_;
22153 alias method_parent object;
22154 GObject2.Object method_parent;
22157 // Creates a new #GZlibCompressor.
22158 // RETURNS: a new #GZlibCompressor
22159 // <format>: The format to use for the compressed data
22160 // <level>: compression level (0-9), -1 for default
22161 static ZlibCompressor* /*new*/ new_(ZlibCompressorFormat format, int level) {
22162 return g_zlib_compressor_new(format, level);
22165 // Returns the #GZlibCompressor:file-info property.
22166 // RETURNS: a #GFileInfo, or %NULL
22167 FileInfo* get_file_info() {
22168 return g_zlib_compressor_get_file_info(&this);
22171 // Sets @file_info in @compressor. If non-%NULL, and @compressor's
22172 // #GZlibCompressor:format property is %G_ZLIB_COMPRESSOR_FORMAT_GZIP,
22173 // it will be used to set the file name and modification time in
22174 // the GZIP header of the compressed data.
22176 // Note: it is an error to call this function while a compression is in
22177 // progress; it may only be called immediately after creation of @compressor,
22178 // or after resetting it with g_converter_reset().
22179 // <file_info>: a #GFileInfo
22180 void set_file_info(FileInfo* file_info=null) {
22181 g_zlib_compressor_set_file_info(&this, file_info);
22185 struct ZlibCompressorClass {
22186 GObject2.ObjectClass parent_class;
22190 // Used to select the type of data format to use for #GZlibDecompressor
22191 // and #GZlibCompressor.
22192 enum ZlibCompressorFormat /* Version 2.24 */ {
22193 ZLIB = 0,
22194 GZIP = 1,
22195 RAW = 2
22197 // Zlib decompression
22198 struct ZlibDecompressor /* : GObject.Object */ {
22199 alias method_parent this;
22200 alias method_parent super_;
22201 alias method_parent object;
22202 GObject2.Object method_parent;
22205 // Creates a new #GZlibDecompressor.
22206 // RETURNS: a new #GZlibDecompressor
22207 // <format>: The format to use for the compressed data
22208 static ZlibDecompressor* /*new*/ new_(ZlibCompressorFormat format) {
22209 return g_zlib_decompressor_new(format);
22212 // Retrieves the #GFileInfo constructed from the GZIP header data
22213 // of compressed data processed by @compressor, or %NULL if @decompressor's
22214 // #GZlibDecompressor:format property is not %G_ZLIB_COMPRESSOR_FORMAT_GZIP,
22215 // or the header data was not fully processed yet, or it not present in the
22216 // data stream at all.
22217 // RETURNS: a #GFileInfo, or %NULL
22218 FileInfo* get_file_info() {
22219 return g_zlib_decompressor_get_file_info(&this);
22223 struct ZlibDecompressorClass {
22224 GObject2.ObjectClass parent_class;
22228 // Creates a new #GAppInfo from the given information.
22229 // RETURNS: new #GAppInfo for given command.
22230 // <commandline>: the commandline to use
22231 // <application_name>: the application name, or %NULL to use @commandline
22232 // <flags>: flags that can specify details of the created #GAppInfo
22233 static AppInfo* /*new*/ app_info_create_from_commandline(char* commandline, char* application_name, AppInfoCreateFlags flags, GLib2.Error** error=null) {
22234 return g_app_info_create_from_commandline(commandline, application_name, flags, error);
22238 // Gets a list of all of the applications currently registered
22239 // on this system.
22241 // For desktop files, this includes applications that have
22242 // <literal>NoDisplay=true</literal> set or are excluded from
22243 // display by means of <literal>OnlyShowIn</literal> or
22244 // <literal>NotShowIn</literal>. See g_app_info_should_show().
22245 // The returned list does not include applications which have
22246 // the <literal>Hidden</literal> key set.
22247 // RETURNS: a newly allocated #GList of references to #GAppInfo<!---->s.
22248 static GLib2.List* /*new*/ app_info_get_all() {
22249 return g_app_info_get_all();
22253 // Gets a list of all #GAppInfos for a given content type.
22255 // for given @content_type or %NULL on error.
22256 // RETURNS: #GList of #GAppInfos
22257 // <content_type>: the content type to find a #GAppInfo for
22258 static GLib2.List* /*new*/ app_info_get_all_for_type(char* content_type) {
22259 return g_app_info_get_all_for_type(content_type);
22263 // Gets the #GAppInfo that corresponds to a given content type.
22265 // %NULL on error.
22266 // RETURNS: #GAppInfo for given @content_type or
22267 // <content_type>: the content type to find a #GAppInfo for
22268 // <must_support_uris>: if %TRUE, the #GAppInfo is expected to support URIs
22269 static AppInfo* /*new*/ app_info_get_default_for_type(char* content_type, int must_support_uris) {
22270 return g_app_info_get_default_for_type(content_type, must_support_uris);
22274 // Gets the default application for launching applications
22275 // using this URI scheme. A URI scheme is the initial part
22276 // of the URI, up to but not including the ':', e.g. "http",
22277 // "ftp" or "sip".
22278 // RETURNS: #GAppInfo for given @uri_scheme or %NULL on error.
22279 // <uri_scheme>: a string containing a URI scheme.
22280 static AppInfo* /*new*/ app_info_get_default_for_uri_scheme(char* uri_scheme) {
22281 return g_app_info_get_default_for_uri_scheme(uri_scheme);
22285 // Gets a list of fallback #GAppInfos for a given content type, i.e.
22286 // those applications which claim to support the given content type
22287 // by MIME type subclassing and not directly.
22289 // for given @content_type or %NULL on error.
22290 // RETURNS: #GList of #GAppInfos
22291 // <content_type>: the content type to find a #GAppInfo for
22292 static GLib2.List* /*new*/ app_info_get_fallback_for_type(char* content_type) {
22293 return g_app_info_get_fallback_for_type(content_type);
22297 // Gets a list of recommended #GAppInfos for a given content type, i.e.
22298 // those applications which claim to support the given content type exactly,
22299 // and not by MIME type subclassing.
22300 // Note that the first application of the list is the last used one, i.e.
22301 // the last one for which #g_app_info_set_as_last_used_for_type has been
22302 // called.
22304 // for given @content_type or %NULL on error.
22305 // RETURNS: #GList of #GAppInfos
22306 // <content_type>: the content type to find a #GAppInfo for
22307 static GLib2.List* /*new*/ app_info_get_recommended_for_type(char* content_type) {
22308 return g_app_info_get_recommended_for_type(content_type);
22312 // Utility function that launches the default application
22313 // registered to handle the specified uri. Synchronous I/O
22314 // is done on the uri to detect the type of the file if
22315 // required.
22316 // RETURNS: %TRUE on success, %FALSE on error.
22317 // <uri>: the uri to show
22318 // <launch_context>: an optional #GAppLaunchContext.
22319 static int app_info_launch_default_for_uri(char* uri, AppLaunchContext* launch_context, GLib2.Error** error=null) {
22320 return g_app_info_launch_default_for_uri(uri, launch_context, error);
22324 // Removes all changes to the type associations done by
22325 // g_app_info_set_as_default_for_type(),
22326 // g_app_info_set_as_default_for_extension(),
22327 // g_app_info_add_supports_type() or g_app_info_remove_supports_type().
22328 // <content_type>: a content type
22329 static void app_info_reset_type_associations(char* content_type) {
22330 g_app_info_reset_type_associations(content_type);
22334 // Helper function for constructing #GAsyncInitable object. This is
22335 // similar to g_object_newv() but also initializes the object asynchronously.
22337 // When the initialization is finished, @callback will be called. You can
22338 // then call g_async_initable_new_finish() to get the new object and check
22339 // for any errors.
22340 // <object_type>: a #GType supporting #GAsyncInitable.
22341 // <n_parameters>: the number of parameters in @parameters
22342 // <parameters>: the parameters to use to construct the object
22343 // <io_priority>: the <link linkend="io-priority">I/O priority</link> of the operation.
22344 // <cancellable>: optional #GCancellable object, %NULL to ignore.
22345 // <callback>: a #GAsyncReadyCallback to call when the initialization is finished
22346 // <user_data>: the data to pass to callback function
22347 static void async_initable_newv_async(Type object_type, uint n_parameters, GObject2.Parameter* parameters, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
22348 g_async_initable_newv_async(object_type, n_parameters, parameters, io_priority, cancellable, callback, user_data);
22352 // Asynchronously connects to the message bus specified by @bus_type.
22354 // When the operation is finished, @callback will be invoked. You can
22355 // then call g_bus_get_finish() to get the result of the operation.
22357 // This is a asynchronous failable function. See g_bus_get_sync() for
22358 // the synchronous version.
22359 // <bus_type>: A #GBusType.
22360 // <cancellable>: A #GCancellable or %NULL.
22361 // <callback>: A #GAsyncReadyCallback to call when the request is satisfied.
22362 // <user_data>: The data to pass to @callback.
22363 static void bus_get(BusType bus_type, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
22364 g_bus_get(bus_type, cancellable, callback, user_data);
22368 // Finishes an operation started with g_bus_get().
22370 // The returned object is a singleton, that is, shared with other
22371 // callers of g_bus_get() and g_bus_get_sync() for @bus_type. In the
22372 // event that you need a private message bus connection, use
22373 // g_dbus_address_get_for_bus_sync() and
22374 // g_dbus_connection_new_for_address().
22376 // Note that the returned #GDBusConnection object will (usually) have
22377 // the #GDBusConnection:exit-on-close property set to %TRUE.
22378 // RETURNS: A #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
22379 // <res>: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_bus_get().
22380 static DBusConnection* /*new*/ bus_get_finish(AsyncResult* res, GLib2.Error** error=null) {
22381 return g_bus_get_finish(res, error);
22385 // Synchronously connects to the message bus specified by @bus_type.
22386 // Note that the returned object may shared with other callers,
22387 // e.g. if two separate parts of a process calls this function with
22388 // the same @bus_type, they will share the same object.
22390 // This is a synchronous failable function. See g_bus_get() and
22391 // g_bus_get_finish() for the asynchronous version.
22393 // The returned object is a singleton, that is, shared with other
22394 // callers of g_bus_get() and g_bus_get_sync() for @bus_type. In the
22395 // event that you need a private message bus connection, use
22396 // g_dbus_address_get_for_bus_sync() and
22397 // g_dbus_connection_new_for_address().
22399 // Note that the returned #GDBusConnection object will (usually) have
22400 // the #GDBusConnection:exit-on-close property set to %TRUE.
22401 // RETURNS: A #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
22402 // <bus_type>: A #GBusType.
22403 // <cancellable>: A #GCancellable or %NULL.
22404 static DBusConnection* /*new*/ bus_get_sync(BusType bus_type, Cancellable* cancellable, GLib2.Error** error=null) {
22405 return g_bus_get_sync(bus_type, cancellable, error);
22409 // Unintrospectable function: bus_own_name() / g_bus_own_name()
22410 // Starts acquiring @name on the bus specified by @bus_type and calls
22411 // @name_acquired_handler and @name_lost_handler when the name is
22412 // acquired respectively lost. Callbacks will be invoked in the <link
22413 // linkend="g-main-context-push-thread-default">thread-default main
22414 // loop</link> of the thread you are calling this function from.
22416 // You are guaranteed that one of the @name_acquired_handler and @name_lost_handler
22417 // callbacks will be invoked after calling this function - there are three
22418 // possible cases:
22419 // <itemizedlist>
22420 // <listitem><para>
22421 // @name_lost_handler with a %NULL connection (if a connection to the bus can't be made).
22422 // </para></listitem>
22423 // <listitem><para>
22424 // @bus_acquired_handler then @name_lost_handler (if the name can't be obtained)
22425 // </para></listitem>
22426 // <listitem><para>
22427 // @bus_acquired_handler then @name_acquired_handler (if the name was obtained).
22428 // </para></listitem>
22429 // </itemizedlist>
22430 // When you are done owning the name, just call g_bus_unown_name()
22431 // with the owner id this function returns.
22433 // If the name is acquired or lost (for example another application
22434 // could acquire the name if you allow replacement or the application
22435 // currently owning the name exits), the handlers are also invoked. If the
22436 // #GDBusConnection that is used for attempting to own the name
22437 // closes, then @name_lost_handler is invoked since it is no
22438 // longer possible for other processes to access the process.
22440 // You cannot use g_bus_own_name() several times for the same name (unless
22441 // interleaved with calls to g_bus_unown_name()) - only the first call
22442 // will work.
22444 // Another guarantee is that invocations of @name_acquired_handler
22445 // and @name_lost_handler are guaranteed to alternate; that
22446 // is, if @name_acquired_handler is invoked then you are
22447 // guaranteed that the next time one of the handlers is invoked, it
22448 // will be @name_lost_handler. The reverse is also true.
22450 // If you plan on exporting objects (using e.g.
22451 // g_dbus_connection_register_object()), note that it is generally too late
22452 // to export the objects in @name_acquired_handler. Instead, you can do this
22453 // in @bus_acquired_handler since you are guaranteed that this will run
22454 // before @name is requested from the bus.
22456 // This behavior makes it very simple to write applications that wants
22457 // to own names and export objects, see <xref linkend="gdbus-owning-names"/>.
22458 // Simply register objects to be exported in @bus_acquired_handler and
22459 // unregister the objects (if any) in @name_lost_handler.
22461 // g_bus_unown_name() to stop owning the name.
22462 // RETURNS: An identifier (never 0) that an be used with
22463 // <bus_type>: The type of bus to own a name on.
22464 // <name>: The well-known name to own.
22465 // <flags>: A set of flags from the #GBusNameOwnerFlags enumeration.
22466 // <bus_acquired_handler>: Handler to invoke when connected to the bus of type @bus_type or %NULL.
22467 // <name_acquired_handler>: Handler to invoke when @name is acquired or %NULL.
22468 // <name_lost_handler>: Handler to invoke when @name is lost or %NULL.
22469 // <user_data>: User data to pass to handlers.
22470 // <user_data_free_func>: Function for freeing @user_data or %NULL.
22471 static uint bus_own_name(BusType bus_type, char* name, BusNameOwnerFlags flags, BusAcquiredCallback bus_acquired_handler, BusNameAcquiredCallback name_acquired_handler, BusNameLostCallback name_lost_handler, void* user_data, GLib2.DestroyNotify user_data_free_func) {
22472 return g_bus_own_name(bus_type, name, flags, bus_acquired_handler, name_acquired_handler, name_lost_handler, user_data, user_data_free_func);
22476 // Unintrospectable function: bus_own_name_on_connection() / g_bus_own_name_on_connection()
22477 // Like g_bus_own_name() but takes a #GDBusConnection instead of a
22478 // #GBusType.
22480 // g_bus_unown_name() to stop owning the name.
22481 // RETURNS: An identifier (never 0) that an be used with
22482 // <connection>: A #GDBusConnection.
22483 // <name>: The well-known name to own.
22484 // <flags>: A set of flags from the #GBusNameOwnerFlags enumeration.
22485 // <name_acquired_handler>: Handler to invoke when @name is acquired or %NULL.
22486 // <name_lost_handler>: Handler to invoke when @name is lost or %NULL.
22487 // <user_data>: User data to pass to handlers.
22488 // <user_data_free_func>: Function for freeing @user_data or %NULL.
22489 static uint bus_own_name_on_connection(DBusConnection* connection, char* name, BusNameOwnerFlags flags, BusNameAcquiredCallback name_acquired_handler, BusNameLostCallback name_lost_handler, void* user_data, GLib2.DestroyNotify user_data_free_func) {
22490 return g_bus_own_name_on_connection(connection, name, flags, name_acquired_handler, name_lost_handler, user_data, user_data_free_func);
22494 // Version of g_bus_own_name_on_connection() using closures instead of callbacks for
22495 // easier binding in other languages.
22497 // g_bus_unown_name() to stop owning the name.
22498 // RETURNS: An identifier (never 0) that an be used with
22499 // <connection>: A #GDBusConnection.
22500 // <name>: The well-known name to own.
22501 // <flags>: A set of flags from the #GBusNameOwnerFlags enumeration.
22502 // <name_acquired_closure>: #GClosure to invoke when @name is acquired or %NULL.
22503 // <name_lost_closure>: #GClosure to invoke when @name is lost or %NULL.
22504 static uint bus_own_name_on_connection_with_closures(DBusConnection* connection, char* name, BusNameOwnerFlags flags, GObject2.Closure* name_acquired_closure=null, GObject2.Closure* name_lost_closure=null) {
22505 return g_bus_own_name_on_connection_with_closures(connection, name, flags, name_acquired_closure, name_lost_closure);
22509 // Version of g_bus_own_name() using closures instead of callbacks for
22510 // easier binding in other languages.
22512 // g_bus_unown_name() to stop owning the name.
22513 // RETURNS: An identifier (never 0) that an be used with
22514 // <bus_type>: The type of bus to own a name on.
22515 // <name>: The well-known name to own.
22516 // <flags>: A set of flags from the #GBusNameOwnerFlags enumeration.
22517 // <bus_acquired_closure>: #GClosure to invoke when connected to the bus of type @bus_type or %NULL.
22518 // <name_acquired_closure>: #GClosure to invoke when @name is acquired or %NULL.
22519 // <name_lost_closure>: #GClosure to invoke when @name is lost or %NULL.
22520 static uint bus_own_name_with_closures(BusType bus_type, char* name, BusNameOwnerFlags flags, GObject2.Closure* bus_acquired_closure=null, GObject2.Closure* name_acquired_closure=null, GObject2.Closure* name_lost_closure=null) {
22521 return g_bus_own_name_with_closures(bus_type, name, flags, bus_acquired_closure, name_acquired_closure, name_lost_closure);
22525 // Stops owning a name.
22526 // <owner_id>: An identifier obtained from g_bus_own_name()
22527 static void bus_unown_name(uint owner_id) {
22528 g_bus_unown_name(owner_id);
22532 // Stops watching a name.
22533 // <watcher_id>: An identifier obtained from g_bus_watch_name()
22534 static void bus_unwatch_name(uint watcher_id) {
22535 g_bus_unwatch_name(watcher_id);
22539 // Unintrospectable function: bus_watch_name() / g_bus_watch_name()
22540 // Starts watching @name on the bus specified by @bus_type and calls
22541 // @name_appeared_handler and @name_vanished_handler when the name is
22542 // known to have a owner respectively known to lose its
22543 // owner. Callbacks will be invoked in the <link
22544 // linkend="g-main-context-push-thread-default">thread-default main
22545 // loop</link> of the thread you are calling this function from.
22547 // You are guaranteed that one of the handlers will be invoked after
22548 // calling this function. When you are done watching the name, just
22549 // call g_bus_unwatch_name() with the watcher id this function
22550 // returns.
22552 // If the name vanishes or appears (for example the application owning
22553 // the name could restart), the handlers are also invoked. If the
22554 // #GDBusConnection that is used for watching the name disconnects, then
22555 // @name_vanished_handler is invoked since it is no longer
22556 // possible to access the name.
22558 // Another guarantee is that invocations of @name_appeared_handler
22559 // and @name_vanished_handler are guaranteed to alternate; that
22560 // is, if @name_appeared_handler is invoked then you are
22561 // guaranteed that the next time one of the handlers is invoked, it
22562 // will be @name_vanished_handler. The reverse is also true.
22564 // This behavior makes it very simple to write applications that wants
22565 // to take action when a certain name exists, see <xref
22566 // linkend="gdbus-watching-names"/>. Basically, the application
22567 // should create object proxies in @name_appeared_handler and destroy
22568 // them again (if any) in @name_vanished_handler.
22570 // g_bus_unwatch_name() to stop watching the name.
22571 // RETURNS: An identifier (never 0) that an be used with
22572 // <bus_type>: The type of bus to watch a name on.
22573 // <name>: The name (well-known or unique) to watch.
22574 // <flags>: Flags from the #GBusNameWatcherFlags enumeration.
22575 // <name_appeared_handler>: Handler to invoke when @name is known to exist or %NULL.
22576 // <name_vanished_handler>: Handler to invoke when @name is known to not exist or %NULL.
22577 // <user_data>: User data to pass to handlers.
22578 // <user_data_free_func>: Function for freeing @user_data or %NULL.
22579 static uint bus_watch_name(BusType bus_type, char* name, BusNameWatcherFlags flags, BusNameAppearedCallback name_appeared_handler, BusNameVanishedCallback name_vanished_handler, void* user_data, GLib2.DestroyNotify user_data_free_func) {
22580 return g_bus_watch_name(bus_type, name, flags, name_appeared_handler, name_vanished_handler, user_data, user_data_free_func);
22584 // Unintrospectable function: bus_watch_name_on_connection() / g_bus_watch_name_on_connection()
22585 // Like g_bus_watch_name() but takes a #GDBusConnection instead of a
22586 // #GBusType.
22588 // g_bus_unwatch_name() to stop watching the name.
22589 // RETURNS: An identifier (never 0) that an be used with
22590 // <connection>: A #GDBusConnection.
22591 // <name>: The name (well-known or unique) to watch.
22592 // <flags>: Flags from the #GBusNameWatcherFlags enumeration.
22593 // <name_appeared_handler>: Handler to invoke when @name is known to exist or %NULL.
22594 // <name_vanished_handler>: Handler to invoke when @name is known to not exist or %NULL.
22595 // <user_data>: User data to pass to handlers.
22596 // <user_data_free_func>: Function for freeing @user_data or %NULL.
22597 static uint bus_watch_name_on_connection(DBusConnection* connection, char* name, BusNameWatcherFlags flags, BusNameAppearedCallback name_appeared_handler, BusNameVanishedCallback name_vanished_handler, void* user_data, GLib2.DestroyNotify user_data_free_func) {
22598 return g_bus_watch_name_on_connection(connection, name, flags, name_appeared_handler, name_vanished_handler, user_data, user_data_free_func);
22602 // Version of g_bus_watch_name_on_connection() using closures instead of callbacks for
22603 // easier binding in other languages.
22605 // g_bus_unwatch_name() to stop watching the name.
22606 // RETURNS: An identifier (never 0) that an be used with
22607 // <connection>: A #GDBusConnection.
22608 // <name>: The name (well-known or unique) to watch.
22609 // <flags>: Flags from the #GBusNameWatcherFlags enumeration.
22610 // <name_appeared_closure>: #GClosure to invoke when @name is known to exist or %NULL.
22611 // <name_vanished_closure>: #GClosure to invoke when @name is known to not exist or %NULL.
22612 static uint bus_watch_name_on_connection_with_closures(DBusConnection* connection, char* name, BusNameWatcherFlags flags, GObject2.Closure* name_appeared_closure=null, GObject2.Closure* name_vanished_closure=null) {
22613 return g_bus_watch_name_on_connection_with_closures(connection, name, flags, name_appeared_closure, name_vanished_closure);
22617 // Version of g_bus_watch_name() using closures instead of callbacks for
22618 // easier binding in other languages.
22620 // g_bus_unwatch_name() to stop watching the name.
22621 // RETURNS: An identifier (never 0) that an be used with
22622 // <bus_type>: The type of bus to watch a name on.
22623 // <name>: The name (well-known or unique) to watch.
22624 // <flags>: Flags from the #GBusNameWatcherFlags enumeration.
22625 // <name_appeared_closure>: #GClosure to invoke when @name is known to exist or %NULL.
22626 // <name_vanished_closure>: #GClosure to invoke when @name is known to not exist or %NULL.
22627 static uint bus_watch_name_with_closures(BusType bus_type, char* name, BusNameWatcherFlags flags, GObject2.Closure* name_appeared_closure=null, GObject2.Closure* name_vanished_closure=null) {
22628 return g_bus_watch_name_with_closures(bus_type, name, flags, name_appeared_closure, name_vanished_closure);
22632 // Checks if a content type can be executable. Note that for instance
22633 // things like text files can be executables (i.e. scripts and batch files).
22635 // can be executable, %FALSE otherwise.
22636 // RETURNS: %TRUE if the file type corresponds to a type that
22637 // <type>: a content type string
22638 static int content_type_can_be_executable(char* type) {
22639 return g_content_type_can_be_executable(type);
22643 // Compares two content types for equality.
22645 // %FALSE otherwise.
22646 // RETURNS: %TRUE if the two strings are identical or equivalent,
22647 // <type1>: a content type string
22648 // <type2>: a content type string
22649 static int content_type_equals(char* type1, char* type2) {
22650 return g_content_type_equals(type1, type2);
22654 // Tries to find a content type based on the mime type name.
22656 // or %NULL. Free with g_free()
22657 // RETURNS: Newly allocated string with content type
22658 // <mime_type>: a mime type string
22659 static char* /*new*/ content_type_from_mime_type(char* mime_type) {
22660 return g_content_type_from_mime_type(mime_type);
22664 // Gets the human readable description of the content type.
22666 // returned string with g_free()
22667 // RETURNS: a short description of the content type @type. Free the
22668 // <type>: a content type string
22669 static char* /*new*/ content_type_get_description(char* type) {
22670 return g_content_type_get_description(type);
22674 // Gets the icon for a content type.
22676 // object with g_object_unref()
22677 // RETURNS: #GIcon corresponding to the content type. Free the returned
22678 // <type>: a content type string
22679 static Icon* /*new*/ content_type_get_icon(char* type) {
22680 return g_content_type_get_icon(type);
22684 // Gets the mime type for the content type, if one is registered.
22686 // or %NULL if unknown.
22687 // RETURNS: the registered mime type for the given @type,
22688 // <type>: a content type string
22689 static char* /*new*/ content_type_get_mime_type(char* type) {
22690 return g_content_type_get_mime_type(type);
22694 // Guesses the content type based on example data. If the function is
22695 // uncertain, @result_uncertain will be set to %TRUE. Either @filename
22696 // or @data may be %NULL, in which case the guess will be based solely
22697 // on the other argument.
22699 // given data. Free with g_free()
22700 // RETURNS: a string indicating a guessed content type for the
22701 // <filename>: a string, or %NULL
22702 // <data>: a stream of data, or %NULL
22703 // <data_size>: the size of @data
22704 // <result_uncertain>: return location for the certainty of the result, or %NULL
22705 static char* /*new*/ content_type_guess(char* filename, ubyte* data, size_t data_size, /*out*/ int* result_uncertain=null) {
22706 return g_content_type_guess(filename, data, data_size, result_uncertain);
22710 // Tries to guess the type of the tree with root @root, by
22711 // looking at the files it contains. The result is an array
22712 // of content types, with the best guess coming first.
22714 // The types returned all have the form x-content/foo, e.g.
22715 // x-content/audio-cdda (for audio CDs) or x-content/image-dcf
22716 // (for a camera memory card). See the <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink>
22717 // specification for more on x-content types.
22719 // This function is useful in the implementation of
22720 // g_mount_guess_content_type().
22722 // array of zero or more content types, or %NULL. Free with g_strfreev()
22723 // RETURNS: an %NULL-terminated
22724 // <root>: the root of the tree to guess a type for
22725 static char** /*new*/ content_type_guess_for_tree(File* root) {
22726 return g_content_type_guess_for_tree(root);
22730 // Determines if @type is a subset of @supertype.
22732 // %FALSE otherwise.
22733 // RETURNS: %TRUE if @type is a kind of @supertype,
22734 // <type>: a content type string
22735 // <supertype>: a content type string
22736 static int content_type_is_a(char* type, char* supertype) {
22737 return g_content_type_is_a(type, supertype);
22741 // Checks if the content type is the generic "unknown" type.
22742 // On UNIX this is the "application/octet-stream" mimetype,
22743 // while on win32 it is "*".
22744 // RETURNS: %TRUE if the type is the unknown type.
22745 // <type>: a content type string
22746 static int content_type_is_unknown(char* type) {
22747 return g_content_type_is_unknown(type);
22751 // Gets a list of strings containing all the registered content types
22752 // known to the system. The list and its data should be freed using
22753 // <programlisting>
22754 // g_list_foreach (list, g_free, NULL);
22755 // g_list_free (list);
22756 // </programlisting>
22757 // RETURNS: #GList of the registered content types
22758 static GLib2.List* /*new*/ content_types_get_registered() {
22759 return g_content_types_get_registered();
22763 // Synchronously looks up the D-Bus address for the well-known message
22764 // bus instance specified by @bus_type. This may involve using various
22765 // platform specific mechanisms.
22766 // RETURNS: A valid D-Bus address string for @bus_type or %NULL if @error is set.
22767 // <bus_type>: A #GBusType.
22768 // <cancellable>: A #GCancellable or %NULL.
22769 static char* /*new*/ dbus_address_get_for_bus_sync(BusType bus_type, Cancellable* cancellable, GLib2.Error** error=null) {
22770 return g_dbus_address_get_for_bus_sync(bus_type, cancellable, error);
22774 // Asynchronously connects to an endpoint specified by @address and
22775 // sets up the connection so it is in a state to run the client-side
22776 // of the D-Bus authentication conversation.
22778 // When the operation is finished, @callback will be invoked. You can
22779 // then call g_dbus_address_get_stream_finish() to get the result of
22780 // the operation.
22782 // This is an asynchronous failable function. See
22783 // g_dbus_address_get_stream_sync() for the synchronous version.
22784 // <address>: A valid D-Bus address.
22785 // <cancellable>: A #GCancellable or %NULL.
22786 // <callback>: A #GAsyncReadyCallback to call when the request is satisfied.
22787 // <user_data>: Data to pass to @callback.
22788 static void dbus_address_get_stream(char* address, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data) {
22789 g_dbus_address_get_stream(address, cancellable, callback, user_data);
22793 // Finishes an operation started with g_dbus_address_get_stream().
22794 // RETURNS: A #GIOStream or %NULL if @error is set.
22795 // <res>: A #GAsyncResult obtained from the GAsyncReadyCallback passed to g_dbus_address_get_stream().
22796 // <out_guid>: %NULL or return location to store the GUID extracted from @address, if any.
22797 static IOStream* /*new*/ dbus_address_get_stream_finish(AsyncResult* res, char** out_guid, GLib2.Error** error=null) {
22798 return g_dbus_address_get_stream_finish(res, out_guid, error);
22802 // Synchronously connects to an endpoint specified by @address and
22803 // sets up the connection so it is in a state to run the client-side
22804 // of the D-Bus authentication conversation.
22806 // This is a synchronous failable function. See
22807 // g_dbus_address_get_stream() for the asynchronous version.
22808 // RETURNS: A #GIOStream or %NULL if @error is set.
22809 // <address>: A valid D-Bus address.
22810 // <out_guid>: %NULL or return location to store the GUID extracted from @address, if any.
22811 // <cancellable>: A #GCancellable or %NULL.
22812 static IOStream* /*new*/ dbus_address_get_stream_sync(char* address, char** out_guid, Cancellable* cancellable, GLib2.Error** error=null) {
22813 return g_dbus_address_get_stream_sync(address, out_guid, cancellable, error);
22817 // Looks up the value of an annotation.
22819 // This cost of this function is O(n) in number of annotations.
22820 // RETURNS: The value or %NULL if not found. Do not free, it is owned by @annotations.
22821 // <annotations>: A %NULL-terminated array of annotations or %NULL.
22822 // <name>: The name of the annotation to look up.
22823 static char* dbus_annotation_info_lookup(DBusAnnotationInfo** annotations, char* name) {
22824 return g_dbus_annotation_info_lookup(annotations, name);
22828 // Creates a D-Bus error name to use for @error. If @error matches
22829 // a registered error (cf. g_dbus_error_register_error()), the corresponding
22830 // D-Bus error name will be returned.
22832 // Otherwise the a name of the form
22833 // <literal>org.gtk.GDBus.UnmappedGError.Quark._ESCAPED_QUARK_NAME.Code_ERROR_CODE</literal>
22834 // will be used. This allows other GDBus applications to map the error
22835 // on the wire back to a #GError using g_dbus_error_new_for_dbus_error().
22837 // This function is typically only used in object mappings to put a
22838 // #GError on the wire. Regular applications should not use it.
22839 // RETURNS: A D-Bus error name (never %NULL). Free with g_free().
22840 // <error>: A #GError.
22841 static char* /*new*/ dbus_error_encode_gerror(GLib2.Error* error) {
22842 return g_dbus_error_encode_gerror(error);
22846 // Gets the D-Bus error name used for @error, if any.
22848 // This function is guaranteed to return a D-Bus error name for all
22849 // #GError<!-- -->s returned from functions handling remote method
22850 // calls (e.g. g_dbus_connection_call_finish()) unless
22851 // g_dbus_error_strip_remote_error() has been used on @error.
22852 // RETURNS: An allocated string or %NULL if the D-Bus error name could not be found. Free with g_free().
22853 // <error>: A #GError.
22854 static char* /*new*/ dbus_error_get_remote_error(GLib2.Error* error) {
22855 return g_dbus_error_get_remote_error(error);
22859 // Checks if @error represents an error received via D-Bus from a remote peer. If so,
22860 // use g_dbus_error_get_remote_error() to get the name of the error.
22862 // %FALSE otherwise.
22863 // RETURNS: %TRUE if @error represents an error from a remote peer,
22864 // <error>: A #GError.
22865 static int dbus_error_is_remote_error(GLib2.Error* error) {
22866 return g_dbus_error_is_remote_error(error);
22870 // Creates a #GError based on the contents of @dbus_error_name and
22871 // @dbus_error_message.
22873 // Errors registered with g_dbus_error_register_error() will be looked
22874 // up using @dbus_error_name and if a match is found, the error domain
22875 // and code is used. Applications can use g_dbus_error_get_remote_error()
22876 // to recover @dbus_error_name.
22878 // If a match against a registered error is not found and the D-Bus
22879 // error name is in a form as returned by g_dbus_error_encode_gerror()
22880 // the error domain and code encoded in the name is used to
22881 // create the #GError. Also, @dbus_error_name is added to the error message
22882 // such that it can be recovered with g_dbus_error_get_remote_error().
22884 // Otherwise, a #GError with the error code %G_IO_ERROR_DBUS_ERROR
22885 // in the #G_IO_ERROR error domain is returned. Also, @dbus_error_name is
22886 // added to the error message such that it can be recovered with
22887 // g_dbus_error_get_remote_error().
22889 // In all three cases, @dbus_error_name can always be recovered from the
22890 // returned #GError using the g_dbus_error_get_remote_error() function
22891 // (unless g_dbus_error_strip_remote_error() hasn't been used on the returned error).
22893 // This function is typically only used in object mappings to prepare
22894 // #GError instances for applications. Regular applications should not use
22895 // it.
22896 // RETURNS: An allocated #GError. Free with g_error_free().
22897 // <dbus_error_name>: D-Bus error name.
22898 // <dbus_error_message>: D-Bus error message.
22899 static GLib2.Error* /*new*/ dbus_error_new_for_dbus_error(char* dbus_error_name, char* dbus_error_message) {
22900 return g_dbus_error_new_for_dbus_error(dbus_error_name, dbus_error_message);
22903 static GLib2.Quark dbus_error_quark() {
22904 return g_dbus_error_quark();
22908 // Creates an association to map between @dbus_error_name and
22909 // #GError<!-- -->s specified by @error_domain and @error_code.
22911 // This is typically done in the routine that returns the #GQuark for
22912 // an error domain.
22914 // exists.
22915 // RETURNS: %TRUE if the association was created, %FALSE if it already
22916 // <error_domain>: A #GQuark for a error domain.
22917 // <error_code>: An error code.
22918 // <dbus_error_name>: A D-Bus error name.
22919 static int dbus_error_register_error(GLib2.Quark error_domain, int error_code, char* dbus_error_name) {
22920 return g_dbus_error_register_error(error_domain, error_code, dbus_error_name);
22924 // Helper function for associating a #GError error domain with D-Bus error names.
22925 // <error_domain_quark_name>: The error domain name.
22926 // <quark_volatile>: A pointer where to store the #GQuark.
22927 // <entries>: A pointer to @num_entries #GDBusErrorEntry struct items.
22928 // <num_entries>: Number of items to register.
22929 static void dbus_error_register_error_domain(char* error_domain_quark_name, size_t* quark_volatile, DBusErrorEntry* entries, uint num_entries) {
22930 g_dbus_error_register_error_domain(error_domain_quark_name, quark_volatile, entries, num_entries);
22934 // Looks for extra information in the error message used to recover
22935 // the D-Bus error name and strips it if found. If stripped, the
22936 // message field in @error will correspond exactly to what was
22937 // received on the wire.
22939 // This is typically used when presenting errors to the end user.
22940 // RETURNS: %TRUE if information was stripped, %FALSE otherwise.
22941 // <error>: A #GError.
22942 static int dbus_error_strip_remote_error(GLib2.Error* error) {
22943 return g_dbus_error_strip_remote_error(error);
22947 // Destroys an association previously set up with g_dbus_error_register_error().
22948 // RETURNS: %TRUE if the association was destroyed, %FALSE if it wasn't found.
22949 // <error_domain>: A #GQuark for a error domain.
22950 // <error_code>: An error code.
22951 // <dbus_error_name>: A D-Bus error name.
22952 static int dbus_error_unregister_error(GLib2.Quark error_domain, int error_code, char* dbus_error_name) {
22953 return g_dbus_error_unregister_error(error_domain, error_code, dbus_error_name);
22957 // Generate a D-Bus GUID that can be used with
22958 // e.g. g_dbus_connection_new().
22960 // See the D-Bus specification regarding what strings are valid D-Bus
22961 // GUID (for example, D-Bus GUIDs are not RFC-4122 compliant).
22962 // RETURNS: A valid D-Bus GUID. Free with g_free().
22963 static char* /*new*/ dbus_generate_guid() {
22964 return g_dbus_generate_guid();
22968 // Converts a #GValue to a #GVariant of the type indicated by the @type parameter.
22970 // The conversion is using the following rules:
22971 // <table frame='all'>
22972 // <title>#GValue / #GVariant conversion rules</title>
22973 // <tgroup cols='2' align='left' colsep='1' rowsep='1'>
22974 // <thead>
22975 // <row>
22976 // <entry>If the #GType for @gvalue is...</entry>
22977 // <entry>... then @type must be</entry>
22978 // </row>
22979 // </thead>
22980 // <tbody>
22981 // <row>
22982 // <entry>#G_TYPE_STRING</entry>
22983 // <entry><link linkend="G-VARIANT-TYPE-STRING:CAPS">'s'</link>, <link linkend="G-VARIANT-TYPE-OBJECT-PATH:CAPS">'o'</link>, <link linkend="G-VARIANT-TYPE-SIGNATURE:CAPS">'g'</link> or <link linkend="G-VARIANT-TYPE-BYTESTRING:CAPS">'ay'</link></entry>
22984 // </row>
22985 // <row>
22986 // <entry>#G_TYPE_STRV</entry>
22987 // <entry><link linkend="G-VARIANT-TYPE-STRING-ARRAY:CAPS">'as'</link>, <link linkend="G-VARIANT-TYPE-OBJECT-PATH-ARRAY:CAPS">'ao'</link> or <link linkend="G-VARIANT-TYPE-BYTESTRING-ARRAY:CAPS">'aay'</link></entry>
22988 // </row>
22989 // <row>
22990 // <entry>#G_TYPE_BOOLEAN</entry>
22991 // <entry><link linkend="G-VARIANT-TYPE-BOOLEAN:CAPS">'b'</link></entry>
22992 // </row>
22993 // <row>
22994 // <entry>#G_TYPE_UCHAR</entry>
22995 // <entry><link linkend="G-VARIANT-TYPE-BYTE:CAPS">'y'</link></entry>
22996 // </row>
22997 // <row>
22998 // <entry>#G_TYPE_INT</entry>
22999 // <entry><link linkend="G-VARIANT-TYPE-INT32:CAPS">'i'</link> or <link linkend="G-VARIANT-TYPE-INT16:CAPS">'n'</link></entry>
23000 // </row>
23001 // <row>
23002 // <entry>#G_TYPE_UINT</entry>
23003 // <entry><link linkend="G-VARIANT-TYPE-UINT32:CAPS">'u'</link> or <link linkend="G-VARIANT-TYPE-UINT16:CAPS">'q'</link></entry>
23004 // </row>
23005 // <row>
23006 // <entry>#G_TYPE_INT64</entry>
23007 // <entry><link linkend="G-VARIANT-TYPE-INT64:CAPS">'x'</link></entry>
23008 // </row>
23009 // <row>
23010 // <entry>#G_TYPE_UINT64</entry>
23011 // <entry><link linkend="G-VARIANT-TYPE-UINT64:CAPS">'t'</link></entry>
23012 // </row>
23013 // <row>
23014 // <entry>#G_TYPE_DOUBLE</entry>
23015 // <entry><link linkend="G-VARIANT-TYPE-DOUBLE:CAPS">'d'</link></entry>
23016 // </row>
23017 // <row>
23018 // <entry>#G_TYPE_VARIANT</entry>
23019 // <entry>Any #GVariantType</entry>
23020 // </row>
23021 // </tbody>
23022 // </tgroup>
23023 // </table>
23024 // This can fail if e.g. @gvalue is of type #G_TYPE_STRING and @type
23025 // is <link linkend="G-VARIANT-TYPE-INT32:CAPS">'i'</link>. It will
23026 // also fail for any #GType (including e.g. #G_TYPE_OBJECT and
23027 // #G_TYPE_BOXED derived-types) not in the table above.
23029 // Note that if @gvalue is of type #G_TYPE_VARIANT and its value is
23030 // %NULL, the <emphasis>empty</emphasis> #GVariant instance (never
23031 // %NULL) for @type is returned (e.g. 0 for scalar types, the empty
23032 // string for string types, <literal>'/'</literal> for object path
23033 // types, the empty array for any array type and so on).
23035 // See the g_dbus_gvariant_to_gvalue() function for how to convert a
23036 // #GVariant to a #GValue.
23038 // @type holding the data from @gvalue or %NULL in case of
23039 // failure. Free with g_variant_unref().
23040 // RETURNS: A #GVariant (never floating) of #GVariantType
23041 // <gvalue>: A #GValue to convert to a #GVariant.
23042 // <type>: A #GVariantType.
23043 static GLib2.Variant* /*new*/ dbus_gvalue_to_gvariant(GObject2.Value* gvalue, GLib2.VariantType* type) {
23044 return g_dbus_gvalue_to_gvariant(gvalue, type);
23048 // Converts a #GVariant to a #GValue. If @value is floating, it is consumed.
23050 // The rules specified in the g_dbus_gvalue_to_gvariant() function are
23051 // used - this function is essentially its reverse form.
23053 // The conversion never fails - a valid #GValue is always returned in
23054 // @out_gvalue.
23055 // <value>: A #GVariant.
23056 // <out_gvalue>: Return location pointing to a zero-filled (uninitialized) #GValue.
23057 static void dbus_gvariant_to_gvalue(GLib2.Variant* value, GObject2.Value* out_gvalue) {
23058 g_dbus_gvariant_to_gvalue(value, out_gvalue);
23062 // Checks if @string is a D-Bus address.
23064 // This doesn't check if @string is actually supported by #GDBusServer
23065 // or #GDBusConnection - use g_dbus_is_supported_address() to do more
23066 // checks.
23067 // RETURNS: %TRUE if @string is a valid D-Bus address, %FALSE otherwise.
23068 // <string>: A string.
23069 static int dbus_is_address(char* string_) {
23070 return g_dbus_is_address(string_);
23074 // Checks if @string is a D-Bus GUID.
23076 // See the D-Bus specification regarding what strings are valid D-Bus
23077 // GUID (for example, D-Bus GUIDs are not RFC-4122 compliant).
23078 // RETURNS: %TRUE if @string is a guid, %FALSE otherwise.
23079 // <string>: The string to check.
23080 static int dbus_is_guid(char* string_) {
23081 return g_dbus_is_guid(string_);
23085 // Checks if @string is a valid D-Bus interface name.
23086 // RETURNS: %TRUE if valid, %FALSE otherwise.
23087 // <string>: The string to check.
23088 static int dbus_is_interface_name(char* string_) {
23089 return g_dbus_is_interface_name(string_);
23093 // Checks if @string is a valid D-Bus member (e.g. signal or method) name.
23094 // RETURNS: %TRUE if valid, %FALSE otherwise.
23095 // <string>: The string to check.
23096 static int dbus_is_member_name(char* string_) {
23097 return g_dbus_is_member_name(string_);
23101 // Checks if @string is a valid D-Bus bus name (either unique or well-known).
23102 // RETURNS: %TRUE if valid, %FALSE otherwise.
23103 // <string>: The string to check.
23104 static int dbus_is_name(char* string_) {
23105 return g_dbus_is_name(string_);
23109 // Like g_dbus_is_address() but also checks if the library suppors the
23110 // transports in @string and that key/value pairs for each transport
23111 // are valid.
23113 // supported by this library, %FALSE if @error is set.
23114 // RETURNS: %TRUE if @string is a valid D-Bus address that is
23115 // <string>: A string.
23116 static int dbus_is_supported_address(char* string_, GLib2.Error** error=null) {
23117 return g_dbus_is_supported_address(string_, error);
23121 // Checks if @string is a valid D-Bus unique bus name.
23122 // RETURNS: %TRUE if valid, %FALSE otherwise.
23123 // <string>: The string to check.
23124 static int dbus_is_unique_name(char* string_) {
23125 return g_dbus_is_unique_name(string_);
23129 // Creates a hash value for a #GFile.
23131 // This call does no blocking i/o.
23133 // integer that can be used as hash value for the #GFile.
23134 // This function is intended for easily hashing a #GFile to
23135 // add to a #GHashTable or similar data structure.
23136 // RETURNS: 0 if @file is not a valid #GFile, otherwise an
23137 // <file>: #gconstpointer to a #GFile.
23138 static uint file_hash(const(void)* file) {
23139 return g_file_hash(file);
23143 // Creates a #GFile with the given argument from the command line. The value of
23144 // @arg can be either a URI, an absolute path or a relative path resolved
23145 // relative to the current working directory.
23146 // This operation never fails, but the returned object might not support any
23147 // I/O operation if @arg points to a malformed path.
23148 // RETURNS: a new #GFile.
23149 // <arg>: a command line string.
23150 static File* /*new*/ file_new_for_commandline_arg(char* arg) {
23151 return g_file_new_for_commandline_arg(arg);
23155 // Constructs a #GFile for a given path. This operation never
23156 // fails, but the returned object might not support any I/O
23157 // operation if @path is malformed.
23158 // RETURNS: a new #GFile for the given @path.
23159 // <path>: a string containing a relative or absolute path. The string must be encoded in the glib filename encoding.
23160 static File* /*new*/ file_new_for_path(char* path) {
23161 return g_file_new_for_path(path);
23165 // Constructs a #GFile for a given URI. This operation never
23166 // fails, but the returned object might not support any I/O
23167 // operation if @uri is malformed or if the uri type is
23168 // not supported.
23169 // RETURNS: a #GFile for the given @uri.
23170 // <uri>: a UTF8 string containing a URI.
23171 static File* /*new*/ file_new_for_uri(char* uri) {
23172 return g_file_new_for_uri(uri);
23176 // Constructs a #GFile with the given @parse_name (i.e. something given by g_file_get_parse_name()).
23177 // This operation never fails, but the returned object might not support any I/O
23178 // operation if the @parse_name cannot be parsed.
23179 // RETURNS: a new #GFile.
23180 // <parse_name>: a file name or path to be parsed.
23181 static File* /*new*/ file_parse_name(char* parse_name) {
23182 return g_file_parse_name(parse_name);
23186 // Gets a hash for an icon.
23188 // use in a #GHashTable or similar data structure.
23189 // RETURNS: a #guint containing a hash for the @icon, suitable for
23190 // <icon>: #gconstpointer to an icon object.
23191 static uint icon_hash(const(void)* icon) {
23192 return g_icon_hash(icon);
23196 // Generate a #GIcon instance from @str. This function can fail if
23197 // @str is not valid - see g_icon_to_string() for discussion.
23199 // If your application or library provides one or more #GIcon
23200 // implementations you need to ensure that each #GType is registered
23201 // with the type system prior to calling g_icon_new_for_string().
23203 // interface or %NULL if @error is set.
23204 // RETURNS: An object implementing the #GIcon
23205 // <str>: A string obtained via g_icon_to_string().
23206 static Icon* /*new*/ icon_new_for_string(char* str, GLib2.Error** error=null) {
23207 return g_icon_new_for_string(str, error);
23211 // Helper function for constructing #GInitiable object. This is
23212 // similar to g_object_newv() but also initializes the object
23213 // and returns %NULL, setting an error on failure.
23214 // RETURNS: a newly allocated #GObject, or %NULL on error
23215 // <object_type>: a #GType supporting #GInitable.
23216 // <n_parameters>: the number of parameters in @parameters
23217 // <parameters>: the parameters to use to construct the object
23218 // <cancellable>: optional #GCancellable object, %NULL to ignore.
23219 static void* /*new*/ initable_newv(Type object_type, uint n_parameters, GObject2.Parameter* parameters, Cancellable* cancellable, GLib2.Error** error=null) {
23220 return g_initable_newv(object_type, n_parameters, parameters, cancellable, error);
23224 // Converts errno.h error codes into GIO error codes.
23225 // RETURNS: #GIOErrorEnum value for the given errno.h error number.
23226 // <err_no>: Error number as defined in errno.h.
23227 static IOErrorEnum io_error_from_errno(int err_no) {
23228 return g_io_error_from_errno(err_no);
23232 // Gets the GIO Error Quark.
23233 // RETURNS: a #GQuark.
23234 static GLib2.Quark io_error_quark() {
23235 return g_io_error_quark();
23239 // Gets the type associated with @extension.
23240 // RETURNS: the type of @extension
23241 // <extension>: a #GIOExtension
23242 static Type io_extension_get_type(IOExtension* extension) {
23243 return g_io_extension_get_type(extension);
23247 // Registers @type as extension for the extension point with name
23248 // @extension_point_name.
23250 // If @type has already been registered as an extension for this
23251 // extension point, the existing #GIOExtension object is returned.
23252 // RETURNS: a #GIOExtension object for #GType
23253 // <extension_point_name>: the name of the extension point
23254 // <type>: the #GType to register as extension
23255 // <extension_name>: the name for the extension
23256 // <priority>: the priority for the extension
23257 static IOExtension* io_extension_point_implement(char* extension_point_name, Type type, char* extension_name, int priority) {
23258 return g_io_extension_point_implement(extension_point_name, type, extension_name, priority);
23262 // Looks up an existing extension point.
23264 // is no registered extension point with the given name.
23265 // RETURNS: the #GIOExtensionPoint, or %NULL if there
23266 // <name>: the name of the extension point
23267 static IOExtensionPoint* io_extension_point_lookup(char* name) {
23268 return g_io_extension_point_lookup(name);
23272 // Registers an extension point.
23274 // owned by GIO and should not be freed.
23275 // RETURNS: the new #GIOExtensionPoint. This object is
23276 // <name>: The name of the extension point
23277 static IOExtensionPoint* io_extension_point_register(char* name) {
23278 return g_io_extension_point_register(name);
23282 // Loads all the modules in the specified directory.
23284 // If don't require all modules to be initialized (and thus registering
23285 // all gtypes) then you can use g_io_modules_scan_all_in_directory()
23286 // which allows delayed/lazy loading of modules.
23288 // from the directory,
23289 // All the modules are loaded into memory, if you want to
23290 // unload them (enabling on-demand loading) you must call
23291 // g_type_module_unuse() on all the modules. Free the list
23292 // with g_list_free().
23293 // RETURNS: a list of #GIOModules loaded
23294 // <dirname>: pathname for a directory containing modules to load.
23295 static GLib2.List* /*new*/ io_modules_load_all_in_directory(char* dirname) {
23296 return g_io_modules_load_all_in_directory(dirname);
23300 // Loads all the modules in the specified directory.
23302 // If don't require all modules to be initialized (and thus registering
23303 // all gtypes) then you can use g_io_modules_scan_all_in_directory()
23304 // which allows delayed/lazy loading of modules.
23306 // from the directory,
23307 // All the modules are loaded into memory, if you want to
23308 // unload them (enabling on-demand loading) you must call
23309 // g_type_module_unuse() on all the modules. Free the list
23310 // with g_list_free().
23311 // RETURNS: a list of #GIOModules loaded
23312 // <dirname>: pathname for a directory containing modules to load.
23313 // <scope>: a scope to use when scanning the modules.
23314 static GLib2.List* /*new*/ io_modules_load_all_in_directory_with_scope(char* dirname, IOModuleScope* scope_) {
23315 return g_io_modules_load_all_in_directory_with_scope(dirname, scope_);
23319 // Scans all the modules in the specified directory, ensuring that
23320 // any extension point implemented by a module is registered.
23322 // This may not actually load and initialize all the types in each
23323 // module, some modules may be lazily loaded and initialized when
23324 // an extension point it implementes is used with e.g.
23325 // g_io_extension_point_get_extensions() or
23326 // g_io_extension_point_get_extension_by_name().
23328 // If you need to guarantee that all types are loaded in all the modules,
23329 // use g_io_modules_load_all_in_directory().
23330 // <dirname>: pathname for a directory containing modules to scan.
23331 static void io_modules_scan_all_in_directory(char* dirname) {
23332 g_io_modules_scan_all_in_directory(dirname);
23336 // Scans all the modules in the specified directory, ensuring that
23337 // any extension point implemented by a module is registered.
23339 // This may not actually load and initialize all the types in each
23340 // module, some modules may be lazily loaded and initialized when
23341 // an extension point it implementes is used with e.g.
23342 // g_io_extension_point_get_extensions() or
23343 // g_io_extension_point_get_extension_by_name().
23345 // If you need to guarantee that all types are loaded in all the modules,
23346 // use g_io_modules_load_all_in_directory().
23347 // <dirname>: pathname for a directory containing modules to scan.
23348 // <scope>: a scope to use when scanning the modules
23349 static void io_modules_scan_all_in_directory_with_scope(char* dirname, IOModuleScope* scope_) {
23350 g_io_modules_scan_all_in_directory_with_scope(dirname, scope_);
23354 // Cancels all cancellable I/O jobs.
23356 // A job is cancellable if a #GCancellable was passed into
23357 // g_io_scheduler_push_job().
23358 static void io_scheduler_cancel_all_jobs() {
23359 g_io_scheduler_cancel_all_jobs();
23363 // Schedules the I/O job to run.
23365 // @notify will be called on @user_data after @job_func has returned,
23366 // regardless whether the job was cancelled or has run to completion.
23368 // If @cancellable is not %NULL, it can be used to cancel the I/O job
23369 // by calling g_cancellable_cancel() or by calling
23370 // g_io_scheduler_cancel_all_jobs().
23371 // <job_func>: a #GIOSchedulerJobFunc.
23372 // <user_data>: data to pass to @job_func
23373 // <notify>: a #GDestroyNotify for @user_data, or %NULL
23374 // <io_priority>: the <link linkend="gioscheduler">I/O priority</link> of the request.
23375 // <cancellable>: optional #GCancellable object, %NULL to ignore.
23376 static void io_scheduler_push_job(IOSchedulerJobFunc job_func, void* user_data, GLib2.DestroyNotify notify, int io_priority, Cancellable* cancellable=null) {
23377 g_io_scheduler_push_job(job_func, user_data, notify, io_priority, cancellable);
23381 // Unintrospectable function: pollable_source_new() / g_pollable_source_new()
23382 // Utility method for #GPollableInputStream and #GPollableOutputStream
23383 // implementations. Creates a new #GSource that expects a callback of
23384 // type #GPollableSourceFunc. The new source does not actually do
23385 // anything on its own; use g_source_add_child_source() to add other
23386 // sources to it to cause it to trigger.
23387 // RETURNS: the new #GSource.
23388 // <pollable_stream>: the stream associated with the new source
23389 static GLib2.Source* /*new*/ pollable_source_new(GObject2.Object* pollable_stream) {
23390 return g_pollable_source_new(pollable_stream);
23394 // Lookup "gio-proxy" extension point for a proxy implementation that supports
23395 // specified protocol.
23397 // is not supported.
23398 // RETURNS: return a #GProxy or NULL if protocol
23399 // <protocol>: the proxy protocol name (e.g. http, socks, etc)
23400 static Proxy* /*new*/ proxy_get_default_for_protocol(char* protocol) {
23401 return g_proxy_get_default_for_protocol(protocol);
23405 // Gets the default #GProxyResolver for the system.
23406 // RETURNS: the default #GProxyResolver.
23407 static ProxyResolver* proxy_resolver_get_default() {
23408 return g_proxy_resolver_get_default();
23412 // Gets the #GResolver Error Quark.
23413 // RETURNS: a #GQuark.
23414 static GLib2.Quark resolver_error_quark() {
23415 return g_resolver_error_quark();
23419 // Unintrospectable function: simple_async_report_error_in_idle() / g_simple_async_report_error_in_idle()
23420 // Reports an error in an asynchronous function in an idle function by
23421 // directly setting the contents of the #GAsyncResult with the given error
23422 // information.
23423 // <object>: a #GObject, or %NULL.
23424 // <callback>: a #GAsyncReadyCallback.
23425 // <user_data>: user data passed to @callback.
23426 // <domain>: a #GQuark containing the error domain (usually #G_IO_ERROR).
23427 // <code>: a specific error code.
23428 // <format>: a formatted error reporting string.
23429 alias g_simple_async_report_error_in_idle simple_async_report_error_in_idle; // Variadic
23432 // Reports an error in an idle function. Similar to
23433 // g_simple_async_report_error_in_idle(), but takes a #GError rather
23434 // than building a new one.
23435 // <object>: a #GObject, or %NULL
23436 // <callback>: a #GAsyncReadyCallback.
23437 // <user_data>: user data passed to @callback.
23438 // <error>: the #GError to report
23439 static void simple_async_report_gerror_in_idle(GObject2.Object* object, AsyncReadyCallback callback, void* user_data, GLib2.Error* error) {
23440 g_simple_async_report_gerror_in_idle(object, callback, user_data, error);
23444 // Unintrospectable function: simple_async_report_take_gerror_in_idle() / g_simple_async_report_take_gerror_in_idle()
23445 // Reports an error in an idle function. Similar to
23446 // g_simple_async_report_gerror_in_idle(), but takes over the caller's
23447 // ownership of @error, so the caller does not have to free it any more.
23448 // <object>: a #GObject, or %NULL
23449 // <callback>: a #GAsyncReadyCallback.
23450 // <user_data>: user data passed to @callback.
23451 // <error>: the #GError to report
23452 static void simple_async_report_take_gerror_in_idle(GObject2.Object* object, AsyncReadyCallback callback, void* user_data, GLib2.Error* error) {
23453 g_simple_async_report_take_gerror_in_idle(object, callback, user_data, error);
23457 // Unintrospectable function: srv_target_list_sort() / g_srv_target_list_sort()
23458 // Sorts @targets in place according to the algorithm in RFC 2782.
23459 // RETURNS: the head of the sorted list.
23460 // <targets>: a #GList of #GSrvTarget
23461 static GLib2.List* /*new*/ srv_target_list_sort(GLib2.List* targets) {
23462 return g_srv_target_list_sort(targets);
23466 // Gets the default #GTlsBackend for the system.
23467 // RETURNS: a #GTlsBackend
23468 static TlsBackend* tls_backend_get_default() {
23469 return g_tls_backend_get_default();
23473 // Creates a new #GTlsClientConnection wrapping @base_io_stream (which
23474 // must have pollable input and output streams) which is assumed to
23475 // communicate with the server identified by @server_identity.
23476 // RETURNS: the new #GTlsClientConnection, or %NULL on error
23477 // <base_io_stream>: the #GIOStream to wrap
23478 // <server_identity>: the expected identity of the server
23479 static IOStream* /*new*/ tls_client_connection_new(IOStream* base_io_stream, SocketConnectable* server_identity, GLib2.Error** error=null) {
23480 return g_tls_client_connection_new(base_io_stream, server_identity, error);
23484 // Gets the TLS error quark.
23485 // RETURNS: a #GQuark.
23486 static GLib2.Quark tls_error_quark() {
23487 return g_tls_error_quark();
23491 // Creates a new #GTlsFileDatabase which uses anchor certificate authorities
23492 // in @anchors to verify certificate chains.
23494 // The certificates in @anchors must be PEM encoded.
23495 // RETURNS: the new #GTlsFileDatabase, or %NULL on error
23496 // <anchors>: filename of anchor certificate authorities.
23497 static TlsDatabase* /*new*/ tls_file_database_new(char* anchors, GLib2.Error** error=null) {
23498 return g_tls_file_database_new(anchors, error);
23502 // Creates a new #GTlsServerConnection wrapping @base_io_stream (which
23503 // must have pollable input and output streams).
23504 // RETURNS: the new #GTlsServerConnection, or %NULL on error
23505 // <base_io_stream>: the #GIOStream to wrap
23506 // <certificate>: the default server certificate, or %NULL
23507 static IOStream* /*new*/ tls_server_connection_new(IOStream* base_io_stream, TlsCertificate* certificate, GLib2.Error** error=null) {
23508 return g_tls_server_connection_new(base_io_stream, certificate, error);
23512 // Determines if @mount_path is considered an implementation of the
23513 // OS. This is primarily used for hiding mountable and mounted volumes
23514 // that only are used in the OS and has little to no relevance to the
23515 // casual user.
23517 // of the OS.
23518 // RETURNS: %TRUE if @mount_path is considered an implementation detail
23519 // <mount_path>: a mount path, e.g. <filename>/media/disk</filename> or <filename>/usr</filename>
23520 static int unix_is_mount_path_system_internal(char* mount_path) {
23521 return g_unix_is_mount_path_system_internal(mount_path);
23525 // Unintrospectable function: unix_mount_at() / g_unix_mount_at()
23526 // Gets a #GUnixMountEntry for a given mount path. If @time_read
23527 // is set, it will be filled with a unix timestamp for checking
23528 // if the mounts have changed since with g_unix_mounts_changed_since().
23529 // RETURNS: a #GUnixMountEntry.
23530 // <mount_path>: path for a possible unix mount.
23531 // <time_read>: guint64 to contain a timestamp.
23532 static UnixMountEntry* /*new*/ unix_mount_at(char* mount_path, /*out*/ ulong* time_read=null) {
23533 return g_unix_mount_at(mount_path, time_read);
23537 // Compares two unix mounts.
23539 // or less than @mount2, respectively.
23540 // RETURNS: 1, 0 or -1 if @mount1 is greater than, equal to,
23541 // <mount1>: first #GUnixMountEntry to compare.
23542 // <mount2>: second #GUnixMountEntry to compare.
23543 static int unix_mount_compare(UnixMountEntry* mount1, UnixMountEntry* mount2) {
23544 return g_unix_mount_compare(mount1, mount2);
23548 // Frees a unix mount.
23549 // <mount_entry>: a #GUnixMount.
23550 static void unix_mount_free(UnixMountEntry* mount_entry) {
23551 g_unix_mount_free(mount_entry);
23555 // Gets the device path for a unix mount.
23556 // RETURNS: a string containing the device path.
23557 // <mount_entry>: a #GUnixMount.
23558 static char* unix_mount_get_device_path(UnixMountEntry* mount_entry) {
23559 return g_unix_mount_get_device_path(mount_entry);
23563 // Gets the filesystem type for the unix mount.
23564 // RETURNS: a string containing the file system type.
23565 // <mount_entry>: a #GUnixMount.
23566 static char* unix_mount_get_fs_type(UnixMountEntry* mount_entry) {
23567 return g_unix_mount_get_fs_type(mount_entry);
23571 // Gets the mount path for a unix mount.
23572 // RETURNS: the mount path for @mount_entry.
23573 // <mount_entry>: input #GUnixMountEntry to get the mount path for.
23574 static char* unix_mount_get_mount_path(UnixMountEntry* mount_entry) {
23575 return g_unix_mount_get_mount_path(mount_entry);
23579 // Guesses whether a Unix mount can be ejected.
23580 // RETURNS: %TRUE if @mount_entry is deemed to be ejectable.
23581 // <mount_entry>: a #GUnixMountEntry
23582 static int unix_mount_guess_can_eject(UnixMountEntry* mount_entry) {
23583 return g_unix_mount_guess_can_eject(mount_entry);
23587 // Guesses the icon of a Unix mount.
23588 // RETURNS: a #GIcon
23589 // <mount_entry>: a #GUnixMountEntry
23590 static Icon* /*new*/ unix_mount_guess_icon(UnixMountEntry* mount_entry) {
23591 return g_unix_mount_guess_icon(mount_entry);
23595 // Guesses the name of a Unix mount.
23596 // The result is a translated string.
23598 // be freed with g_free()
23599 // RETURNS: A newly allocated string that must
23600 // <mount_entry>: a #GUnixMountEntry
23601 static char* /*new*/ unix_mount_guess_name(UnixMountEntry* mount_entry) {
23602 return g_unix_mount_guess_name(mount_entry);
23606 // Guesses whether a Unix mount should be displayed in the UI.
23607 // RETURNS: %TRUE if @mount_entry is deemed to be displayable.
23608 // <mount_entry>: a #GUnixMountEntry
23609 static int unix_mount_guess_should_display(UnixMountEntry* mount_entry) {
23610 return g_unix_mount_guess_should_display(mount_entry);
23614 // Checks if a unix mount is mounted read only.
23615 // RETURNS: %TRUE if @mount_entry is read only.
23616 // <mount_entry>: a #GUnixMount.
23617 static int unix_mount_is_readonly(UnixMountEntry* mount_entry) {
23618 return g_unix_mount_is_readonly(mount_entry);
23622 // Checks if a unix mount is a system path.
23623 // RETURNS: %TRUE if the unix mount is for a system path.
23624 // <mount_entry>: a #GUnixMount.
23625 static int unix_mount_is_system_internal(UnixMountEntry* mount_entry) {
23626 return g_unix_mount_is_system_internal(mount_entry);
23630 // Checks if the unix mount points have changed since a given unix time.
23631 // RETURNS: %TRUE if the mount points have changed since @time.
23632 // <time>: guint64 to contain a timestamp.
23633 static int unix_mount_points_changed_since(ulong time) {
23634 return g_unix_mount_points_changed_since(time);
23638 // Unintrospectable function: unix_mount_points_get() / g_unix_mount_points_get()
23639 // Gets a #GList of #GUnixMountPoint containing the unix mount points.
23640 // If @time_read is set, it will be filled with the mount timestamp,
23641 // allowing for checking if the mounts have changed with
23642 // g_unix_mount_points_changed_since().
23644 // a #GList of the UNIX mountpoints.
23645 // <time_read>: guint64 to contain a timestamp.
23646 static GLib2.List* /*new*/ unix_mount_points_get(/*out*/ ulong* time_read=null) {
23647 return g_unix_mount_points_get(time_read);
23651 // Checks if the unix mounts have changed since a given unix time.
23652 // RETURNS: %TRUE if the mounts have changed since @time.
23653 // <time>: guint64 to contain a timestamp.
23654 static int unix_mounts_changed_since(ulong time) {
23655 return g_unix_mounts_changed_since(time);
23659 // Unintrospectable function: unix_mounts_get() / g_unix_mounts_get()
23660 // Gets a #GList of #GUnixMountEntry containing the unix mounts.
23661 // If @time_read is set, it will be filled with the mount
23662 // timestamp, allowing for checking if the mounts have changed
23663 // with g_unix_mounts_changed_since().
23665 // a #GList of the UNIX mounts.
23666 // <time_read>: guint64 to contain a timestamp, or %NULL
23667 static GLib2.List* /*new*/ unix_mounts_get(/*out*/ ulong* time_read=null) {
23668 return g_unix_mounts_get(time_read);
23672 // C prototypes:
23674 extern (C) {
23675 void g_action_activate(Action* this_, GLib2.Variant* parameter=null);
23676 void g_action_change_state(Action* this_, GLib2.Variant* value);
23677 int g_action_get_enabled(Action* this_);
23678 char* g_action_get_name(Action* this_);
23679 GLib2.VariantType* g_action_get_parameter_type(Action* this_);
23680 GLib2.Variant* /*new*/ g_action_get_state(Action* this_);
23681 GLib2.Variant* /*new*/ g_action_get_state_hint(Action* this_);
23682 GLib2.VariantType* g_action_get_state_type(Action* this_);
23683 void g_action_group_action_added(ActionGroup* this_, char* action_name);
23684 void g_action_group_action_enabled_changed(ActionGroup* this_, char* action_name, int enabled);
23685 void g_action_group_action_removed(ActionGroup* this_, char* action_name);
23686 void g_action_group_action_state_changed(ActionGroup* this_, char* action_name, GLib2.Variant* state);
23687 void g_action_group_activate_action(ActionGroup* this_, char* action_name, GLib2.Variant* parameter=null);
23688 void g_action_group_change_action_state(ActionGroup* this_, char* action_name, GLib2.Variant* value);
23689 int g_action_group_get_action_enabled(ActionGroup* this_, char* action_name);
23690 GLib2.VariantType* g_action_group_get_action_parameter_type(ActionGroup* this_, char* action_name);
23691 GLib2.Variant* /*new*/ g_action_group_get_action_state(ActionGroup* this_, char* action_name);
23692 GLib2.Variant* /*new*/ g_action_group_get_action_state_hint(ActionGroup* this_, char* action_name);
23693 GLib2.VariantType* /*new*/ g_action_group_get_action_state_type(ActionGroup* this_, char* action_name);
23694 int g_action_group_has_action(ActionGroup* this_, char* action_name);
23695 char** /*new*/ g_action_group_list_actions(ActionGroup* this_);
23696 AppInfo* /*new*/ g_app_info_create_from_commandline(char* commandline, char* application_name, AppInfoCreateFlags flags, GLib2.Error** error);
23697 GLib2.List* /*new*/ g_app_info_get_all();
23698 GLib2.List* /*new*/ g_app_info_get_all_for_type(char* content_type);
23699 AppInfo* /*new*/ g_app_info_get_default_for_type(char* content_type, int must_support_uris);
23700 AppInfo* /*new*/ g_app_info_get_default_for_uri_scheme(char* uri_scheme);
23701 GLib2.List* /*new*/ g_app_info_get_fallback_for_type(char* content_type);
23702 GLib2.List* /*new*/ g_app_info_get_recommended_for_type(char* content_type);
23703 int g_app_info_launch_default_for_uri(char* uri, AppLaunchContext* launch_context, GLib2.Error** error);
23704 void g_app_info_reset_type_associations(char* content_type);
23705 int g_app_info_add_supports_type(AppInfo* this_, char* content_type, GLib2.Error** error);
23706 int g_app_info_can_delete(AppInfo* this_);
23707 int g_app_info_can_remove_supports_type(AppInfo* this_);
23708 int g_app_info_delete(AppInfo* this_);
23709 AppInfo* /*new*/ g_app_info_dup(AppInfo* this_);
23710 int g_app_info_equal(AppInfo* this_, AppInfo* appinfo2);
23711 char* g_app_info_get_commandline(AppInfo* this_);
23712 char* g_app_info_get_description(AppInfo* this_);
23713 char* g_app_info_get_display_name(AppInfo* this_);
23714 char* g_app_info_get_executable(AppInfo* this_);
23715 Icon* g_app_info_get_icon(AppInfo* this_);
23716 char* g_app_info_get_id(AppInfo* this_);
23717 char* g_app_info_get_name(AppInfo* this_);
23718 int g_app_info_launch(AppInfo* this_, GLib2.List* files, AppLaunchContext* launch_context, GLib2.Error** error);
23719 int g_app_info_launch_uris(AppInfo* this_, GLib2.List* uris, AppLaunchContext* launch_context, GLib2.Error** error);
23720 int g_app_info_remove_supports_type(AppInfo* this_, char* content_type, GLib2.Error** error);
23721 int g_app_info_set_as_default_for_extension(AppInfo* this_, char* extension, GLib2.Error** error);
23722 int g_app_info_set_as_default_for_type(AppInfo* this_, char* content_type, GLib2.Error** error);
23723 int g_app_info_set_as_last_used_for_type(AppInfo* this_, char* content_type, GLib2.Error** error);
23724 int g_app_info_should_show(AppInfo* this_);
23725 int g_app_info_supports_files(AppInfo* this_);
23726 int g_app_info_supports_uris(AppInfo* this_);
23727 AppLaunchContext* /*new*/ g_app_launch_context_new();
23728 char* /*new*/ g_app_launch_context_get_display(AppLaunchContext* this_, AppInfo* info, GLib2.List* files);
23729 char* /*new*/ g_app_launch_context_get_startup_notify_id(AppLaunchContext* this_, AppInfo* info, GLib2.List* files);
23730 void g_app_launch_context_launch_failed(AppLaunchContext* this_, char* startup_notify_id);
23731 Application* /*new*/ g_application_new(char* application_id, ApplicationFlags flags);
23732 int g_application_id_is_valid(char* application_id);
23733 void g_application_activate(Application* this_);
23734 char* g_application_get_application_id(Application* this_);
23735 ApplicationFlags g_application_get_flags(Application* this_);
23736 uint g_application_get_inactivity_timeout(Application* this_);
23737 int g_application_get_is_registered(Application* this_);
23738 int g_application_get_is_remote(Application* this_);
23739 void g_application_hold(Application* this_);
23740 void g_application_open(Application* this_, File** files, int n_files, char* hint);
23741 int g_application_register(Application* this_, Cancellable* cancellable, GLib2.Error** error);
23742 void g_application_release(Application* this_);
23743 int g_application_run(Application* this_, int argc, char** argv=null);
23744 void g_application_set_action_group(Application* this_, ActionGroup* action_group=null);
23745 void g_application_set_application_id(Application* this_, char* application_id);
23746 void g_application_set_flags(Application* this_, ApplicationFlags flags);
23747 void g_application_set_inactivity_timeout(Application* this_, uint inactivity_timeout);
23748 char** /*new*/ g_application_command_line_get_arguments(ApplicationCommandLine* this_, /*out*/ int* argc);
23749 char* g_application_command_line_get_cwd(ApplicationCommandLine* this_);
23750 char** g_application_command_line_get_environ(ApplicationCommandLine* this_);
23751 int g_application_command_line_get_exit_status(ApplicationCommandLine* this_);
23752 int g_application_command_line_get_is_remote(ApplicationCommandLine* this_);
23753 GLib2.Variant* /*new*/ g_application_command_line_get_platform_data(ApplicationCommandLine* this_);
23754 char* g_application_command_line_getenv(ApplicationCommandLine* this_, char* name);
23755 void g_application_command_line_print(ApplicationCommandLine* this_, char* format, ...);
23756 void g_application_command_line_printerr(ApplicationCommandLine* this_, char* format, ...);
23757 void g_application_command_line_set_exit_status(ApplicationCommandLine* this_, int exit_status);
23758 void g_async_initable_new_async(Type object_type, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data, char* first_property_name, ...);
23759 void g_async_initable_new_valist_async(Type object_type, char* first_property_name, va_list var_args, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23760 void g_async_initable_newv_async(Type object_type, uint n_parameters, GObject2.Parameter* parameters, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23761 void g_async_initable_init_async(AsyncInitable* this_, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23762 int g_async_initable_init_finish(AsyncInitable* this_, AsyncResult* res, GLib2.Error** error);
23763 GObject2.Object* /*new*/ g_async_initable_new_finish(AsyncInitable* this_, AsyncResult* res, GLib2.Error** error);
23764 GObject2.Object* /*new*/ g_async_result_get_source_object(AsyncResult* this_);
23765 void* /*new*/ g_async_result_get_user_data(AsyncResult* this_);
23766 BufferedInputStream* /*new*/ g_buffered_input_stream_new(InputStream* base_stream);
23767 BufferedInputStream* /*new*/ g_buffered_input_stream_new_sized(InputStream* base_stream, size_t size);
23768 ssize_t g_buffered_input_stream_fill(BufferedInputStream* this_, ssize_t count, Cancellable* cancellable, GLib2.Error** error);
23769 void g_buffered_input_stream_fill_async(BufferedInputStream* this_, ssize_t count, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23770 ssize_t g_buffered_input_stream_fill_finish(BufferedInputStream* this_, AsyncResult* result, GLib2.Error** error);
23771 size_t g_buffered_input_stream_get_available(BufferedInputStream* this_);
23772 size_t g_buffered_input_stream_get_buffer_size(BufferedInputStream* this_);
23773 size_t g_buffered_input_stream_peek(BufferedInputStream* this_, void* buffer, size_t offset, size_t count);
23774 ubyte* g_buffered_input_stream_peek_buffer(BufferedInputStream* this_, /*out*/ size_t* count);
23775 int g_buffered_input_stream_read_byte(BufferedInputStream* this_, Cancellable* cancellable, GLib2.Error** error);
23776 void g_buffered_input_stream_set_buffer_size(BufferedInputStream* this_, size_t size);
23777 BufferedOutputStream* /*new*/ g_buffered_output_stream_new(OutputStream* base_stream);
23778 BufferedOutputStream* /*new*/ g_buffered_output_stream_new_sized(OutputStream* base_stream, size_t size);
23779 int g_buffered_output_stream_get_auto_grow(BufferedOutputStream* this_);
23780 size_t g_buffered_output_stream_get_buffer_size(BufferedOutputStream* this_);
23781 void g_buffered_output_stream_set_auto_grow(BufferedOutputStream* this_, int auto_grow);
23782 void g_buffered_output_stream_set_buffer_size(BufferedOutputStream* this_, size_t size);
23783 Cancellable* /*new*/ g_cancellable_new();
23784 Cancellable* g_cancellable_get_current();
23785 void g_cancellable_cancel(Cancellable* this_);
23786 c_ulong g_cancellable_connect(Cancellable* this_, GObject2.Callback callback, void* data, GLib2.DestroyNotify data_destroy_func);
23787 void g_cancellable_disconnect(Cancellable* this_, c_ulong handler_id);
23788 int g_cancellable_get_fd(Cancellable* this_);
23789 int g_cancellable_is_cancelled(Cancellable* this_);
23790 int g_cancellable_make_pollfd(Cancellable* this_, GLib2.PollFD* pollfd);
23791 void g_cancellable_pop_current(Cancellable* this_);
23792 void g_cancellable_push_current(Cancellable* this_);
23793 void g_cancellable_release_fd(Cancellable* this_);
23794 void g_cancellable_reset(Cancellable* this_);
23795 int g_cancellable_set_error_if_cancelled(Cancellable* this_, GLib2.Error** error);
23796 GLib2.Source* /*new*/ g_cancellable_source_new(Cancellable* this_);
23797 CharsetConverter* /*new*/ g_charset_converter_new(char* to_charset, char* from_charset, GLib2.Error** error);
23798 uint g_charset_converter_get_num_fallbacks(CharsetConverter* this_);
23799 int g_charset_converter_get_use_fallback(CharsetConverter* this_);
23800 void g_charset_converter_set_use_fallback(CharsetConverter* this_, int use_fallback);
23801 ConverterResult g_converter_convert(Converter* this_, ubyte* inbuf, size_t inbuf_size, void* outbuf, size_t outbuf_size, ConverterFlags flags, /*out*/ size_t* bytes_read, /*out*/ size_t* bytes_written, GLib2.Error** error);
23802 void g_converter_reset(Converter* this_);
23803 ConverterInputStream* /*new*/ g_converter_input_stream_new(InputStream* base_stream, Converter* converter);
23804 Converter* g_converter_input_stream_get_converter(ConverterInputStream* this_);
23805 ConverterOutputStream* /*new*/ g_converter_output_stream_new(OutputStream* base_stream, Converter* converter);
23806 Converter* g_converter_output_stream_get_converter(ConverterOutputStream* this_);
23807 Credentials* /*new*/ g_credentials_new();
23808 void* g_credentials_get_native(Credentials* this_, CredentialsType native_type);
23809 uint g_credentials_get_unix_user(Credentials* this_, GLib2.Error** error);
23810 int g_credentials_is_same_user(Credentials* this_, Credentials* other_credentials, GLib2.Error** error);
23811 void g_credentials_set_native(Credentials* this_, CredentialsType native_type, void* native);
23812 int g_credentials_set_unix_user(Credentials* this_, uint uid, GLib2.Error** error);
23813 char* /*new*/ g_credentials_to_string(Credentials* this_);
23814 DBusAnnotationInfo* /*new*/ g_dbus_annotation_info_ref(DBusAnnotationInfo* this_);
23815 void g_dbus_annotation_info_unref(DBusAnnotationInfo* this_);
23816 char* g_dbus_annotation_info_lookup(DBusAnnotationInfo** annotations, char* name);
23817 DBusArgInfo* /*new*/ g_dbus_arg_info_ref(DBusArgInfo* this_);
23818 void g_dbus_arg_info_unref(DBusArgInfo* this_);
23819 DBusAuthObserver* /*new*/ g_dbus_auth_observer_new();
23820 int g_dbus_auth_observer_authorize_authenticated_peer(DBusAuthObserver* this_, IOStream* stream, Credentials* credentials);
23821 DBusConnection* /*new*/ g_dbus_connection_new_finish(AsyncResult* res, GLib2.Error** error);
23822 DBusConnection* /*new*/ g_dbus_connection_new_for_address_finish(AsyncResult* res, GLib2.Error** error);
23823 DBusConnection* /*new*/ g_dbus_connection_new_for_address_sync(char* address, DBusConnectionFlags flags, DBusAuthObserver* observer, Cancellable* cancellable, GLib2.Error** error);
23824 DBusConnection* /*new*/ g_dbus_connection_new_sync(IOStream* stream, char* guid, DBusConnectionFlags flags, DBusAuthObserver* observer, Cancellable* cancellable, GLib2.Error** error);
23825 void g_dbus_connection_new(IOStream* stream, char* guid, DBusConnectionFlags flags, DBusAuthObserver* observer, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23826 void g_dbus_connection_new_for_address(char* address, DBusConnectionFlags flags, DBusAuthObserver* observer, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23827 uint g_dbus_connection_add_filter(DBusConnection* this_, DBusMessageFilterFunction filter_function, void* user_data, GLib2.DestroyNotify user_data_free_func);
23828 void g_dbus_connection_call(DBusConnection* this_, char* bus_name, char* object_path, char* interface_name, char* method_name, GLib2.Variant* parameters, GLib2.VariantType* reply_type, DBusCallFlags flags, int timeout_msec, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23829 GLib2.Variant* /*new*/ g_dbus_connection_call_finish(DBusConnection* this_, AsyncResult* res, GLib2.Error** error);
23830 GLib2.Variant* /*new*/ g_dbus_connection_call_sync(DBusConnection* this_, char* bus_name, char* object_path, char* interface_name, char* method_name, GLib2.Variant* parameters, GLib2.VariantType* reply_type, DBusCallFlags flags, int timeout_msec, Cancellable* cancellable, GLib2.Error** error);
23831 void g_dbus_connection_call_with_unix_fd_list(DBusConnection* this_, char* bus_name, char* object_path, char* interface_name, char* method_name, GLib2.Variant* parameters, GLib2.VariantType* reply_type, DBusCallFlags flags, int timeout_msec, UnixFDList* fd_list, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23832 GLib2.Variant* /*new*/ g_dbus_connection_call_with_unix_fd_list_finish(DBusConnection* this_, /*out*/ UnixFDList** out_fd_list, AsyncResult* res, GLib2.Error** error);
23833 GLib2.Variant* /*new*/ g_dbus_connection_call_with_unix_fd_list_sync(DBusConnection* this_, char* bus_name, char* object_path, char* interface_name, char* method_name, GLib2.Variant* parameters, GLib2.VariantType* reply_type, DBusCallFlags flags, int timeout_msec, UnixFDList* fd_list, /*out*/ UnixFDList** out_fd_list, Cancellable* cancellable, GLib2.Error** error);
23834 void g_dbus_connection_close(DBusConnection* this_, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23835 int g_dbus_connection_close_finish(DBusConnection* this_, AsyncResult* res, GLib2.Error** error);
23836 int g_dbus_connection_close_sync(DBusConnection* this_, Cancellable* cancellable, GLib2.Error** error);
23837 int g_dbus_connection_emit_signal(DBusConnection* this_, char* destination_bus_name, char* object_path, char* interface_name, char* signal_name, GLib2.Variant* parameters, GLib2.Error** error);
23838 void g_dbus_connection_flush(DBusConnection* this_, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23839 int g_dbus_connection_flush_finish(DBusConnection* this_, AsyncResult* res, GLib2.Error** error);
23840 int g_dbus_connection_flush_sync(DBusConnection* this_, Cancellable* cancellable, GLib2.Error** error);
23841 DBusCapabilityFlags g_dbus_connection_get_capabilities(DBusConnection* this_);
23842 int g_dbus_connection_get_exit_on_close(DBusConnection* this_);
23843 char* g_dbus_connection_get_guid(DBusConnection* this_);
23844 Credentials* g_dbus_connection_get_peer_credentials(DBusConnection* this_);
23845 IOStream* g_dbus_connection_get_stream(DBusConnection* this_);
23846 char* g_dbus_connection_get_unique_name(DBusConnection* this_);
23847 int g_dbus_connection_is_closed(DBusConnection* this_);
23848 uint g_dbus_connection_register_object(DBusConnection* this_, char* object_path, DBusInterfaceInfo* interface_info, DBusInterfaceVTable* vtable, void* user_data, GLib2.DestroyNotify user_data_free_func, GLib2.Error** error);
23849 uint g_dbus_connection_register_subtree(DBusConnection* this_, char* object_path, DBusSubtreeVTable* vtable, DBusSubtreeFlags flags, void* user_data, GLib2.DestroyNotify user_data_free_func, GLib2.Error** error);
23850 void g_dbus_connection_remove_filter(DBusConnection* this_, uint filter_id);
23851 int g_dbus_connection_send_message(DBusConnection* this_, DBusMessage* message, DBusSendMessageFlags flags, /*out*/ uint* out_serial, GLib2.Error** error);
23852 void g_dbus_connection_send_message_with_reply(DBusConnection* this_, DBusMessage* message, DBusSendMessageFlags flags, int timeout_msec, /*out*/ uint* out_serial, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23853 DBusMessage* /*new*/ g_dbus_connection_send_message_with_reply_finish(DBusConnection* this_, AsyncResult* res, GLib2.Error** error);
23854 DBusMessage* /*new*/ g_dbus_connection_send_message_with_reply_sync(DBusConnection* this_, DBusMessage* message, DBusSendMessageFlags flags, int timeout_msec, /*out*/ uint* out_serial, Cancellable* cancellable, GLib2.Error** error);
23855 void g_dbus_connection_set_exit_on_close(DBusConnection* this_, int exit_on_close);
23856 uint g_dbus_connection_signal_subscribe(DBusConnection* this_, char* sender, char* interface_name, char* member, char* object_path, char* arg0, DBusSignalFlags flags, DBusSignalCallback callback, void* user_data, GLib2.DestroyNotify user_data_free_func=null);
23857 void g_dbus_connection_signal_unsubscribe(DBusConnection* this_, uint subscription_id);
23858 void g_dbus_connection_start_message_processing(DBusConnection* this_);
23859 int g_dbus_connection_unregister_object(DBusConnection* this_, uint registration_id);
23860 int g_dbus_connection_unregister_subtree(DBusConnection* this_, uint registration_id);
23861 DBusInterfaceInfo* g_dbus_interface_get_info(DBusInterface* this_);
23862 DBusObject* g_dbus_interface_get_object(DBusInterface* this_);
23863 void g_dbus_interface_set_object(DBusInterface* this_, DBusObject* object);
23864 void g_dbus_interface_info_cache_build(DBusInterfaceInfo* this_);
23865 void g_dbus_interface_info_cache_release(DBusInterfaceInfo* this_);
23866 void g_dbus_interface_info_generate_xml(DBusInterfaceInfo* this_, uint indent, /*out*/ GLib2.String* string_builder);
23867 DBusMethodInfo* g_dbus_interface_info_lookup_method(DBusInterfaceInfo* this_, char* name);
23868 DBusPropertyInfo* g_dbus_interface_info_lookup_property(DBusInterfaceInfo* this_, char* name);
23869 DBusSignalInfo* g_dbus_interface_info_lookup_signal(DBusInterfaceInfo* this_, char* name);
23870 DBusInterfaceInfo* /*new*/ g_dbus_interface_info_ref(DBusInterfaceInfo* this_);
23871 void g_dbus_interface_info_unref(DBusInterfaceInfo* this_);
23872 int g_dbus_interface_skeleton_export(DBusInterfaceSkeleton* this_, DBusConnection* connection, char* object_path, GLib2.Error** error);
23873 void g_dbus_interface_skeleton_flush(DBusInterfaceSkeleton* this_);
23874 DBusConnection* g_dbus_interface_skeleton_get_connection(DBusInterfaceSkeleton* this_);
23875 DBusInterfaceSkeletonFlags g_dbus_interface_skeleton_get_flags(DBusInterfaceSkeleton* this_);
23876 DBusInterfaceInfo* g_dbus_interface_skeleton_get_info(DBusInterfaceSkeleton* this_);
23877 char* g_dbus_interface_skeleton_get_object_path(DBusInterfaceSkeleton* this_);
23878 GLib2.Variant* /*new*/ g_dbus_interface_skeleton_get_properties(DBusInterfaceSkeleton* this_);
23879 DBusInterfaceVTable* g_dbus_interface_skeleton_get_vtable(DBusInterfaceSkeleton* this_);
23880 void g_dbus_interface_skeleton_set_flags(DBusInterfaceSkeleton* this_, DBusInterfaceSkeletonFlags flags);
23881 void g_dbus_interface_skeleton_unexport(DBusInterfaceSkeleton* this_);
23882 DBusMessage* /*new*/ g_dbus_message_new();
23883 DBusMessage* /*new*/ g_dbus_message_new_from_blob(ubyte* blob, size_t blob_len, DBusCapabilityFlags capabilities, GLib2.Error** error);
23884 DBusMessage* /*new*/ g_dbus_message_new_method_call(char* name, char* path, char* interface_, char* method);
23885 DBusMessage* /*new*/ g_dbus_message_new_signal(char* path, char* interface_, char* signal);
23886 ssize_t g_dbus_message_bytes_needed(ubyte* blob, size_t blob_len, GLib2.Error** error);
23887 DBusMessage* /*new*/ g_dbus_message_copy(DBusMessage* this_, GLib2.Error** error);
23888 char* g_dbus_message_get_arg0(DBusMessage* this_);
23889 GLib2.Variant* /*new*/ g_dbus_message_get_body(DBusMessage* this_);
23890 DBusMessageByteOrder g_dbus_message_get_byte_order(DBusMessage* this_);
23891 char* g_dbus_message_get_destination(DBusMessage* this_);
23892 char* g_dbus_message_get_error_name(DBusMessage* this_);
23893 DBusMessageFlags g_dbus_message_get_flags(DBusMessage* this_);
23894 GLib2.Variant* /*new*/ g_dbus_message_get_header(DBusMessage* this_, DBusMessageHeaderField header_field);
23895 ubyte* g_dbus_message_get_header_fields(DBusMessage* this_);
23896 char* g_dbus_message_get_interface(DBusMessage* this_);
23897 int g_dbus_message_get_locked(DBusMessage* this_);
23898 char* g_dbus_message_get_member(DBusMessage* this_);
23899 DBusMessageType g_dbus_message_get_message_type(DBusMessage* this_);
23900 uint g_dbus_message_get_num_unix_fds(DBusMessage* this_);
23901 char* g_dbus_message_get_path(DBusMessage* this_);
23902 uint g_dbus_message_get_reply_serial(DBusMessage* this_);
23903 char* g_dbus_message_get_sender(DBusMessage* this_);
23904 uint g_dbus_message_get_serial(DBusMessage* this_);
23905 char* g_dbus_message_get_signature(DBusMessage* this_);
23906 UnixFDList* g_dbus_message_get_unix_fd_list(DBusMessage* this_);
23907 void g_dbus_message_lock(DBusMessage* this_);
23908 DBusMessage* /*new*/ g_dbus_message_new_method_error(DBusMessage* this_, char* error_name, char* error_message_format, ...);
23909 DBusMessage* /*new*/ g_dbus_message_new_method_error_literal(DBusMessage* this_, char* error_name, char* error_message);
23910 DBusMessage* /*new*/ g_dbus_message_new_method_error_valist(DBusMessage* this_, char* error_name, char* error_message_format, va_list var_args);
23911 DBusMessage* /*new*/ g_dbus_message_new_method_reply(DBusMessage* this_);
23912 char* /*new*/ g_dbus_message_print(DBusMessage* this_, uint indent);
23913 void g_dbus_message_set_body(DBusMessage* this_, GLib2.Variant* body_);
23914 void g_dbus_message_set_byte_order(DBusMessage* this_, DBusMessageByteOrder byte_order);
23915 void g_dbus_message_set_destination(DBusMessage* this_, char* value);
23916 void g_dbus_message_set_error_name(DBusMessage* this_, char* value);
23917 void g_dbus_message_set_flags(DBusMessage* this_, DBusMessageFlags flags);
23918 void g_dbus_message_set_header(DBusMessage* this_, DBusMessageHeaderField header_field, GLib2.Variant* value);
23919 void g_dbus_message_set_interface(DBusMessage* this_, char* value);
23920 void g_dbus_message_set_member(DBusMessage* this_, char* value);
23921 void g_dbus_message_set_message_type(DBusMessage* this_, DBusMessageType type);
23922 void g_dbus_message_set_num_unix_fds(DBusMessage* this_, uint value);
23923 void g_dbus_message_set_path(DBusMessage* this_, char* value);
23924 void g_dbus_message_set_reply_serial(DBusMessage* this_, uint value);
23925 void g_dbus_message_set_sender(DBusMessage* this_, char* value);
23926 void g_dbus_message_set_serial(DBusMessage* this_, uint serial);
23927 void g_dbus_message_set_signature(DBusMessage* this_, char* value);
23928 void g_dbus_message_set_unix_fd_list(DBusMessage* this_, UnixFDList* fd_list=null);
23929 ubyte* g_dbus_message_to_blob(DBusMessage* this_, size_t* out_size, DBusCapabilityFlags capabilities, GLib2.Error** error);
23930 int g_dbus_message_to_gerror(DBusMessage* this_, GLib2.Error** error);
23931 DBusMethodInfo* /*new*/ g_dbus_method_info_ref(DBusMethodInfo* this_);
23932 void g_dbus_method_info_unref(DBusMethodInfo* this_);
23933 DBusConnection* g_dbus_method_invocation_get_connection(DBusMethodInvocation* this_);
23934 char* g_dbus_method_invocation_get_interface_name(DBusMethodInvocation* this_);
23935 DBusMessage* g_dbus_method_invocation_get_message(DBusMethodInvocation* this_);
23936 DBusMethodInfo* g_dbus_method_invocation_get_method_info(DBusMethodInvocation* this_);
23937 char* g_dbus_method_invocation_get_method_name(DBusMethodInvocation* this_);
23938 char* g_dbus_method_invocation_get_object_path(DBusMethodInvocation* this_);
23939 GLib2.Variant* g_dbus_method_invocation_get_parameters(DBusMethodInvocation* this_);
23940 char* g_dbus_method_invocation_get_sender(DBusMethodInvocation* this_);
23941 void* g_dbus_method_invocation_get_user_data(DBusMethodInvocation* this_);
23942 void g_dbus_method_invocation_return_dbus_error(DBusMethodInvocation* this_, char* error_name, char* error_message);
23943 void g_dbus_method_invocation_return_error(DBusMethodInvocation* this_, GLib2.Quark domain, int code, char* format, ...);
23944 void g_dbus_method_invocation_return_error_literal(DBusMethodInvocation* this_, GLib2.Quark domain, int code, char* message);
23945 void g_dbus_method_invocation_return_error_valist(DBusMethodInvocation* this_, GLib2.Quark domain, int code, char* format, va_list var_args);
23946 void g_dbus_method_invocation_return_gerror(DBusMethodInvocation* this_, GLib2.Error* error);
23947 void g_dbus_method_invocation_return_value(DBusMethodInvocation* this_, GLib2.Variant* parameters=null);
23948 void g_dbus_method_invocation_return_value_with_unix_fd_list(DBusMethodInvocation* this_, GLib2.Variant* parameters=null, UnixFDList* fd_list=null);
23949 void g_dbus_method_invocation_take_error(DBusMethodInvocation* this_, GLib2.Error* error);
23950 DBusNodeInfo* /*new*/ g_dbus_node_info_new_for_xml(char* xml_data, GLib2.Error** error);
23951 void g_dbus_node_info_generate_xml(DBusNodeInfo* this_, uint indent, /*out*/ GLib2.String* string_builder);
23952 DBusInterfaceInfo* g_dbus_node_info_lookup_interface(DBusNodeInfo* this_, char* name);
23953 DBusNodeInfo* /*new*/ g_dbus_node_info_ref(DBusNodeInfo* this_);
23954 void g_dbus_node_info_unref(DBusNodeInfo* this_);
23955 DBusInterface* /*new*/ g_dbus_object_get_interface(DBusObject* this_, char* interface_name);
23956 GLib2.List* /*new*/ g_dbus_object_get_interfaces(DBusObject* this_);
23957 char* g_dbus_object_get_object_path(DBusObject* this_);
23958 DBusInterface* /*new*/ g_dbus_object_manager_get_interface(DBusObjectManager* this_, char* object_path, char* interface_name);
23959 DBusObject* /*new*/ g_dbus_object_manager_get_object(DBusObjectManager* this_, char* object_path);
23960 char* g_dbus_object_manager_get_object_path(DBusObjectManager* this_);
23961 GLib2.List* /*new*/ g_dbus_object_manager_get_objects(DBusObjectManager* this_);
23962 DBusObjectManagerClient* /*new*/ g_dbus_object_manager_client_new_finish(AsyncResult* res, GLib2.Error** error);
23963 DBusObjectManagerClient* /*new*/ g_dbus_object_manager_client_new_for_bus_finish(AsyncResult* res, GLib2.Error** error);
23964 DBusObjectManagerClient* /*new*/ g_dbus_object_manager_client_new_for_bus_sync(BusType bus_type, DBusObjectManagerClientFlags flags, char* name, char* object_path, DBusProxyTypeFunc get_proxy_type_func, void* get_proxy_type_user_data, GLib2.DestroyNotify get_proxy_type_destroy_notify, Cancellable* cancellable, GLib2.Error** error);
23965 DBusObjectManagerClient* /*new*/ g_dbus_object_manager_client_new_sync(DBusConnection* connection, DBusObjectManagerClientFlags flags, char* name, char* object_path, DBusProxyTypeFunc get_proxy_type_func, void* get_proxy_type_user_data, GLib2.DestroyNotify get_proxy_type_destroy_notify, Cancellable* cancellable, GLib2.Error** error);
23966 void g_dbus_object_manager_client_new(DBusConnection* connection, DBusObjectManagerClientFlags flags, char* name, char* object_path, DBusProxyTypeFunc get_proxy_type_func, void* get_proxy_type_user_data, GLib2.DestroyNotify get_proxy_type_destroy_notify, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23967 void g_dbus_object_manager_client_new_for_bus(BusType bus_type, DBusObjectManagerClientFlags flags, char* name, char* object_path, DBusProxyTypeFunc get_proxy_type_func, void* get_proxy_type_user_data, GLib2.DestroyNotify get_proxy_type_destroy_notify, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23968 DBusConnection* g_dbus_object_manager_client_get_connection(DBusObjectManagerClient* this_);
23969 DBusObjectManagerClientFlags g_dbus_object_manager_client_get_flags(DBusObjectManagerClient* this_);
23970 char* g_dbus_object_manager_client_get_name(DBusObjectManagerClient* this_);
23971 char* /*new*/ g_dbus_object_manager_client_get_name_owner(DBusObjectManagerClient* this_);
23972 DBusObjectManagerServer* /*new*/ g_dbus_object_manager_server_new(char* object_path);
23973 void g_dbus_object_manager_server_export(DBusObjectManagerServer* this_, DBusObjectSkeleton* object);
23974 void g_dbus_object_manager_server_export_uniquely(DBusObjectManagerServer* this_, DBusObjectSkeleton* object);
23975 DBusConnection* /*new*/ g_dbus_object_manager_server_get_connection(DBusObjectManagerServer* this_);
23976 void g_dbus_object_manager_server_set_connection(DBusObjectManagerServer* this_, DBusConnection* connection=null);
23977 int g_dbus_object_manager_server_unexport(DBusObjectManagerServer* this_, char* object_path);
23978 DBusObjectProxy* /*new*/ g_dbus_object_proxy_new(DBusConnection* connection, char* object_path);
23979 DBusConnection* g_dbus_object_proxy_get_connection(DBusObjectProxy* this_);
23980 DBusObjectSkeleton* /*new*/ g_dbus_object_skeleton_new(char* object_path);
23981 void g_dbus_object_skeleton_add_interface(DBusObjectSkeleton* this_, DBusInterfaceSkeleton* interface_);
23982 void g_dbus_object_skeleton_flush(DBusObjectSkeleton* this_);
23983 void g_dbus_object_skeleton_remove_interface(DBusObjectSkeleton* this_, DBusInterfaceSkeleton* interface_);
23984 void g_dbus_object_skeleton_remove_interface_by_name(DBusObjectSkeleton* this_, char* interface_name);
23985 void g_dbus_object_skeleton_set_object_path(DBusObjectSkeleton* this_, char* object_path);
23986 DBusPropertyInfo* /*new*/ g_dbus_property_info_ref(DBusPropertyInfo* this_);
23987 void g_dbus_property_info_unref(DBusPropertyInfo* this_);
23988 DBusProxy* /*new*/ g_dbus_proxy_new_finish(AsyncResult* res, GLib2.Error** error);
23989 DBusProxy* /*new*/ g_dbus_proxy_new_for_bus_finish(AsyncResult* res, GLib2.Error** error);
23990 DBusProxy* /*new*/ g_dbus_proxy_new_for_bus_sync(BusType bus_type, DBusProxyFlags flags, DBusInterfaceInfo* info, char* name, char* object_path, char* interface_name, Cancellable* cancellable, GLib2.Error** error);
23991 DBusProxy* /*new*/ g_dbus_proxy_new_sync(DBusConnection* connection, DBusProxyFlags flags, DBusInterfaceInfo* info, char* name, char* object_path, char* interface_name, Cancellable* cancellable, GLib2.Error** error);
23992 void g_dbus_proxy_new(DBusConnection* connection, DBusProxyFlags flags, DBusInterfaceInfo* info, char* name, char* object_path, char* interface_name, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23993 void g_dbus_proxy_new_for_bus(BusType bus_type, DBusProxyFlags flags, DBusInterfaceInfo* info, char* name, char* object_path, char* interface_name, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23994 void g_dbus_proxy_call(DBusProxy* this_, char* method_name, GLib2.Variant* parameters, DBusCallFlags flags, int timeout_msec, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23995 GLib2.Variant* /*new*/ g_dbus_proxy_call_finish(DBusProxy* this_, AsyncResult* res, GLib2.Error** error);
23996 GLib2.Variant* /*new*/ g_dbus_proxy_call_sync(DBusProxy* this_, char* method_name, GLib2.Variant* parameters, DBusCallFlags flags, int timeout_msec, Cancellable* cancellable, GLib2.Error** error);
23997 void g_dbus_proxy_call_with_unix_fd_list(DBusProxy* this_, char* method_name, GLib2.Variant* parameters, DBusCallFlags flags, int timeout_msec, UnixFDList* fd_list, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
23998 GLib2.Variant* /*new*/ g_dbus_proxy_call_with_unix_fd_list_finish(DBusProxy* this_, /*out*/ UnixFDList** out_fd_list, AsyncResult* res, GLib2.Error** error);
23999 GLib2.Variant* /*new*/ g_dbus_proxy_call_with_unix_fd_list_sync(DBusProxy* this_, char* method_name, GLib2.Variant* parameters, DBusCallFlags flags, int timeout_msec, UnixFDList* fd_list, /*out*/ UnixFDList** out_fd_list, Cancellable* cancellable, GLib2.Error** error);
24000 GLib2.Variant* /*new*/ g_dbus_proxy_get_cached_property(DBusProxy* this_, char* property_name);
24001 char** /*new*/ g_dbus_proxy_get_cached_property_names(DBusProxy* this_);
24002 DBusConnection* g_dbus_proxy_get_connection(DBusProxy* this_);
24003 int g_dbus_proxy_get_default_timeout(DBusProxy* this_);
24004 DBusProxyFlags g_dbus_proxy_get_flags(DBusProxy* this_);
24005 DBusInterfaceInfo* /*new*/ g_dbus_proxy_get_interface_info(DBusProxy* this_);
24006 char* g_dbus_proxy_get_interface_name(DBusProxy* this_);
24007 char* g_dbus_proxy_get_name(DBusProxy* this_);
24008 char* /*new*/ g_dbus_proxy_get_name_owner(DBusProxy* this_);
24009 char* g_dbus_proxy_get_object_path(DBusProxy* this_);
24010 void g_dbus_proxy_set_cached_property(DBusProxy* this_, char* property_name, GLib2.Variant* value=null);
24011 void g_dbus_proxy_set_default_timeout(DBusProxy* this_, int timeout_msec);
24012 void g_dbus_proxy_set_interface_info(DBusProxy* this_, DBusInterfaceInfo* info=null);
24013 DBusServer* /*new*/ g_dbus_server_new_sync(char* address, DBusServerFlags flags, char* guid, DBusAuthObserver* observer, Cancellable* cancellable, GLib2.Error** error);
24014 char* g_dbus_server_get_client_address(DBusServer* this_);
24015 DBusServerFlags g_dbus_server_get_flags(DBusServer* this_);
24016 char* g_dbus_server_get_guid(DBusServer* this_);
24017 int g_dbus_server_is_active(DBusServer* this_);
24018 void g_dbus_server_start(DBusServer* this_);
24019 void g_dbus_server_stop(DBusServer* this_);
24020 DBusSignalInfo* /*new*/ g_dbus_signal_info_ref(DBusSignalInfo* this_);
24021 void g_dbus_signal_info_unref(DBusSignalInfo* this_);
24022 DataInputStream* /*new*/ g_data_input_stream_new(InputStream* base_stream);
24023 DataStreamByteOrder g_data_input_stream_get_byte_order(DataInputStream* this_);
24024 DataStreamNewlineType g_data_input_stream_get_newline_type(DataInputStream* this_);
24025 ubyte g_data_input_stream_read_byte(DataInputStream* this_, Cancellable* cancellable, GLib2.Error** error);
24026 short g_data_input_stream_read_int16(DataInputStream* this_, Cancellable* cancellable, GLib2.Error** error);
24027 int g_data_input_stream_read_int32(DataInputStream* this_, Cancellable* cancellable, GLib2.Error** error);
24028 long g_data_input_stream_read_int64(DataInputStream* this_, Cancellable* cancellable, GLib2.Error** error);
24029 ubyte* /*new*/ g_data_input_stream_read_line(DataInputStream* this_, /*out*/ size_t* length, Cancellable* cancellable, GLib2.Error** error);
24030 void g_data_input_stream_read_line_async(DataInputStream* this_, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24031 ubyte* /*new*/ g_data_input_stream_read_line_finish(DataInputStream* this_, AsyncResult* result, /*out*/ size_t* length, GLib2.Error** error);
24032 char* /*new*/ g_data_input_stream_read_line_finish_utf8(DataInputStream* this_, AsyncResult* result, /*out*/ size_t* length, GLib2.Error** error);
24033 char* /*new*/ g_data_input_stream_read_line_utf8(DataInputStream* this_, /*out*/ size_t* length, Cancellable* cancellable, GLib2.Error** error);
24034 ushort g_data_input_stream_read_uint16(DataInputStream* this_, Cancellable* cancellable, GLib2.Error** error);
24035 uint g_data_input_stream_read_uint32(DataInputStream* this_, Cancellable* cancellable, GLib2.Error** error);
24036 ulong g_data_input_stream_read_uint64(DataInputStream* this_, Cancellable* cancellable, GLib2.Error** error);
24037 char* /*new*/ g_data_input_stream_read_until(DataInputStream* this_, char* stop_chars, /*out*/ size_t* length, Cancellable* cancellable, GLib2.Error** error);
24038 void g_data_input_stream_read_until_async(DataInputStream* this_, char* stop_chars, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24039 char* /*new*/ g_data_input_stream_read_until_finish(DataInputStream* this_, AsyncResult* result, /*out*/ size_t* length, GLib2.Error** error);
24040 char* /*new*/ g_data_input_stream_read_upto(DataInputStream* this_, char* stop_chars, ssize_t stop_chars_len, /*out*/ size_t* length, Cancellable* cancellable, GLib2.Error** error);
24041 void g_data_input_stream_read_upto_async(DataInputStream* this_, char* stop_chars, ssize_t stop_chars_len, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24042 char* /*new*/ g_data_input_stream_read_upto_finish(DataInputStream* this_, AsyncResult* result, /*out*/ size_t* length, GLib2.Error** error);
24043 void g_data_input_stream_set_byte_order(DataInputStream* this_, DataStreamByteOrder order);
24044 void g_data_input_stream_set_newline_type(DataInputStream* this_, DataStreamNewlineType type);
24045 DataOutputStream* /*new*/ g_data_output_stream_new(OutputStream* base_stream);
24046 DataStreamByteOrder g_data_output_stream_get_byte_order(DataOutputStream* this_);
24047 int g_data_output_stream_put_byte(DataOutputStream* this_, ubyte data, Cancellable* cancellable, GLib2.Error** error);
24048 int g_data_output_stream_put_int16(DataOutputStream* this_, short data, Cancellable* cancellable, GLib2.Error** error);
24049 int g_data_output_stream_put_int32(DataOutputStream* this_, int data, Cancellable* cancellable, GLib2.Error** error);
24050 int g_data_output_stream_put_int64(DataOutputStream* this_, long data, Cancellable* cancellable, GLib2.Error** error);
24051 int g_data_output_stream_put_string(DataOutputStream* this_, char* str, Cancellable* cancellable, GLib2.Error** error);
24052 int g_data_output_stream_put_uint16(DataOutputStream* this_, ushort data, Cancellable* cancellable, GLib2.Error** error);
24053 int g_data_output_stream_put_uint32(DataOutputStream* this_, uint data, Cancellable* cancellable, GLib2.Error** error);
24054 int g_data_output_stream_put_uint64(DataOutputStream* this_, ulong data, Cancellable* cancellable, GLib2.Error** error);
24055 void g_data_output_stream_set_byte_order(DataOutputStream* this_, DataStreamByteOrder order);
24056 DesktopAppInfo* /*new*/ g_desktop_app_info_new(char* desktop_id);
24057 DesktopAppInfo* /*new*/ g_desktop_app_info_new_from_filename(char* filename);
24058 DesktopAppInfo* /*new*/ g_desktop_app_info_new_from_keyfile(GLib2.KeyFile* key_file);
24059 void g_desktop_app_info_set_desktop_env(char* desktop_env);
24060 char* g_desktop_app_info_get_categories(DesktopAppInfo* this_);
24061 char* g_desktop_app_info_get_filename(DesktopAppInfo* this_);
24062 char* g_desktop_app_info_get_generic_name(DesktopAppInfo* this_);
24063 int g_desktop_app_info_get_is_hidden(DesktopAppInfo* this_);
24064 int g_desktop_app_info_get_nodisplay(DesktopAppInfo* this_);
24065 int g_desktop_app_info_get_show_in(DesktopAppInfo* this_, char* desktop_env);
24066 int g_desktop_app_info_launch_uris_as_manager(DesktopAppInfo* this_, GLib2.List* uris, AppLaunchContext* launch_context, GLib2.SpawnFlags spawn_flags, GLib2.SpawnChildSetupFunc user_setup, void* user_setup_data, DesktopAppLaunchCallback pid_callback, void* pid_callback_data, GLib2.Error** error);
24067 AppInfo* /*new*/ g_desktop_app_info_lookup_get_default_for_uri_scheme(DesktopAppInfoLookup* this_, char* uri_scheme);
24068 int g_drive_can_eject(Drive* this_);
24069 int g_drive_can_poll_for_media(Drive* this_);
24070 int g_drive_can_start(Drive* this_);
24071 int g_drive_can_start_degraded(Drive* this_);
24072 int g_drive_can_stop(Drive* this_);
24073 void g_drive_eject(Drive* this_, MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24074 int g_drive_eject_finish(Drive* this_, AsyncResult* result, GLib2.Error** error);
24075 void g_drive_eject_with_operation(Drive* this_, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24076 int g_drive_eject_with_operation_finish(Drive* this_, AsyncResult* result, GLib2.Error** error);
24077 char** /*new*/ g_drive_enumerate_identifiers(Drive* this_);
24078 Icon* /*new*/ g_drive_get_icon(Drive* this_);
24079 char* /*new*/ g_drive_get_identifier(Drive* this_, char* kind);
24080 char* /*new*/ g_drive_get_name(Drive* this_);
24081 DriveStartStopType g_drive_get_start_stop_type(Drive* this_);
24082 GLib2.List* /*new*/ g_drive_get_volumes(Drive* this_);
24083 int g_drive_has_media(Drive* this_);
24084 int g_drive_has_volumes(Drive* this_);
24085 int g_drive_is_media_check_automatic(Drive* this_);
24086 int g_drive_is_media_removable(Drive* this_);
24087 void g_drive_poll_for_media(Drive* this_, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24088 int g_drive_poll_for_media_finish(Drive* this_, AsyncResult* result, GLib2.Error** error);
24089 void g_drive_start(Drive* this_, DriveStartFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24090 int g_drive_start_finish(Drive* this_, AsyncResult* result, GLib2.Error** error);
24091 void g_drive_stop(Drive* this_, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24092 int g_drive_stop_finish(Drive* this_, AsyncResult* result, GLib2.Error** error);
24093 Emblem* /*new*/ g_emblem_new(Icon* icon);
24094 Emblem* /*new*/ g_emblem_new_with_origin(Icon* icon, EmblemOrigin origin);
24095 Icon* g_emblem_get_icon(Emblem* this_);
24096 EmblemOrigin g_emblem_get_origin(Emblem* this_);
24097 Icon* /*new*/ g_emblemed_icon_new(Icon* icon, Emblem* emblem=null);
24098 void g_emblemed_icon_add_emblem(EmblemedIcon* this_, Emblem* emblem);
24099 void g_emblemed_icon_clear_emblems(EmblemedIcon* this_);
24100 GLib2.List* g_emblemed_icon_get_emblems(EmblemedIcon* this_);
24101 Icon* g_emblemed_icon_get_icon(EmblemedIcon* this_);
24102 uint g_file_hash(const(void)* file);
24103 File* /*new*/ g_file_new_for_commandline_arg(char* arg);
24104 File* /*new*/ g_file_new_for_path(char* path);
24105 File* /*new*/ g_file_new_for_uri(char* uri);
24106 File* /*new*/ g_file_parse_name(char* parse_name);
24107 FileOutputStream* /*new*/ g_file_append_to(File* this_, FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error);
24108 void g_file_append_to_async(File* this_, FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24109 FileOutputStream* /*new*/ g_file_append_to_finish(File* this_, AsyncResult* res, GLib2.Error** error);
24110 int g_file_copy(File* this_, File* destination, FileCopyFlags flags, Cancellable* cancellable, FileProgressCallback progress_callback, void* progress_callback_data, GLib2.Error** error);
24111 void g_file_copy_async(File* this_, File* destination, FileCopyFlags flags, int io_priority, Cancellable* cancellable, FileProgressCallback progress_callback, void* progress_callback_data, AsyncReadyCallback callback, void* user_data);
24112 int g_file_copy_attributes(File* this_, File* destination, FileCopyFlags flags, Cancellable* cancellable, GLib2.Error** error);
24113 int g_file_copy_finish(File* this_, AsyncResult* res, GLib2.Error** error);
24114 FileOutputStream* /*new*/ g_file_create(File* this_, FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error);
24115 void g_file_create_async(File* this_, FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24116 FileOutputStream* /*new*/ g_file_create_finish(File* this_, AsyncResult* res, GLib2.Error** error);
24117 FileIOStream* /*new*/ g_file_create_readwrite(File* this_, FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error);
24118 void g_file_create_readwrite_async(File* this_, FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24119 FileIOStream* /*new*/ g_file_create_readwrite_finish(File* this_, AsyncResult* res, GLib2.Error** error);
24120 int g_file_delete(File* this_, Cancellable* cancellable, GLib2.Error** error);
24121 File* /*new*/ g_file_dup(File* this_);
24122 void g_file_eject_mountable(File* this_, MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24123 int g_file_eject_mountable_finish(File* this_, AsyncResult* result, GLib2.Error** error);
24124 void g_file_eject_mountable_with_operation(File* this_, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24125 int g_file_eject_mountable_with_operation_finish(File* this_, AsyncResult* result, GLib2.Error** error);
24126 FileEnumerator* /*new*/ g_file_enumerate_children(File* this_, char* attributes, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error);
24127 void g_file_enumerate_children_async(File* this_, char* attributes, FileQueryInfoFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24128 FileEnumerator* /*new*/ g_file_enumerate_children_finish(File* this_, AsyncResult* res, GLib2.Error** error);
24129 int g_file_equal(File* this_, File* file2);
24130 Mount* /*new*/ g_file_find_enclosing_mount(File* this_, Cancellable* cancellable, GLib2.Error** error);
24131 void g_file_find_enclosing_mount_async(File* this_, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24132 Mount* /*new*/ g_file_find_enclosing_mount_finish(File* this_, AsyncResult* res, GLib2.Error** error);
24133 char* /*new*/ g_file_get_basename(File* this_);
24134 File* /*new*/ g_file_get_child(File* this_, char* name);
24135 File* /*new*/ g_file_get_child_for_display_name(File* this_, char* display_name, GLib2.Error** error);
24136 File* /*new*/ g_file_get_parent(File* this_);
24137 char* /*new*/ g_file_get_parse_name(File* this_);
24138 char* /*new*/ g_file_get_path(File* this_);
24139 char* /*new*/ g_file_get_relative_path(File* this_, File* descendant);
24140 char* /*new*/ g_file_get_uri(File* this_);
24141 char* /*new*/ g_file_get_uri_scheme(File* this_);
24142 int g_file_has_parent(File* this_, File* parent);
24143 int g_file_has_prefix(File* this_, File* prefix);
24144 int g_file_has_uri_scheme(File* this_, char* uri_scheme);
24145 Icon* /*new*/ g_file_icon_new(File* this_);
24146 int g_file_is_native(File* this_);
24147 int g_file_load_contents(File* this_, Cancellable* cancellable, /*out*/ ubyte** contents, /*out*/ size_t* length, /*out*/ char** etag_out, GLib2.Error** error);
24148 void g_file_load_contents_async(File* this_, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24149 int g_file_load_contents_finish(File* this_, AsyncResult* res, /*out*/ ubyte** contents, /*out*/ size_t* length, /*out*/ char** etag_out, GLib2.Error** error);
24150 void g_file_load_partial_contents_async(File* this_, Cancellable* cancellable, FileReadMoreCallback read_more_callback, AsyncReadyCallback callback, void* user_data);
24151 int g_file_load_partial_contents_finish(File* this_, AsyncResult* res, /*out*/ ubyte** contents, /*out*/ size_t* length, /*out*/ char** etag_out, GLib2.Error** error);
24152 int g_file_make_directory(File* this_, Cancellable* cancellable, GLib2.Error** error);
24153 int g_file_make_directory_with_parents(File* this_, Cancellable* cancellable, GLib2.Error** error);
24154 int g_file_make_symbolic_link(File* this_, char* symlink_value, Cancellable* cancellable, GLib2.Error** error);
24155 FileMonitor* /*new*/ g_file_monitor(File* this_, FileMonitorFlags flags, Cancellable* cancellable, GLib2.Error** error);
24156 FileMonitor* /*new*/ g_file_monitor_directory(File* this_, FileMonitorFlags flags, Cancellable* cancellable, GLib2.Error** error);
24157 FileMonitor* /*new*/ g_file_monitor_file(File* this_, FileMonitorFlags flags, Cancellable* cancellable, GLib2.Error** error);
24158 void g_file_mount_enclosing_volume(File* this_, MountMountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24159 int g_file_mount_enclosing_volume_finish(File* this_, AsyncResult* result, GLib2.Error** error);
24160 void g_file_mount_mountable(File* this_, MountMountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24161 File* /*new*/ g_file_mount_mountable_finish(File* this_, AsyncResult* result, GLib2.Error** error);
24162 int g_file_move(File* this_, File* destination, FileCopyFlags flags, Cancellable* cancellable, FileProgressCallback progress_callback, void* progress_callback_data, GLib2.Error** error);
24163 FileIOStream* /*new*/ g_file_open_readwrite(File* this_, Cancellable* cancellable, GLib2.Error** error);
24164 void g_file_open_readwrite_async(File* this_, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24165 FileIOStream* /*new*/ g_file_open_readwrite_finish(File* this_, AsyncResult* res, GLib2.Error** error);
24166 void g_file_poll_mountable(File* this_, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24167 int g_file_poll_mountable_finish(File* this_, AsyncResult* result, GLib2.Error** error);
24168 AppInfo* /*new*/ g_file_query_default_handler(File* this_, Cancellable* cancellable, GLib2.Error** error);
24169 int g_file_query_exists(File* this_, Cancellable* cancellable=null);
24170 FileType g_file_query_file_type(File* this_, FileQueryInfoFlags flags, Cancellable* cancellable=null);
24171 FileInfo* /*new*/ g_file_query_filesystem_info(File* this_, char* attributes, Cancellable* cancellable, GLib2.Error** error);
24172 void g_file_query_filesystem_info_async(File* this_, char* attributes, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24173 FileInfo* /*new*/ g_file_query_filesystem_info_finish(File* this_, AsyncResult* res, GLib2.Error** error);
24174 FileInfo* /*new*/ g_file_query_info(File* this_, char* attributes, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error);
24175 void g_file_query_info_async(File* this_, char* attributes, FileQueryInfoFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24176 FileInfo* /*new*/ g_file_query_info_finish(File* this_, AsyncResult* res, GLib2.Error** error);
24177 FileAttributeInfoList* /*new*/ g_file_query_settable_attributes(File* this_, Cancellable* cancellable, GLib2.Error** error);
24178 FileAttributeInfoList* /*new*/ g_file_query_writable_namespaces(File* this_, Cancellable* cancellable, GLib2.Error** error);
24179 FileInputStream* /*new*/ g_file_read(File* this_, Cancellable* cancellable, GLib2.Error** error);
24180 void g_file_read_async(File* this_, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24181 FileInputStream* /*new*/ g_file_read_finish(File* this_, AsyncResult* res, GLib2.Error** error);
24182 FileOutputStream* /*new*/ g_file_replace(File* this_, char* etag, int make_backup, FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error);
24183 void g_file_replace_async(File* this_, char* etag, int make_backup, FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24184 int g_file_replace_contents(File* this_, ubyte* contents, size_t length, char* etag, int make_backup, FileCreateFlags flags, /*out*/ char** new_etag, Cancellable* cancellable, GLib2.Error** error);
24185 void g_file_replace_contents_async(File* this_, ubyte* contents, size_t length, char* etag, int make_backup, FileCreateFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24186 int g_file_replace_contents_finish(File* this_, AsyncResult* res, /*out*/ char** new_etag, GLib2.Error** error);
24187 FileOutputStream* /*new*/ g_file_replace_finish(File* this_, AsyncResult* res, GLib2.Error** error);
24188 FileIOStream* /*new*/ g_file_replace_readwrite(File* this_, char* etag, int make_backup, FileCreateFlags flags, Cancellable* cancellable, GLib2.Error** error);
24189 void g_file_replace_readwrite_async(File* this_, char* etag, int make_backup, FileCreateFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24190 FileIOStream* /*new*/ g_file_replace_readwrite_finish(File* this_, AsyncResult* res, GLib2.Error** error);
24191 File* /*new*/ g_file_resolve_relative_path(File* this_, char* relative_path);
24192 int g_file_set_attribute(File* this_, char* attribute, FileAttributeType type, void* value_p, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error);
24193 int g_file_set_attribute_byte_string(File* this_, char* attribute, char* value, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error);
24194 int g_file_set_attribute_int32(File* this_, char* attribute, int value, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error);
24195 int g_file_set_attribute_int64(File* this_, char* attribute, long value, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error);
24196 int g_file_set_attribute_string(File* this_, char* attribute, char* value, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error);
24197 int g_file_set_attribute_uint32(File* this_, char* attribute, uint value, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error);
24198 int g_file_set_attribute_uint64(File* this_, char* attribute, ulong value, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error);
24199 void g_file_set_attributes_async(File* this_, FileInfo* info, FileQueryInfoFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24200 int g_file_set_attributes_finish(File* this_, AsyncResult* result, /*out*/ FileInfo** info, GLib2.Error** error);
24201 int g_file_set_attributes_from_info(File* this_, FileInfo* info, FileQueryInfoFlags flags, Cancellable* cancellable, GLib2.Error** error);
24202 File* /*new*/ g_file_set_display_name(File* this_, char* display_name, Cancellable* cancellable, GLib2.Error** error);
24203 void g_file_set_display_name_async(File* this_, char* display_name, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24204 File* /*new*/ g_file_set_display_name_finish(File* this_, AsyncResult* res, GLib2.Error** error);
24205 void g_file_start_mountable(File* this_, DriveStartFlags flags, MountOperation* start_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24206 int g_file_start_mountable_finish(File* this_, AsyncResult* result, GLib2.Error** error);
24207 void g_file_stop_mountable(File* this_, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24208 int g_file_stop_mountable_finish(File* this_, AsyncResult* result, GLib2.Error** error);
24209 int g_file_supports_thread_contexts(File* this_);
24210 int g_file_trash(File* this_, Cancellable* cancellable, GLib2.Error** error);
24211 void g_file_unmount_mountable(File* this_, MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24212 int g_file_unmount_mountable_finish(File* this_, AsyncResult* result, GLib2.Error** error);
24213 void g_file_unmount_mountable_with_operation(File* this_, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24214 int g_file_unmount_mountable_with_operation_finish(File* this_, AsyncResult* result, GLib2.Error** error);
24215 FileAttributeInfoList* /*new*/ g_file_attribute_info_list_new();
24216 void g_file_attribute_info_list_add(FileAttributeInfoList* this_, char* name, FileAttributeType type, FileAttributeInfoFlags flags);
24217 FileAttributeInfoList* /*new*/ g_file_attribute_info_list_dup(FileAttributeInfoList* this_);
24218 FileAttributeInfo* g_file_attribute_info_list_lookup(FileAttributeInfoList* this_, char* name);
24219 FileAttributeInfoList* /*new*/ g_file_attribute_info_list_ref(FileAttributeInfoList* this_);
24220 void g_file_attribute_info_list_unref(FileAttributeInfoList* this_);
24221 FileAttributeMatcher* /*new*/ g_file_attribute_matcher_new(char* attributes);
24222 int g_file_attribute_matcher_enumerate_namespace(FileAttributeMatcher* this_, char* ns);
24223 char* g_file_attribute_matcher_enumerate_next(FileAttributeMatcher* this_);
24224 int g_file_attribute_matcher_matches(FileAttributeMatcher* this_, char* attribute);
24225 int g_file_attribute_matcher_matches_only(FileAttributeMatcher* this_, char* attribute);
24226 FileAttributeMatcher* /*new*/ g_file_attribute_matcher_ref(FileAttributeMatcher* this_);
24227 void g_file_attribute_matcher_unref(FileAttributeMatcher* this_);
24228 int g_file_descriptor_based_get_fd(FileDescriptorBased* this_);
24229 int g_file_enumerator_close(FileEnumerator* this_, Cancellable* cancellable, GLib2.Error** error);
24230 void g_file_enumerator_close_async(FileEnumerator* this_, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24231 int g_file_enumerator_close_finish(FileEnumerator* this_, AsyncResult* result, GLib2.Error** error);
24232 File* g_file_enumerator_get_container(FileEnumerator* this_);
24233 int g_file_enumerator_has_pending(FileEnumerator* this_);
24234 int g_file_enumerator_is_closed(FileEnumerator* this_);
24235 FileInfo* /*new*/ g_file_enumerator_next_file(FileEnumerator* this_, Cancellable* cancellable, GLib2.Error** error);
24236 void g_file_enumerator_next_files_async(FileEnumerator* this_, int num_files, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24237 GLib2.List* /*new*/ g_file_enumerator_next_files_finish(FileEnumerator* this_, AsyncResult* result, GLib2.Error** error);
24238 void g_file_enumerator_set_pending(FileEnumerator* this_, int pending);
24239 char* /*new*/ g_file_io_stream_get_etag(FileIOStream* this_);
24240 FileInfo* /*new*/ g_file_io_stream_query_info(FileIOStream* this_, char* attributes, Cancellable* cancellable, GLib2.Error** error);
24241 void g_file_io_stream_query_info_async(FileIOStream* this_, char* attributes, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24242 FileInfo* /*new*/ g_file_io_stream_query_info_finish(FileIOStream* this_, AsyncResult* result, GLib2.Error** error);
24243 File* g_file_icon_get_file(FileIcon* this_);
24244 FileInfo* /*new*/ g_file_info_new();
24245 void g_file_info_clear_status(FileInfo* this_);
24246 void g_file_info_copy_into(FileInfo* this_, FileInfo* dest_info);
24247 FileInfo* /*new*/ g_file_info_dup(FileInfo* this_);
24248 char* /*new*/ g_file_info_get_attribute_as_string(FileInfo* this_, char* attribute);
24249 int g_file_info_get_attribute_boolean(FileInfo* this_, char* attribute);
24250 char* g_file_info_get_attribute_byte_string(FileInfo* this_, char* attribute);
24251 int g_file_info_get_attribute_data(FileInfo* this_, char* attribute, /*out*/ FileAttributeType* type=null, /*out*/ void** value_pp=null, /*out*/ FileAttributeStatus* status=null);
24252 int g_file_info_get_attribute_int32(FileInfo* this_, char* attribute);
24253 long g_file_info_get_attribute_int64(FileInfo* this_, char* attribute);
24254 GObject2.Object* g_file_info_get_attribute_object(FileInfo* this_, char* attribute);
24255 FileAttributeStatus g_file_info_get_attribute_status(FileInfo* this_, char* attribute);
24256 char* g_file_info_get_attribute_string(FileInfo* this_, char* attribute);
24257 char** g_file_info_get_attribute_stringv(FileInfo* this_, char* attribute);
24258 FileAttributeType g_file_info_get_attribute_type(FileInfo* this_, char* attribute);
24259 uint g_file_info_get_attribute_uint32(FileInfo* this_, char* attribute);
24260 ulong g_file_info_get_attribute_uint64(FileInfo* this_, char* attribute);
24261 char* g_file_info_get_content_type(FileInfo* this_);
24262 char* g_file_info_get_display_name(FileInfo* this_);
24263 char* g_file_info_get_edit_name(FileInfo* this_);
24264 char* g_file_info_get_etag(FileInfo* this_);
24265 FileType g_file_info_get_file_type(FileInfo* this_);
24266 Icon* g_file_info_get_icon(FileInfo* this_);
24267 int g_file_info_get_is_backup(FileInfo* this_);
24268 int g_file_info_get_is_hidden(FileInfo* this_);
24269 int g_file_info_get_is_symlink(FileInfo* this_);
24270 void g_file_info_get_modification_time(FileInfo* this_, GLib2.TimeVal* result);
24271 char* g_file_info_get_name(FileInfo* this_);
24272 long g_file_info_get_size(FileInfo* this_);
24273 int g_file_info_get_sort_order(FileInfo* this_);
24274 char* g_file_info_get_symlink_target(FileInfo* this_);
24275 int g_file_info_has_attribute(FileInfo* this_, char* attribute);
24276 int g_file_info_has_namespace(FileInfo* this_, char* name_space);
24277 char** /*new*/ g_file_info_list_attributes(FileInfo* this_, char* name_space);
24278 void g_file_info_remove_attribute(FileInfo* this_, char* attribute);
24279 void g_file_info_set_attribute(FileInfo* this_, char* attribute, FileAttributeType type, void* value_p);
24280 void g_file_info_set_attribute_boolean(FileInfo* this_, char* attribute, int attr_value);
24281 void g_file_info_set_attribute_byte_string(FileInfo* this_, char* attribute, char* attr_value);
24282 void g_file_info_set_attribute_int32(FileInfo* this_, char* attribute, int attr_value);
24283 void g_file_info_set_attribute_int64(FileInfo* this_, char* attribute, long attr_value);
24284 void g_file_info_set_attribute_mask(FileInfo* this_, FileAttributeMatcher* mask);
24285 void g_file_info_set_attribute_object(FileInfo* this_, char* attribute, GObject2.Object* attr_value);
24286 int g_file_info_set_attribute_status(FileInfo* this_, char* attribute, FileAttributeStatus status);
24287 void g_file_info_set_attribute_string(FileInfo* this_, char* attribute, char* attr_value);
24288 void g_file_info_set_attribute_stringv(FileInfo* this_, char* attribute, char** attr_value);
24289 void g_file_info_set_attribute_uint32(FileInfo* this_, char* attribute, uint attr_value);
24290 void g_file_info_set_attribute_uint64(FileInfo* this_, char* attribute, ulong attr_value);
24291 void g_file_info_set_content_type(FileInfo* this_, char* content_type);
24292 void g_file_info_set_display_name(FileInfo* this_, char* display_name);
24293 void g_file_info_set_edit_name(FileInfo* this_, char* edit_name);
24294 void g_file_info_set_file_type(FileInfo* this_, FileType type);
24295 void g_file_info_set_icon(FileInfo* this_, Icon* icon);
24296 void g_file_info_set_is_hidden(FileInfo* this_, int is_hidden);
24297 void g_file_info_set_is_symlink(FileInfo* this_, int is_symlink);
24298 void g_file_info_set_modification_time(FileInfo* this_, GLib2.TimeVal* mtime);
24299 void g_file_info_set_name(FileInfo* this_, char* name);
24300 void g_file_info_set_size(FileInfo* this_, long size);
24301 void g_file_info_set_sort_order(FileInfo* this_, int sort_order);
24302 void g_file_info_set_symlink_target(FileInfo* this_, char* symlink_target);
24303 void g_file_info_unset_attribute_mask(FileInfo* this_);
24304 FileInfo* /*new*/ g_file_input_stream_query_info(FileInputStream* this_, char* attributes, Cancellable* cancellable, GLib2.Error** error);
24305 void g_file_input_stream_query_info_async(FileInputStream* this_, char* attributes, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24306 FileInfo* /*new*/ g_file_input_stream_query_info_finish(FileInputStream* this_, AsyncResult* result, GLib2.Error** error);
24307 int g_file_monitor_cancel(FileMonitor* this_);
24308 void g_file_monitor_emit_event(FileMonitor* this_, File* child, File* other_file, FileMonitorEvent event_type);
24309 int g_file_monitor_is_cancelled(FileMonitor* this_);
24310 void g_file_monitor_set_rate_limit(FileMonitor* this_, int limit_msecs);
24311 char* /*new*/ g_file_output_stream_get_etag(FileOutputStream* this_);
24312 FileInfo* /*new*/ g_file_output_stream_query_info(FileOutputStream* this_, char* attributes, Cancellable* cancellable, GLib2.Error** error);
24313 void g_file_output_stream_query_info_async(FileOutputStream* this_, char* attributes, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24314 FileInfo* /*new*/ g_file_output_stream_query_info_finish(FileOutputStream* this_, AsyncResult* result, GLib2.Error** error);
24315 FilenameCompleter* /*new*/ g_filename_completer_new();
24316 char* /*new*/ g_filename_completer_get_completion_suffix(FilenameCompleter* this_, char* initial_text);
24317 char** /*new*/ g_filename_completer_get_completions(FilenameCompleter* this_, char* initial_text);
24318 void g_filename_completer_set_dirs_only(FilenameCompleter* this_, int dirs_only);
24319 InputStream* g_filter_input_stream_get_base_stream(FilterInputStream* this_);
24320 int g_filter_input_stream_get_close_base_stream(FilterInputStream* this_);
24321 void g_filter_input_stream_set_close_base_stream(FilterInputStream* this_, int close_base);
24322 OutputStream* g_filter_output_stream_get_base_stream(FilterOutputStream* this_);
24323 int g_filter_output_stream_get_close_base_stream(FilterOutputStream* this_);
24324 void g_filter_output_stream_set_close_base_stream(FilterOutputStream* this_, int close_base);
24325 char* g_io_extension_get_name(IOExtension* this_);
24326 int g_io_extension_get_priority(IOExtension* this_);
24327 GObject2.TypeClass* /*new*/ g_io_extension_ref_class(IOExtension* this_);
24328 IOExtension* g_io_extension_point_get_extension_by_name(IOExtensionPoint* this_, char* name);
24329 GLib2.List* g_io_extension_point_get_extensions(IOExtensionPoint* this_);
24330 Type g_io_extension_point_get_required_type(IOExtensionPoint* this_);
24331 void g_io_extension_point_set_required_type(IOExtensionPoint* this_, Type type);
24332 IOExtension* g_io_extension_point_implement(char* extension_point_name, Type type, char* extension_name, int priority);
24333 IOExtensionPoint* g_io_extension_point_lookup(char* name);
24334 IOExtensionPoint* g_io_extension_point_register(char* name);
24335 IOModule* /*new*/ g_io_module_new(char* filename);
24336 char** /*new*/ g_io_module_query();
24337 void g_io_module_load(IOModule* this_);
24338 void g_io_module_unload(IOModule* this_);
24339 void g_io_module_scope_block(IOModuleScope* this_, char* basename);
24340 void g_io_module_scope_free(IOModuleScope* this_);
24341 IOModuleScope* /*new*/ g_io_module_scope_new(IOModuleScopeFlags flags);
24342 int g_io_scheduler_job_send_to_mainloop(IOSchedulerJob* this_, GLib2.SourceFunc func, void* user_data, GLib2.DestroyNotify notify);
24343 void g_io_scheduler_job_send_to_mainloop_async(IOSchedulerJob* this_, GLib2.SourceFunc func, void* user_data, GLib2.DestroyNotify notify);
24344 int g_io_stream_splice_finish(AsyncResult* result, GLib2.Error** error);
24345 void g_io_stream_clear_pending(IOStream* this_);
24346 int g_io_stream_close(IOStream* this_, Cancellable* cancellable, GLib2.Error** error);
24347 void g_io_stream_close_async(IOStream* this_, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24348 int g_io_stream_close_finish(IOStream* this_, AsyncResult* result, GLib2.Error** error);
24349 InputStream* g_io_stream_get_input_stream(IOStream* this_);
24350 OutputStream* g_io_stream_get_output_stream(IOStream* this_);
24351 int g_io_stream_has_pending(IOStream* this_);
24352 int g_io_stream_is_closed(IOStream* this_);
24353 int g_io_stream_set_pending(IOStream* this_, GLib2.Error** error);
24354 void g_io_stream_splice_async(IOStream* this_, IOStream* stream2, IOStreamSpliceFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24355 uint g_icon_hash(const(void)* icon);
24356 Icon* /*new*/ g_icon_new_for_string(char* str, GLib2.Error** error);
24357 int g_icon_equal(Icon* this_, Icon* icon2);
24358 char* /*new*/ g_icon_to_string(Icon* this_);
24359 InetAddress* /*new*/ g_inet_address_new_any(SocketFamily family);
24360 InetAddress* /*new*/ g_inet_address_new_from_bytes(ubyte* bytes, SocketFamily family);
24361 InetAddress* /*new*/ g_inet_address_new_from_string(char* string_);
24362 InetAddress* /*new*/ g_inet_address_new_loopback(SocketFamily family);
24363 int g_inet_address_equal(InetAddress* this_, InetAddress* other_address);
24364 SocketFamily g_inet_address_get_family(InetAddress* this_);
24365 int g_inet_address_get_is_any(InetAddress* this_);
24366 int g_inet_address_get_is_link_local(InetAddress* this_);
24367 int g_inet_address_get_is_loopback(InetAddress* this_);
24368 int g_inet_address_get_is_mc_global(InetAddress* this_);
24369 int g_inet_address_get_is_mc_link_local(InetAddress* this_);
24370 int g_inet_address_get_is_mc_node_local(InetAddress* this_);
24371 int g_inet_address_get_is_mc_org_local(InetAddress* this_);
24372 int g_inet_address_get_is_mc_site_local(InetAddress* this_);
24373 int g_inet_address_get_is_multicast(InetAddress* this_);
24374 int g_inet_address_get_is_site_local(InetAddress* this_);
24375 size_t g_inet_address_get_native_size(InetAddress* this_);
24376 ubyte* g_inet_address_to_bytes(InetAddress* this_);
24377 char* /*new*/ g_inet_address_to_string(InetAddress* this_);
24378 InetSocketAddress* /*new*/ g_inet_socket_address_new(InetAddress* address, ushort port);
24379 InetAddress* g_inet_socket_address_get_address(InetSocketAddress* this_);
24380 ushort g_inet_socket_address_get_port(InetSocketAddress* this_);
24381 void* /*new*/ g_initable_new(Type object_type, Cancellable* cancellable, GLib2.Error** error, char* first_property_name, ...);
24382 GObject2.Object* /*new*/ g_initable_new_valist(Type object_type, char* first_property_name, va_list var_args, Cancellable* cancellable, GLib2.Error** error);
24383 void* /*new*/ g_initable_newv(Type object_type, uint n_parameters, GObject2.Parameter* parameters, Cancellable* cancellable, GLib2.Error** error);
24384 int g_initable_init(Initable* this_, Cancellable* cancellable, GLib2.Error** error);
24385 void g_input_stream_clear_pending(InputStream* this_);
24386 int g_input_stream_close(InputStream* this_, Cancellable* cancellable, GLib2.Error** error);
24387 void g_input_stream_close_async(InputStream* this_, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24388 int g_input_stream_close_finish(InputStream* this_, AsyncResult* result, GLib2.Error** error);
24389 int g_input_stream_has_pending(InputStream* this_);
24390 int g_input_stream_is_closed(InputStream* this_);
24391 ssize_t g_input_stream_read(InputStream* this_, void* buffer, size_t count, Cancellable* cancellable, GLib2.Error** error);
24392 int g_input_stream_read_all(InputStream* this_, void* buffer, size_t count, /*out*/ size_t* bytes_read, Cancellable* cancellable, GLib2.Error** error);
24393 void g_input_stream_read_async(InputStream* this_, void* buffer, size_t count, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24394 ssize_t g_input_stream_read_finish(InputStream* this_, AsyncResult* result, GLib2.Error** error);
24395 int g_input_stream_set_pending(InputStream* this_, GLib2.Error** error);
24396 ssize_t g_input_stream_skip(InputStream* this_, size_t count, Cancellable* cancellable, GLib2.Error** error);
24397 void g_input_stream_skip_async(InputStream* this_, size_t count, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24398 ssize_t g_input_stream_skip_finish(InputStream* this_, AsyncResult* result, GLib2.Error** error);
24399 InputStream* /*new*/ g_loadable_icon_load(LoadableIcon* this_, int size, /*out*/ char** type, Cancellable* cancellable, GLib2.Error** error);
24400 void g_loadable_icon_load_async(LoadableIcon* this_, int size, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24401 InputStream* /*new*/ g_loadable_icon_load_finish(LoadableIcon* this_, AsyncResult* res, char** type, GLib2.Error** error);
24402 MemoryInputStream* /*new*/ g_memory_input_stream_new();
24403 MemoryInputStream* /*new*/ g_memory_input_stream_new_from_data(ubyte* data, ssize_t len, GLib2.DestroyNotify destroy=null);
24404 void g_memory_input_stream_add_data(MemoryInputStream* this_, ubyte* data, ssize_t len, GLib2.DestroyNotify destroy=null);
24405 MemoryOutputStream* /*new*/ g_memory_output_stream_new(void* data, size_t size, ReallocFunc realloc_function, GLib2.DestroyNotify destroy_function);
24406 void* g_memory_output_stream_get_data(MemoryOutputStream* this_);
24407 size_t g_memory_output_stream_get_data_size(MemoryOutputStream* this_);
24408 size_t g_memory_output_stream_get_size(MemoryOutputStream* this_);
24409 void* /*new*/ g_memory_output_stream_steal_data(MemoryOutputStream* this_);
24410 int g_mount_can_eject(Mount* this_);
24411 int g_mount_can_unmount(Mount* this_);
24412 void g_mount_eject(Mount* this_, MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24413 int g_mount_eject_finish(Mount* this_, AsyncResult* result, GLib2.Error** error);
24414 void g_mount_eject_with_operation(Mount* this_, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24415 int g_mount_eject_with_operation_finish(Mount* this_, AsyncResult* result, GLib2.Error** error);
24416 File* /*new*/ g_mount_get_default_location(Mount* this_);
24417 Drive* /*new*/ g_mount_get_drive(Mount* this_);
24418 Icon* /*new*/ g_mount_get_icon(Mount* this_);
24419 char* /*new*/ g_mount_get_name(Mount* this_);
24420 File* /*new*/ g_mount_get_root(Mount* this_);
24421 char* /*new*/ g_mount_get_uuid(Mount* this_);
24422 Volume* /*new*/ g_mount_get_volume(Mount* this_);
24423 void g_mount_guess_content_type(Mount* this_, int force_rescan, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24424 char** /*new*/ g_mount_guess_content_type_finish(Mount* this_, AsyncResult* result, GLib2.Error** error);
24425 char** /*new*/ g_mount_guess_content_type_sync(Mount* this_, int force_rescan, Cancellable* cancellable, GLib2.Error** error);
24426 int g_mount_is_shadowed(Mount* this_);
24427 void g_mount_remount(Mount* this_, MountMountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24428 int g_mount_remount_finish(Mount* this_, AsyncResult* result, GLib2.Error** error);
24429 void g_mount_shadow(Mount* this_);
24430 void g_mount_unmount(Mount* this_, MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24431 int g_mount_unmount_finish(Mount* this_, AsyncResult* result, GLib2.Error** error);
24432 void g_mount_unmount_with_operation(Mount* this_, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24433 int g_mount_unmount_with_operation_finish(Mount* this_, AsyncResult* result, GLib2.Error** error);
24434 void g_mount_unshadow(Mount* this_);
24435 MountOperation* /*new*/ g_mount_operation_new();
24436 int g_mount_operation_get_anonymous(MountOperation* this_);
24437 int g_mount_operation_get_choice(MountOperation* this_);
24438 char* g_mount_operation_get_domain(MountOperation* this_);
24439 char* g_mount_operation_get_password(MountOperation* this_);
24440 PasswordSave g_mount_operation_get_password_save(MountOperation* this_);
24441 char* g_mount_operation_get_username(MountOperation* this_);
24442 void g_mount_operation_reply(MountOperation* this_, MountOperationResult result);
24443 void g_mount_operation_set_anonymous(MountOperation* this_, int anonymous);
24444 void g_mount_operation_set_choice(MountOperation* this_, int choice);
24445 void g_mount_operation_set_domain(MountOperation* this_, char* domain);
24446 void g_mount_operation_set_password(MountOperation* this_, char* password);
24447 void g_mount_operation_set_password_save(MountOperation* this_, PasswordSave save);
24448 void g_mount_operation_set_username(MountOperation* this_, char* username);
24449 SocketConnectable* /*new*/ g_network_address_new(char* hostname, ushort port);
24450 SocketConnectable* /*new*/ g_network_address_parse(char* host_and_port, ushort default_port, GLib2.Error** error);
24451 SocketConnectable* /*new*/ g_network_address_parse_uri(char* uri, ushort default_port, GLib2.Error** error);
24452 char* g_network_address_get_hostname(NetworkAddress* this_);
24453 ushort g_network_address_get_port(NetworkAddress* this_);
24454 char* g_network_address_get_scheme(NetworkAddress* this_);
24455 SocketConnectable* /*new*/ g_network_service_new(char* service, char* protocol, char* domain);
24456 char* g_network_service_get_domain(NetworkService* this_);
24457 char* g_network_service_get_protocol(NetworkService* this_);
24458 char* g_network_service_get_scheme(NetworkService* this_);
24459 char* g_network_service_get_service(NetworkService* this_);
24460 void g_network_service_set_scheme(NetworkService* this_, char* scheme);
24461 void g_output_stream_clear_pending(OutputStream* this_);
24462 int g_output_stream_close(OutputStream* this_, Cancellable* cancellable, GLib2.Error** error);
24463 void g_output_stream_close_async(OutputStream* this_, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24464 int g_output_stream_close_finish(OutputStream* this_, AsyncResult* result, GLib2.Error** error);
24465 int g_output_stream_flush(OutputStream* this_, Cancellable* cancellable, GLib2.Error** error);
24466 void g_output_stream_flush_async(OutputStream* this_, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24467 int g_output_stream_flush_finish(OutputStream* this_, AsyncResult* result, GLib2.Error** error);
24468 int g_output_stream_has_pending(OutputStream* this_);
24469 int g_output_stream_is_closed(OutputStream* this_);
24470 int g_output_stream_is_closing(OutputStream* this_);
24471 int g_output_stream_set_pending(OutputStream* this_, GLib2.Error** error);
24472 ssize_t g_output_stream_splice(OutputStream* this_, InputStream* source, OutputStreamSpliceFlags flags, Cancellable* cancellable, GLib2.Error** error);
24473 void g_output_stream_splice_async(OutputStream* this_, InputStream* source, OutputStreamSpliceFlags flags, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24474 ssize_t g_output_stream_splice_finish(OutputStream* this_, AsyncResult* result, GLib2.Error** error);
24475 ssize_t g_output_stream_write(OutputStream* this_, ubyte* buffer, size_t count, Cancellable* cancellable, GLib2.Error** error);
24476 int g_output_stream_write_all(OutputStream* this_, ubyte* buffer, size_t count, /*out*/ size_t* bytes_written, Cancellable* cancellable, GLib2.Error** error);
24477 void g_output_stream_write_async(OutputStream* this_, ubyte* buffer, size_t count, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24478 ssize_t g_output_stream_write_finish(OutputStream* this_, AsyncResult* result, GLib2.Error** error);
24479 int g_permission_acquire(Permission* this_, Cancellable* cancellable, GLib2.Error** error);
24480 void g_permission_acquire_async(Permission* this_, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24481 int g_permission_acquire_finish(Permission* this_, AsyncResult* result, GLib2.Error** error);
24482 int g_permission_get_allowed(Permission* this_);
24483 int g_permission_get_can_acquire(Permission* this_);
24484 int g_permission_get_can_release(Permission* this_);
24485 void g_permission_impl_update(Permission* this_, int allowed, int can_acquire, int can_release);
24486 int g_permission_release(Permission* this_, Cancellable* cancellable, GLib2.Error** error);
24487 void g_permission_release_async(Permission* this_, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24488 int g_permission_release_finish(Permission* this_, AsyncResult* result, GLib2.Error** error);
24489 int g_pollable_input_stream_can_poll(PollableInputStream* this_);
24490 GLib2.Source* /*new*/ g_pollable_input_stream_create_source(PollableInputStream* this_, Cancellable* cancellable=null);
24491 int g_pollable_input_stream_is_readable(PollableInputStream* this_);
24492 ssize_t g_pollable_input_stream_read_nonblocking(PollableInputStream* this_, void* buffer, size_t size, Cancellable* cancellable, GLib2.Error** error);
24493 int g_pollable_output_stream_can_poll(PollableOutputStream* this_);
24494 GLib2.Source* /*new*/ g_pollable_output_stream_create_source(PollableOutputStream* this_, Cancellable* cancellable=null);
24495 int g_pollable_output_stream_is_writable(PollableOutputStream* this_);
24496 ssize_t g_pollable_output_stream_write_nonblocking(PollableOutputStream* this_, ubyte* buffer, size_t size, Cancellable* cancellable, GLib2.Error** error);
24497 Proxy* /*new*/ g_proxy_get_default_for_protocol(char* protocol);
24498 IOStream* /*new*/ g_proxy_connect(Proxy* this_, IOStream* connection, ProxyAddress* proxy_address, Cancellable* cancellable, GLib2.Error** error);
24499 void g_proxy_connect_async(Proxy* this_, IOStream* connection, ProxyAddress* proxy_address, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24500 IOStream* /*new*/ g_proxy_connect_finish(Proxy* this_, AsyncResult* result, GLib2.Error** error);
24501 int g_proxy_supports_hostname(Proxy* this_);
24502 ProxyAddress* /*new*/ g_proxy_address_new(InetAddress* inetaddr, ushort port, char* protocol, char* dest_hostname, ushort dest_port, char* username=null, char* password=null);
24503 char* g_proxy_address_get_destination_hostname(ProxyAddress* this_);
24504 ushort g_proxy_address_get_destination_port(ProxyAddress* this_);
24505 char* g_proxy_address_get_password(ProxyAddress* this_);
24506 char* g_proxy_address_get_protocol(ProxyAddress* this_);
24507 char* g_proxy_address_get_username(ProxyAddress* this_);
24508 ProxyResolver* g_proxy_resolver_get_default();
24509 int g_proxy_resolver_is_supported(ProxyResolver* this_);
24510 char** /*new*/ g_proxy_resolver_lookup(ProxyResolver* this_, char* uri, Cancellable* cancellable, GLib2.Error** error);
24511 void g_proxy_resolver_lookup_async(ProxyResolver* this_, char* uri, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24512 char** /*new*/ g_proxy_resolver_lookup_finish(ProxyResolver* this_, AsyncResult* result, GLib2.Error** error);
24513 void g_resolver_free_addresses(GLib2.List* addresses);
24514 void g_resolver_free_targets(GLib2.List* targets);
24515 Resolver* /*new*/ g_resolver_get_default();
24516 char* /*new*/ g_resolver_lookup_by_address(Resolver* this_, InetAddress* address, Cancellable* cancellable, GLib2.Error** error);
24517 void g_resolver_lookup_by_address_async(Resolver* this_, InetAddress* address, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24518 char* /*new*/ g_resolver_lookup_by_address_finish(Resolver* this_, AsyncResult* result, GLib2.Error** error);
24519 GLib2.List* /*new*/ g_resolver_lookup_by_name(Resolver* this_, char* hostname, Cancellable* cancellable, GLib2.Error** error);
24520 void g_resolver_lookup_by_name_async(Resolver* this_, char* hostname, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24521 GLib2.List* /*new*/ g_resolver_lookup_by_name_finish(Resolver* this_, AsyncResult* result, GLib2.Error** error);
24522 GLib2.List* /*new*/ g_resolver_lookup_service(Resolver* this_, char* service, char* protocol, char* domain, Cancellable* cancellable, GLib2.Error** error);
24523 void g_resolver_lookup_service_async(Resolver* this_, char* service, char* protocol, char* domain, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24524 GLib2.List* /*new*/ g_resolver_lookup_service_finish(Resolver* this_, AsyncResult* result, GLib2.Error** error);
24525 void g_resolver_set_default(Resolver* this_);
24526 int g_seekable_can_seek(Seekable* this_);
24527 int g_seekable_can_truncate(Seekable* this_);
24528 int g_seekable_seek(Seekable* this_, long offset, GLib2.SeekType type, Cancellable* cancellable, GLib2.Error** error);
24529 long g_seekable_tell(Seekable* this_);
24530 int g_seekable_truncate(Seekable* this_, long offset, Cancellable* cancellable, GLib2.Error** error);
24531 Settings* /*new*/ g_settings_new(char* schema);
24532 Settings* /*new*/ g_settings_new_with_backend(char* schema, SettingsBackend* backend);
24533 Settings* /*new*/ g_settings_new_with_backend_and_path(char* schema, SettingsBackend* backend, char* path);
24534 Settings* /*new*/ g_settings_new_with_path(char* schema, char* path);
24535 char** g_settings_list_relocatable_schemas();
24536 char** g_settings_list_schemas();
24537 void g_settings_sync();
24538 void g_settings_unbind(void* object, char* property);
24539 void g_settings_apply(Settings* this_);
24540 void g_settings_bind(Settings* this_, char* key, GObject2.Object* object, char* property, SettingsBindFlags flags);
24541 void g_settings_bind_with_mapping(Settings* this_, char* key, GObject2.Object* object, char* property, SettingsBindFlags flags, SettingsBindGetMapping get_mapping, SettingsBindSetMapping set_mapping, void* user_data, GLib2.DestroyNotify destroy);
24542 void g_settings_bind_writable(Settings* this_, char* key, GObject2.Object* object, char* property, int inverted);
24543 void g_settings_delay(Settings* this_);
24544 void g_settings_get(Settings* this_, char* key, char* format, ...);
24545 int g_settings_get_boolean(Settings* this_, char* key);
24546 Settings* /*new*/ g_settings_get_child(Settings* this_, char* name);
24547 double g_settings_get_double(Settings* this_, char* key);
24548 int g_settings_get_enum(Settings* this_, char* key);
24549 uint g_settings_get_flags(Settings* this_, char* key);
24550 int g_settings_get_has_unapplied(Settings* this_);
24551 int g_settings_get_int(Settings* this_, char* key);
24552 void* /*new*/ g_settings_get_mapped(Settings* this_, char* key, SettingsGetMapping mapping, void* user_data);
24553 GLib2.Variant* /*new*/ g_settings_get_range(Settings* this_, char* key);
24554 char* /*new*/ g_settings_get_string(Settings* this_, char* key);
24555 char** /*new*/ g_settings_get_strv(Settings* this_, char* key);
24556 uint g_settings_get_uint(Settings* this_, char* key);
24557 GLib2.Variant* /*new*/ g_settings_get_value(Settings* this_, char* key);
24558 int g_settings_is_writable(Settings* this_, char* name);
24559 char** /*new*/ g_settings_list_children(Settings* this_);
24560 char** /*new*/ g_settings_list_keys(Settings* this_);
24561 int g_settings_range_check(Settings* this_, char* key, GLib2.Variant* value);
24562 void g_settings_reset(Settings* this_, char* key);
24563 void g_settings_revert(Settings* this_);
24564 int g_settings_set(Settings* this_, char* key, char* format, ...);
24565 int g_settings_set_boolean(Settings* this_, char* key, int value);
24566 int g_settings_set_double(Settings* this_, char* key, double value);
24567 int g_settings_set_enum(Settings* this_, char* key, int value);
24568 int g_settings_set_flags(Settings* this_, char* key, uint value);
24569 int g_settings_set_int(Settings* this_, char* key, int value);
24570 int g_settings_set_string(Settings* this_, char* key, char* value);
24571 int g_settings_set_strv(Settings* this_, char* key, char** value=null);
24572 int g_settings_set_uint(Settings* this_, char* key, uint value);
24573 int g_settings_set_value(Settings* this_, char* key, GLib2.Variant* value);
24574 SimpleAction* /*new*/ g_simple_action_new(char* name, GLib2.VariantType* parameter_type=null);
24575 SimpleAction* /*new*/ g_simple_action_new_stateful(char* name, GLib2.VariantType* parameter_type, GLib2.Variant* state);
24576 void g_simple_action_set_enabled(SimpleAction* this_, int enabled);
24577 void g_simple_action_set_state(SimpleAction* this_, GLib2.Variant* value);
24578 SimpleActionGroup* /*new*/ g_simple_action_group_new();
24579 void g_simple_action_group_add_entries(SimpleActionGroup* this_, ActionEntry* entries, int n_entries, void* user_data);
24580 void g_simple_action_group_insert(SimpleActionGroup* this_, Action* action);
24581 Action* g_simple_action_group_lookup(SimpleActionGroup* this_, char* action_name);
24582 void g_simple_action_group_remove(SimpleActionGroup* this_, char* action_name);
24583 SimpleAsyncResult* /*new*/ g_simple_async_result_new(GObject2.Object* source_object, AsyncReadyCallback callback, void* user_data, void* source_tag);
24584 SimpleAsyncResult* /*new*/ g_simple_async_result_new_error(GObject2.Object* source_object, AsyncReadyCallback callback, void* user_data, GLib2.Quark domain, int code, char* format, ...);
24585 SimpleAsyncResult* /*new*/ g_simple_async_result_new_from_error(GObject2.Object* source_object, AsyncReadyCallback callback, void* user_data, GLib2.Error* error);
24586 SimpleAsyncResult* /*new*/ g_simple_async_result_new_take_error(GObject2.Object* source_object, AsyncReadyCallback callback, void* user_data, GLib2.Error* error);
24587 int g_simple_async_result_is_valid(AsyncResult* result, GObject2.Object* source, void* source_tag);
24588 void g_simple_async_result_complete(SimpleAsyncResult* this_);
24589 void g_simple_async_result_complete_in_idle(SimpleAsyncResult* this_);
24590 int g_simple_async_result_get_op_res_gboolean(SimpleAsyncResult* this_);
24591 void* g_simple_async_result_get_op_res_gpointer(SimpleAsyncResult* this_);
24592 ssize_t g_simple_async_result_get_op_res_gssize(SimpleAsyncResult* this_);
24593 void* g_simple_async_result_get_source_tag(SimpleAsyncResult* this_);
24594 int g_simple_async_result_propagate_error(SimpleAsyncResult* this_, GLib2.Error** error);
24595 void g_simple_async_result_run_in_thread(SimpleAsyncResult* this_, SimpleAsyncThreadFunc func, int io_priority, Cancellable* cancellable=null);
24596 void g_simple_async_result_set_error(SimpleAsyncResult* this_, GLib2.Quark domain, int code, char* format, ...);
24597 void g_simple_async_result_set_error_va(SimpleAsyncResult* this_, GLib2.Quark domain, int code, char* format, va_list args);
24598 void g_simple_async_result_set_from_error(SimpleAsyncResult* this_, GLib2.Error* error);
24599 void g_simple_async_result_set_handle_cancellation(SimpleAsyncResult* this_, int handle_cancellation);
24600 void g_simple_async_result_set_op_res_gboolean(SimpleAsyncResult* this_, int op_res);
24601 void g_simple_async_result_set_op_res_gpointer(SimpleAsyncResult* this_, void* op_res, GLib2.DestroyNotify destroy_op_res);
24602 void g_simple_async_result_set_op_res_gssize(SimpleAsyncResult* this_, ssize_t op_res);
24603 void g_simple_async_result_take_error(SimpleAsyncResult* this_, GLib2.Error* error);
24604 SimplePermission* /*new*/ g_simple_permission_new(int allowed);
24605 Socket* /*new*/ g_socket_new(SocketFamily family, SocketType type, SocketProtocol protocol, GLib2.Error** error);
24606 Socket* /*new*/ g_socket_new_from_fd(int fd, GLib2.Error** error);
24607 Socket* /*new*/ g_socket_accept(Socket* this_, Cancellable* cancellable, GLib2.Error** error);
24608 int g_socket_bind(Socket* this_, SocketAddress* address, int allow_reuse, GLib2.Error** error);
24609 int g_socket_check_connect_result(Socket* this_, GLib2.Error** error);
24610 int g_socket_close(Socket* this_, GLib2.Error** error);
24611 GLib2.IOCondition g_socket_condition_check(Socket* this_, GLib2.IOCondition condition);
24612 int g_socket_condition_wait(Socket* this_, GLib2.IOCondition condition, Cancellable* cancellable, GLib2.Error** error);
24613 int g_socket_connect(Socket* this_, SocketAddress* address, Cancellable* cancellable, GLib2.Error** error);
24614 SocketConnection* /*new*/ g_socket_connection_factory_create_connection(Socket* this_);
24615 GLib2.Source* /*new*/ g_socket_create_source(Socket* this_, GLib2.IOCondition condition, Cancellable* cancellable=null);
24616 int g_socket_get_blocking(Socket* this_);
24617 Credentials* /*new*/ g_socket_get_credentials(Socket* this_, GLib2.Error** error);
24618 SocketFamily g_socket_get_family(Socket* this_);
24619 int g_socket_get_fd(Socket* this_);
24620 int g_socket_get_keepalive(Socket* this_);
24621 int g_socket_get_listen_backlog(Socket* this_);
24622 SocketAddress* /*new*/ g_socket_get_local_address(Socket* this_, GLib2.Error** error);
24623 SocketProtocol g_socket_get_protocol(Socket* this_);
24624 SocketAddress* /*new*/ g_socket_get_remote_address(Socket* this_, GLib2.Error** error);
24625 SocketType g_socket_get_socket_type(Socket* this_);
24626 uint g_socket_get_timeout(Socket* this_);
24627 int g_socket_is_closed(Socket* this_);
24628 int g_socket_is_connected(Socket* this_);
24629 int g_socket_listen(Socket* this_, GLib2.Error** error);
24630 ssize_t g_socket_receive(Socket* this_, char* buffer, size_t size, Cancellable* cancellable, GLib2.Error** error);
24631 ssize_t g_socket_receive_from(Socket* this_, SocketAddress** address, char* buffer, size_t size, Cancellable* cancellable, GLib2.Error** error);
24632 ssize_t g_socket_receive_message(Socket* this_, SocketAddress** address, InputVector* vectors, int num_vectors, SocketControlMessage*** messages, int* num_messages, int* flags, Cancellable* cancellable, GLib2.Error** error);
24633 ssize_t g_socket_receive_with_blocking(Socket* this_, char* buffer, size_t size, int blocking, Cancellable* cancellable, GLib2.Error** error);
24634 ssize_t g_socket_send(Socket* this_, char* buffer, size_t size, Cancellable* cancellable, GLib2.Error** error);
24635 ssize_t g_socket_send_message(Socket* this_, SocketAddress* address, OutputVector* vectors, int num_vectors, SocketControlMessage** messages, int num_messages, int flags, Cancellable* cancellable, GLib2.Error** error);
24636 ssize_t g_socket_send_to(Socket* this_, SocketAddress* address, char* buffer, size_t size, Cancellable* cancellable, GLib2.Error** error);
24637 ssize_t g_socket_send_with_blocking(Socket* this_, char* buffer, size_t size, int blocking, Cancellable* cancellable, GLib2.Error** error);
24638 void g_socket_set_blocking(Socket* this_, int blocking);
24639 void g_socket_set_keepalive(Socket* this_, int keepalive);
24640 void g_socket_set_listen_backlog(Socket* this_, int backlog);
24641 void g_socket_set_timeout(Socket* this_, uint timeout);
24642 int g_socket_shutdown(Socket* this_, int shutdown_read, int shutdown_write, GLib2.Error** error);
24643 int g_socket_speaks_ipv4(Socket* this_);
24644 SocketAddress* /*new*/ g_socket_address_new_from_native(void* native, size_t len);
24645 SocketFamily g_socket_address_get_family(SocketAddress* this_);
24646 ssize_t g_socket_address_get_native_size(SocketAddress* this_);
24647 int g_socket_address_to_native(SocketAddress* this_, void* dest, size_t destlen, GLib2.Error** error);
24648 SocketAddress* /*new*/ g_socket_address_enumerator_next(SocketAddressEnumerator* this_, Cancellable* cancellable, GLib2.Error** error);
24649 void g_socket_address_enumerator_next_async(SocketAddressEnumerator* this_, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24650 SocketAddress* /*new*/ g_socket_address_enumerator_next_finish(SocketAddressEnumerator* this_, AsyncResult* result, GLib2.Error** error);
24651 SocketClient* /*new*/ g_socket_client_new();
24652 void g_socket_client_add_application_proxy(SocketClient* this_, char* protocol);
24653 SocketConnection* /*new*/ g_socket_client_connect(SocketClient* this_, SocketConnectable* connectable, Cancellable* cancellable, GLib2.Error** error);
24654 void g_socket_client_connect_async(SocketClient* this_, SocketConnectable* connectable, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24655 SocketConnection* /*new*/ g_socket_client_connect_finish(SocketClient* this_, AsyncResult* result, GLib2.Error** error);
24656 SocketConnection* /*new*/ g_socket_client_connect_to_host(SocketClient* this_, char* host_and_port, ushort default_port, Cancellable* cancellable, GLib2.Error** error);
24657 void g_socket_client_connect_to_host_async(SocketClient* this_, char* host_and_port, ushort default_port, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24658 SocketConnection* /*new*/ g_socket_client_connect_to_host_finish(SocketClient* this_, AsyncResult* result, GLib2.Error** error);
24659 SocketConnection* /*new*/ g_socket_client_connect_to_service(SocketClient* this_, char* domain, char* service, Cancellable* cancellable, GLib2.Error** error);
24660 void g_socket_client_connect_to_service_async(SocketClient* this_, char* domain, char* service, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24661 SocketConnection* /*new*/ g_socket_client_connect_to_service_finish(SocketClient* this_, AsyncResult* result, GLib2.Error** error);
24662 SocketConnection* /*new*/ g_socket_client_connect_to_uri(SocketClient* this_, char* uri, ushort default_port, Cancellable* cancellable, GLib2.Error** error);
24663 void g_socket_client_connect_to_uri_async(SocketClient* this_, char* uri, ushort default_port, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24664 SocketConnection* /*new*/ g_socket_client_connect_to_uri_finish(SocketClient* this_, AsyncResult* result, GLib2.Error** error);
24665 int g_socket_client_get_enable_proxy(SocketClient* this_);
24666 SocketFamily g_socket_client_get_family(SocketClient* this_);
24667 SocketAddress* g_socket_client_get_local_address(SocketClient* this_);
24668 SocketProtocol g_socket_client_get_protocol(SocketClient* this_);
24669 SocketType g_socket_client_get_socket_type(SocketClient* this_);
24670 uint g_socket_client_get_timeout(SocketClient* this_);
24671 int g_socket_client_get_tls(SocketClient* this_);
24672 TlsCertificateFlags g_socket_client_get_tls_validation_flags(SocketClient* this_);
24673 void g_socket_client_set_enable_proxy(SocketClient* this_, int enable);
24674 void g_socket_client_set_family(SocketClient* this_, SocketFamily family);
24675 void g_socket_client_set_local_address(SocketClient* this_, SocketAddress* address);
24676 void g_socket_client_set_protocol(SocketClient* this_, SocketProtocol protocol);
24677 void g_socket_client_set_socket_type(SocketClient* this_, SocketType type);
24678 void g_socket_client_set_timeout(SocketClient* this_, uint timeout);
24679 void g_socket_client_set_tls(SocketClient* this_, int tls);
24680 void g_socket_client_set_tls_validation_flags(SocketClient* this_, TlsCertificateFlags flags);
24681 SocketAddressEnumerator* /*new*/ g_socket_connectable_enumerate(SocketConnectable* this_);
24682 SocketAddressEnumerator* /*new*/ g_socket_connectable_proxy_enumerate(SocketConnectable* this_);
24683 Type g_socket_connection_factory_lookup_type(SocketFamily family, SocketType type, int protocol_id);
24684 void g_socket_connection_factory_register_type(Type g_type, SocketFamily family, SocketType type, int protocol);
24685 SocketAddress* /*new*/ g_socket_connection_get_local_address(SocketConnection* this_, GLib2.Error** error);
24686 SocketAddress* /*new*/ g_socket_connection_get_remote_address(SocketConnection* this_, GLib2.Error** error);
24687 Socket* g_socket_connection_get_socket(SocketConnection* this_);
24688 SocketControlMessage* /*new*/ g_socket_control_message_deserialize(int level, int type, size_t size, void* data);
24689 int g_socket_control_message_get_level(SocketControlMessage* this_);
24690 int g_socket_control_message_get_msg_type(SocketControlMessage* this_);
24691 size_t g_socket_control_message_get_size(SocketControlMessage* this_);
24692 void g_socket_control_message_serialize(SocketControlMessage* this_, void* data);
24693 SocketListener* /*new*/ g_socket_listener_new();
24694 SocketConnection* /*new*/ g_socket_listener_accept(SocketListener* this_, /*out*/ GObject2.Object** source_object, Cancellable* cancellable, GLib2.Error** error);
24695 void g_socket_listener_accept_async(SocketListener* this_, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24696 SocketConnection* /*new*/ g_socket_listener_accept_finish(SocketListener* this_, AsyncResult* result, /*out*/ GObject2.Object** source_object, GLib2.Error** error);
24697 Socket* /*new*/ g_socket_listener_accept_socket(SocketListener* this_, /*out*/ GObject2.Object** source_object, Cancellable* cancellable, GLib2.Error** error);
24698 void g_socket_listener_accept_socket_async(SocketListener* this_, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24699 Socket* /*new*/ g_socket_listener_accept_socket_finish(SocketListener* this_, AsyncResult* result, /*out*/ GObject2.Object** source_object, GLib2.Error** error);
24700 int g_socket_listener_add_address(SocketListener* this_, SocketAddress* address, SocketType type, SocketProtocol protocol, GObject2.Object* source_object, /*out*/ SocketAddress** effective_address, GLib2.Error** error);
24701 ushort g_socket_listener_add_any_inet_port(SocketListener* this_, GObject2.Object* source_object, GLib2.Error** error);
24702 int g_socket_listener_add_inet_port(SocketListener* this_, ushort port, GObject2.Object* source_object, GLib2.Error** error);
24703 int g_socket_listener_add_socket(SocketListener* this_, Socket* socket, GObject2.Object* source_object, GLib2.Error** error);
24704 void g_socket_listener_close(SocketListener* this_);
24705 void g_socket_listener_set_backlog(SocketListener* this_, int listen_backlog);
24706 SocketService* /*new*/ g_socket_service_new();
24707 int g_socket_service_is_active(SocketService* this_);
24708 void g_socket_service_start(SocketService* this_);
24709 void g_socket_service_stop(SocketService* this_);
24710 SrvTarget* /*new*/ g_srv_target_new(char* hostname, ushort port, ushort priority, ushort weight);
24711 SrvTarget* /*new*/ g_srv_target_copy(SrvTarget* this_);
24712 void g_srv_target_free(SrvTarget* this_);
24713 char* g_srv_target_get_hostname(SrvTarget* this_);
24714 ushort g_srv_target_get_port(SrvTarget* this_);
24715 ushort g_srv_target_get_priority(SrvTarget* this_);
24716 ushort g_srv_target_get_weight(SrvTarget* this_);
24717 GLib2.List* /*new*/ g_srv_target_list_sort(GLib2.List* targets);
24718 int g_tcp_connection_get_graceful_disconnect(TcpConnection* this_);
24719 void g_tcp_connection_set_graceful_disconnect(TcpConnection* this_, int graceful_disconnect);
24720 TcpWrapperConnection* /*new*/ g_tcp_wrapper_connection_new(IOStream* base_io_stream, Socket* socket);
24721 IOStream* g_tcp_wrapper_connection_get_base_io_stream(TcpWrapperConnection* this_);
24722 Icon* /*new*/ g_themed_icon_new(char* iconname);
24723 Icon* /*new*/ g_themed_icon_new_from_names(char** iconnames, int len);
24724 Icon* /*new*/ g_themed_icon_new_with_default_fallbacks(char* iconname);
24725 void g_themed_icon_append_name(ThemedIcon* this_, char* iconname);
24726 char** g_themed_icon_get_names(ThemedIcon* this_);
24727 void g_themed_icon_prepend_name(ThemedIcon* this_, char* iconname);
24728 ThreadedSocketService* /*new*/ g_threaded_socket_service_new(int max_threads);
24729 TlsBackend* g_tls_backend_get_default();
24730 Type g_tls_backend_get_certificate_type(TlsBackend* this_);
24731 Type g_tls_backend_get_client_connection_type(TlsBackend* this_);
24732 TlsDatabase* /*new*/ g_tls_backend_get_default_database(TlsBackend* this_);
24733 Type g_tls_backend_get_file_database_type(TlsBackend* this_);
24734 Type g_tls_backend_get_server_connection_type(TlsBackend* this_);
24735 int g_tls_backend_supports_tls(TlsBackend* this_);
24736 TlsCertificate* /*new*/ g_tls_certificate_new_from_file(char* file, GLib2.Error** error);
24737 TlsCertificate* /*new*/ g_tls_certificate_new_from_files(char* cert_file, char* key_file, GLib2.Error** error);
24738 TlsCertificate* /*new*/ g_tls_certificate_new_from_pem(char* data, ssize_t length, GLib2.Error** error);
24739 GLib2.List* /*new*/ g_tls_certificate_list_new_from_file(char* file, GLib2.Error** error);
24740 TlsCertificate* g_tls_certificate_get_issuer(TlsCertificate* this_);
24741 TlsCertificateFlags g_tls_certificate_verify(TlsCertificate* this_, SocketConnectable* identity=null, TlsCertificate* trusted_ca=null);
24742 IOStream* /*new*/ g_tls_client_connection_new(IOStream* base_io_stream, SocketConnectable* server_identity, GLib2.Error** error);
24743 GLib2.List* /*new*/ g_tls_client_connection_get_accepted_cas(TlsClientConnection* this_);
24744 SocketConnectable* g_tls_client_connection_get_server_identity(TlsClientConnection* this_);
24745 int g_tls_client_connection_get_use_ssl3(TlsClientConnection* this_);
24746 TlsCertificateFlags g_tls_client_connection_get_validation_flags(TlsClientConnection* this_);
24747 void g_tls_client_connection_set_server_identity(TlsClientConnection* this_, SocketConnectable* identity);
24748 void g_tls_client_connection_set_use_ssl3(TlsClientConnection* this_, int use_ssl3);
24749 void g_tls_client_connection_set_validation_flags(TlsClientConnection* this_, TlsCertificateFlags flags);
24750 int g_tls_connection_emit_accept_certificate(TlsConnection* this_, TlsCertificate* peer_cert, TlsCertificateFlags errors);
24751 TlsCertificate* g_tls_connection_get_certificate(TlsConnection* this_);
24752 TlsDatabase* g_tls_connection_get_database(TlsConnection* this_);
24753 TlsInteraction* g_tls_connection_get_interaction(TlsConnection* this_);
24754 TlsCertificate* g_tls_connection_get_peer_certificate(TlsConnection* this_);
24755 TlsCertificateFlags g_tls_connection_get_peer_certificate_errors(TlsConnection* this_);
24756 TlsRehandshakeMode g_tls_connection_get_rehandshake_mode(TlsConnection* this_);
24757 int g_tls_connection_get_require_close_notify(TlsConnection* this_);
24758 int g_tls_connection_get_use_system_certdb(TlsConnection* this_);
24759 int g_tls_connection_handshake(TlsConnection* this_, Cancellable* cancellable, GLib2.Error** error);
24760 void g_tls_connection_handshake_async(TlsConnection* this_, int io_priority, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24761 int g_tls_connection_handshake_finish(TlsConnection* this_, AsyncResult* result, GLib2.Error** error);
24762 void g_tls_connection_set_certificate(TlsConnection* this_, TlsCertificate* certificate);
24763 void g_tls_connection_set_database(TlsConnection* this_, TlsDatabase* database);
24764 void g_tls_connection_set_interaction(TlsConnection* this_, TlsInteraction* interaction=null);
24765 void g_tls_connection_set_rehandshake_mode(TlsConnection* this_, TlsRehandshakeMode mode);
24766 void g_tls_connection_set_require_close_notify(TlsConnection* this_, int require_close_notify);
24767 void g_tls_connection_set_use_system_certdb(TlsConnection* this_, int use_system_certdb);
24768 char* /*new*/ g_tls_database_create_certificate_handle(TlsDatabase* this_, TlsCertificate* certificate);
24769 TlsCertificate* /*new*/ g_tls_database_lookup_certificate_for_handle(TlsDatabase* this_, char* handle, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, GLib2.Error** error);
24770 void g_tls_database_lookup_certificate_for_handle_async(TlsDatabase* this_, char* handle, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24771 TlsCertificate* /*new*/ g_tls_database_lookup_certificate_for_handle_finish(TlsDatabase* this_, AsyncResult* result, GLib2.Error** error);
24772 TlsCertificate* /*new*/ g_tls_database_lookup_certificate_issuer(TlsDatabase* this_, TlsCertificate* certificate, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, GLib2.Error** error);
24773 void g_tls_database_lookup_certificate_issuer_async(TlsDatabase* this_, TlsCertificate* certificate, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24774 TlsCertificate* /*new*/ g_tls_database_lookup_certificate_issuer_finish(TlsDatabase* this_, AsyncResult* result, GLib2.Error** error);
24775 GLib2.List* /*new*/ g_tls_database_lookup_certificates_issued_by(TlsDatabase* this_, ByteArray* issuer_raw_dn, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, GLib2.Error** error);
24776 void g_tls_database_lookup_certificates_issued_by_async(TlsDatabase* this_, ByteArray* issuer_raw_dn, TlsInteraction* interaction, TlsDatabaseLookupFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24777 GLib2.List* /*new*/ g_tls_database_lookup_certificates_issued_by_finish(TlsDatabase* this_, AsyncResult* result, GLib2.Error** error);
24778 TlsCertificateFlags g_tls_database_verify_chain(TlsDatabase* this_, TlsCertificate* chain, char* purpose, SocketConnectable* identity, TlsInteraction* interaction, TlsDatabaseVerifyFlags flags, Cancellable* cancellable, GLib2.Error** error);
24779 void g_tls_database_verify_chain_async(TlsDatabase* this_, TlsCertificate* chain, char* purpose, SocketConnectable* identity, TlsInteraction* interaction, TlsDatabaseVerifyFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24780 TlsCertificateFlags g_tls_database_verify_chain_finish(TlsDatabase* this_, AsyncResult* result, GLib2.Error** error);
24781 TlsDatabase* /*new*/ g_tls_file_database_new(char* anchors, GLib2.Error** error);
24782 TlsInteractionResult g_tls_interaction_ask_password(TlsInteraction* this_, TlsPassword* password, Cancellable* cancellable, GLib2.Error** error);
24783 void g_tls_interaction_ask_password_async(TlsInteraction* this_, TlsPassword* password, Cancellable* cancellable=null, AsyncReadyCallback callback=null, void* user_data=null);
24784 TlsInteractionResult g_tls_interaction_ask_password_finish(TlsInteraction* this_, AsyncResult* result, GLib2.Error** error);
24785 TlsInteractionResult g_tls_interaction_invoke_ask_password(TlsInteraction* this_, TlsPassword* password, Cancellable* cancellable, GLib2.Error** error);
24786 TlsPassword* /*new*/ g_tls_password_new(TlsPasswordFlags flags, char* description);
24787 char* g_tls_password_get_description(TlsPassword* this_);
24788 TlsPasswordFlags g_tls_password_get_flags(TlsPassword* this_);
24789 ubyte* g_tls_password_get_value(TlsPassword* this_, size_t* length=null);
24790 char* g_tls_password_get_warning(TlsPassword* this_);
24791 void g_tls_password_set_description(TlsPassword* this_, char* description);
24792 void g_tls_password_set_flags(TlsPassword* this_, TlsPasswordFlags flags);
24793 void g_tls_password_set_value(TlsPassword* this_, ubyte* value, ssize_t length);
24794 void g_tls_password_set_value_full(TlsPassword* this_, ubyte* value, ssize_t length, GLib2.DestroyNotify destroy=null);
24795 void g_tls_password_set_warning(TlsPassword* this_, char* warning);
24796 IOStream* /*new*/ g_tls_server_connection_new(IOStream* base_io_stream, TlsCertificate* certificate, GLib2.Error** error);
24797 Credentials* /*new*/ g_unix_connection_receive_credentials(UnixConnection* this_, Cancellable* cancellable, GLib2.Error** error);
24798 int g_unix_connection_receive_fd(UnixConnection* this_, Cancellable* cancellable, GLib2.Error** error);
24799 int g_unix_connection_send_credentials(UnixConnection* this_, Cancellable* cancellable, GLib2.Error** error);
24800 int g_unix_connection_send_fd(UnixConnection* this_, int fd, Cancellable* cancellable, GLib2.Error** error);
24801 UnixCredentialsMessage* /*new*/ g_unix_credentials_message_new();
24802 UnixCredentialsMessage* /*new*/ g_unix_credentials_message_new_with_credentials(Credentials* credentials);
24803 int g_unix_credentials_message_is_supported();
24804 Credentials* g_unix_credentials_message_get_credentials(UnixCredentialsMessage* this_);
24805 UnixFDList* /*new*/ g_unix_fd_list_new();
24806 UnixFDList* /*new*/ g_unix_fd_list_new_from_array(int* fds, int n_fds);
24807 int g_unix_fd_list_append(UnixFDList* this_, int fd, GLib2.Error** error);
24808 int g_unix_fd_list_get(UnixFDList* this_, int index_, GLib2.Error** error);
24809 int g_unix_fd_list_get_length(UnixFDList* this_);
24810 int* g_unix_fd_list_peek_fds(UnixFDList* this_, /*out*/ int* length=null);
24811 int* /*new*/ g_unix_fd_list_steal_fds(UnixFDList* this_, /*out*/ int* length=null);
24812 UnixFDMessage* /*new*/ g_unix_fd_message_new();
24813 UnixFDMessage* /*new*/ g_unix_fd_message_new_with_fd_list(UnixFDList* fd_list);
24814 int g_unix_fd_message_append_fd(UnixFDMessage* this_, int fd, GLib2.Error** error);
24815 UnixFDList* g_unix_fd_message_get_fd_list(UnixFDMessage* this_);
24816 int* /*new*/ g_unix_fd_message_steal_fds(UnixFDMessage* this_, /*out*/ int* length=null);
24817 UnixInputStream* /*new*/ g_unix_input_stream_new(int fd, int close_fd);
24818 int g_unix_input_stream_get_close_fd(UnixInputStream* this_);
24819 int g_unix_input_stream_get_fd(UnixInputStream* this_);
24820 void g_unix_input_stream_set_close_fd(UnixInputStream* this_, int close_fd);
24821 UnixMountMonitor* /*new*/ g_unix_mount_monitor_new();
24822 void g_unix_mount_monitor_set_rate_limit(UnixMountMonitor* this_, int limit_msec);
24823 int g_unix_mount_point_compare(UnixMountPoint* this_, UnixMountPoint* mount2);
24824 void g_unix_mount_point_free(UnixMountPoint* this_);
24825 char* g_unix_mount_point_get_device_path(UnixMountPoint* this_);
24826 char* g_unix_mount_point_get_fs_type(UnixMountPoint* this_);
24827 char* g_unix_mount_point_get_mount_path(UnixMountPoint* this_);
24828 int g_unix_mount_point_guess_can_eject(UnixMountPoint* this_);
24829 Icon* /*new*/ g_unix_mount_point_guess_icon(UnixMountPoint* this_);
24830 char* /*new*/ g_unix_mount_point_guess_name(UnixMountPoint* this_);
24831 int g_unix_mount_point_is_loopback(UnixMountPoint* this_);
24832 int g_unix_mount_point_is_readonly(UnixMountPoint* this_);
24833 int g_unix_mount_point_is_user_mountable(UnixMountPoint* this_);
24834 UnixOutputStream* /*new*/ g_unix_output_stream_new(int fd, int close_fd);
24835 int g_unix_output_stream_get_close_fd(UnixOutputStream* this_);
24836 int g_unix_output_stream_get_fd(UnixOutputStream* this_);
24837 void g_unix_output_stream_set_close_fd(UnixOutputStream* this_, int close_fd);
24838 UnixSocketAddress* /*new*/ g_unix_socket_address_new(char* path);
24839 UnixSocketAddress* /*new*/ g_unix_socket_address_new_abstract(char* path, int path_len);
24840 UnixSocketAddress* /*new*/ g_unix_socket_address_new_with_type(char* path, int path_len, UnixSocketAddressType type);
24841 int g_unix_socket_address_abstract_names_supported();
24842 UnixSocketAddressType g_unix_socket_address_get_address_type(UnixSocketAddress* this_);
24843 int g_unix_socket_address_get_is_abstract(UnixSocketAddress* this_);
24844 char* g_unix_socket_address_get_path(UnixSocketAddress* this_);
24845 size_t g_unix_socket_address_get_path_len(UnixSocketAddress* this_);
24846 Vfs* g_vfs_get_default();
24847 Vfs* g_vfs_get_local();
24848 File* /*new*/ g_vfs_get_file_for_path(Vfs* this_, char* path);
24849 File* /*new*/ g_vfs_get_file_for_uri(Vfs* this_, char* uri);
24850 char** g_vfs_get_supported_uri_schemes(Vfs* this_);
24851 int g_vfs_is_active(Vfs* this_);
24852 File* /*new*/ g_vfs_parse_name(Vfs* this_, char* parse_name);
24853 int g_volume_can_eject(Volume* this_);
24854 int g_volume_can_mount(Volume* this_);
24855 void g_volume_eject(Volume* this_, MountUnmountFlags flags, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24856 int g_volume_eject_finish(Volume* this_, AsyncResult* result, GLib2.Error** error);
24857 void g_volume_eject_with_operation(Volume* this_, MountUnmountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24858 int g_volume_eject_with_operation_finish(Volume* this_, AsyncResult* result, GLib2.Error** error);
24859 char** /*new*/ g_volume_enumerate_identifiers(Volume* this_);
24860 File* /*new*/ g_volume_get_activation_root(Volume* this_);
24861 Drive* /*new*/ g_volume_get_drive(Volume* this_);
24862 Icon* /*new*/ g_volume_get_icon(Volume* this_);
24863 char* /*new*/ g_volume_get_identifier(Volume* this_, char* kind);
24864 Mount* /*new*/ g_volume_get_mount(Volume* this_);
24865 char* /*new*/ g_volume_get_name(Volume* this_);
24866 char* /*new*/ g_volume_get_uuid(Volume* this_);
24867 void g_volume_mount(Volume* this_, MountMountFlags flags, MountOperation* mount_operation, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24868 int g_volume_mount_finish(Volume* this_, AsyncResult* result, GLib2.Error** error);
24869 int g_volume_should_automount(Volume* this_);
24870 Volume* /*new*/ g_volume_monitor_adopt_orphan_mount(Mount* mount);
24871 VolumeMonitor* /*new*/ g_volume_monitor_get();
24872 GLib2.List* /*new*/ g_volume_monitor_get_connected_drives(VolumeMonitor* this_);
24873 Mount* /*new*/ g_volume_monitor_get_mount_for_uuid(VolumeMonitor* this_, char* uuid);
24874 GLib2.List* /*new*/ g_volume_monitor_get_mounts(VolumeMonitor* this_);
24875 Volume* /*new*/ g_volume_monitor_get_volume_for_uuid(VolumeMonitor* this_, char* uuid);
24876 GLib2.List* /*new*/ g_volume_monitor_get_volumes(VolumeMonitor* this_);
24877 ZlibCompressor* /*new*/ g_zlib_compressor_new(ZlibCompressorFormat format, int level);
24878 FileInfo* g_zlib_compressor_get_file_info(ZlibCompressor* this_);
24879 void g_zlib_compressor_set_file_info(ZlibCompressor* this_, FileInfo* file_info=null);
24880 ZlibDecompressor* /*new*/ g_zlib_decompressor_new(ZlibCompressorFormat format);
24881 FileInfo* g_zlib_decompressor_get_file_info(ZlibDecompressor* this_);
24882 void g_bus_get(BusType bus_type, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24883 DBusConnection* /*new*/ g_bus_get_finish(AsyncResult* res, GLib2.Error** error);
24884 DBusConnection* /*new*/ g_bus_get_sync(BusType bus_type, Cancellable* cancellable, GLib2.Error** error);
24885 uint g_bus_own_name(BusType bus_type, char* name, BusNameOwnerFlags flags, BusAcquiredCallback bus_acquired_handler, BusNameAcquiredCallback name_acquired_handler, BusNameLostCallback name_lost_handler, void* user_data, GLib2.DestroyNotify user_data_free_func);
24886 uint g_bus_own_name_on_connection(DBusConnection* connection, char* name, BusNameOwnerFlags flags, BusNameAcquiredCallback name_acquired_handler, BusNameLostCallback name_lost_handler, void* user_data, GLib2.DestroyNotify user_data_free_func);
24887 uint g_bus_own_name_on_connection_with_closures(DBusConnection* connection, char* name, BusNameOwnerFlags flags, GObject2.Closure* name_acquired_closure=null, GObject2.Closure* name_lost_closure=null);
24888 uint g_bus_own_name_with_closures(BusType bus_type, char* name, BusNameOwnerFlags flags, GObject2.Closure* bus_acquired_closure=null, GObject2.Closure* name_acquired_closure=null, GObject2.Closure* name_lost_closure=null);
24889 void g_bus_unown_name(uint owner_id);
24890 void g_bus_unwatch_name(uint watcher_id);
24891 uint g_bus_watch_name(BusType bus_type, char* name, BusNameWatcherFlags flags, BusNameAppearedCallback name_appeared_handler, BusNameVanishedCallback name_vanished_handler, void* user_data, GLib2.DestroyNotify user_data_free_func);
24892 uint g_bus_watch_name_on_connection(DBusConnection* connection, char* name, BusNameWatcherFlags flags, BusNameAppearedCallback name_appeared_handler, BusNameVanishedCallback name_vanished_handler, void* user_data, GLib2.DestroyNotify user_data_free_func);
24893 uint g_bus_watch_name_on_connection_with_closures(DBusConnection* connection, char* name, BusNameWatcherFlags flags, GObject2.Closure* name_appeared_closure=null, GObject2.Closure* name_vanished_closure=null);
24894 uint g_bus_watch_name_with_closures(BusType bus_type, char* name, BusNameWatcherFlags flags, GObject2.Closure* name_appeared_closure=null, GObject2.Closure* name_vanished_closure=null);
24895 int g_content_type_can_be_executable(char* type);
24896 int g_content_type_equals(char* type1, char* type2);
24897 char* /*new*/ g_content_type_from_mime_type(char* mime_type);
24898 char* /*new*/ g_content_type_get_description(char* type);
24899 Icon* /*new*/ g_content_type_get_icon(char* type);
24900 char* /*new*/ g_content_type_get_mime_type(char* type);
24901 char* /*new*/ g_content_type_guess(char* filename, ubyte* data, size_t data_size, /*out*/ int* result_uncertain=null);
24902 char** /*new*/ g_content_type_guess_for_tree(File* root);
24903 int g_content_type_is_a(char* type, char* supertype);
24904 int g_content_type_is_unknown(char* type);
24905 GLib2.List* /*new*/ g_content_types_get_registered();
24906 char* /*new*/ g_dbus_address_get_for_bus_sync(BusType bus_type, Cancellable* cancellable, GLib2.Error** error);
24907 void g_dbus_address_get_stream(char* address, Cancellable* cancellable, AsyncReadyCallback callback, void* user_data);
24908 IOStream* /*new*/ g_dbus_address_get_stream_finish(AsyncResult* res, char** out_guid, GLib2.Error** error);
24909 IOStream* /*new*/ g_dbus_address_get_stream_sync(char* address, char** out_guid, Cancellable* cancellable, GLib2.Error** error);
24910 char* /*new*/ g_dbus_error_encode_gerror(GLib2.Error* error);
24911 char* /*new*/ g_dbus_error_get_remote_error(GLib2.Error* error);
24912 int g_dbus_error_is_remote_error(GLib2.Error* error);
24913 GLib2.Error* /*new*/ g_dbus_error_new_for_dbus_error(char* dbus_error_name, char* dbus_error_message);
24914 GLib2.Quark g_dbus_error_quark();
24915 int g_dbus_error_register_error(GLib2.Quark error_domain, int error_code, char* dbus_error_name);
24916 void g_dbus_error_register_error_domain(char* error_domain_quark_name, size_t* quark_volatile, DBusErrorEntry* entries, uint num_entries);
24917 int g_dbus_error_strip_remote_error(GLib2.Error* error);
24918 int g_dbus_error_unregister_error(GLib2.Quark error_domain, int error_code, char* dbus_error_name);
24919 char* /*new*/ g_dbus_generate_guid();
24920 GLib2.Variant* /*new*/ g_dbus_gvalue_to_gvariant(GObject2.Value* gvalue, GLib2.VariantType* type);
24921 void g_dbus_gvariant_to_gvalue(GLib2.Variant* value, GObject2.Value* out_gvalue);
24922 int g_dbus_is_address(char* string_);
24923 int g_dbus_is_guid(char* string_);
24924 int g_dbus_is_interface_name(char* string_);
24925 int g_dbus_is_member_name(char* string_);
24926 int g_dbus_is_name(char* string_);
24927 int g_dbus_is_supported_address(char* string_, GLib2.Error** error);
24928 int g_dbus_is_unique_name(char* string_);
24929 IOErrorEnum g_io_error_from_errno(int err_no);
24930 GLib2.Quark g_io_error_quark();
24931 Type g_io_extension_get_type(IOExtension* extension);
24932 GLib2.List* /*new*/ g_io_modules_load_all_in_directory(char* dirname);
24933 GLib2.List* /*new*/ g_io_modules_load_all_in_directory_with_scope(char* dirname, IOModuleScope* scope_);
24934 void g_io_modules_scan_all_in_directory(char* dirname);
24935 void g_io_modules_scan_all_in_directory_with_scope(char* dirname, IOModuleScope* scope_);
24936 void g_io_scheduler_cancel_all_jobs();
24937 void g_io_scheduler_push_job(IOSchedulerJobFunc job_func, void* user_data, GLib2.DestroyNotify notify, int io_priority, Cancellable* cancellable=null);
24938 GLib2.Source* /*new*/ g_pollable_source_new(GObject2.Object* pollable_stream);
24939 GLib2.Quark g_resolver_error_quark();
24940 void g_simple_async_report_error_in_idle(GObject2.Object* object, AsyncReadyCallback callback, void* user_data, GLib2.Quark domain, int code, char* format, ...);
24941 void g_simple_async_report_gerror_in_idle(GObject2.Object* object, AsyncReadyCallback callback, void* user_data, GLib2.Error* error);
24942 void g_simple_async_report_take_gerror_in_idle(GObject2.Object* object, AsyncReadyCallback callback, void* user_data, GLib2.Error* error);
24943 GLib2.Quark g_tls_error_quark();
24944 int g_unix_is_mount_path_system_internal(char* mount_path);
24945 UnixMountEntry* /*new*/ g_unix_mount_at(char* mount_path, /*out*/ ulong* time_read=null);
24946 int g_unix_mount_compare(UnixMountEntry* mount1, UnixMountEntry* mount2);
24947 void g_unix_mount_free(UnixMountEntry* mount_entry);
24948 char* g_unix_mount_get_device_path(UnixMountEntry* mount_entry);
24949 char* g_unix_mount_get_fs_type(UnixMountEntry* mount_entry);
24950 char* g_unix_mount_get_mount_path(UnixMountEntry* mount_entry);
24951 int g_unix_mount_guess_can_eject(UnixMountEntry* mount_entry);
24952 Icon* /*new*/ g_unix_mount_guess_icon(UnixMountEntry* mount_entry);
24953 char* /*new*/ g_unix_mount_guess_name(UnixMountEntry* mount_entry);
24954 int g_unix_mount_guess_should_display(UnixMountEntry* mount_entry);
24955 int g_unix_mount_is_readonly(UnixMountEntry* mount_entry);
24956 int g_unix_mount_is_system_internal(UnixMountEntry* mount_entry);
24957 int g_unix_mount_points_changed_since(ulong time);
24958 GLib2.List* /*new*/ g_unix_mount_points_get(/*out*/ ulong* time_read=null);
24959 int g_unix_mounts_changed_since(ulong time);
24960 GLib2.List* /*new*/ g_unix_mounts_get(/*out*/ ulong* time_read=null);