Functions¶
Details¶
- Gio.action_name_is_valid(action_name)[source]¶
- Parameters:
action_name (
str
) – a potential action name- Returns:
True
if action_name is valid- Return type:
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
None
.New in version 2.38.
- Gio.action_parse_detailed_name(detailed_name)[source]¶
- Parameters:
detailed_name (
str
) – a detailed action name- Raises:
- Returns:
True
if successful, elseFalse
with error set- action_name:
the action name
- target_value:
the target value, or
None
for no target
- Return type:
(
bool
, action_name:str
, target_value:GLib.Variant
orNone
)
Parses a detailed action name into its separate name and target components.
Detailed action names can have three formats.
The first format is used to represent an action name with no target value and consists of just an action name containing no whitespace nor the characters
:
,(
or)
. For example:app.action
.The second format is used to represent an action with a target value that is a non-empty string consisting only of alphanumerics, plus
-
and.
. In that case, the action name and target value are separated by a double colon (::
). For example:app.action::target
.The third format is used to represent an action with any type of target value, including strings. The target value follows the action name, surrounded in parens. For example:
app.action(42)
. The target value is parsed usingGLib.Variant.parse
(). If a tuple-typed value is desired, it must be specified in the same way, resulting in two sets of parens, for example:app.action((1,2,3))
. A string target can be specified this way as well:app.action('target')
. For strings, this third format must be used if target value is empty or contains characters other than alphanumerics,-
and.
.If this function returns
True
, a non-None
value is guaranteed to be returned in action_name (if a pointer is passed in). ANone
value may still be returned in target_value, as the detailed_name may not contain a target.If returned, the
GLib.Variant
in target_value is guaranteed to not be floating.New in version 2.38.
- Gio.action_print_detailed_name(action_name, target_value)[source]¶
- Parameters:
action_name (
str
) – a valid action nametarget_value (
GLib.Variant
orNone
) – aGLib.Variant
target value, orNone
- Returns:
a detailed format string
- Return type:
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
Gio.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.
New in version 2.38.
- Gio.app_info_create_from_commandline(commandline, application_name, flags)[source]¶
- Parameters:
commandline (
str
) – the commandline to useapplication_name (
str
orNone
) – the application name, orNone
to use commandlineflags (
Gio.AppInfoCreateFlags
) – flags that can specify details of the createdGio.AppInfo
- Raises:
- Returns:
new
Gio.AppInfo
for given command.- Return type:
Creates a new
Gio.AppInfo
from the given information.Note that for commandline, the quoting rules of the Exec key of the freedesktop.org Desktop Entry Specification 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.
- Gio.app_info_get_all()[source]¶
- Returns:
a newly allocated
GLib.List
of references toGio.AppInfos
.- Return type:
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 ofOnlyShowIn
orNotShowIn
. SeeGio.AppInfo.should_show
(). The returned list does not include applications which have theHidden
key set.
- Gio.app_info_get_all_for_type(content_type)[source]¶
- Parameters:
content_type (
str
) – the content type to find aGio.AppInfo
for- Returns:
GLib.List
ofGio.AppInfos
for given content_type orNone
on error.- Return type:
Gets a list of all
Gio.AppInfos
for a given content type, including the recommended and fallbackGio.AppInfos
. SeeGio.AppInfo.get_recommended_for_type
() andGio.AppInfo.get_fallback_for_type
().
- Gio.app_info_get_default_for_type(content_type, must_support_uris)[source]¶
- Parameters:
content_type (
str
) – the content type to find aGio.AppInfo
formust_support_uris (
bool
) – ifTrue
, theGio.AppInfo
is expected to support URIs
- Returns:
Gio.AppInfo
for given content_type orNone
on error.- Return type:
Gio.AppInfo
orNone
Gets the default
Gio.AppInfo
for a given content type.
- Gio.app_info_get_default_for_type_async(content_type, must_support_uris, cancellable, callback, *user_data)[source]¶
- Parameters:
content_type (
str
) – the content type to find aGio.AppInfo
formust_support_uris (
bool
) – ifTrue
, theGio.AppInfo
is expected to support URIscancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is done
Asynchronously gets the default
Gio.AppInfo
for a given content type.New in version 2.74.
- Gio.app_info_get_default_for_type_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
Gio.AppInfo
for given content_type orNone
on error.- Return type:
Finishes a default
Gio.AppInfo
lookup started byGio.AppInfo.get_default_for_type_async
().If no
Gio.AppInfo
is found, then error will be set toGio.IOErrorEnum.NOT_FOUND
.New in version 2.74.
- Gio.app_info_get_default_for_uri_scheme(uri_scheme)[source]¶
- Parameters:
uri_scheme (
str
) – a string containing a URI scheme.- Returns:
Gio.AppInfo
for given uri_scheme orNone
on error.- Return type:
Gio.AppInfo
orNone
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”.
- Gio.app_info_get_default_for_uri_scheme_async(uri_scheme, cancellable, callback, *user_data)[source]¶
- Parameters:
uri_scheme (
str
) – a string containing a URI scheme.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is done
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”.
New in version 2.74.
- Gio.app_info_get_default_for_uri_scheme_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
Gio.AppInfo
for given uri_scheme orNone
on error.- Return type:
Finishes a default
Gio.AppInfo
lookup started byGio.AppInfo.get_default_for_uri_scheme_async
().If no
Gio.AppInfo
is found, then error will be set toGio.IOErrorEnum.NOT_FOUND
.New in version 2.74.
- Gio.app_info_get_fallback_for_type(content_type)[source]¶
- Parameters:
content_type (
str
) – the content type to find aGio.AppInfo
for- Returns:
GLib.List
ofGio.AppInfos
for given content_type orNone
on error.- Return type:
Gets a list of fallback
Gio.AppInfos
for a given content type, i.e. those applications which claim to support the given content type by MIME type subclassing and not directly.New in version 2.28.
- Gio.app_info_get_recommended_for_type(content_type)[source]¶
- Parameters:
content_type (
str
) – the content type to find aGio.AppInfo
for- Returns:
GLib.List
ofGio.AppInfos
for given content_type orNone
on error.- Return type:
Gets a list of recommended
Gio.AppInfos
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 whichGio.AppInfo.set_as_last_used_for_type
() has been called.New in version 2.28.
- Gio.app_info_launch_default_for_uri(uri, context)[source]¶
- Parameters:
uri (
str
) – the uri to showcontext (
Gio.AppLaunchContext
orNone
) – an optionalGio.AppLaunchContext
- Raises:
- Returns:
- Return type:
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
Gio.AppInfo.launch_default_for_uri_async
() instead.
- Gio.app_info_launch_default_for_uri_async(uri, context, cancellable, callback, *user_data)[source]¶
- Parameters:
uri (
str
) – the uri to showcontext (
Gio.AppLaunchContext
orNone
) – an optionalGio.AppLaunchContext
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is done
Async version of
Gio.AppInfo.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.
New in version 2.50.
- Gio.app_info_launch_default_for_uri_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
- Return type:
Finishes an asynchronous launch-default-for-uri operation.
New in version 2.50.
- Gio.app_info_reset_type_associations(content_type)[source]¶
- Parameters:
content_type (
str
) – a content type
Removes all changes to the type associations done by
Gio.AppInfo.set_as_default_for_type
(),Gio.AppInfo.set_as_default_for_extension
(),Gio.AppInfo.add_supports_type
() orGio.AppInfo.remove_supports_type
().New in version 2.20.
- Gio.async_initable_newv_async(object_type, n_parameters, parameters, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters:
object_type (
GObject.GType
) – aGObject.GType
supportingGio.AsyncInitable
.n_parameters (
int
) – the number of parameters in parametersparameters (
GObject.Parameter
) – the parameters to use to construct the objectio_priority (
int
) – the I/O priority of the operationcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the initialization is finisheduser_data (
object
orNone
) – the data to pass to callback function
Helper function for constructing
Gio.AsyncInitable
object. This is similar toGObject.Object.newv
() but also initializes the object asynchronously.When the initialization is finished, callback will be called. You can then call
Gio.AsyncInitable.new_finish
() to get the new object and check for any errors.New in version 2.22.
Deprecated since version 2.54: Use g_object_new_with_properties() and
Gio.AsyncInitable.init_async
() instead. SeeGObject.Parameter
for more information.
- Gio.bus_get(bus_type, cancellable, callback, *user_data)[source]¶
- Parameters:
bus_type (
Gio.BusType
) – aGio.BusType
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfied
Asynchronously connects to the message bus specified by bus_type.
When the operation is finished, callback will be invoked. You can then call
Gio.bus_get_finish
() to get the result of the operation.This is an asynchronous failable function. See
Gio.bus_get_sync
() for the synchronous version.New in version 2.26.
- Gio.bus_get_finish(res)[source]¶
- Parameters:
res (
Gio.AsyncResult
) – aGio.AsyncResult
obtained from theGio.AsyncReadyCallback
passed toGio.bus_get
()- Raises:
- Returns:
a
Gio.DBusConnection
orNone
if error is set. Free withGObject.Object.unref
().- Return type:
Finishes an operation started with
Gio.bus_get
().The returned object is a singleton, that is, shared with other callers of
Gio.bus_get
() andGio.bus_get_sync
() for bus_type. In the event that you need a private message bus connection, useGio.dbus_address_get_for_bus_sync
() andGio.DBusConnection.new_for_address
() withGio.DBusConnectionFlags.AUTHENTICATION_CLIENT
andGio.DBusConnectionFlags.MESSAGE_BUS_CONNECTION
flags.Note that the returned
Gio.DBusConnection
object will (usually) have theGio.DBusConnection
:exit-on-close
property set toTrue
.New in version 2.26.
- Gio.bus_get_sync(bus_type, cancellable)[source]¶
- Parameters:
bus_type (
Gio.BusType
) – aGio.BusType
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
- Raises:
- Returns:
a
Gio.DBusConnection
orNone
if error is set. Free withGObject.Object.unref
().- Return type:
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
Gio.bus_get
() andGio.bus_get_finish
() for the asynchronous version.The returned object is a singleton, that is, shared with other callers of
Gio.bus_get
() andGio.bus_get_sync
() for bus_type. In the event that you need a private message bus connection, useGio.dbus_address_get_for_bus_sync
() andGio.DBusConnection.new_for_address
() withGio.DBusConnectionFlags.AUTHENTICATION_CLIENT
andGio.DBusConnectionFlags.MESSAGE_BUS_CONNECTION
flags.Note that the returned
Gio.DBusConnection
object will (usually) have theGio.DBusConnection
:exit-on-close
property set toTrue
.New in version 2.26.
- Gio.bus_own_name(bus_type, name, flags, bus_acquired_closure, name_acquired_closure, name_lost_closure)[source]¶
- Parameters:
bus_type (
Gio.BusType
) – the type of bus to own a name onname (
str
) – the well-known name to ownflags (
Gio.BusNameOwnerFlags
) – a set of flags from theGio.BusNameOwnerFlags
enumerationbus_acquired_closure (
GObject.Closure
orNone
) –GObject.Closure
to invoke when connected to the bus of type bus_type orNone
name_acquired_closure (
GObject.Closure
orNone
) –GObject.Closure
to invoke when name is acquired orNone
name_lost_closure (
GObject.Closure
orNone
) –GObject.Closure
to invoke when name is lost orNone
- Returns:
an identifier (never 0) that can be used with
Gio.bus_unown_name
() to stop owning the name.- Return type:
Version of
Gio.bus_own_name
() using closures instead of callbacks for easier binding in other languages.New in version 2.26.
- Gio.bus_own_name_on_connection(connection, name, flags, name_acquired_closure, name_lost_closure)[source]¶
- Parameters:
connection (
Gio.DBusConnection
) – aGio.DBusConnection
name (
str
) – the well-known name to ownflags (
Gio.BusNameOwnerFlags
) – a set of flags from theGio.BusNameOwnerFlags
enumerationname_acquired_closure (
GObject.Closure
orNone
) –GObject.Closure
to invoke when name is acquired orNone
name_lost_closure (
GObject.Closure
orNone
) –GObject.Closure
to invoke when name is lost orNone
- Returns:
an identifier (never 0) that can be used with
Gio.bus_unown_name
() to stop owning the name.- Return type:
Version of
Gio.bus_own_name_on_connection
() using closures instead of callbacks for easier binding in other languages.New in version 2.26.
- Gio.bus_unown_name(owner_id)[source]¶
- Parameters:
owner_id (
int
) – an identifier obtained fromGio.bus_own_name
()
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
GLib.MainContext
after this function has returned. You should continue to iterate theGLib.MainContext
until theGLib.DestroyNotify
function passed toGio.bus_own_name
() is called, in order to avoid memory leaks through callbacks queued on theGLib.MainContext
after it’s stopped being iterated.New in version 2.26.
- Gio.bus_unwatch_name(watcher_id)[source]¶
- Parameters:
watcher_id (
int
) – An identifier obtained fromGio.bus_watch_name
()
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
GLib.MainContext
after this function has returned. You should continue to iterate theGLib.MainContext
until theGLib.DestroyNotify
function passed toGio.bus_watch_name
() is called, in order to avoid memory leaks through callbacks queued on theGLib.MainContext
after it’s stopped being iterated.New in version 2.26.
- Gio.bus_watch_name(bus_type, name, flags, name_appeared_closure, name_vanished_closure)[source]¶
- Parameters:
bus_type (
Gio.BusType
) – The type of bus to watch a name on.name (
str
) – The name (well-known or unique) to watch.flags (
Gio.BusNameWatcherFlags
) – Flags from theGio.BusNameWatcherFlags
enumeration.name_appeared_closure (
GObject.Closure
orNone
) –GObject.Closure
to invoke when name is known to exist orNone
.name_vanished_closure (
GObject.Closure
orNone
) –GObject.Closure
to invoke when name is known to not exist orNone
.
- Returns:
An identifier (never 0) that can be used with
Gio.bus_unwatch_name
() to stop watching the name.- Return type:
Version of
Gio.bus_watch_name
() using closures instead of callbacks for easier binding in other languages.New in version 2.26.
- Gio.bus_watch_name_on_connection(connection, name, flags, name_appeared_closure, name_vanished_closure)[source]¶
- Parameters:
connection (
Gio.DBusConnection
) – AGio.DBusConnection
.name (
str
) – The name (well-known or unique) to watch.flags (
Gio.BusNameWatcherFlags
) – Flags from theGio.BusNameWatcherFlags
enumeration.name_appeared_closure (
GObject.Closure
orNone
) –GObject.Closure
to invoke when name is known to exist orNone
.name_vanished_closure (
GObject.Closure
orNone
) –GObject.Closure
to invoke when name is known to not exist orNone
.
- Returns:
An identifier (never 0) that can be used with
Gio.bus_unwatch_name
() to stop watching the name.- Return type:
Version of
Gio.bus_watch_name_on_connection
() using closures instead of callbacks for easier binding in other languages.New in version 2.26.
- Gio.content_type_can_be_executable(type)[source]¶
- Parameters:
type (
str
) – a content type string- Returns:
True
if the file type corresponds to a type that can be executable,False
otherwise.- Return 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).
- Gio.content_type_equals(type1, type2)[source]¶
- Parameters:
- Returns:
True
if the two strings are identical or equivalent,False
otherwise.- Return type:
Compares two content types for equality.
- Gio.content_type_from_mime_type(mime_type)[source]¶
- Parameters:
mime_type (
str
) – a mime type string- Returns:
Newly allocated string with content type or
None
. Free withGLib.free
()- Return type:
Tries to find a content type based on the mime type name.
New in version 2.18.
- Gio.content_type_get_description(type)[source]¶
- Parameters:
type (
str
) – a content type string- Returns:
a short description of the content type type. Free the returned string with
GLib.free
()- Return type:
Gets the human readable description of the content type.
- Gio.content_type_get_generic_icon_name(type)[source]¶
- Parameters:
type (
str
) – a content type string- Returns:
the registered generic icon name for the given type, or
None
if unknown. Free withGLib.free
()- Return type:
Gets the generic icon name for a content type.
See the shared-mime-info specification for more on the generic icon name.
New in version 2.34.
- Gio.content_type_get_icon(type)[source]¶
- Parameters:
type (
str
) – a content type string- Returns:
Gio.Icon
corresponding to the content type. Free the returned object withGObject.Object.unref
()- Return type:
Gets the icon for a content type.
- Gio.content_type_get_mime_dirs()[source]¶
- Returns:
None
-terminated list of directories to load MIME data from, including anymime/
subdirectory, and with the first directory to try listed first- Return type:
[
str
]
Get the list of directories which MIME data is loaded from. See
Gio.content_type_set_mime_dirs
() for details.New in version 2.60.
- Gio.content_type_get_mime_type(type)[source]¶
- Parameters:
type (
str
) – a content type string- Returns:
the registered mime type for the given type, or
None
if unknown; free withGLib.free
().- Return type:
Gets the mime type for the content type, if one is registered.
- Gio.content_type_get_symbolic_icon(type)[source]¶
- Parameters:
type (
str
) – a content type string- Returns:
symbolic
Gio.Icon
corresponding to the content type. Free the returned object withGObject.Object.unref
()- Return type:
Gets the symbolic icon for a content type.
New in version 2.34.
- Gio.content_type_guess(filename, data)[source]¶
- Parameters:
- Returns:
a string indicating a guessed content type for the given data. Free with
GLib.free
()- result_uncertain:
return location for the certainty of the result, or
None
- Return type:
Guesses the content type based on example data. If the function is uncertain, result_uncertain will be set to
True
. Either filename or data may beNone
, in which case the guess will be based solely on the other argument.
- Gio.content_type_guess_for_tree(root)[source]¶
- Parameters:
root (
Gio.File
) – the root of the tree to guess a type for- Returns:
an
None
-terminated array of zero or more content types. Free withGLib.strfreev
()- Return type:
[
str
]
Tries to guess the type of the tree with root root, by looking at the files it contains. The result is an array of content types, with the best guess coming first.
The types returned all have the form x-content/foo, e.g. x-content/audio-cdda (for audio CDs) or x-content/image-dcf (for a camera memory card). See the shared-mime-info specification for more on x-content types.
This function is useful in the implementation of
Gio.Mount.guess_content_type
().New in version 2.18.
- Gio.content_type_is_a(type, supertype)[source]¶
- Parameters:
- Returns:
- Return type:
Determines if type is a subset of supertype.
- Gio.content_type_is_mime_type(type, mime_type)[source]¶
- Parameters:
- Returns:
- Return type:
Determines if type is a subset of mime_type. Convenience wrapper around
Gio.content_type_is_a
().New in version 2.52.
- Gio.content_type_is_unknown(type)[source]¶
- Parameters:
type (
str
) – a content type string- Returns:
True
if the type is the unknown type.- Return 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.
- Gio.content_type_set_mime_dirs(dirs)[source]¶
- Parameters:
dirs ([
str
] orNone
) –None
-terminated list of directories to load MIME data from, including anymime/
subdirectory, and with the first directory to try listed first
Set the list of directories used by GIO to load the MIME database. If dirs is
None
, the directories used are the default:the
mime
subdirectory of the directory in$XDG_DATA_HOME
the
mime
subdirectory of every directory in$XDG_DATA_DIRS
This function is intended to be used when writing tests that depend on information stored in the MIME database, in order to control the data.
Typically, in case your tests use
GLib.TEST_OPTION_ISOLATE_DIRS
, but they depend on the system’s MIME database, you should call this function with dirs set toNone
before calling g_test_init(), for instance:// Load MIME data from the system g_content_type_set_mime_dirs (NULL); // Isolate the environment g_test_init (&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL); … return g_test_run ();
New in version 2.60.
- Gio.content_types_get_registered()[source]¶
- Returns:
list of the registered content types
- Return type:
[
str
]
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)
.
- Gio.dbus_address_escape_value(string)[source]¶
- Parameters:
string (
str
) – 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
- Return type:
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 likeunix:nonce-tcp:host=127.0.0.1,port=42,noncefile=/run/bus-for-%3A0
.New in version 2.36.
- Gio.dbus_address_get_for_bus_sync(bus_type, cancellable)[source]¶
- Parameters:
bus_type (
Gio.BusType
) – aGio.BusType
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
- Raises:
- Returns:
a valid D-Bus address string for bus_type or
None
if error is set- Return type:
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.
New in version 2.26.
- Gio.dbus_address_get_stream(address, cancellable, callback, *user_data)[source]¶
- Parameters:
address (
str
) – A valid D-Bus address.cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
orNone
.callback (
Gio.AsyncReadyCallback
orNone
) – AGio.AsyncReadyCallback
to call when the request is satisfied.
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.
When the operation is finished, callback will be invoked. You can then call
Gio.dbus_address_get_stream_finish
() to get the result of the operation.This is an asynchronous failable function. See
Gio.dbus_address_get_stream_sync
() for the synchronous version.New in version 2.26.
- Gio.dbus_address_get_stream_finish(res)[source]¶
- Parameters:
res (
Gio.AsyncResult
) – AGio.AsyncResult
obtained from theGio.AsyncReadyCallback
passed toGio.dbus_address_get_stream
().- Raises:
- Returns:
A
Gio.IOStream
orNone
if error is set.- out_guid:
None
or return location to store the GUID extracted from address, if any.
- Return type:
(
Gio.IOStream
, out_guid:str
orNone
)
Finishes an operation started with
Gio.dbus_address_get_stream
().A server is not required to set a GUID, so out_guid may be set to
None
even on success.New in version 2.26.
- Gio.dbus_address_get_stream_sync(address, cancellable)[source]¶
- Parameters:
address (
str
) – A valid D-Bus address.cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
orNone
.
- Raises:
- Returns:
A
Gio.IOStream
orNone
if error is set.- out_guid:
None
or return location to store the GUID extracted from address, if any.
- Return type:
(
Gio.IOStream
, out_guid:str
orNone
)
Synchronously 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.
A server is not required to set a GUID, so out_guid may be set to
None
even on success.This is a synchronous failable function. See
Gio.dbus_address_get_stream
() for the asynchronous version.New in version 2.26.
- Gio.dbus_annotation_info_lookup(annotations, name)[source]¶
- Parameters:
annotations ([
Gio.DBusAnnotationInfo
] orNone
) – ANone
-terminated array of annotations orNone
.name (
str
) – The name of the annotation to look up.
- Returns:
The value or
None
if not found. Do not free, it is owned by annotations.- Return type:
Looks up the value of an annotation.
The cost of this function is O(n) in number of annotations.
New in version 2.26.
- Gio.dbus_error_encode_gerror(error)[source]¶
- Parameters:
error (
GLib.Error
) – AGLib.Error
.- Returns:
- Return type:
Creates a D-Bus error name to use for error. If error matches a registered error (cf.
Gio.DBusError.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 aGLib.Error
usingGio.DBusError.new_for_dbus_error
().This function is typically only used in object mappings to put a
GLib.Error
on the wire. Regular applications should not use it.New in version 2.26.
- Gio.dbus_error_get_remote_error(error)[source]¶
- Parameters:
error (
GLib.Error
) – aGLib.Error
- Returns:
an allocated string or
None
if the D-Bus error name could not be found. Free withGLib.free
().- Return type:
Gets the D-Bus error name used for error, if any.
This function is guaranteed to return a D-Bus error name for all
GLib.Errors
returned from functions handling remote method calls (e.g.Gio.DBusConnection.call_finish
()) unlessGio.DBusError.strip_remote_error
() has been used on error.New in version 2.26.
- Gio.dbus_error_is_remote_error(error)[source]¶
- Parameters:
error (
GLib.Error
) – AGLib.Error
.- Returns:
True
if error represents an error from a remote peer,False
otherwise.- Return type:
Checks if error represents an error received via D-Bus from a remote peer. If so, use
Gio.DBusError.get_remote_error
() to get the name of the error.New in version 2.26.
- Gio.dbus_error_new_for_dbus_error(dbus_error_name, dbus_error_message)[source]¶
- Parameters:
- Returns:
An allocated
GLib.Error
. Free withGLib.Error.free
().- Return type:
Creates a
GLib.Error
based on the contents of dbus_error_name and dbus_error_message.Errors registered with
Gio.DBusError.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 useGio.DBusError.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
Gio.DBusError.encode_gerror
() the error domain and code encoded in the name is used to create theGLib.Error
. Also, dbus_error_name is added to the error message such that it can be recovered withGio.DBusError.get_remote_error
().Otherwise, a
GLib.Error
with the error codeGio.IOErrorEnum.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 withGio.DBusError.get_remote_error
().In all three cases, dbus_error_name can always be recovered from the returned
GLib.Error
using theGio.DBusError.get_remote_error
() function (unlessGio.DBusError.strip_remote_error
() hasn’t been used on the returned error).This function is typically only used in object mappings to prepare
GLib.Error
instances for applications. Regular applications should not use it.New in version 2.26.
- Gio.dbus_error_register_error(error_domain, error_code, dbus_error_name)[source]¶
-
Creates an association to map between dbus_error_name and
GLib.Errors
specified by error_domain and error_code.This is typically done in the routine that returns the #GQuark for an error domain.
New in version 2.26.
- Gio.dbus_error_register_error_domain(error_domain_quark_name, quark_volatile, entries)[source]¶
- Parameters:
error_domain_quark_name (
str
) – The error domain name.quark_volatile (
int
) – A pointer where to store the #GQuark.entries ([
Gio.DBusErrorEntry
]) – A pointer to num_entriesGio.DBusErrorEntry
struct items.
Helper function for associating a
GLib.Error
error domain with D-Bus error names.While quark_volatile has a
volatile
qualifier, this is a historical artifact and the argument passed to it should not bevolatile
.New in version 2.26.
- Gio.dbus_error_strip_remote_error(error)[source]¶
- Parameters:
error (
GLib.Error
) – AGLib.Error
.- Returns:
- Return type:
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.
New in version 2.26.
- Gio.dbus_error_unregister_error(error_domain, error_code, dbus_error_name)[source]¶
-
Destroys an association previously set up with
Gio.DBusError.register_error
().New in version 2.26.
- Gio.dbus_escape_object_path(s)[source]¶
- Parameters:
s (
str
) – the string to escape- Returns:
an escaped version of s. Free with
GLib.free
().- Return type:
This is a language binding friendly version of
Gio.dbus_escape_object_path_bytestring
().New in version 2.68.
- Gio.dbus_escape_object_path_bytestring(bytes)[source]¶
- Parameters:
bytes (
bytes
) – the string of bytes to escape- Returns:
an escaped version of bytes. Free with
GLib.free
().- Return type:
Escapes bytes for use in a D-Bus object path component. bytes is an array of zero or more nonzero bytes in an unspecified encoding, followed by a single zero byte.
The escaping method consists of replacing all non-alphanumeric characters (see g_ascii_isalnum()) with their hexadecimal value preceded by an underscore (
_
). For example:foo.bar.baz
will becomefoo_2ebar_2ebaz
.This method is appropriate to use when the input is nearly a valid object path component but is not when your input is far from being a valid object path component. Other escaping algorithms are also valid to use with D-Bus object paths.
This can be reversed with
Gio.dbus_unescape_object_path
().New in version 2.68.
- Gio.dbus_generate_guid()[source]¶
-
Generate a D-Bus GUID that can be used with e.g.
Gio.DBusConnection.new
().See the D-Bus specification 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.
New in version 2.26.
- Gio.dbus_gvalue_to_gvariant(gvalue, type)[source]¶
- Parameters:
gvalue (
GObject.Value
) – AGObject.Value
to convert to aGLib.Variant
type (
GLib.VariantType
) – AGLib.VariantType
- Returns:
A
GLib.Variant
(never floating) ofGLib.VariantType
type holding the data from gvalue or an emptyGLib.Variant
in case of failure. Free withGLib.Variant.unref
().- Return type:
Converts a
GObject.Value
to aGLib.Variant
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
: AnyGLib.VariantType
This can fail if e.g. gvalue is of type
GObject.TYPE_STRING
and type is ‘i’, i.e. %G_VARIANT_TYPE_INT32. It will also fail for anyGObject.GType
(including e.g.GObject.TYPE_OBJECT
andGObject.TYPE_BOXED
derived-types) not in the table above.Note that if gvalue is of type
GObject.TYPE_VARIANT
and its value isNone
, the emptyGLib.Variant
instance (neverNone
) 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
Gio.dbus_gvariant_to_gvalue
() function for how to convert aGLib.Variant
to aGObject.Value
.New in version 2.30.
- Gio.dbus_gvariant_to_gvalue(value)[source]¶
- Parameters:
value (
GLib.Variant
) – AGLib.Variant
.- Returns:
Return location pointing to a zero-filled (uninitialized)
GObject.Value
.- Return type:
out_gvalue:
GObject.Value
Converts a
GLib.Variant
to aGObject.Value
. If value is floating, it is consumed.The rules specified in the
Gio.dbus_gvalue_to_gvariant
() function are used - this function is essentially its reverse form. So, aGLib.Variant
containing any basic or string array type will be converted to aGObject.Value
containing a basic value or string array. Any otherGLib.Variant
(handle, variant, tuple, dict entry) will be converted to aGObject.Value
containing thatGLib.Variant
.The conversion never fails - a valid
GObject.Value
is always returned in out_gvalue.New in version 2.30.
- Gio.dbus_is_address(string)[source]¶
- Parameters:
string (
str
) – A string.- Returns:
- Return type:
Checks if string is a D-Bus address.
This doesn’t check if string is actually supported by
Gio.DBusServer
orGio.DBusConnection
- useGio.dbus_is_supported_address
() to do more checks.New in version 2.26.
- Gio.dbus_is_error_name(string)[source]¶
- Parameters:
string (
str
) – The string to check.- Returns:
- Return type:
Check whether string is a valid D-Bus error name.
This function returns the same result as
Gio.dbus_is_interface_name
(), because D-Bus error names are defined to have exactly the same syntax as interface names.New in version 2.70.
- Gio.dbus_is_guid(string)[source]¶
- Parameters:
string (
str
) – The string to check.- Returns:
- Return type:
Checks if string is a D-Bus GUID.
See the documentation for
Gio.dbus_generate_guid
() for more information about the format of a GUID.New in version 2.26.
- Gio.dbus_is_interface_name(string)[source]¶
- Parameters:
string (
str
) – The string to check.- Returns:
- Return type:
Checks if string is a valid D-Bus interface name.
New in version 2.26.
- Gio.dbus_is_member_name(string)[source]¶
- Parameters:
string (
str
) – The string to check.- Returns:
- Return type:
Checks if string is a valid D-Bus member (e.g. signal or method) name.
New in version 2.26.
- Gio.dbus_is_name(string)[source]¶
- Parameters:
string (
str
) – The string to check.- Returns:
- Return type:
Checks if string is a valid D-Bus bus name (either unique or well-known).
New in version 2.26.
- Gio.dbus_is_supported_address(string)[source]¶
- Parameters:
string (
str
) – A string.- Raises:
- Returns:
True
if string is a valid D-Bus address that is supported by this library,False
if error is set.- Return type:
Like
Gio.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.New in version 2.26.
- Gio.dbus_is_unique_name(string)[source]¶
- Parameters:
string (
str
) – The string to check.- Returns:
- Return type:
Checks if string is a valid D-Bus unique bus name.
New in version 2.26.
- Gio.dbus_unescape_object_path(s)[source]¶
- Parameters:
s (
str
) – the string to unescape- Returns:
an unescaped version of s, or
None
if s is not a string returned fromGio.dbus_escape_object_path
(). Free withGLib.free
().- Return type:
Unescapes an string that was previously escaped with
Gio.dbus_escape_object_path
(). If the string is in a format that could not have been returned byGio.dbus_escape_object_path
(), this function returnsNone
.Encoding alphanumeric characters which do not need to be encoded is not allowed (e.g
_63
is not valid, the string should containc
instead).New in version 2.68.
- Gio.dtls_client_connection_new(base_socket, server_identity)[source]¶
- Parameters:
base_socket (
Gio.DatagramBased
) – theGio.DatagramBased
to wrapserver_identity (
Gio.SocketConnectable
orNone
) – the expected identity of the server
- Raises:
- Returns:
the new
Gio.DtlsClientConnection
, orNone
on error- Return type:
Creates a new
Gio.DtlsClientConnection
wrapping base_socket which is assumed to communicate with the server identified by server_identity.New in version 2.48.
- Gio.dtls_server_connection_new(base_socket, certificate)[source]¶
- Parameters:
base_socket (
Gio.DatagramBased
) – theGio.DatagramBased
to wrapcertificate (
Gio.TlsCertificate
orNone
) – the default server certificate, orNone
- Raises:
- Returns:
the new
Gio.DtlsServerConnection
, orNone
on error- Return type:
Creates a new
Gio.DtlsServerConnection
wrapping base_socket.New in version 2.48.
- Gio.file_new_build_filenamev(args)[source]¶
- Parameters:
args ([
str
]) –None
-terminated array of strings containing the path elements.- Returns:
a new
Gio.File
- Return type:
Constructs a
Gio.File
from a vector of elements using the correct separator for filenames.Using this function is equivalent to calling
GLib.build_filenamev
(), followed byGio.File.new_for_path
() on the result.New in version 2.78.
- Gio.file_new_for_commandline_arg(arg)[source]¶
- Parameters:
arg (
str
) – a command line string- Returns:
a new
Gio.File
. Free the returned object withGObject.Object.unref
().- Return type:
Creates a
Gio.File
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.
Gio.Application
also uses UTF-8 butGio.ApplicationCommandLine.create_file_for_arg
() may be more useful for you there. It is also always possible to use this function withGLib.OptionContext
arguments of typeGLib.OptionArg.FILENAME
.
- Gio.file_new_for_commandline_arg_and_cwd(arg, cwd)[source]¶
- Parameters:
- Returns:
a new
Gio.File
- Return type:
Creates a
Gio.File
with the given argument from the command line.This function is similar to
Gio.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
Gio.ApplicationCommandLine.create_file_for_arg
().New in version 2.36.
- Gio.file_new_for_path(path)[source]¶
- Parameters:
path (
str
) – a string containing a relative or absolute path. The string must be encoded in the glib filename encoding.- Returns:
a new
Gio.File
for the given path. Free the returned object withGObject.Object.unref
().- Return type:
Constructs a
Gio.File
for a given path. This operation never fails, but the returned object might not support any I/O operation if path is malformed.
- Gio.file_new_for_uri(uri)[source]¶
- Parameters:
uri (
str
) – a UTF-8 string containing a URI- Returns:
a new
Gio.File
for the given uri. Free the returned object withGObject.Object.unref
().- Return type:
Constructs a
Gio.File
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.
- Gio.file_new_tmp(tmpl)[source]¶
- Parameters:
tmpl (
str
orNone
) – Template for the file name, as inGLib.file_open_tmp
(), orNone
for a default template- Raises:
- Returns:
a new
Gio.File
. Free the returned object withGObject.Object.unref
().- iostream:
on return, a
Gio.FileIOStream
for the created file
- Return type:
(
Gio.File
, iostream:Gio.FileIOStream
)
Opens a file in the preferred directory for temporary files (as returned by
GLib.get_tmp_dir
()) and returns aGio.File
andGio.FileIOStream
pointing to it.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
None
, a default template is used.Unlike the other
Gio.File
constructors, this will returnNone
if a temporary file could not be created.New in version 2.32.
- Gio.file_new_tmp_async(tmpl, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters:
tmpl (
str
orNone
) – Template for the file name, as inGLib.file_open_tmp
(), orNone
for a default templateio_priority (
int
) – the I/O priority of the requestcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is done
Asynchronously opens a file in the preferred directory for temporary files (as returned by
GLib.get_tmp_dir
()) asGio.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
None
, a default template is used.New in version 2.74.
- Gio.file_new_tmp_dir_async(tmpl, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters:
tmpl (
str
orNone
) – Template for the file name, as inGLib.Dir.make_tmp
(), orNone
for a default templateio_priority (
int
) – the I/O priority of the requestcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is done
Asynchronously creates a directory in the preferred directory for temporary files (as returned by
GLib.get_tmp_dir
()) asGLib.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
None
, a default template is used.New in version 2.74.
- Gio.file_new_tmp_dir_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
a new
Gio.File
. Free the returned object withGObject.Object.unref
().- Return type:
Finishes a temporary directory creation started by
Gio.File.new_tmp_dir_async
().New in version 2.74.
- Gio.file_new_tmp_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
a new
Gio.File
. Free the returned object withGObject.Object.unref
().- iostream:
on return, a
Gio.FileIOStream
for the created file
- Return type:
(
Gio.File
, iostream:Gio.FileIOStream
)
Finishes a temporary file creation started by
Gio.File.new_tmp_async
().New in version 2.74.
- Gio.file_parse_name(parse_name)[source]¶
- Parameters:
parse_name (
str
) – a file name or path to be parsed- Returns:
a new
Gio.File
.- Return type:
Constructs a
Gio.File
with the given parse_name (i.e. something given byGio.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.
- Gio.icon_deserialize(value)[source]¶
- Parameters:
value (
GLib.Variant
) – aGLib.Variant
created withGio.Icon.serialize
()- Returns:
- Return type:
Deserializes a
Gio.Icon
previously serialized usingGio.Icon.serialize
().New in version 2.38.
- Gio.icon_new_for_string(str)[source]¶
- Parameters:
str (
str
) – A string obtained viaGio.Icon.to_string
().- Raises:
- Returns:
An object implementing the
Gio.Icon
interface orNone
if error is set.- Return type:
Generate a
Gio.Icon
instance from str. This function can fail if str is not valid - seeGio.Icon.to_string
() for discussion.If your application or library provides one or more
Gio.Icon
implementations you need to ensure that eachGObject.GType
is registered with the type system prior to callingGio.Icon.new_for_string
().New in version 2.20.
- Gio.initable_newv(object_type, parameters, cancellable)[source]¶
- Parameters:
object_type (
GObject.GType
) – aGObject.GType
supportingGio.Initable
.parameters ([
GObject.Parameter
]) – the parameters to use to construct the objectcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.
- Raises:
- Returns:
a newly allocated
GObject.Object
, orNone
on error- Return type:
Helper function for constructing
Gio.Initable
object. This is similar toGObject.Object.newv
() but also initializes the object and returnsNone
, setting an error on failure.New in version 2.22.
Deprecated since version 2.54: Use g_object_new_with_properties() and
Gio.Initable.init
() instead. SeeGObject.Parameter
for more information.
- Gio.io_error_from_errno(err_no)[source]¶
- Parameters:
err_no (
int
) – Error number as defined in errno.h.- Returns:
Gio.IOErrorEnum
value for the givenerrno.h
error number- Return type:
Converts
errno.h
error codes into GIO error codes.The fallback value
Gio.IOErrorEnum.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 immediately after the call returns, and use the saved value instead oferrno
:int saved_errno; ret = read (blah); saved_errno = errno; g_io_error_from_errno (saved_errno);
- Gio.io_error_from_file_error(file_error)[source]¶
- Parameters:
file_error (
GLib.FileError
) – aGLib.FileError
.- Returns:
Gio.IOErrorEnum
value for the givenGLib.FileError
error value.- Return type:
Converts
GLib.FileError
error codes into GIO error codes.New in version 2.74.
- Gio.io_extension_point_implement(extension_point_name, type, extension_name, priority)[source]¶
- Parameters:
extension_point_name (
str
) – the name of the extension pointtype (
GObject.GType
) – theGObject.GType
to register as extensionextension_name (
str
) – the name for the extensionpriority (
int
) – the priority for the extension
- Returns:
a
Gio.IOExtension
object forGObject.GType
- Return type:
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
Gio.IOExtension
object is returned.
- Gio.io_extension_point_lookup(name)[source]¶
- Parameters:
name (
str
) – the name of the extension point- Returns:
the
Gio.IOExtensionPoint
, orNone
if there is no registered extension point with the given name.- Return type:
Looks up an existing extension point.
- Gio.io_extension_point_register(name)[source]¶
- Parameters:
name (
str
) – The name of the extension point- Returns:
the new
Gio.IOExtensionPoint
. This object is owned by GIO and should not be freed.- Return type:
Registers an extension point.
- Gio.io_modules_load_all_in_directory(dirname)[source]¶
- Parameters:
dirname (
str
) – pathname for a directory containing modules to load.- Returns:
a list of
Gio.IOModules
loaded from the directory, All the modules are loaded into memory, if you want to unload them (enabling on-demand loading) you must callGObject.TypeModule.unuse
() on all the modules. Free the list with g_list_free().- Return type:
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
Gio.io_modules_scan_all_in_directory
() which allows delayed/lazy loading of modules.
- Gio.io_modules_load_all_in_directory_with_scope(dirname, scope)[source]¶
- Parameters:
dirname (
str
) – pathname for a directory containing modules to load.scope (
Gio.IOModuleScope
) – a scope to use when scanning the modules.
- Returns:
a list of
Gio.IOModules
loaded from the directory, All the modules are loaded into memory, if you want to unload them (enabling on-demand loading) you must callGObject.TypeModule.unuse
() on all the modules. Free the list with g_list_free().- Return type:
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
Gio.io_modules_scan_all_in_directory
() which allows delayed/lazy loading of modules.New in version 2.30.
- Gio.io_modules_scan_all_in_directory(dirname)[source]¶
- Parameters:
dirname (
str
) – pathname for a directory containing modules to scan.
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.
Gio.IOExtensionPoint.get_extensions
() orGio.IOExtensionPoint.get_extension_by_name
().If you need to guarantee that all types are loaded in all the modules, use
Gio.io_modules_load_all_in_directory
().New in version 2.24.
- Gio.io_modules_scan_all_in_directory_with_scope(dirname, scope)[source]¶
- Parameters:
dirname (
str
) – pathname for a directory containing modules to scan.scope (
Gio.IOModuleScope
) – a scope to use when scanning the modules
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.
Gio.IOExtensionPoint.get_extensions
() orGio.IOExtensionPoint.get_extension_by_name
().If you need to guarantee that all types are loaded in all the modules, use
Gio.io_modules_load_all_in_directory
().New in version 2.30.
- Gio.io_scheduler_cancel_all_jobs()[source]¶
Cancels all cancellable I/O jobs.
A job is cancellable if a
Gio.Cancellable
was passed intoGio.io_scheduler_push_job
().Deprecated since version 2.36: You should never call this function, since you don’t know how other libraries in your program might be making use of gioscheduler.
- Gio.io_scheduler_push_job(job_func, user_data, io_priority, cancellable)[source]¶
- Parameters:
job_func (
Gio.IOSchedulerJobFunc
) – aGio.IOSchedulerJobFunc
.io_priority (
int
) – the I/O priority of the request.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.
Schedules the I/O job to run in another thread.
notify will be called on user_data after job_func has returned, regardless whether the job was cancelled or has run to completion.
If cancellable is not
None
, it can be used to cancel the I/O job by callingGio.Cancellable.cancel
() or by callingGio.io_scheduler_cancel_all_jobs
().Deprecated since version 2.36: use
GLib.ThreadPool
orGio.Task.run_in_thread
()
- Gio.keyfile_settings_backend_new(filename, root_path, root_group)[source]¶
- Parameters:
- Returns:
a keyfile-backed
Gio.SettingsBackend
- Return type:
Creates a keyfile-backed
Gio.SettingsBackend
.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-
None
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 ofTrue
will cause the following to appear in the keyfile:[toplevel] enabled=true
If root_group is
None
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 isNone
, 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 namelocks
in the same location.
- Gio.memory_monitor_dup_default()[source]¶
- Returns:
a new reference to the default
Gio.MemoryMonitor
- Return type:
Gets a reference to the default
Gio.MemoryMonitor
for the system.New in version 2.64.
- Gio.memory_settings_backend_new()[source]¶
- Returns:
a newly created
Gio.SettingsBackend
- Return type:
Creates a memory-backed
Gio.SettingsBackend
.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.
New in version 2.28.
- Gio.network_monitor_get_default()[source]¶
- Returns:
a
Gio.NetworkMonitor
, which will be a dummy object if no network monitor is available- Return type:
Gets the default
Gio.NetworkMonitor
for the system.New in version 2.32.
- Gio.networking_init()[source]¶
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).
New in version 2.36.
- Gio.null_settings_backend_new()[source]¶
- Returns:
a newly created
Gio.SettingsBackend
- Return type:
Creates a readonly
Gio.SettingsBackend
.This backend does not allow changes to settings, so all settings will always have their default values.
New in version 2.28.
- Gio.pollable_source_new(pollable_stream)[source]¶
- Parameters:
pollable_stream (
GObject.Object
) – the stream associated with the new source- Returns:
the new
GLib.Source
.- Return type:
Utility method for
Gio.PollableInputStream
andGio.PollableOutputStream
implementations. Creates a newGLib.Source
that expects a callback of typeGio.PollableSourceFunc
. The new source does not actually do anything on its own; useGLib.Source.add_child_source
() to add other sources to it to cause it to trigger.New in version 2.28.
- Gio.pollable_source_new_full(pollable_stream, child_source, cancellable)[source]¶
- Parameters:
pollable_stream (
GObject.Object
) – the stream associated with the new sourcechild_source (
GLib.Source
orNone
) – optional child source to attachcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
to attach
- Returns:
the new
GLib.Source
.- Return type:
Utility method for
Gio.PollableInputStream
andGio.PollableOutputStream
implementations. Creates a newGLib.Source
, as withGio.pollable_source_new
(), but also attaching child_source (with a dummy callback), and cancellable, if they are non-None
.New in version 2.34.
- Gio.pollable_stream_read(stream, buffer, blocking, cancellable)[source]¶
- Parameters:
stream (
Gio.InputStream
) – aGio.InputStream
buffer (
bytes
) – a buffer to read data intoblocking (
bool
) – whether to do blocking I/Ocancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.
- Raises:
- Returns:
the number of bytes read, or -1 on error.
- Return type:
Tries to read from stream, as with
Gio.InputStream.read
() (if blocking isTrue
) orGio.PollableInputStream.read_nonblocking
() (if blocking isFalse
). 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 aGio.PollableInputStream
for whichGio.PollableInputStream.can_poll
() returnsTrue
, or else the behavior is undefined. If blocking isTrue
, then stream does not need to be aGio.PollableInputStream
.New in version 2.34.
- Gio.pollable_stream_write(stream, buffer, blocking, cancellable)[source]¶
- Parameters:
stream (
Gio.OutputStream
) – aGio.OutputStream
.buffer (
bytes
) – the buffer containing the data to write.blocking (
bool
) – whether to do blocking I/Ocancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.
- Raises:
- Returns:
the number of bytes written, or -1 on error.
- Return type:
Tries to write to stream, as with
Gio.OutputStream.write
() (if blocking isTrue
) orGio.PollableOutputStream.write_nonblocking
() (if blocking isFalse
). 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 aGio.PollableOutputStream
for whichGio.PollableOutputStream.can_poll
() returnsTrue
or else the behavior is undefined. If blocking isTrue
, then stream does not need to be aGio.PollableOutputStream
.New in version 2.34.
- Gio.pollable_stream_write_all(stream, buffer, blocking, cancellable)[source]¶
- Parameters:
stream (
Gio.OutputStream
) – aGio.OutputStream
.buffer (
bytes
) – the buffer containing the data to write.blocking (
bool
) – whether to do blocking I/Ocancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.
- Raises:
- Returns:
True
on success,False
if there was an error- bytes_written:
location to store the number of bytes that was written to the stream
- Return type:
Tries to write count bytes to stream, as with
Gio.OutputStream.write_all
(), but usingGio.pollable_stream_write
() rather thanGio.OutputStream.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
Gio.IOErrorEnum.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
Gio.pollable_stream_write
(), if blocking isFalse
, then stream must be aGio.PollableOutputStream
for whichGio.PollableOutputStream.can_poll
() returnsTrue
or else the behavior is undefined. If blocking isTrue
, then stream does not need to be aGio.PollableOutputStream
.New in version 2.34.
- Gio.power_profile_monitor_dup_default()[source]¶
- Returns:
a new reference to the default
Gio.PowerProfileMonitor
- Return type:
Gets a reference to the default
Gio.PowerProfileMonitor
for the system.New in version 2.70.
- Gio.proxy_get_default_for_protocol(protocol)[source]¶
- Parameters:
protocol (
str
) – the proxy protocol name (e.g. http, socks, etc)- Returns:
- Return type:
Find the
gio-proxy
extension point for a proxy implementation that supports the specified protocol.New in version 2.26.
- Gio.proxy_resolver_get_default()[source]¶
- Returns:
the default
Gio.ProxyResolver
, which will be a dummy object if no proxy resolver is available- Return type:
Gets the default
Gio.ProxyResolver
for the system.New in version 2.26.
- Gio.resolver_error_quark()[source]¶
- Returns:
a #GQuark.
- Return type:
Gets the
Gio.Resolver
Error Quark.New in version 2.22.
- Gio.resource_error_quark()[source]¶
- Returns:
a #GQuark
- Return type:
Gets the
Gio.Resource
Error Quark.New in version 2.32.
- Gio.resource_load(filename)[source]¶
- Parameters:
filename (
str
) – the path of a filename to load, in the GLib filename encoding- Raises:
- Returns:
a new
Gio.Resource
, orNone
on error- Return type:
Loads a binary resource bundle and creates a
Gio.Resource
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
Gio.Resource._register
().If filename is empty or the data in it is corrupt,
Gio.ResourceError.INTERNAL
will be returned. If filename doesn’t exist, or there is an error in reading it, an error fromGLib.MappedFile.new
() will be returned.New in version 2.32.
- Gio.resources_enumerate_children(path, lookup_flags)[source]¶
- Parameters:
path (
str
) – A pathname inside the resourcelookup_flags (
Gio.ResourceLookupFlags
) – AGio.ResourceLookupFlags
- Raises:
- Returns:
an array of constant strings
- Return type:
[
str
]
Returns all the names of children at the specified path in the set of globally registered resources. The return result is a
None
terminated list of strings which should be released withGLib.strfreev
().lookup_flags controls the behaviour of the lookup.
New in version 2.32.
- Gio.resources_get_info(path, lookup_flags)[source]¶
- Parameters:
path (
str
) – A pathname inside the resourcelookup_flags (
Gio.ResourceLookupFlags
) – AGio.ResourceLookupFlags
- Raises:
- Returns:
True
if the file was found.False
if there were errors- size:
a location to place the length of the contents of the file, or
None
if the length is not needed- flags:
a location to place the
Gio.ResourceFlags
about the file, orNone
if the flags are not needed
- Return type:
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.
New in version 2.32.
- Gio.resources_lookup_data(path, lookup_flags)[source]¶
- Parameters:
path (
str
) – A pathname inside the resourcelookup_flags (
Gio.ResourceLookupFlags
) – AGio.ResourceLookupFlags
- Raises:
- Returns:
GLib.Bytes
orNone
on error. Free the returned object withGLib.Bytes.unref
()- Return type:
Looks for a file at the specified path in the set of globally registered resources and returns a
GLib.Bytes
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
GLib.Bytes
.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.
New in version 2.32.
- Gio.resources_open_stream(path, lookup_flags)[source]¶
- Parameters:
path (
str
) – A pathname inside the resourcelookup_flags (
Gio.ResourceLookupFlags
) – AGio.ResourceLookupFlags
- Raises:
- Returns:
Gio.InputStream
orNone
on error. Free the returned object withGObject.Object.unref
()- Return type:
Looks for a file at the specified path in the set of globally registered resources and returns a
Gio.InputStream
that lets you read the data.lookup_flags controls the behaviour of the lookup.
New in version 2.32.
- Gio.resources_register(resource)[source]¶
- Parameters:
resource (
Gio.Resource
) – AGio.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
Gio.resources_lookup_data
().New in version 2.32.
- Gio.resources_unregister(resource)[source]¶
- Parameters:
resource (
Gio.Resource
) – AGio.Resource
Unregisters the resource from the process-global set of resources.
New in version 2.32.
- Gio.settings_schema_source_get_default()[source]¶
- Returns:
the default schema source
- Return type:
Gets the default system schema source.
This function is not required for normal uses of
Gio.Settings
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,
None
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
andGSETTINGS_SCHEMA_DIR
. For this reason, all lookups performed against the default source should probably be done recursively.New in version 2.32.
- Gio.simple_async_report_gerror_in_idle(object, callback, user_data, error)[source]¶
- Parameters:
object (
GObject.Object
orNone
) – aGObject.Object
, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
.error (
GLib.Error
) – theGLib.Error
to report
Reports an error in an idle function. Similar to g_simple_async_report_error_in_idle(), but takes a
GLib.Error
rather than building a new one.Deprecated since version 2.46: Use
Gio.Task.report_error
().
- Gio.tls_backend_get_default()[source]¶
- Returns:
a
Gio.TlsBackend
, which will be a dummy object if no TLS backend is available- Return type:
Gets the default
Gio.TlsBackend
for the system.New in version 2.28.
- Gio.tls_channel_binding_error_quark()[source]¶
- Returns:
a #GQuark.
- Return type:
Gets the TLS channel binding error quark.
New in version 2.66.
- Gio.tls_client_connection_new(base_io_stream, server_identity)[source]¶
- Parameters:
base_io_stream (
Gio.IOStream
) – theGio.IOStream
to wrapserver_identity (
Gio.SocketConnectable
orNone
) – the expected identity of the server
- Raises:
- Returns:
the new
Gio.TlsClientConnection
, orNone
on error- Return type:
Creates a new
Gio.TlsClientConnection
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
Gio.TlsConnection
:base-io-stream
for restrictions on when application code can run operations on the base_io_stream after this function has returned.New in version 2.28.
- Gio.tls_error_quark()[source]¶
- Returns:
a #GQuark.
- Return type:
Gets the TLS error quark.
New in version 2.28.
- Gio.tls_file_database_new(anchors)[source]¶
- Parameters:
anchors (
str
) – filename of anchor certificate authorities.- Raises:
- Returns:
the new
Gio.TlsFileDatabase
, orNone
on error- Return type:
Creates a new
Gio.TlsFileDatabase
which uses anchor certificate authorities in anchors to verify certificate chains.The certificates in anchors must be PEM encoded.
New in version 2.30.
- Gio.tls_server_connection_new(base_io_stream, certificate)[source]¶
- Parameters:
base_io_stream (
Gio.IOStream
) – theGio.IOStream
to wrapcertificate (
Gio.TlsCertificate
orNone
) – the default server certificate, orNone
- Raises:
- Returns:
the new
Gio.TlsServerConnection
, orNone
on error- Return type:
Creates a new
Gio.TlsServerConnection
wrapping base_io_stream (which must have pollable input and output streams).See the documentation for
Gio.TlsConnection
:base-io-stream
for restrictions on when application code can run operations on the base_io_stream after this function has returned.New in version 2.28.
- Gio.unix_is_mount_path_system_internal(mount_path)[source]¶
- Parameters:
mount_path (
str
) – a mount path, e.g./media/disk
or/usr
- Returns:
True
if mount_path is considered an implementation detail of the OS.- Return type:
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.
- Gio.unix_is_system_device_path(device_path)[source]¶
- Parameters:
device_path (
str
) – a device path, e.g./dev/loop0
ornfsd
- Returns:
True
if device_path is considered an implementation detail of the OS.- Return type:
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.
New in version 2.56.
- Gio.unix_is_system_fs_type(fs_type)[source]¶
- Parameters:
fs_type (
str
) – a file system type, e.g.procfs
ortmpfs
- Returns:
True
if fs_type is considered an implementation detail of the OS.- Return 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.
New in version 2.56.
- Gio.unix_mount_at(mount_path)[source]¶
- Parameters:
mount_path (
str
) – path for a possible unix mount.- Returns:
-
- time_read:
guint64 to contain a timestamp.
- Return type:
(
Gio.UnixMountEntry
orNone
, time_read:int
)
Gets a
Gio.UnixMountEntry
for a given mount path. If time_read is set, it will be filled with a unix timestamp for checking if the mounts have changed since withGio.unix_mounts_changed_since
().If more mounts have the same mount path, the last matching mount is returned.
This will return
None
if there is no mount point at mount_path.
- Gio.unix_mount_compare(mount1, mount2)[source]¶
- Parameters:
mount1 (
Gio.UnixMountEntry
) – firstGio.UnixMountEntry
to compare.mount2 (
Gio.UnixMountEntry
) – secondGio.UnixMountEntry
to compare.
- Returns:
1, 0 or -1 if mount1 is greater than, equal to, or less than mount2, respectively.
- Return type:
Compares two unix mounts.
- Gio.unix_mount_copy(mount_entry)[source]¶
- Parameters:
mount_entry (
Gio.UnixMountEntry
) – aGio.UnixMountEntry
.- Returns:
a new
Gio.UnixMountEntry
- Return type:
Makes a copy of mount_entry.
New in version 2.54.
- Gio.unix_mount_for(file_path)[source]¶
- Parameters:
file_path (
str
) – file path on some unix mount.- Returns:
-
- time_read:
guint64 to contain a timestamp.
- Return type:
(
Gio.UnixMountEntry
orNone
, time_read:int
)
Gets a
Gio.UnixMountEntry
for a given file path. If time_read is set, it will be filled with a unix timestamp for checking if the mounts have changed since withGio.unix_mounts_changed_since
().If more mounts have the same mount path, the last matching mount is returned.
This will return
None
if looking up the mount entry fails, if file_path doesn’t exist or there is an I/O error.New in version 2.52.
- Gio.unix_mount_free(mount_entry)[source]¶
- Parameters:
mount_entry (
Gio.UnixMountEntry
) – aGio.UnixMountEntry
.
Frees a unix mount.
- Gio.unix_mount_get_device_path(mount_entry)[source]¶
- Parameters:
mount_entry (
Gio.UnixMountEntry
) – a #GUnixMount.- Returns:
a string containing the device path.
- Return type:
Gets the device path for a unix mount.
- Gio.unix_mount_get_fs_type(mount_entry)[source]¶
- Parameters:
mount_entry (
Gio.UnixMountEntry
) – a #GUnixMount.- Returns:
a string containing the file system type.
- Return type:
Gets the filesystem type for the unix mount.
- Gio.unix_mount_get_mount_path(mount_entry)[source]¶
- Parameters:
mount_entry (
Gio.UnixMountEntry
) – inputGio.UnixMountEntry
to get the mount path for.- Returns:
the mount path for mount_entry.
- Return type:
Gets the mount path for a unix mount.
- Gio.unix_mount_get_options(mount_entry)[source]¶
- Parameters:
mount_entry (
Gio.UnixMountEntry
) – aGio.UnixMountEntry
.- Returns:
a string containing the options, or
None
if not available.- Return type:
Gets a comma-separated list of mount options for the unix mount. For example,
rw,relatime,seclabel,data=ordered
.This is similar to
Gio.UnixMountPoint.get_options
(), but it takes aGio.UnixMountEntry
as an argument.New in version 2.58.
- Gio.unix_mount_get_root_path(mount_entry)[source]¶
- Parameters:
mount_entry (
Gio.UnixMountEntry
) – aGio.UnixMountEntry
.- Returns:
a string containing the root, or
None
if not supported.- Return type:
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”.
New in version 2.60.
- Gio.unix_mount_guess_can_eject(mount_entry)[source]¶
- Parameters:
mount_entry (
Gio.UnixMountEntry
) – aGio.UnixMountEntry
- Returns:
True
if mount_entry is deemed to be ejectable.- Return type:
Guesses whether a Unix mount can be ejected.
- Gio.unix_mount_guess_icon(mount_entry)[source]¶
- Parameters:
mount_entry (
Gio.UnixMountEntry
) – aGio.UnixMountEntry
- Returns:
a
Gio.Icon
- Return type:
Guesses the icon of a Unix mount.
- Gio.unix_mount_guess_name(mount_entry)[source]¶
- Parameters:
mount_entry (
Gio.UnixMountEntry
) – aGio.UnixMountEntry
- Returns:
A newly allocated string that must be freed with
GLib.free
()- Return type:
Guesses the name of a Unix mount. The result is a translated string.
- Gio.unix_mount_guess_should_display(mount_entry)[source]¶
- Parameters:
mount_entry (
Gio.UnixMountEntry
) – aGio.UnixMountEntry
- Returns:
True
if mount_entry is deemed to be displayable.- Return type:
Guesses whether a Unix mount should be displayed in the UI.
- Gio.unix_mount_guess_symbolic_icon(mount_entry)[source]¶
- Parameters:
mount_entry (
Gio.UnixMountEntry
) – aGio.UnixMountEntry
- Returns:
a
Gio.Icon
- Return type:
Guesses the symbolic icon of a Unix mount.
New in version 2.34.
- Gio.unix_mount_is_readonly(mount_entry)[source]¶
- Parameters:
mount_entry (
Gio.UnixMountEntry
) – a #GUnixMount.- Returns:
True
if mount_entry is read only.- Return type:
Checks if a unix mount is mounted read only.
- Gio.unix_mount_is_system_internal(mount_entry)[source]¶
- Parameters:
mount_entry (
Gio.UnixMountEntry
) – a #GUnixMount.- Returns:
True
if the unix mount is for a system path.- Return type:
Checks if a Unix mount is a system mount. This is the Boolean OR of
Gio.unix_is_system_fs_type
(),Gio.unix_is_system_device_path
() andGio.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.
- Gio.unix_mount_point_at(mount_path)[source]¶
- Parameters:
mount_path (
str
) – path for a possible unix mount point.- Returns:
a
Gio.UnixMountPoint
, orNone
if no match is found.- time_read:
guint64 to contain a timestamp.
- Return type:
(
Gio.UnixMountPoint
orNone
, time_read:int
)
Gets a
Gio.UnixMountPoint
for a given mount path. If time_read is set, it will be filled with a unix timestamp for checking if the mount points have changed since withGio.unix_mount_points_changed_since
().If more mount points have the same mount path, the last matching mount point is returned.
New in version 2.66.
- Gio.unix_mount_points_changed_since(time)[source]¶
- Parameters:
time (
int
) – guint64 to contain a timestamp.- Returns:
True
if the mount points have changed since time.- Return type:
Checks if the unix mount points have changed since a given unix time.
- Gio.unix_mount_points_get()[source]¶
- Returns:
a
GLib.List
of the UNIX mountpoints.- time_read:
guint64 to contain a timestamp.
- Return type:
([
Gio.UnixMountPoint
], time_read:int
)
Gets a
GLib.List
ofGio.UnixMountPoint
containing the unix mount points. If time_read is set, it will be filled with the mount timestamp, allowing for checking if the mounts have changed withGio.unix_mount_points_changed_since
().
- Gio.unix_mounts_changed_since(time)[source]¶
- Parameters:
time (
int
) – guint64 to contain a timestamp.- Returns:
True
if the mounts have changed since time.- Return type:
Checks if the unix mounts have changed since a given unix time.
- Gio.unix_mounts_get()[source]¶
- Returns:
a
GLib.List
of the UNIX mounts.- time_read:
guint64 to contain a timestamp, or
None
- Return type:
([
Gio.UnixMountEntry
], time_read:int
)
Gets a
GLib.List
ofGio.UnixMountEntry
containing the unix mounts. If time_read is set, it will be filled with the mount timestamp, allowing for checking if the mounts have changed withGio.unix_mounts_changed_since
().