Class Gio


public class Gio extends Package
  • Constructor Details

    • Gio

      public Gio()
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • actionNameIsValid

      public static boolean actionNameIsValid(@Nonnull Str action_name)
      Checks if @action_name is valid.

      @action_name is valid if it consists only of alphanumeric characters,
      plus '-' and '.'. The empty string is not a valid action name.

      It is an error to call this function with a non-utf8 @action_name.
      @action_name must not be %NULL.
      Parameters:
      action_name - a potential action name
      Returns:
      %TRUE if @action_name is valid
    • actionPrintDetailedName

      public static Str actionPrintDetailedName(@Nonnull Str action_name, @Nullable Variant target_value)
      Formats a detailed action name from @action_name and @target_value.

      It is an error to call this function with an invalid action name.

      This function is the opposite of g_action_parse_detailed_name().
      It will produce a string that can be parsed back to the @action_name
      and @target_value by that function.

      See that function for the types of strings that will be printed by
      this function.
      Parameters:
      action_name - a valid action name
      target_value - a #GVariant target value, or %NULL
      Returns:
      a detailed format string
    • appInfoCreateFromCommandline

      public static AppInfo appInfoCreateFromCommandline(@Nonnull Str commandline, @Nullable Str application_name, int flags) throws AllocationError
      Creates a new #GAppInfo from the given information.

      Note that for @commandline, the quoting rules of the Exec key of the
      [freedesktop.org Desktop Entry Specification](http://freedesktop.org/Standards/desktop-entry-spec)
      are applied. For example, if the @commandline contains
      percent-encoded URIs, the percent-character must be doubled in order to prevent it from
      being swallowed by Exec key unquoting. See the specification for exact quoting rules.
      Parameters:
      commandline - the commandline to use
      application_name - the application name, or %NULL to use @commandline
      flags - flags that can specify details of the created #GAppInfo
      Returns:
      new #GAppInfo for given command.
      Throws:
      AllocationError
    • appInfoGetAll

      public static List appInfoGetAll()
      Gets a list of all of the applications currently registered
      on this system.

      For desktop files, this includes applications that have
      `NoDisplay=true` set or are excluded from display by means
      of `OnlyShowIn` or `NotShowIn`. See g_app_info_should_show().
      The returned list does not include applications which have
      the `Hidden` key set.
      Returns:
      a newly allocated #GList of references to #GAppInfos.
    • appInfoGetAllForType

      public static List appInfoGetAllForType(@Nonnull Str content_type)
      Gets a list of all #GAppInfos for a given content type,
      including the recommended and fallback #GAppInfos. See
      g_app_info_get_recommended_for_type() and
      g_app_info_get_fallback_for_type().
      Parameters:
      content_type - the content type to find a #GAppInfo for
      Returns:
      #GList of #GAppInfos for given @content_type or %NULL on error.
    • appInfoGetDefaultForType

      public static AppInfo appInfoGetDefaultForType(@Nonnull Str content_type, boolean must_support_uris)
      Gets the default #GAppInfo for a given content type.
      Parameters:
      content_type - the content type to find a #GAppInfo for
      must_support_uris - if %TRUE, the #GAppInfo is expected to support URIs
      Returns:
      #GAppInfo for given @content_type or %NULL on error.
    • appInfoGetDefaultForTypeAsync

      public static void appInfoGetDefaultForTypeAsync(@Nonnull Str content_type, boolean must_support_uris, @Nullable Cancellable cancellable, Gio.OnAsyncReadyCallback callback, @Nullable Pointer user_data)
      Asynchronously gets the default #GAppInfo for a given content type.
      Parameters:
      content_type - the content type to find a #GAppInfo for
      must_support_uris - if %TRUE, the #GAppInfo is expected to support URIs
      cancellable - optional #GCancellable object, %NULL to ignore
      callback - a #GAsyncReadyCallback to call when the request is done
      user_data - data to pass to @callback
    • appInfoGetDefaultForTypeFinish

      public static AppInfo appInfoGetDefaultForTypeFinish(@Nonnull AsyncResult result) throws AllocationError
      Finishes a default #GAppInfo lookup started by
      g_app_info_get_default_for_type_async().

      If no #GAppInfo is found, then @error will be set to %G_IO_ERROR_NOT_FOUND.
      Parameters:
      result - a #GAsyncResult
      Returns:
      #GAppInfo for given @content_type or %NULL on error.
      Throws:
      AllocationError
    • appInfoGetDefaultForUriScheme

      public static AppInfo appInfoGetDefaultForUriScheme(@Nonnull Str uri_scheme)
      Gets the default application for handling URIs with
      the given URI scheme. A URI scheme is the initial part
      of the URI, up to but not including the ':', e.g. "http",
      "ftp" or "sip".
      Parameters:
      uri_scheme - a string containing a URI scheme.
      Returns:
      #GAppInfo for given @uri_scheme or %NULL on error.
    • appInfoGetDefaultForUriSchemeAsync

      public static void appInfoGetDefaultForUriSchemeAsync(@Nonnull Str uri_scheme, @Nullable Cancellable cancellable, Gio.OnAsyncReadyCallback callback, @Nullable Pointer user_data)
      Asynchronously gets the default application for handling URIs with
      the given URI scheme. A URI scheme is the initial part
      of the URI, up to but not including the ':', e.g. "http",
      "ftp" or "sip".
      Parameters:
      uri_scheme - a string containing a URI scheme.
      cancellable - optional #GCancellable object, %NULL to ignore
      callback - a #GAsyncReadyCallback to call when the request is done
      user_data - data to pass to @callback
    • appInfoGetDefaultForUriSchemeFinish

      public static AppInfo appInfoGetDefaultForUriSchemeFinish(@Nonnull AsyncResult result) throws AllocationError
      Finishes a default #GAppInfo lookup started by
      g_app_info_get_default_for_uri_scheme_async().

      If no #GAppInfo is found, then @error will be set to %G_IO_ERROR_NOT_FOUND.
      Parameters:
      result - a #GAsyncResult
      Returns:
      #GAppInfo for given @uri_scheme or %NULL on error.
      Throws:
      AllocationError
    • appInfoGetFallbackForType

      public static List appInfoGetFallbackForType(@Nonnull Str content_type)
      Gets a list of fallback #GAppInfos for a given content type, i.e.
      those applications which claim to support the given content type
      by MIME type subclassing and not directly.
      Parameters:
      content_type - the content type to find a #GAppInfo for
      Returns:
      #GList of #GAppInfos for given @content_type or %NULL on error.
    • appInfoGetRecommendedForType

      public static List appInfoGetRecommendedForType(@Nonnull Str content_type)
      Gets a list of recommended #GAppInfos for a given content type, i.e.
      those applications which claim to support the given content type exactly,
      and not by MIME type subclassing.
      Note that the first application of the list is the last used one, i.e.
      the last one for which g_app_info_set_as_last_used_for_type() has been
      called.
      Parameters:
      content_type - the content type to find a #GAppInfo for
      Returns:
      #GList of #GAppInfos for given @content_type or %NULL on error.
    • appInfoLaunchDefaultForUri

      public static boolean appInfoLaunchDefaultForUri(@Nonnull Str uri, @Nullable AppLaunchContext context) throws AllocationError
      Utility function that launches the default application
      registered to handle the specified uri. Synchronous I/O
      is done on the uri to detect the type of the file if
      required.

      The D-Bus–activated applications don't have to be started if your application
      terminates too soon after this function. To prevent this, use
      g_app_info_launch_default_for_uri_async() instead.
      Parameters:
      uri - the uri to show
      context - an optional #GAppLaunchContext
      Returns:
      %TRUE on success, %FALSE on error.
      Throws:
      AllocationError
    • appInfoLaunchDefaultForUriAsync

      public static void appInfoLaunchDefaultForUriAsync(@Nonnull Str uri, @Nullable AppLaunchContext context, @Nullable Cancellable cancellable, Gio.OnAsyncReadyCallback callback, @Nullable Pointer user_data)
      Async version of g_app_info_launch_default_for_uri().

      This version is useful if you are interested in receiving
      error information in the case where the application is
      sandboxed and the portal may present an application chooser
      dialog to the user.

      This is also useful if you want to be sure that the D-Bus–activated
      applications are really started before termination and if you are interested
      in receiving error information from their activation.
      Parameters:
      uri - the uri to show
      context - an optional #GAppLaunchContext
      cancellable - a #GCancellable
      callback - a #GAsyncReadyCallback to call when the request is done
      user_data - data to pass to @callback
    • appInfoLaunchDefaultForUriFinish

      public static boolean appInfoLaunchDefaultForUriFinish(@Nonnull AsyncResult result) throws AllocationError
      Finishes an asynchronous launch-default-for-uri operation.
      Parameters:
      result - a #GAsyncResult
      Returns:
      %TRUE if the launch was successful, %FALSE if @error is set
      Throws:
      AllocationError
    • appInfoResetTypeAssociations

      public static void appInfoResetTypeAssociations(@Nonnull Str content_type)
      Removes all changes to the type associations done by
      g_app_info_set_as_default_for_type(),
      g_app_info_set_as_default_for_extension(),
      g_app_info_add_supports_type() or
      g_app_info_remove_supports_type().
      Parameters:
      content_type - a content type
    • busGet

      public static void busGet(int bus_type, @Nullable Cancellable cancellable, Gio.OnAsyncReadyCallback callback, @Nullable Pointer user_data)
      Asynchronously connects to the message bus specified by @bus_type.

      When the operation is finished, @callback will be invoked. You can
      then call g_bus_get_finish() to get the result of the operation.

      This is an asynchronous failable function. See g_bus_get_sync() for
      the synchronous version.
      Parameters:
      bus_type - a #GBusType
      cancellable - a #GCancellable or %NULL
      callback - a #GAsyncReadyCallback to call when the request is satisfied
      user_data - the data to pass to @callback
    • busGetFinish

      public static DBusConnection busGetFinish(@Nonnull AsyncResult res) throws AllocationError
      Finishes an operation started with g_bus_get().

      The returned object is a singleton, that is, shared with other
      callers of g_bus_get() and g_bus_get_sync() for @bus_type. In the
      event that you need a private message bus connection, use
      g_dbus_address_get_for_bus_sync() and
      g_dbus_connection_new_for_address() with
      G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT and
      G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flags.

      Note that the returned #GDBusConnection object will (usually) have
      the #GDBusConnection:exit-on-close property set to %TRUE.
      Parameters:
      res - a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_bus_get()
      Returns:
      a #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
      Throws:
      AllocationError
    • busGetSync

      public static DBusConnection busGetSync(int bus_type, @Nullable Cancellable cancellable) throws AllocationError
      Synchronously connects to the message bus specified by @bus_type.
      Note that the returned object may shared with other callers,
      e.g. if two separate parts of a process calls this function with
      the same @bus_type, they will share the same object.

      This is a synchronous failable function. See g_bus_get() and
      g_bus_get_finish() for the asynchronous version.

      The returned object is a singleton, that is, shared with other
      callers of g_bus_get() and g_bus_get_sync() for @bus_type. In the
      event that you need a private message bus connection, use
      g_dbus_address_get_for_bus_sync() and
      g_dbus_connection_new_for_address() with
      G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT and
      G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flags.

      Note that the returned #GDBusConnection object will (usually) have
      the #GDBusConnection:exit-on-close property set to %TRUE.
      Parameters:
      bus_type - a #GBusType
      cancellable - a #GCancellable or %NULL
      Returns:
      a #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
      Throws:
      AllocationError
    • busOwnName

      public static int busOwnName(int bus_type, @Nonnull Str name, int flags, Gio.OnBusAcquiredCallback bus_acquired_handler, Gio.OnBusNameAcquiredCallback name_acquired_handler, Gio.OnBusNameLostCallback name_lost_handler, @Nullable Pointer user_data, Gio.OnDestroyNotify user_data_free_func)
      Starts acquiring @name on the bus specified by @bus_type and calls
      @name_acquired_handler and @name_lost_handler when the name is
      acquired respectively lost. Callbacks will be invoked in the
      [thread-default main context][g-main-context-push-thread-default]
      of the thread you are calling this function from.

      You are guaranteed that one of the @name_acquired_handler and @name_lost_handler
      callbacks will be invoked after calling this function - there are three
      possible cases:

      - @name_lost_handler with a %NULL connection (if a connection to the bus
      can't be made).

      - @bus_acquired_handler then @name_lost_handler (if the name can't be
      obtained)

      - @bus_acquired_handler then @name_acquired_handler (if the name was
      obtained).

      When you are done owning the name, just call g_bus_unown_name()
      with the owner id this function returns.

      If the name is acquired or lost (for example another application
      could acquire the name if you allow replacement or the application
      currently owning the name exits), the handlers are also invoked.
      If the #GDBusConnection that is used for attempting to own the name
      closes, then @name_lost_handler is invoked since it is no longer
      possible for other processes to access the process.

      You cannot use g_bus_own_name() several times for the same name (unless
      interleaved with calls to g_bus_unown_name()) - only the first call
      will work.

      Another guarantee is that invocations of @name_acquired_handler
      and @name_lost_handler are guaranteed to alternate; that
      is, if @name_acquired_handler is invoked then you are
      guaranteed that the next time one of the handlers is invoked, it
      will be @name_lost_handler. The reverse is also true.

      If you plan on exporting objects (using e.g.
      g_dbus_connection_register_object()), note that it is generally too late
      to export the objects in @name_acquired_handler. Instead, you can do this
      in @bus_acquired_handler since you are guaranteed that this will run
      before @name is requested from the bus.

      This behavior makes it very simple to write applications that wants
      to [own names][gdbus-owning-names] and export objects.
      Simply register objects to be exported in @bus_acquired_handler and
      unregister the objects (if any) in @name_lost_handler.
      Parameters:
      bus_type - the type of bus to own a name on
      name - the well-known name to own
      flags - a set of flags from the #GBusNameOwnerFlags enumeration
      bus_acquired_handler - handler to invoke when connected to the bus of type @bus_type or %NULL
      name_acquired_handler - handler to invoke when @name is acquired or %NULL
      name_lost_handler - handler to invoke when @name is lost or %NULL
      user_data - user data to pass to handlers
      user_data_free_func - function for freeing @user_data or %NULL
      Returns:
      an identifier (never 0) that can be used with g_bus_unown_name() to stop owning the name.
    • busOwnNameOnConnection

      public static int busOwnNameOnConnection(@Nonnull DBusConnection connection, @Nonnull Str name, int flags, Gio.OnBusNameAcquiredCallback name_acquired_handler, Gio.OnBusNameLostCallback name_lost_handler, @Nullable Pointer user_data, Gio.OnDestroyNotify user_data_free_func)
      Like g_bus_own_name() but takes a #GDBusConnection instead of a
      #GBusType.
      Parameters:
      connection - a #GDBusConnection
      name - the well-known name to own
      flags - a set of flags from the #GBusNameOwnerFlags enumeration
      name_acquired_handler - handler to invoke when @name is acquired or %NULL
      name_lost_handler - handler to invoke when @name is lost or %NULL
      user_data - user data to pass to handlers
      user_data_free_func - function for freeing @user_data or %NULL
      Returns:
      an identifier (never 0) that can be used with g_bus_unown_name() to stop owning the name
    • busOwnNameOnConnectionWithClosures

      public static int busOwnNameOnConnectionWithClosures(@Nonnull DBusConnection connection, @Nonnull Str name, int flags, @Nullable Closure name_acquired_closure, @Nullable Closure name_lost_closure)
      Version of g_bus_own_name_on_connection() using closures instead of
      callbacks for easier binding in other languages.
      Parameters:
      connection - a #GDBusConnection
      name - the well-known name to own
      flags - a set of flags from the #GBusNameOwnerFlags enumeration
      name_acquired_closure - #GClosure to invoke when @name is acquired or %NULL
      name_lost_closure - #GClosure to invoke when @name is lost or %NULL
      Returns:
      an identifier (never 0) that can be used with g_bus_unown_name() to stop owning the name.
    • busOwnNameWithClosures

      public static int busOwnNameWithClosures(int bus_type, @Nonnull Str name, int flags, @Nullable Closure bus_acquired_closure, @Nullable Closure name_acquired_closure, @Nullable Closure name_lost_closure)
      Version of g_bus_own_name() using closures instead of callbacks for
      easier binding in other languages.
      Parameters:
      bus_type - the type of bus to own a name on
      name - the well-known name to own
      flags - a set of flags from the #GBusNameOwnerFlags enumeration
      bus_acquired_closure - #GClosure to invoke when connected to the bus of type @bus_type or %NULL
      name_acquired_closure - #GClosure to invoke when @name is acquired or %NULL
      name_lost_closure - #GClosure to invoke when @name is lost or %NULL
      Returns:
      an identifier (never 0) that can be used with g_bus_unown_name() to stop owning the name.
    • busUnownName

      public static void busUnownName(int owner_id)
      Stops owning a name.

      Note that there may still be D-Bus traffic to process (relating to owning
      and unowning the name) in the current thread-default #GMainContext after
      this function has returned. You should continue to iterate the #GMainContext
      until the #GDestroyNotify function passed to g_bus_own_name() is called, in
      order to avoid memory leaks through callbacks queued on the #GMainContext
      after it’s stopped being iterated.
      Parameters:
      owner_id - an identifier obtained from g_bus_own_name()
    • busUnwatchName

      public static void busUnwatchName(int watcher_id)
      Stops watching a name.

      Note that there may still be D-Bus traffic to process (relating to watching
      and unwatching the name) in the current thread-default #GMainContext after
      this function has returned. You should continue to iterate the #GMainContext
      until the #GDestroyNotify function passed to g_bus_watch_name() is called, in
      order to avoid memory leaks through callbacks queued on the #GMainContext
      after it’s stopped being iterated.
      Parameters:
      watcher_id - An identifier obtained from g_bus_watch_name()
    • busWatchName

      public static int busWatchName(int bus_type, @Nonnull Str name, int flags, Gio.OnBusNameAppearedCallback name_appeared_handler, Gio.OnBusNameVanishedCallback name_vanished_handler, @Nullable Pointer user_data, Gio.OnDestroyNotify user_data_free_func)
      Starts watching @name on the bus specified by @bus_type and calls
      @name_appeared_handler and @name_vanished_handler when the name is
      known to have an owner respectively known to lose its
      owner. Callbacks will be invoked in the
      [thread-default main context][g-main-context-push-thread-default]
      of the thread you are calling this function from.

      You are guaranteed that one of the handlers will be invoked after
      calling this function. When you are done watching the name, just
      call g_bus_unwatch_name() with the watcher id this function
      returns.

      If the name vanishes or appears (for example the application owning
      the name could restart), the handlers are also invoked. If the
      #GDBusConnection that is used for watching the name disconnects, then
      @name_vanished_handler is invoked since it is no longer
      possible to access the name.

      Another guarantee is that invocations of @name_appeared_handler
      and @name_vanished_handler are guaranteed to alternate; that
      is, if @name_appeared_handler is invoked then you are
      guaranteed that the next time one of the handlers is invoked, it
      will be @name_vanished_handler. The reverse is also true.

      This behavior makes it very simple to write applications that want
      to take action when a certain [name exists][gdbus-watching-names].
      Basically, the application should create object proxies in
      @name_appeared_handler and destroy them again (if any) in
      @name_vanished_handler.
      Parameters:
      bus_type - The type of bus to watch a name on.
      name - The name (well-known or unique) to watch.
      flags - Flags from the #GBusNameWatcherFlags enumeration.
      name_appeared_handler - Handler to invoke when @name is known to exist or %NULL.
      name_vanished_handler - Handler to invoke when @name is known to not exist or %NULL.
      user_data - User data to pass to handlers.
      user_data_free_func - Function for freeing @user_data or %NULL.
      Returns:
      An identifier (never 0) that can be used with g_bus_unwatch_name() to stop watching the name.
    • busWatchNameOnConnection

      public static int busWatchNameOnConnection(@Nonnull DBusConnection connection, @Nonnull Str name, int flags, Gio.OnBusNameAppearedCallback name_appeared_handler, Gio.OnBusNameVanishedCallback name_vanished_handler, @Nullable Pointer user_data, Gio.OnDestroyNotify user_data_free_func)
      Like g_bus_watch_name() but takes a #GDBusConnection instead of a
      #GBusType.
      Parameters:
      connection - A #GDBusConnection.
      name - The name (well-known or unique) to watch.
      flags - Flags from the #GBusNameWatcherFlags enumeration.
      name_appeared_handler - Handler to invoke when @name is known to exist or %NULL.
      name_vanished_handler - Handler to invoke when @name is known to not exist or %NULL.
      user_data - User data to pass to handlers.
      user_data_free_func - Function for freeing @user_data or %NULL.
      Returns:
      An identifier (never 0) that can be used with g_bus_unwatch_name() to stop watching the name.
    • busWatchNameOnConnectionWithClosures

      public static int busWatchNameOnConnectionWithClosures(@Nonnull DBusConnection connection, @Nonnull Str name, int flags, @Nullable Closure name_appeared_closure, @Nullable Closure name_vanished_closure)
      Version of g_bus_watch_name_on_connection() using closures instead of callbacks for
      easier binding in other languages.
      Parameters:
      connection - A #GDBusConnection.
      name - The name (well-known or unique) to watch.
      flags - Flags from the #GBusNameWatcherFlags enumeration.
      name_appeared_closure - #GClosure to invoke when @name is known to exist or %NULL.
      name_vanished_closure - #GClosure to invoke when @name is known to not exist or %NULL.
      Returns:
      An identifier (never 0) that can be used with g_bus_unwatch_name() to stop watching the name.
    • busWatchNameWithClosures

      public static int busWatchNameWithClosures(int bus_type, @Nonnull Str name, int flags, @Nullable Closure name_appeared_closure, @Nullable Closure name_vanished_closure)
      Version of g_bus_watch_name() using closures instead of callbacks for
      easier binding in other languages.
      Parameters:
      bus_type - The type of bus to watch a name on.
      name - The name (well-known or unique) to watch.
      flags - Flags from the #GBusNameWatcherFlags enumeration.
      name_appeared_closure - #GClosure to invoke when @name is known to exist or %NULL.
      name_vanished_closure - #GClosure to invoke when @name is known to not exist or %NULL.
      Returns:
      An identifier (never 0) that can be used with g_bus_unwatch_name() to stop watching the name.
    • contentTypeCanBeExecutable

      public static boolean contentTypeCanBeExecutable(@Nonnull Str type)
      Checks if a content type can be executable. Note that for instance
      things like text files can be executables (i.e. scripts and batch files).
      Parameters:
      type - a content type string
      Returns:
      %TRUE if the file type corresponds to a type that can be executable, %FALSE otherwise.
    • contentTypeEquals

      public static boolean contentTypeEquals(@Nonnull Str type1, @Nonnull Str type2)
      Compares two content types for equality.
      Parameters:
      type1 - a content type string
      type2 - a content type string
      Returns:
      %TRUE if the two strings are identical or equivalent, %FALSE otherwise.
    • contentTypeFromMimeType

      public static Str contentTypeFromMimeType(@Nonnull Str mime_type)
      Tries to find a content type based on the mime type name.
      Parameters:
      mime_type - a mime type string
      Returns:
      Newly allocated string with content type or %NULL. Free with g_free()
    • contentTypeGetDescription

      public static Str contentTypeGetDescription(@Nonnull Str type)
      Gets the human readable description of the content type.
      Parameters:
      type - a content type string
      Returns:
      a short description of the content type @type. Free the returned string with g_free()
    • contentTypeGetGenericIconName

      public static Str contentTypeGetGenericIconName(@Nonnull Str type)
      Gets the generic icon name for a content type.

      See the
      [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
      specification for more on the generic icon name.
      Parameters:
      type - a content type string
      Returns:
      the registered generic icon name for the given @type, or %NULL if unknown. Free with g_free()
    • contentTypeGetIcon

      public static Icon contentTypeGetIcon(@Nonnull Str type)
      Gets the icon for a content type.
      Parameters:
      type - a content type string
      Returns:
      #GIcon corresponding to the content type. Free the returned object with g_object_unref()
    • contentTypeGetMimeType

      public static Str contentTypeGetMimeType(@Nonnull Str type)
      Gets the mime type for the content type, if one is registered.
      Parameters:
      type - a content type string
      Returns:
      the registered mime type for the given @type, or %NULL if unknown; free with g_free().
    • contentTypeGetSymbolicIcon

      public static Icon contentTypeGetSymbolicIcon(@Nonnull Str type)
      Gets the symbolic icon for a content type.
      Parameters:
      type - a content type string
      Returns:
      symbolic #GIcon corresponding to the content type. Free the returned object with g_object_unref()
    • contentTypeIsA

      public static boolean contentTypeIsA(@Nonnull Str type, @Nonnull Str supertype)
      Determines if @type is a subset of @supertype.
      Parameters:
      type - a content type string
      supertype - a content type string
      Returns:
      %TRUE if @type is a kind of @supertype, %FALSE otherwise.
    • contentTypeIsMimeType

      public static boolean contentTypeIsMimeType(@Nonnull Str type, @Nonnull Str mime_type)
      Determines if @type is a subset of @mime_type.
      Convenience wrapper around g_content_type_is_a().
      Parameters:
      type - a content type string
      mime_type - a mime type string
      Returns:
      %TRUE if @type is a kind of @mime_type, %FALSE otherwise.
    • contentTypeIsUnknown

      public static boolean contentTypeIsUnknown(@Nonnull Str type)
      Checks if the content type is the generic "unknown" type.
      On UNIX this is the "application/octet-stream" mimetype,
      while on win32 it is "*" and on OSX it is a dynamic type
      or octet-stream.
      Parameters:
      type - a content type string
      Returns:
      %TRUE if the type is the unknown type.
    • contentTypesGetRegistered

      public static List contentTypesGetRegistered()
      Gets a list of strings containing all the registered content types
      known to the system. The list and its data should be freed using
      `g_list_free_full (list, g_free)`.
      Returns:
      list of the registered content types
    • dbusAddressEscapeValue

      public static Str dbusAddressEscapeValue(@Nonnull Str string)
      Escape @string so it can appear in a D-Bus address as the value
      part of a key-value pair.

      For instance, if @string is `/run/bus-for-:0`,
      this function would return `/run/bus-for-%3A0`,
      which could be used in a D-Bus address like
      `unix:nonce-tcp:host=127.0.0.1,port=42,noncefile=/run/bus-for-%3A0`.
      Parameters:
      string - an unescaped string to be included in a D-Bus address as the value in a key-value pair
      Returns:
      a copy of @string with all non-optionally-escaped bytes escaped
    • dbusAddressGetForBusSync

      public static Str dbusAddressGetForBusSync(int bus_type, @Nullable Cancellable cancellable) throws AllocationError
      Synchronously looks up the D-Bus address for the well-known message
      bus instance specified by @bus_type. This may involve using various
      platform specific mechanisms.

      The returned address will be in the
      [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
      Parameters:
      bus_type - a #GBusType
      cancellable - a #GCancellable or %NULL
      Returns:
      a valid D-Bus address string for @bus_type or %NULL if @error is set
      Throws:
      AllocationError
    • dbusAddressGetStream

      public static void dbusAddressGetStream(@Nonnull Str address, @Nullable Cancellable cancellable, Gio.OnAsyncReadyCallback callback, @Nullable Pointer user_data)
      Asynchronously connects to an endpoint specified by @address and
      sets up the connection so it is in a state to run the client-side
      of the D-Bus authentication conversation. @address must be in the
      [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).

      When the operation is finished, @callback will be invoked. You can
      then call g_dbus_address_get_stream_finish() to get the result of
      the operation.

      This is an asynchronous failable function. See
      g_dbus_address_get_stream_sync() for the synchronous version.
      Parameters:
      address - A valid D-Bus address.
      cancellable - A #GCancellable or %NULL.
      callback - A #GAsyncReadyCallback to call when the request is satisfied.
      user_data - Data to pass to @callback.
    • dbusErrorEncodeGerror

      public static Str dbusErrorEncodeGerror(@Nonnull Error error)
      Creates a D-Bus error name to use for @error. If @error matches
      a registered error (cf. g_dbus_error_register_error()), the corresponding
      D-Bus error name will be returned.

      Otherwise the a name of the form
      `org.gtk.GDBus.UnmappedGError.Quark._ESCAPED_QUARK_NAME.Code_ERROR_CODE`
      will be used. This allows other GDBus applications to map the error
      on the wire back to a #GError using g_dbus_error_new_for_dbus_error().

      This function is typically only used in object mappings to put a
      #GError on the wire. Regular applications should not use it.
      Parameters:
      error - A #GError.
      Returns:
      A D-Bus error name (never %NULL). Free with g_free().
    • dbusErrorGetRemoteError

      public static Str dbusErrorGetRemoteError(@Nonnull Error error)
      Gets the D-Bus error name used for @error, if any.

      This function is guaranteed to return a D-Bus error name for all
      #GErrors returned from functions handling remote method calls
      (e.g. g_dbus_connection_call_finish()) unless
      g_dbus_error_strip_remote_error() has been used on @error.
      Parameters:
      error - a #GError
      Returns:
      an allocated string or %NULL if the D-Bus error name could not be found. Free with g_free().
    • dbusErrorIsRemoteError

      public static boolean dbusErrorIsRemoteError(@Nonnull Error error)
      Checks if @error represents an error received via D-Bus from a remote peer. If so,
      use g_dbus_error_get_remote_error() to get the name of the error.
      Parameters:
      error - A #GError.
      Returns:
      %TRUE if @error represents an error from a remote peer, %FALSE otherwise.
    • dbusErrorNewForDbusError

      public static Error dbusErrorNewForDbusError(@Nonnull Str dbus_error_name, @Nonnull Str dbus_error_message)
      Creates a #GError based on the contents of @dbus_error_name and
      @dbus_error_message.

      Errors registered with g_dbus_error_register_error() will be looked
      up using @dbus_error_name and if a match is found, the error domain
      and code is used. Applications can use g_dbus_error_get_remote_error()
      to recover @dbus_error_name.

      If a match against a registered error is not found and the D-Bus
      error name is in a form as returned by g_dbus_error_encode_gerror()
      the error domain and code encoded in the name is used to
      create the #GError. Also, @dbus_error_name is added to the error message
      such that it can be recovered with g_dbus_error_get_remote_error().

      Otherwise, a #GError with the error code %G_IO_ERROR_DBUS_ERROR
      in the %G_IO_ERROR error domain is returned. Also, @dbus_error_name is
      added to the error message such that it can be recovered with
      g_dbus_error_get_remote_error().

      In all three cases, @dbus_error_name can always be recovered from the
      returned #GError using the g_dbus_error_get_remote_error() function
      (unless g_dbus_error_strip_remote_error() hasn't been used on the returned error).

      This function is typically only used in object mappings to prepare
      #GError instances for applications. Regular applications should not use
      it.
      Parameters:
      dbus_error_name - D-Bus error name.
      dbus_error_message - D-Bus error message.
      Returns:
      An allocated #GError. Free with g_error_free().
    • dbusErrorQuark

      public static int dbusErrorQuark()
      Returns:
    • dbusErrorRegisterError

      public static boolean dbusErrorRegisterError(int error_domain, int error_code, @Nonnull Str dbus_error_name)
      Creates an association to map between @dbus_error_name and
      #GErrors specified by @error_domain and @error_code.

      This is typically done in the routine that returns the #GQuark for
      an error domain.
      Parameters:
      error_domain - A #GQuark for an error domain.
      error_code - An error code.
      dbus_error_name - A D-Bus error name.
      Returns:
      %TRUE if the association was created, %FALSE if it already exists.
    • dbusErrorStripRemoteError

      public static boolean dbusErrorStripRemoteError(@Nonnull Error error)
      Looks for extra information in the error message used to recover
      the D-Bus error name and strips it if found. If stripped, the
      message field in @error will correspond exactly to what was
      received on the wire.

      This is typically used when presenting errors to the end user.
      Parameters:
      error - A #GError.
      Returns:
      %TRUE if information was stripped, %FALSE otherwise.
    • dbusErrorUnregisterError

      public static boolean dbusErrorUnregisterError(int error_domain, int error_code, @Nonnull Str dbus_error_name)
      Destroys an association previously set up with g_dbus_error_register_error().
      Parameters:
      error_domain - A #GQuark for an error domain.
      error_code - An error code.
      dbus_error_name - A D-Bus error name.
      Returns:
      %TRUE if the association was destroyed, %FALSE if it wasn't found.
    • dbusEscapeObjectPath

      public static Str dbusEscapeObjectPath(@Nonnull Str s)
      This is a language binding friendly version of g_dbus_escape_object_path_bytestring().
      Parameters:
      s - the string to escape
      Returns:
      an escaped version of @s. Free with g_free().
    • dbusGenerateGuid

      public static Str dbusGenerateGuid()
      Generate a D-Bus GUID that can be used with
      e.g. g_dbus_connection_new().

      See the
      [D-Bus specification](https://dbus.freedesktop.org/doc/dbus-specification.html#uuids)
      regarding what strings are valid D-Bus GUIDs. The specification refers to
      these as ‘UUIDs’ whereas GLib (for historical reasons) refers to them as
      ‘GUIDs’. The terms are interchangeable.

      Note that D-Bus GUIDs do not follow
      [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122).
      Returns:
      A valid D-Bus GUID. Free with g_free().
    • dbusGvalueToGvariant

      public static Variant dbusGvalueToGvariant(@Nonnull Value gvalue, @Nonnull VariantType type)
      Converts a #GValue to a #GVariant of the type indicated by the @type
      parameter.

      The conversion is using the following rules:

      - `G_TYPE_STRING`: 's', 'o', 'g' or 'ay'
      - `G_TYPE_STRV`: 'as', 'ao' or 'aay'
      - `G_TYPE_BOOLEAN`: 'b'
      - `G_TYPE_UCHAR`: 'y'
      - `G_TYPE_INT`: 'i', 'n'
      - `G_TYPE_UINT`: 'u', 'q'
      - `G_TYPE_INT64`: 'x'
      - `G_TYPE_UINT64`: 't'
      - `G_TYPE_DOUBLE`: 'd'
      - `G_TYPE_VARIANT`: Any #GVariantType

      This can fail if e.g. @gvalue is of type %G_TYPE_STRING and @type
      is 'i', i.e. %G_VARIANT_TYPE_INT32. It will also fail for any #GType
      (including e.g. %G_TYPE_OBJECT and %G_TYPE_BOXED derived-types) not
      in the table above.

      Note that if @gvalue is of type %G_TYPE_VARIANT and its value is
      %NULL, the empty #GVariant instance (never %NULL) for @type is
      returned (e.g. 0 for scalar types, the empty string for string types,
      '/' for object path types, the empty array for any array type and so on).

      See the g_dbus_gvariant_to_gvalue() function for how to convert a
      #GVariant to a #GValue.
      Parameters:
      gvalue - A #GValue to convert to a #GVariant
      type - A #GVariantType
      Returns:
      A #GVariant (never floating) of #GVariantType @type holding the data from @gvalue or an empty #GVariant in case of failure. Free with g_variant_unref().
    • dbusGvariantToGvalue

      public static void dbusGvariantToGvalue(@Nonnull Variant value, @Nonnull Value out_gvalue)
      Converts a #GVariant to a #GValue. If @value is floating, it is consumed.

      The rules specified in the g_dbus_gvalue_to_gvariant() function are
      used - this function is essentially its reverse form. So, a #GVariant
      containing any basic or string array type will be converted to a #GValue
      containing a basic value or string array. Any other #GVariant (handle,
      variant, tuple, dict entry) will be converted to a #GValue containing that
      #GVariant.

      The conversion never fails - a valid #GValue is always returned in
      @out_gvalue.
      Parameters:
      value - A #GVariant.
      out_gvalue - Return location pointing to a zero-filled (uninitialized) #GValue.
    • dbusIsAddress

      public static boolean dbusIsAddress(@Nonnull Str string)
      Checks if @string is a
      [D-Bus address](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).

      This doesn't check if @string is actually supported by #GDBusServer
      or #GDBusConnection - use g_dbus_is_supported_address() to do more
      checks.
      Parameters:
      string - A string.
      Returns:
      %TRUE if @string is a valid D-Bus address, %FALSE otherwise.
    • dbusIsErrorName

      public static boolean dbusIsErrorName(@Nonnull Str string)
      Check whether @string is a valid D-Bus error name.

      This function returns the same result as g_dbus_is_interface_name(),
      because D-Bus error names are defined to have exactly the
      same syntax as interface names.
      Parameters:
      string - The string to check.
      Returns:
      %TRUE if valid, %FALSE otherwise.
    • dbusIsGuid

      public static boolean dbusIsGuid(@Nonnull Str string)
      Checks if @string is a D-Bus GUID.

      See the documentation for g_dbus_generate_guid() for more information about
      the format of a GUID.
      Parameters:
      string - The string to check.
      Returns:
      %TRUE if @string is a GUID, %FALSE otherwise.
    • dbusIsInterfaceName

      public static boolean dbusIsInterfaceName(@Nonnull Str string)
      Checks if @string is a valid D-Bus interface name.
      Parameters:
      string - The string to check.
      Returns:
      %TRUE if valid, %FALSE otherwise.
    • dbusIsMemberName

      public static boolean dbusIsMemberName(@Nonnull Str string)
      Checks if @string is a valid D-Bus member (e.g. signal or method) name.
      Parameters:
      string - The string to check.
      Returns:
      %TRUE if valid, %FALSE otherwise.
    • dbusIsName

      public static boolean dbusIsName(@Nonnull Str string)
      Checks if @string is a valid D-Bus bus name (either unique or well-known).
      Parameters:
      string - The string to check.
      Returns:
      %TRUE if valid, %FALSE otherwise.
    • dbusIsSupportedAddress

      public static boolean dbusIsSupportedAddress(@Nonnull Str string) throws AllocationError
      Like g_dbus_is_address() but also checks if the library supports the
      transports in @string and that key/value pairs for each transport
      are valid. See the specification of the
      [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
      Parameters:
      string - A string.
      Returns:
      %TRUE if @string is a valid D-Bus address that is supported by this library, %FALSE if @error is set.
      Throws:
      AllocationError
    • dbusIsUniqueName

      public static boolean dbusIsUniqueName(@Nonnull Str string)
      Checks if @string is a valid D-Bus unique bus name.
      Parameters:
      string - The string to check.
      Returns:
      %TRUE if valid, %FALSE otherwise.
    • dtlsClientConnectionNew

      public static DtlsClientConnection dtlsClientConnectionNew(@Nonnull DatagramBased base_socket, @Nullable SocketConnectable server_identity) throws AllocationError
      Creates a new #GDtlsClientConnection wrapping @base_socket which is
      assumed to communicate with the server identified by @server_identity.
      Parameters:
      base_socket - the #GDatagramBased to wrap
      server_identity - the expected identity of the server
      Returns:
      the new #GDtlsClientConnection, or %NULL on error
      Throws:
      AllocationError
    • dtlsServerConnectionNew

      public static DtlsServerConnection dtlsServerConnectionNew(@Nonnull DatagramBased base_socket, @Nullable TlsCertificate certificate) throws AllocationError
      Creates a new #GDtlsServerConnection wrapping @base_socket.
      Parameters:
      base_socket - the #GDatagramBased to wrap
      certificate - the default server certificate, or %NULL
      Returns:
      the new #GDtlsServerConnection, or %NULL on error
      Throws:
      AllocationError
    • fileNewForCommandlineArg

      public static File fileNewForCommandlineArg(@Nonnull Str arg)
      Creates a #GFile with the given argument from the command line.
      The value of @arg can be either a URI, an absolute path or a
      relative path resolved relative to the current working directory.
      This operation never fails, but the returned object might not
      support any I/O operation if @arg points to a malformed path.

      Note that on Windows, this function expects its argument to be in
      UTF-8 -- not the system code page. This means that you
      should not use this function with string from argv as it is passed
      to main(). g_win32_get_command_line() will return a UTF-8 version of
      the commandline. #GApplication also uses UTF-8 but
      g_application_command_line_create_file_for_arg() may be more useful
      for you there. It is also always possible to use this function with
      #GOptionContext arguments of type %G_OPTION_ARG_FILENAME.
      Parameters:
      arg - a command line string
      Returns:
      a new #GFile. Free the returned object with g_object_unref().
    • fileNewForCommandlineArgAndCwd

      public static File fileNewForCommandlineArgAndCwd(@Nonnull Str arg, @Nonnull Str cwd)
      Creates a #GFile with the given argument from the command line.

      This function is similar to g_file_new_for_commandline_arg() except
      that it allows for passing the current working directory as an
      argument instead of using the current working directory of the
      process.

      This is useful if the commandline argument was given in a context
      other than the invocation of the current process.

      See also g_application_command_line_create_file_for_arg().
      Parameters:
      arg - a command line string
      cwd - the current working directory of the commandline
      Returns:
      a new #GFile
    • fileNewForPath

      public static File fileNewForPath(@Nonnull Str path)
      Constructs a #GFile for a given path. This operation never
      fails, but the returned object might not support any I/O
      operation if @path is malformed.
      Parameters:
      path - a string containing a relative or absolute path. The string must be encoded in the glib filename encoding.
      Returns:
      a new #GFile for the given @path. Free the returned object with g_object_unref().
    • fileNewForUri

      public static File fileNewForUri(@Nonnull Str uri)
      Constructs a #GFile for a given URI. This operation never
      fails, but the returned object might not support any I/O
      operation if @uri is malformed or if the uri type is
      not supported.
      Parameters:
      uri - a UTF-8 string containing a URI
      Returns:
      a new #GFile for the given @uri. Free the returned object with g_object_unref().
    • fileNewTmpAsync

      public static void fileNewTmpAsync(@Nullable Str tmpl, int io_priority, @Nullable Cancellable cancellable, Gio.OnAsyncReadyCallback callback, @Nullable Pointer user_data)
      Asynchronously opens a file in the preferred directory for temporary files
      (as returned by g_get_tmp_dir()) as g_file_new_tmp().

      @tmpl should be a string in the GLib file name encoding
      containing a sequence of six 'X' characters, and containing no
      directory components. If it is %NULL, a default template is used.
      Parameters:
      tmpl - Template for the file name, as in g_file_open_tmp(), or %NULL for a default template
      io_priority - the [I/O priority][io-priority] of the request
      cancellable - optional #GCancellable object, %NULL to ignore
      callback - a #GAsyncReadyCallback to call when the request is done
      user_data - data to pass to @callback
    • fileNewTmpDirAsync

      public static void fileNewTmpDirAsync(@Nullable Str tmpl, int io_priority, @Nullable Cancellable cancellable, Gio.OnAsyncReadyCallback callback, @Nullable Pointer user_data)
      Asynchronously creates a directory in the preferred directory for
      temporary files (as returned by g_get_tmp_dir()) as g_dir_make_tmp().

      @tmpl should be a string in the GLib file name encoding
      containing a sequence of six 'X' characters, and containing no
      directory components. If it is %NULL, a default template is used.
      Parameters:
      tmpl - Template for the file name, as in g_dir_make_tmp(), or %NULL for a default template
      io_priority - the [I/O priority][io-priority] of the request
      cancellable - optional #GCancellable object, %NULL to ignore
      callback - a #GAsyncReadyCallback to call when the request is done
      user_data - data to pass to @callback
    • fileNewTmpDirFinish

      public static File fileNewTmpDirFinish(@Nonnull AsyncResult result) throws AllocationError
      Finishes a temporary directory creation started by
      g_file_new_tmp_dir_async().
      Parameters:
      result - a #GAsyncResult
      Returns:
      a new #GFile. Free the returned object with g_object_unref().
      Throws:
      AllocationError
    • fileParseName

      public static File fileParseName(@Nonnull Str parse_name)
      Constructs a #GFile with the given @parse_name (i.e. something
      given by g_file_get_parse_name()). This operation never fails,
      but the returned object might not support any I/O operation if
      the @parse_name cannot be parsed.
      Parameters:
      parse_name - a file name or path to be parsed
      Returns:
      a new #GFile.
    • iconDeserialize

      public static Icon iconDeserialize(@Nonnull Variant value)
      Deserializes a #GIcon previously serialized using g_icon_serialize().
      Parameters:
      value - a #GVariant created with g_icon_serialize()
      Returns:
      a #GIcon, or %NULL when deserialization fails.
    • iconHash

      public static int iconHash(@Nonnull Pointer icon)
      Gets a hash for an icon.
      Parameters:
      icon - #gconstpointer to an icon object.
      Returns:
      a #guint containing a hash for the @icon, suitable for use in a #GHashTable or similar data structure.
    • iconNewForString

      public static Icon iconNewForString(@Nonnull Str str) throws AllocationError
      Generate a #GIcon instance from @str. This function can fail if
      @str is not valid - see g_icon_to_string() for discussion.

      If your application or library provides one or more #GIcon
      implementations you need to ensure that each #GType is registered
      with the type system prior to calling g_icon_new_for_string().
      Parameters:
      str - A string obtained via g_icon_to_string().
      Returns:
      An object implementing the #GIcon interface or %NULL if @error is set.
      Throws:
      AllocationError
    • ioErrorFromErrno

      public static int ioErrorFromErrno(int err_no)
      Converts errno.h error codes into GIO error codes. The fallback
      value %G_IO_ERROR_FAILED is returned for error codes not currently
      handled (but note that future GLib releases may return a more
      specific value instead).

      As %errno is global and may be modified by intermediate function
      calls, you should save its value as soon as the call which sets it
      Parameters:
      err_no - Error number as defined in errno.h.
      Returns:
      #GIOErrorEnum value for the given errno.h error number.
    • ioErrorFromFileError

      public static int ioErrorFromFileError(int file_error)
      Converts #GFileError error codes into GIO error codes.
      Parameters:
      file_error - a #GFileError.
      Returns:
      #GIOErrorEnum value for the given #GFileError error value.
    • ioErrorQuark

      public static int ioErrorQuark()
      Gets the GIO Error Quark.
      Returns:
      a #GQuark.
    • ioExtensionPointImplement

      public static ch.bailu.gtk.gio.IOExtension ioExtensionPointImplement(@Nonnull Str extension_point_name, long type, @Nonnull Str extension_name, int priority)
      Registers @type as extension for the extension point with name
      @extension_point_name.

      If @type has already been registered as an extension for this
      extension point, the existing #GIOExtension object is returned.
      Parameters:
      extension_point_name - the name of the extension point
      type - the #GType to register as extension
      extension_name - the name for the extension
      priority - the priority for the extension
      Returns:
      a #GIOExtension object for #GType
    • ioExtensionPointLookup

      public static ch.bailu.gtk.gio.IOExtensionPoint ioExtensionPointLookup(@Nonnull Str name)
      Looks up an existing extension point.
      Parameters:
      name - the name of the extension point
      Returns:
      the #GIOExtensionPoint, or %NULL if there is no registered extension point with the given name.
    • ioExtensionPointRegister

      public static ch.bailu.gtk.gio.IOExtensionPoint ioExtensionPointRegister(@Nonnull Str name)
      Registers an extension point.
      Parameters:
      name - The name of the extension point
      Returns:
      the new #GIOExtensionPoint. This object is owned by GIO and should not be freed.
    • ioModulesLoadAllInDirectory

      public static List ioModulesLoadAllInDirectory(@Nonnull Str dirname)
      Loads all the modules in the specified directory.

      If don't require all modules to be initialized (and thus registering
      all gtypes) then you can use g_io_modules_scan_all_in_directory()
      which allows delayed/lazy loading of modules.
      Parameters:
      dirname - pathname for a directory containing modules to load.
      Returns:
      a list of #GIOModules loaded from the directory, All the modules are loaded into memory, if you want to unload them (enabling on-demand loading) you must call g_type_module_unuse() on all the modules. Free the list with g_list_free().
    • ioModulesLoadAllInDirectoryWithScope

      public static List ioModulesLoadAllInDirectoryWithScope(@Nonnull Str dirname, @Nonnull ch.bailu.gtk.gio.IOModuleScope scope)
      Loads all the modules in the specified directory.

      If don't require all modules to be initialized (and thus registering
      all gtypes) then you can use g_io_modules_scan_all_in_directory()
      which allows delayed/lazy loading of modules.
      Parameters:
      dirname - pathname for a directory containing modules to load.
      scope - a scope to use when scanning the modules.
      Returns:
      a list of #GIOModules loaded from the directory, All the modules are loaded into memory, if you want to unload them (enabling on-demand loading) you must call g_type_module_unuse() on all the modules. Free the list with g_list_free().
    • ioModulesScanAllInDirectory

      public static void ioModulesScanAllInDirectory(@Nonnull Str dirname)
      Scans all the modules in the specified directory, ensuring that
      any extension point implemented by a module is registered.

      This may not actually load and initialize all the types in each
      module, some modules may be lazily loaded and initialized when
      an extension point it implements is used with e.g.
      g_io_extension_point_get_extensions() or
      g_io_extension_point_get_extension_by_name().

      If you need to guarantee that all types are loaded in all the modules,
      use g_io_modules_load_all_in_directory().
      Parameters:
      dirname - pathname for a directory containing modules to scan.
    • ioModulesScanAllInDirectoryWithScope

      public static void ioModulesScanAllInDirectoryWithScope(@Nonnull Str dirname, @Nonnull ch.bailu.gtk.gio.IOModuleScope scope)
      Scans all the modules in the specified directory, ensuring that
      any extension point implemented by a module is registered.

      This may not actually load and initialize all the types in each
      module, some modules may be lazily loaded and initialized when
      an extension point it implements is used with e.g.
      g_io_extension_point_get_extensions() or
      g_io_extension_point_get_extension_by_name().

      If you need to guarantee that all types are loaded in all the modules,
      use g_io_modules_load_all_in_directory().
      Parameters:
      dirname - pathname for a directory containing modules to scan.
      scope - a scope to use when scanning the modules
    • keyfileSettingsBackendNew

      public static SettingsBackend keyfileSettingsBackendNew(@Nonnull Str filename, @Nonnull Str root_path, @Nullable Str root_group)
      Creates a keyfile-backed #GSettingsBackend.

      The filename of the keyfile to use is given by @filename.

      All settings read to or written from the backend must fall under the
      path given in @root_path (which must start and end with a slash and
      not contain two consecutive slashes). @root_path may be "/".

      If @root_group is non-%NULL then it specifies the name of the keyfile
      group used for keys that are written directly below @root_path. For
      example, if @root_path is "/apps/example/" and @root_group is
      "toplevel", then settings the key "/apps/example/enabled" to a value
      of %TRUE will cause the following to appear in the keyfile:
         [toplevel]
         enabled=true
       


      If @root_group is %NULL then it is not permitted to store keys
      directly below the @root_path.

      For keys not stored directly below @root_path (ie: in a sub-path),
      the name of the subpath (with the final slash stripped) is used as
      the name of the keyfile group. To continue the example, if
      "/apps/example/profiles/default/font-size" were set to
      12 then the following would appear in the keyfile:
         [profiles/default]
         font-size=12
       


      The backend will refuse writes (and return writability as being
      %FALSE) for keys outside of @root_path and, in the event that
      @root_group is %NULL, also for keys directly under @root_path.
      Writes will also be refused if the backend detects that it has the
      inability to rewrite the keyfile (ie: the containing directory is not
      writable).

      There is no checking done for your key namespace clashing with the
      syntax of the key file format. For example, if you have '[' or ']'
      characters in your path names or '=' in your key names you may be in
      trouble.

      The backend reads default values from a keyfile called `defaults` in
      the directory specified by the #GKeyfileSettingsBackend:defaults-dir property,
      and a list of locked keys from a text file with the name `locks` in
      the same location.
      Parameters:
      filename - the filename of the keyfile
      root_path - the path under which all settings keys appear
      root_group - the group name corresponding to @root_path, or %NULL
      Returns:
      a keyfile-backed #GSettingsBackend
    • memoryMonitorDupDefault

      public static MemoryMonitor memoryMonitorDupDefault()
      Gets a reference to the default #GMemoryMonitor for the system.
      Returns:
      a new reference to the default #GMemoryMonitor
    • memorySettingsBackendNew

      public static SettingsBackend memorySettingsBackendNew()
      Creates a memory-backed #GSettingsBackend.

      This backend allows changes to settings, but does not write them
      to any backing storage, so the next time you run your application,
      the memory backend will start out with the default values again.
      Returns:
      a newly created #GSettingsBackend
    • networkMonitorGetDefault

      public static NetworkMonitor networkMonitorGetDefault()
      Gets the default #GNetworkMonitor for the system.
      Returns:
      a #GNetworkMonitor, which will be a dummy object if no network monitor is available
    • networkingInit

      public static void networkingInit()
      Initializes the platform networking libraries (eg, on Windows, this
      calls WSAStartup()). GLib will call this itself if it is needed, so
      you only need to call it if you directly call system networking
      functions (without calling any GLib networking functions first).
    • nullSettingsBackendNew

      public static SettingsBackend nullSettingsBackendNew()
      Creates a readonly #GSettingsBackend.

      This backend does not allow changes to settings, so all settings
      will always have their default values.
      Returns:
      a newly created #GSettingsBackend
    • pollableSourceNew

      public static Source pollableSourceNew(@Nonnull Object pollable_stream)
      Utility method for #GPollableInputStream and #GPollableOutputStream
      implementations. Creates a new #GSource that expects a callback of
      type #GPollableSourceFunc. The new source does not actually do
      anything on its own; use g_source_add_child_source() to add other
      sources to it to cause it to trigger.
      Parameters:
      pollable_stream - the stream associated with the new source
      Returns:
      the new #GSource.
    • pollableSourceNewFull

      public static Source pollableSourceNewFull(@Nonnull Pointer pollable_stream, @Nullable Source child_source, @Nullable Cancellable cancellable)
      Utility method for #GPollableInputStream and #GPollableOutputStream
      implementations. Creates a new #GSource, as with
      g_pollable_source_new(), but also attaching @child_source (with a
      dummy callback), and @cancellable, if they are non-%NULL.
      Parameters:
      pollable_stream - the stream associated with the new source
      child_source - optional child source to attach
      cancellable - optional #GCancellable to attach
      Returns:
      the new #GSource.
    • pollableStreamRead

      public static long pollableStreamRead(@Nonnull InputStream stream, @Nonnull Pointer buffer, long count, boolean blocking, @Nullable Cancellable cancellable) throws AllocationError
      Tries to read from @stream, as with g_input_stream_read() (if
      @blocking is %TRUE) or g_pollable_input_stream_read_nonblocking()
      (if @blocking is %FALSE). This can be used to more easily share
      code between blocking and non-blocking implementations of a method.

      If @blocking is %FALSE, then @stream must be a
      #GPollableInputStream for which g_pollable_input_stream_can_poll()
      returns %TRUE, or else the behavior is undefined. If @blocking is
      %TRUE, then @stream does not need to be a #GPollableInputStream.
      Parameters:
      stream - a #GInputStream
      buffer - a buffer to read data into
      count - the number of bytes to read
      blocking - whether to do blocking I/O
      cancellable - optional #GCancellable object, %NULL to ignore.
      Returns:
      the number of bytes read, or -1 on error.
      Throws:
      AllocationError
    • pollableStreamWrite

      public static long pollableStreamWrite(@Nonnull OutputStream stream, @Nonnull Pointer buffer, long count, boolean blocking, @Nullable Cancellable cancellable) throws AllocationError
      Tries to write to @stream, as with g_output_stream_write() (if
      @blocking is %TRUE) or g_pollable_output_stream_write_nonblocking()
      (if @blocking is %FALSE). This can be used to more easily share
      code between blocking and non-blocking implementations of a method.

      If @blocking is %FALSE, then @stream must be a
      #GPollableOutputStream for which
      g_pollable_output_stream_can_poll() returns %TRUE or else the
      behavior is undefined. If @blocking is %TRUE, then @stream does not
      need to be a #GPollableOutputStream.
      Parameters:
      stream - a #GOutputStream.
      buffer - the buffer containing the data to write.
      count - the number of bytes to write
      blocking - whether to do blocking I/O
      cancellable - optional #GCancellable object, %NULL to ignore.
      Returns:
      the number of bytes written, or -1 on error.
      Throws:
      AllocationError
    • pollableStreamWriteAll

      public static boolean pollableStreamWriteAll(@Nonnull OutputStream stream, @Nonnull Pointer buffer, long count, boolean blocking, @Nonnull Int64 bytes_written, @Nullable Cancellable cancellable) throws AllocationError
      Tries to write @count bytes to @stream, as with
      g_output_stream_write_all(), but using g_pollable_stream_write()
      rather than g_output_stream_write().

      On a successful write of @count bytes, %TRUE is returned, and
      @bytes_written is set to @count.

      If there is an error during the operation (including
      %G_IO_ERROR_WOULD_BLOCK in the non-blocking case), %FALSE is
      returned and @error is set to indicate the error status,
      @bytes_written is updated to contain the number of bytes written
      into the stream before the error occurred.

      As with g_pollable_stream_write(), if @blocking is %FALSE, then
      @stream must be a #GPollableOutputStream for which
      g_pollable_output_stream_can_poll() returns %TRUE or else the
      behavior is undefined. If @blocking is %TRUE, then @stream does not
      need to be a #GPollableOutputStream.
      Parameters:
      stream - a #GOutputStream.
      buffer - the buffer containing the data to write.
      count - the number of bytes to write
      blocking - whether to do blocking I/O
      bytes_written - location to store the number of bytes that was written to the stream
      cancellable - optional #GCancellable object, %NULL to ignore.
      Returns:
      %TRUE on success, %FALSE if there was an error
      Throws:
      AllocationError
    • powerProfileMonitorDupDefault

      public static PowerProfileMonitor powerProfileMonitorDupDefault()
      Gets a reference to the default #GPowerProfileMonitor for the system.
      Returns:
      a new reference to the default #GPowerProfileMonitor
    • proxyGetDefaultForProtocol

      public static Proxy proxyGetDefaultForProtocol(@Nonnull Str protocol)
      Find the `gio-proxy` extension point for a proxy implementation that supports
      the specified protocol.
      Parameters:
      protocol - the proxy protocol name (e.g. http, socks, etc)
      Returns:
      return a #GProxy or NULL if protocol is not supported.
    • proxyResolverGetDefault

      public static ProxyResolver proxyResolverGetDefault()
      Gets the default #GProxyResolver for the system.
      Returns:
      the default #GProxyResolver, which will be a dummy object if no proxy resolver is available
    • resolverErrorQuark

      public static int resolverErrorQuark()
      Gets the #GResolver Error Quark.
      Returns:
      a #GQuark.
    • resourceErrorQuark

      public static int resourceErrorQuark()
      Gets the #GResource Error Quark.
      Returns:
      a #GQuark
    • resourceLoad

      public static Resource resourceLoad(@Nonnull Str filename) throws AllocationError
      Loads a binary resource bundle and creates a #GResource representation of it, allowing
      you to query it for data.

      If you want to use this resource in the global resource namespace you need
      to register it with g_resources_register().

      If @filename is empty or the data in it is corrupt,
      %G_RESOURCE_ERROR_INTERNAL will be returned. If @filename doesn’t exist, or
      there is an error in reading it, an error from g_mapped_file_new() will be
      returned.
      Parameters:
      filename - the path of a filename to load, in the GLib filename encoding
      Returns:
      a new #GResource, or %NULL on error
      Throws:
      AllocationError
    • resourcesEnumerateChildren

      public static Strs resourcesEnumerateChildren(@Nonnull Str path, int lookup_flags) throws AllocationError
      Returns all the names of children at the specified @path in the set of
      globally registered resources.
      The return result is a %NULL terminated list of strings which should
      be released with g_strfreev().

      @lookup_flags controls the behaviour of the lookup.
      Parameters:
      path - A pathname inside the resource
      lookup_flags - A #GResourceLookupFlags
      Returns:
      an array of constant strings
      Throws:
      AllocationError
    • resourcesGetInfo

      public static boolean resourcesGetInfo(@Nonnull Str path, int lookup_flags, @Nullable Int64 size, @Nullable Int flags) throws AllocationError
      Looks for a file at the specified @path in the set of
      globally registered resources and if found returns information about it.

      @lookup_flags controls the behaviour of the lookup.
      Parameters:
      path - A pathname inside the resource
      lookup_flags - A #GResourceLookupFlags
      size - a location to place the length of the contents of the file, or %NULL if the length is not needed
      flags - a location to place the #GResourceFlags about the file, or %NULL if the flags are not needed
      Returns:
      %TRUE if the file was found. %FALSE if there were errors
      Throws:
      AllocationError
    • resourcesLookupData

      public static Bytes resourcesLookupData(@Nonnull Str path, int lookup_flags) throws AllocationError
      Looks for a file at the specified @path in the set of
      globally registered resources and returns a #GBytes that
      lets you directly access the data in memory.

      The data is always followed by a zero byte, so you
      can safely use the data as a C string. However, that byte
      is not included in the size of the GBytes.

      For uncompressed resource files this is a pointer directly into
      the resource bundle, which is typically in some readonly data section
      in the program binary. For compressed files we allocate memory on
      the heap and automatically uncompress the data.

      @lookup_flags controls the behaviour of the lookup.
      Parameters:
      path - A pathname inside the resource
      lookup_flags - A #GResourceLookupFlags
      Returns:
      #GBytes or %NULL on error. Free the returned object with g_bytes_unref()
      Throws:
      AllocationError
    • resourcesOpenStream

      public static InputStream resourcesOpenStream(@Nonnull Str path, int lookup_flags) throws AllocationError
      Looks for a file at the specified @path in the set of
      globally registered resources and returns a #GInputStream
      that lets you read the data.

      @lookup_flags controls the behaviour of the lookup.
      Parameters:
      path - A pathname inside the resource
      lookup_flags - A #GResourceLookupFlags
      Returns:
      #GInputStream or %NULL on error. Free the returned object with g_object_unref()
      Throws:
      AllocationError
    • resourcesRegister

      public static void resourcesRegister(@Nonnull Resource resource)
      Registers the resource with the process-global set of resources.
      Once a resource is registered the files in it can be accessed
      with the global resource lookup functions like g_resources_lookup_data().
      Parameters:
      resource - A #GResource
    • resourcesUnregister

      public static void resourcesUnregister(@Nonnull Resource resource)
      Unregisters the resource from the process-global set of resources.
      Parameters:
      resource - A #GResource
    • settingsSchemaSourceGetDefault

      public static SettingsSchemaSource settingsSchemaSourceGetDefault()
      Gets the default system schema source.

      This function is not required for normal uses of #GSettings but it
      may be useful to authors of plugin management systems or to those who
      want to introspect the content of schemas.

      If no schemas are installed, %NULL will be returned.

      The returned source may actually consist of multiple schema sources
      from different directories, depending on which directories were given
      in `XDG_DATA_DIRS` and `GSETTINGS_SCHEMA_DIR`. For this reason, all
      lookups performed against the default source should probably be done
      recursively.
      Returns:
      the default schema source
    • srvTargetListSort

      public static List srvTargetListSort(@Nonnull List targets)
      Sorts @targets in place according to the algorithm in RFC 2782.
      Parameters:
      targets - a #GList of #GSrvTarget
      Returns:
      the head of the sorted list.
    • tlsBackendGetDefault

      public static TlsBackend tlsBackendGetDefault()
      Gets the default #GTlsBackend for the system.
      Returns:
      a #GTlsBackend, which will be a dummy object if no TLS backend is available
    • tlsChannelBindingErrorQuark

      public static int tlsChannelBindingErrorQuark()
      Gets the TLS channel binding error quark.
      Returns:
      a #GQuark.
    • tlsClientConnectionNew

      public static TlsClientConnection tlsClientConnectionNew(@Nonnull IOStream base_io_stream, @Nullable SocketConnectable server_identity) throws AllocationError
      Creates a new #GTlsClientConnection wrapping @base_io_stream (which
      must have pollable input and output streams) which is assumed to
      communicate with the server identified by @server_identity.

      See the documentation for #GTlsConnection:base-io-stream for restrictions
      on when application code can run operations on the @base_io_stream after
      this function has returned.
      Parameters:
      base_io_stream - the #GIOStream to wrap
      server_identity - the expected identity of the server
      Returns:
      the new #GTlsClientConnection, or %NULL on error
      Throws:
      AllocationError
    • tlsErrorQuark

      public static int tlsErrorQuark()
      Gets the TLS error quark.
      Returns:
      a #GQuark.
    • tlsFileDatabaseNew

      public static TlsFileDatabase tlsFileDatabaseNew(@Nonnull Str anchors) throws AllocationError
      Creates a new #GTlsFileDatabase which uses anchor certificate authorities
      in @anchors to verify certificate chains.

      The certificates in @anchors must be PEM encoded.
      Parameters:
      anchors - filename of anchor certificate authorities.
      Returns:
      the new #GTlsFileDatabase, or %NULL on error
      Throws:
      AllocationError
    • tlsServerConnectionNew

      public static TlsServerConnection tlsServerConnectionNew(@Nonnull IOStream base_io_stream, @Nullable TlsCertificate certificate) throws AllocationError
      Creates a new #GTlsServerConnection wrapping @base_io_stream (which
      must have pollable input and output streams).

      See the documentation for #GTlsConnection:base-io-stream for restrictions
      on when application code can run operations on the @base_io_stream after
      this function has returned.
      Parameters:
      base_io_stream - the #GIOStream to wrap
      certificate - the default server certificate, or %NULL
      Returns:
      the new #GTlsServerConnection, or %NULL on error
      Throws:
      AllocationError
    • unixIsMountPathSystemInternal

      public static boolean unixIsMountPathSystemInternal(@Nonnull Str mount_path)
      Determines if @mount_path is considered an implementation of the
      OS. This is primarily used for hiding mountable and mounted volumes
      that only are used in the OS and has little to no relevance to the
      casual user.
      Parameters:
      mount_path - a mount path, e.g. `/media/disk` or `/usr`
      Returns:
      %TRUE if @mount_path is considered an implementation detail of the OS.
    • unixIsSystemDevicePath

      public static boolean unixIsSystemDevicePath(@Nonnull Str device_path)
      Determines if @device_path is considered a block device path which is only
      used in implementation of the OS. This is primarily used for hiding
      mounted volumes that are intended as APIs for programs to read, and system
      administrators at a shell; rather than something that should, for example,
      appear in a GUI. For example, the Linux `/proc` filesystem.

      The list of device paths considered ‘system’ ones may change over time.
      Parameters:
      device_path - a device path, e.g. `/dev/loop0` or `nfsd`
      Returns:
      %TRUE if @device_path is considered an implementation detail of the OS.
    • unixIsSystemFsType

      public static boolean unixIsSystemFsType(@Nonnull Str fs_type)
      Determines if @fs_type is considered a type of file system which is only
      used in implementation of the OS. This is primarily used for hiding
      mounted volumes that are intended as APIs for programs to read, and system
      administrators at a shell; rather than something that should, for example,
      appear in a GUI. For example, the Linux `/proc` filesystem.

      The list of file system types considered ‘system’ ones may change over time.
      Parameters:
      fs_type - a file system type, e.g. `procfs` or `tmpfs`
      Returns:
      %TRUE if @fs_type is considered an implementation detail of the OS.
    • unixMountCompare

      public static int unixMountCompare(@Nonnull UnixMountEntry mount1, @Nonnull UnixMountEntry mount2)
      Compares two unix mounts.
      Parameters:
      mount1 - first #GUnixMountEntry to compare.
      mount2 - second #GUnixMountEntry to compare.
      Returns:
      1, 0 or -1 if @mount1 is greater than, equal to, or less than @mount2, respectively.
    • unixMountCopy

      public static UnixMountEntry unixMountCopy(@Nonnull UnixMountEntry mount_entry)
      Makes a copy of @mount_entry.
      Parameters:
      mount_entry - a #GUnixMountEntry.
      Returns:
      a new #GUnixMountEntry
    • unixMountFree

      public static void unixMountFree(@Nonnull UnixMountEntry mount_entry)
      Frees a unix mount.
      Parameters:
      mount_entry - a #GUnixMountEntry.
    • unixMountGetDevicePath

      public static Str unixMountGetDevicePath(@Nonnull UnixMountEntry mount_entry)
      Gets the device path for a unix mount.
      Parameters:
      mount_entry - a #GUnixMount.
      Returns:
      a string containing the device path.
    • unixMountGetFsType

      public static Str unixMountGetFsType(@Nonnull UnixMountEntry mount_entry)
      Gets the filesystem type for the unix mount.
      Parameters:
      mount_entry - a #GUnixMount.
      Returns:
      a string containing the file system type.
    • unixMountGetMountPath

      public static Str unixMountGetMountPath(@Nonnull UnixMountEntry mount_entry)
      Gets the mount path for a unix mount.
      Parameters:
      mount_entry - input #GUnixMountEntry to get the mount path for.
      Returns:
      the mount path for @mount_entry.
    • unixMountGetOptions

      public static Str unixMountGetOptions(@Nonnull UnixMountEntry mount_entry)
      Gets a comma-separated list of mount options for the unix mount. For example,
      `rw,relatime,seclabel,data=ordered`.

      This is similar to g_unix_mount_point_get_options(), but it takes
      a #GUnixMountEntry as an argument.
      Parameters:
      mount_entry - a #GUnixMountEntry.
      Returns:
      a string containing the options, or %NULL if not available.
    • unixMountGetRootPath

      public static Str unixMountGetRootPath(@Nonnull UnixMountEntry mount_entry)
      Gets the root of the mount within the filesystem. This is useful e.g. for
      mounts created by bind operation, or btrfs subvolumes.

      For example, the root path is equal to "/" for mount created by
      "mount /dev/sda1 /mnt/foo" and "/bar" for
      "mount --bind /mnt/foo/bar /mnt/bar".
      Parameters:
      mount_entry - a #GUnixMountEntry.
      Returns:
      a string containing the root, or %NULL if not supported.
    • unixMountGuessCanEject

      public static boolean unixMountGuessCanEject(@Nonnull UnixMountEntry mount_entry)
      Guesses whether a Unix mount can be ejected.
      Parameters:
      mount_entry - a #GUnixMountEntry
      Returns:
      %TRUE if @mount_entry is deemed to be ejectable.
    • unixMountGuessIcon

      public static Icon unixMountGuessIcon(@Nonnull UnixMountEntry mount_entry)
      Guesses the icon of a Unix mount.
      Parameters:
      mount_entry - a #GUnixMountEntry
      Returns:
      a #GIcon
    • unixMountGuessName

      public static Str unixMountGuessName(@Nonnull UnixMountEntry mount_entry)
      Guesses the name of a Unix mount.
      The result is a translated string.
      Parameters:
      mount_entry - a #GUnixMountEntry
      Returns:
      A newly allocated string that must be freed with g_free()
    • unixMountGuessShouldDisplay

      public static boolean unixMountGuessShouldDisplay(@Nonnull UnixMountEntry mount_entry)
      Guesses whether a Unix mount should be displayed in the UI.
      Parameters:
      mount_entry - a #GUnixMountEntry
      Returns:
      %TRUE if @mount_entry is deemed to be displayable.
    • unixMountGuessSymbolicIcon

      public static Icon unixMountGuessSymbolicIcon(@Nonnull UnixMountEntry mount_entry)
      Guesses the symbolic icon of a Unix mount.
      Parameters:
      mount_entry - a #GUnixMountEntry
      Returns:
      a #GIcon
    • unixMountIsReadonly

      public static boolean unixMountIsReadonly(@Nonnull UnixMountEntry mount_entry)
      Checks if a unix mount is mounted read only.
      Parameters:
      mount_entry - a #GUnixMount.
      Returns:
      %TRUE if @mount_entry is read only.
    • unixMountIsSystemInternal

      public static boolean unixMountIsSystemInternal(@Nonnull UnixMountEntry mount_entry)
      Checks if a Unix mount is a system mount. This is the Boolean OR of
      g_unix_is_system_fs_type(), g_unix_is_system_device_path() and
      g_unix_is_mount_path_system_internal() on @mount_entry’s properties.

      The definition of what a ‘system’ mount entry is may change over time as new
      file system types and device paths are ignored.
      Parameters:
      mount_entry - a #GUnixMount.
      Returns:
      %TRUE if the unix mount is for a system path.
    • unixMountPointsChangedSince

      public static boolean unixMountPointsChangedSince(long time)
      Checks if the unix mount points have changed since a given unix time.
      Parameters:
      time - guint64 to contain a timestamp.
      Returns:
      %TRUE if the mount points have changed since @time.
    • unixMountsChangedSince

      public static boolean unixMountsChangedSince(long time)
      Checks if the unix mounts have changed since a given unix time.
      Parameters:
      time - guint64 to contain a timestamp.
      Returns:
      %TRUE if the mounts have changed since @time.