UDisks.Client¶
- Subclasses:
 None
Methods¶
- Inherited:
 GObject.Object (37), Gio.AsyncInitable (4), Gio.Initable (2)
- Structs:
 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
|
class  | 
  | 
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Virtual Methods¶
- Inherited:
 
Properties¶
Name  | 
Type  | 
Flags  | 
Short Description  | 
|---|---|---|---|
r/w/co  | 
The D-Bus connection with which to talk to udisksd  | 
||
r  | 
The   | 
||
r  | 
The   | 
Signals¶
- Inherited:
 
Name  | 
Short Description  | 
|---|---|
This signal is emitted either when an object or interface is added or removed a when property has changed.  | 
Fields¶
- Inherited:
 
Class Details¶
- class UDisks.Client(**kwargs)¶
 - Bases:
 - Abstract:
 No
UDisks.Clientis used for accessing the UDisks service from a client program.- classmethod get_job_description_from_operation(operation)¶
 - Parameters:
 operation (
str) – A job operation name.- Returns:
 A string that should be freed with
GLib.free().- Return type:
 
Gets a human-readable and localized text string describing a a job operation.
For known job operation types, see the documentation for the
Job:Operation D-Bus property.
- classmethod new(cancellable, callback, *user_data)¶
 - Parameters:
 cancellable (
Gio.CancellableorNone) – AGio.CancellableorNone.callback (
Gio.AsyncReadyCallbackorNone) – Function that will be called when the result is ready.
Asynchronously gets a
UDisks.Client. When the operation is finished, callback will be invoked in thethread-default main loopof the thread you are calling this method from.
- classmethod new_finish(res)¶
 - Parameters:
 res (
Gio.AsyncResult) – AGio.AsyncResult.- Raises:
 - Returns:
 A
UDisks.ClientorNoneif error is set. Free withGObject.Object.unref() when done with it.- Return type:
 
Finishes an operation started with
UDisks.Client.new().
- classmethod new_for_connection(connection, cancellable, callback, *user_data)¶
 - Parameters:
 connection (
Gio.DBusConnectionorNone) – aGio.DBusConnection. IfNone, a system bus connection will be used.cancellable (
Gio.CancellableorNone) – AGio.CancellableorNone.callback (
Gio.AsyncReadyCallbackorNone) – Function that will be called when the result is ready.
Like
UDisks.Client.new() but takes aGio.DBusConnectionwhich will be used when connecting to the UDisks daemon over D-Bus. This is useful for unit tests which may want to useGio.TestDBusto create a D-Bus daemon on the session bus.New in version 2.9.0.
- classmethod new_for_connection_finish(res)¶
 - Parameters:
 res (
Gio.AsyncResult) – AGio.AsyncResult.- Raises:
 - Returns:
 A
UDisks.ClientorNoneif error is set. Free withGObject.Object.unref() when done with it.- Return type:
 
Finishes an operation started with
UDisks.Client.new_for_connection().New in version 2.9.0.
- classmethod new_sync(cancellable)¶
 - Parameters:
 cancellable (
Gio.CancellableorNone) – AGio.CancellableorNone.- Raises:
 - Returns:
 A
UDisks.ClientorNoneif error is set. Free withGObject.Object.unref() when done with it.- Return type:
 
Synchronously gets a
UDisks.Clientfor the local system.
- get_all_blocks_for_mdraid(raid)¶
 - Parameters:
 raid (
UDisks.MDRaid) – AUDisks.MDRaid.- Returns:
 A list of
UDisks.Blockinstances. The returned list should be freed with g_list_free() after each element has been freed withGObject.Object.unref().- Return type:
 
Gets all RAID devices (e.g. /dev/md0 and /dev/md1) for raid.
This is usually only useful in split-brain situations — see
UDisks.Client.get_block_for_mdraid() for an example — and is normally used only to convey the problem in an user interface.New in version 2.1.
- get_block_for_dev(block_device_number)¶
 - Parameters:
 block_device_number (
int) – A #dev_t to get aUDisks.Blockfor.- Returns:
 A
UDisks.BlockorNoneif not found.- Return type:
 
Gets the
UDisks.Blockcorresponding to block_device_number, if any.
- get_block_for_drive(drive, get_physical)¶
 - Parameters:
 drive (
UDisks.Drive) – AUDisks.Drive.get_physical (
bool) –Trueto get a physical device,Falseto get the logical device.
- Returns:
 A
UDisks.BlockorNoneif the requested kind of block device is not available - useGObject.Object.unref() to free the returned object.- Return type:
 
Gets a block device corresponding to drive. The returned block device, if any, is for the whole disk drive, e.g. a partition block device is never returned.
Set get_physical to
Trueif you need a block device that you can send low-level SCSI commands with (for multipath, this returns one of the physical paths). Set it toFalseif you need a block device that you can read/write data with (for multipath, this returns the mapped device).
- get_block_for_label(label)¶
 - Parameters:
 label (
str) – The label.- Returns:
 A list of
UDisks.Blockinstances. The returned list should be freed with g_list_free() after each element has been freed withGObject.Object.unref().- Return type:
 
Gets all the
UDisks.Blockinstances with the given label, if any.
- get_block_for_mdraid(raid)¶
 - Parameters:
 raid (
UDisks.MDRaid) – AUDisks.MDRaid.- Returns:
 A
UDisks.BlockorNoneif no RAID device is running.- Return type:
 
Gets the RAID device (e.g. /dev/md0) for raid.
In the case of a split-brain syndrome, it is undefined which RAID device is returned. For example this can happen if /dev/sda and /dev/sdb are components of a two-disk RAID-1 and /dev/md0 and /dev/md1 are two degraded arrays, each one using exactly one of the two devices. Use
UDisks.Client.get_all_blocks_for_mdraid() to get all RAID devices.New in version 2.1.
- get_block_for_uuid(uuid)¶
 - Parameters:
 uuid (
str) – The uuid.- Returns:
 A list of
UDisks.Blockinstances. The returned list should be freed with g_list_free() after each element has been freed withGObject.Object.unref().- Return type:
 
Gets all the
UDisks.Blockinstances with the given uuid, if any.
- get_cleartext_block(block)¶
 - Parameters:
 block (
UDisks.Block) – AUDisks.Block.- Returns:
 A
UDisks.BlockorNone. Free withGObject.Object.unref() when done with it.- Return type:
 
If block is an unlocked encrypted device, gets the cleartext device.
- get_drive_for_block(block)¶
 - Parameters:
 block (
UDisks.Block) – AUDisks.Block.- Returns:
 A
UDisks.DriveorNoneif there is noUDisks.Drivefor block - free the returned object withGObject.Object.unref().- Return type:
 
Gets the
UDisks.Drivethat block belongs to, if any.
- get_drive_info(drive)¶
 - Parameters:
 drive (
UDisks.Drive) – AUDisks.Drive.- Returns:
 - out_name:
 Return location for name or
None.- out_description:
 Return location for description or
None.- out_drive_icon:
 Return location for icon representing the drive or
None.- out_media_description:
 Return location for description of the media or
None.- out_media_icon:
 Return location for icon representing the media or
None.
- Return type:
 (out_name:
str, out_description:str, out_drive_icon:Gio.Icon, out_media_description:str, out_media_icon:Gio.Icon)
Gets information about a
UDisks.Driveobject that is suitable to present in an user interface. The returned strings are localized.Deprecated since version 2.1: Use
UDisks.Client.get_object_info() instead.
- get_drive_siblings(drive)¶
 - Parameters:
 drive (
UDisks.Drive) – AUDisks.Drive.- Returns:
 A list of
UDisks.Driveinstances. The returned list should be freed with g_list_free() after each element has been freed withGObject.Object.unref().- Return type:
 
Gets all siblings for drive.
New in version 2.1.
- get_id_for_display(usage, type, version, long_string)¶
 - Parameters:
 - Returns:
 A string that should be freed with
GLib.free().- Return type:
 
Gets a human readable localized string for usage, type and version.
- get_job_description(job)¶
 - Parameters:
 job (
UDisks.Job) – AUDisks.Job.- Returns:
 A string that should be freed with
GLib.free().- Return type:
 
Gets a human-readable and localized text string describing the operation of job.
For known job types, see the documentation for the
Job:Operation D-Bus property.
- get_jobs_for_object(object)¶
 - Parameters:
 object (
UDisks.Object) – AUDisks.Object.- Returns:
 A list of
UDisks.Jobinstances. The returned list should be freed with g_list_free() after each element has been freed withGObject.Object.unref().- Return type:
 
Gets all the
UDisks.Jobinstances that reference object, if any.
- get_loop_for_block(block)¶
 - Parameters:
 block (
UDisks.Block) – AUDisks.Block.- Returns:
 A
UDisks.LooporNone. Free withGObject.Object.unref().- Return type:
 
Gets the corresponding loop interface for block.
This only works if block itself is a loop device or a partition of a loop device.
- get_manager()¶
 - Returns:
 A
UDisks.ManagerorNoneif the udisksd daemon is not currently running. Do not free, the instance is owned by self.- Return type:
 
Gets the
UDisks.Managerinterface on the well-known/org/freedesktop/UDisks2/Managerobject.
- get_mdraid_for_block(block)¶
 - Parameters:
 block (
UDisks.Block) – AUDisks.Block.- Returns:
 A
UDisks.MDRaidorNoneif there is noUDisks.MDRaidfor block or block is not a MD-RAID block device. Free the returned object withGObject.Object.unref().- Return type:
 
Gets the
UDisks.MDRaidthat block is the block device for, if any.New in version 2.1.
- get_media_compat_for_display(media_compat)¶
 - Parameters:
 media_compat (
str) – An array of media types.- Returns:
 A string that should be freed with
GLib.free() orNoneif unknown.- Return type:
 
Gets a human-readable string of the media described by media_compat. The returned information is localized.
- get_members_for_mdraid(raid)¶
 - Parameters:
 raid (
UDisks.MDRaid) – AUDisks.MDRaid.- Returns:
 A list of
UDisks.Blockinstances. The returned list should be freed with g_list_free() after each element has been freed withGObject.Object.unref().- Return type:
 
Gets the physical block devices that are part of raid.
New in version 2.1.
- get_object(object_path)¶
 - Parameters:
 object_path (
str) – Object path.- Returns:
 A
UDisks.Objectcorresponding to object_path orNoneif not found. The returned object must be freed withGObject.Object.unref().- Return type:
 
Convenience function for looking up an
UDisks.Objectfor object_path.
- get_object_info(object)¶
 - Parameters:
 object (
UDisks.Object) – AUDisks.Object.- Returns:
 A
UDisks.ObjectInfoinstance that should be freed withGObject.Object.unref().- Return type:
 
Gets information about a
UDisks.Objectinstance that is suitable to present in an user interface. Information is returned in theUDisks.ObjectInfoobject and is localized.New in version 2.1.
- get_object_manager()¶
 - Returns:
 A
Gio.DBusObjectManager. Do not free, the instance is owned by self.- Return type:
 
Gets the
Gio.DBusObjectManagerused by self.
- get_partition_info(partition)¶
 - Parameters:
 partition (
UDisks.Partition) –- Returns:
 A string that should be freed with
GLib.free().- Return type:
 
Gets information about partition that is suitable to present in an user interface in a single line of text.
The returned string is localized and includes things like the partition type, flags (if any) and name (if any).
- get_partition_table(partition)¶
 - Parameters:
 partition (
UDisks.Partition) – AUDisks.Partition.- Returns:
 A
UDisks.PartitionTable. Free withGObject.Object.unref().- Return type:
 
Gets the
UDisks.PartitionTablecorresponding to partition.
- get_partition_table_subtype_for_display(partition_table_type, partition_table_subtype)¶
 - Parameters:
 - Returns:
 A description of partition_table_type and partition_table_subtype or
None.- Return type:
 
Gets a human readable localized string for partition_table_type and partition_table_subtype.
- get_partition_table_subtypes(partition_table_type)¶
 - Parameters:
 partition_table_type (
str) – A partition table type e.g. ‘dos’ or ‘gpt’.- Returns:
 A
None-terminated array of strings. Only the container should be freed withGLib.free().- Return type:
 [
str]
Gets all known subtypes for partition_table_type.
- get_partition_table_type_for_display(partition_table_type)¶
 - Parameters:
 partition_table_type (
str) – A partition table type e.g. ‘dos’ or ‘gpt’.- Returns:
 A description of partition_table_type or
None.- Return type:
 
Gets a human readable localized string for partition_table_type.
- get_partition_type_and_subtype_for_display(partition_table_type, partition_table_subtype, partition_type)¶
 - Parameters:
 - Returns:
 A description of partition_type or
Noneif unknown.- Return type:
 
Like
UDisks.Client.get_partition_type_for_display() but also takes the partition table subtype into account, if available. This is useful in scenarios where different subtypes is using the same partition type.New in version 2.1.1.
- get_partition_type_for_display(partition_table_type, partition_type)¶
 - Parameters:
 - Returns:
 A description of partition_type or
Noneif unknown.- Return type:
 
Gets a human readable localized string for partiton_table_type and partition_type.
- get_partition_type_infos(partition_table_type, partition_table_subtype)¶
 - Parameters:
 - Returns:
 A list of
UDisks.PartitionTypeInfoinstances. The returned list should be freed with g_list_free() after freeing each element withUDisks.PartitionTypeInfo.free().- Return type:
 
Gets information about all known partition types for partition_table_type and partition_table_subtype.
- get_partitions(table)¶
 - Parameters:
 table (
UDisks.PartitionTable) – AUDisks.PartitionTable.- Returns:
 A list of
UDisks.Partitioninstances. The returned list should be freed with g_list_free() after each element has been freed withGObject.Object.unref().- Return type:
 
Gets all partitions of table.
- get_size_for_display(size, use_pow2, long_string)¶
 - Parameters:
 - Returns:
 A string that should be freed with
GLib.free().- Return type:
 
Utility function to get a human-readable string that represents size.
- peek_object(object_path)¶
 - Parameters:
 object_path (
str) – Object path.- Returns:
 A
UDisks.Objectcorresponding to object_path orNoneif not found.- Return type:
 
Like
UDisks.Client.get_object() but doesn’t increase the reference count on the returnedUDisks.Object.The returned object is only valid until removed so it is only safe to use this function on the thread where self was constructed. Use
UDisks.Client.get_object() if on another thread.
- queue_changed()¶
 Queues up a
UDisks.Client::changedsignal and rate-limit it. See the documentation for theUDisks.Client::changedproperty for more information.New in version 2.1.
- settle()¶
 Blocks until all pending D-Bus messages have been delivered. Also emits the (rate-limited)
UDisks.Client::changedsignal if changes are currently pending.This is useful in two situations: 1. when using synchronous method calls since e.g. D-Bus signals received while waiting for the reply are queued up and dispatched after the synchronous call ends; and
when using asynchronous calls where the return value references a newly created object (such as the Manager.LoopSetup() method).
Signal Details¶
- UDisks.Client.signals.changed(client)¶
 - Signal Name:
 changed- Flags:
 - Parameters:
 client (
UDisks.Client) – The object which received the signal
This signal is emitted either when an object or interface is added or removed a when property has changed. Additionally, multiple received signals are coalesced into a single signal that is rate-limited to fire at most every 100ms.
Note that calling
UDisks.Client.settle() will cause this signal to fire if any changes are outstanding.For greater detail, connect to the
Gio.DBusObjectManager::object-added,Gio.DBusObjectManager::object-removed,Gio.DBusObjectManager::interface-added,Gio.DBusObjectManager::interface-removed,Gio.DBusObjectManagerClient::interface-proxy-properties-changedand signals on theUDisks.Client:object-managerobject.
Property Details¶
- UDisks.Client.props.bus_connection¶
 - Name:
 bus-connection- Type:
 - Default Value:
 - Flags:
 
The
Gio.DBusConnectionused to create theUDisks.Client:object-manager, orNoneif one wasn’t specified during construction of theUDisks.Client(in which case a system bus connection is used).New in version 2.9.0.
- UDisks.Client.props.manager¶
 - Name:
 manager- Type:
 - Default Value:
 - Flags:
 
The
UDisks.Managerinterface on the well-known/org/freedesktop/UDisks2/Managerobject
- UDisks.Client.props.object_manager¶
 - Name:
 object-manager- Type:
 - Default Value:
 - Flags:
 
The
Gio.DBusObjectManagerused by theUDisks.Clientinstance.