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.Client
is 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.Cancellable
orNone
) – AGio.Cancellable
orNone
.callback (
Gio.AsyncReadyCallback
orNone
) – 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 loop
of the thread you are calling this method from.
- classmethod new_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – AGio.AsyncResult
.- Raises:
- Returns:
A
UDisks.Client
orNone
if 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.DBusConnection
orNone
) – aGio.DBusConnection
. IfNone
, a system bus connection will be used.cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
orNone
.callback (
Gio.AsyncReadyCallback
orNone
) – Function that will be called when the result is ready.
Like
UDisks.Client.new
() but takes aGio.DBusConnection
which will be used when connecting to the UDisks daemon over D-Bus. This is useful for unit tests which may want to useGio.TestDBus
to 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.Client
orNone
if 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.Cancellable
orNone
) – AGio.Cancellable
orNone
.- Raises:
- Returns:
A
UDisks.Client
orNone
if error is set. Free withGObject.Object.unref
() when done with it.- Return type:
Synchronously gets a
UDisks.Client
for the local system.
- get_all_blocks_for_mdraid(raid)¶
- Parameters:
raid (
UDisks.MDRaid
) – AUDisks.MDRaid
.- Returns:
A list of
UDisks.Block
instances. 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.Block
for.- Returns:
A
UDisks.Block
orNone
if not found.- Return type:
Gets the
UDisks.Block
corresponding to block_device_number, if any.
- get_block_for_drive(drive, get_physical)¶
- Parameters:
drive (
UDisks.Drive
) – AUDisks.Drive
.get_physical (
bool
) –True
to get a physical device,False
to get the logical device.
- Returns:
A
UDisks.Block
orNone
if 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
True
if 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 toFalse
if 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.Block
instances. 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.Block
instances with the given label, if any.
- get_block_for_mdraid(raid)¶
- Parameters:
raid (
UDisks.MDRaid
) – AUDisks.MDRaid
.- Returns:
A
UDisks.Block
orNone
if 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.Block
instances. 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.Block
instances with the given uuid, if any.
- get_cleartext_block(block)¶
- Parameters:
block (
UDisks.Block
) – AUDisks.Block
.- Returns:
A
UDisks.Block
orNone
. 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.Drive
orNone
if there is noUDisks.Drive
for block - free the returned object withGObject.Object.unref
().- Return type:
Gets the
UDisks.Drive
that 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.Drive
object 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.Drive
instances. 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.Job
instances. 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.Job
instances that reference object, if any.
- get_loop_for_block(block)¶
- Parameters:
block (
UDisks.Block
) – AUDisks.Block
.- Returns:
A
UDisks.Loop
orNone
. 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.Manager
orNone
if the udisksd daemon is not currently running. Do not free, the instance is owned by self.- Return type:
Gets the
UDisks.Manager
interface on the well-known/org/freedesktop/UDisks2/Manager
object.
- get_mdraid_for_block(block)¶
- Parameters:
block (
UDisks.Block
) – AUDisks.Block
.- Returns:
A
UDisks.MDRaid
orNone
if there is noUDisks.MDRaid
for block or block is not a MD-RAID block device. Free the returned object withGObject.Object.unref
().- Return type:
Gets the
UDisks.MDRaid
that 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
() orNone
if 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.Block
instances. 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.Object
corresponding to object_path orNone
if not found. The returned object must be freed withGObject.Object.unref
().- Return type:
Convenience function for looking up an
UDisks.Object
for object_path.
- get_object_info(object)¶
- Parameters:
object (
UDisks.Object
) – AUDisks.Object
.- Returns:
A
UDisks.ObjectInfo
instance that should be freed withGObject.Object.unref
().- Return type:
Gets information about a
UDisks.Object
instance that is suitable to present in an user interface. Information is returned in theUDisks.ObjectInfo
object 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.DBusObjectManager
used 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.PartitionTable
corresponding 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
None
if 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
None
if 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.PartitionTypeInfo
instances. 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.Partition
instances. 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.Object
corresponding to object_path orNone
if 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
::changed
signal and rate-limit it. See the documentation for theUDisks.Client
::changed
property 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
::changed
signal 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-changed
and signals on theUDisks.Client
:object-manager
object.
Property Details¶
- UDisks.Client.props.bus_connection¶
- Name:
bus-connection
- Type:
- Default Value:
- Flags:
The
Gio.DBusConnection
used to create theUDisks.Client
:object-manager
, orNone
if 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.Manager
interface on the well-known/org/freedesktop/UDisks2/Manager
object
- UDisks.Client.props.object_manager¶
- Name:
object-manager
- Type:
- Default Value:
- Flags:
The
Gio.DBusObjectManager
used by theUDisks.Client
instance.