UDisksClient: add get_partition_info() method
authorDavid Zeuthen <davidz@redhat.com>
Fri, 28 Oct 2011 16:36:08 +0000 (12:36 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Fri, 28 Oct 2011 16:36:08 +0000 (12:36 -0400)
Signed-off-by: David Zeuthen <davidz@redhat.com>
doc/udisks2-sections.txt
udisks/udisksclient.c
udisks/udisksclient.h

index f119212..6a0cbbb 100644 (file)
@@ -33,13 +33,14 @@ udisks_client_peek_object
 udisks_client_get_object_manager
 udisks_client_get_manager
 udisks_client_settle
-udisks_client_get_drive_info
 udisks_client_get_block_for_dev
 udisks_client_get_block_for_drive
 udisks_client_get_drive_for_block
 udisks_client_get_cleartext_block
 udisks_client_get_partition_table
-
+<SUBSECTION>
+udisks_client_get_drive_info
+udisks_client_get_partition_info
 <SUBSECTION>
 udisks_client_get_size_for_display
 udisks_client_get_part_scheme_for_display
index dbe23df..f9a476d 100644 (file)
@@ -1185,6 +1185,44 @@ udisks_client_get_drive_info (UDisksClient  *client,
 /* ---------------------------------------------------------------------------------------------------- */
 
 /**
+ * udisks_client_get_partition_info:
+ * @client: A #UDisksClient.
+ * @partition: # #UDisksPartition.
+ *
+ * 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 type,
+ * label (if any) and flags (if any).
+ *
+ * Returns: (transfer full): A string that should be freed with g_free().
+ */
+gchar *
+udisks_client_get_partition_info (UDisksClient    *client,
+                                  UDisksPartition *partition)
+{
+  gchar *ret = NULL;
+  UDisksPartitionTable *table = NULL;
+
+  g_return_val_if_fail (UDISKS_IS_CLIENT (client), NULL);
+  g_return_val_if_fail (UDISKS_IS_PARTITION (partition), NULL);
+
+  table = udisks_client_get_partition_table (client, partition);
+
+  /* TODO: also include label and flags */
+  ret = udisks_client_get_part_type_for_display (client,
+                                                 udisks_partition_table_get_type_ (table),
+                                                 udisks_partition_get_type_ (partition),
+                                                 FALSE /* long_string */);
+
+  g_object_unref (table);
+
+  return ret;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+/**
  * udisks_client_get_cleartext_block:
  * @client: A #UDisksClient.
  * @block: A #UDisksBlock.
index c6416e5..5b219c4 100644 (file)
@@ -74,6 +74,10 @@ void                udisks_client_get_drive_info      (UDisksClient        *clie
                                                        gchar              **out_media_description,
                                                        GIcon              **out_media_icon);
 
+gchar              *udisks_client_get_partition_info  (UDisksClient        *client,
+                                                       UDisksPartition     *partition);
+
+
 gchar              *udisks_client_get_size_for_display (UDisksClient *client,
                                                         guint64       size,
                                                         gboolean      use_pow2,