|
|
170140 |
From 68e0d368fb5d3088c5e7d7513607d24dbcb50e02 Mon Sep 17 00:00:00 2001
|
|
|
170140 |
From: David Zeuthen <zeuthen@gmail.com>
|
|
|
170140 |
Date: Tue, 21 May 2013 16:06:19 +0000
|
|
|
170140 |
Subject: UDisksClient: Make it possible to get part desc based on the part table subtype
|
|
|
170140 |
|
|
|
170140 |
Otherwise, Disks can't populate the partition table combobox correctly
|
|
|
170140 |
for GPT because "Generic", "Apple" and "Other" subtypes all have the
|
|
|
170140 |
same partition type (ZFS) but with different descriptions ("ZFS",
|
|
|
170140 |
"Apple ZFS", "Solaris /usr").
|
|
|
170140 |
|
|
|
170140 |
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
|
|
|
170140 |
---
|
|
|
170140 |
diff --git a/doc/udisks2-sections.txt b/doc/udisks2-sections.txt
|
|
|
170140 |
index 9dbeef6..897f48a 100644
|
|
|
170140 |
--- a/doc/udisks2-sections.txt
|
|
|
170140 |
+++ b/doc/udisks2-sections.txt
|
|
|
170140 |
@@ -70,6 +70,7 @@ udisks_partition_type_info_free
|
|
|
170140 |
udisks_client_get_partition_type_infos
|
|
|
170140 |
udisks_client_get_partition_table_subtypes
|
|
|
170140 |
udisks_client_get_partition_type_for_display
|
|
|
170140 |
+udisks_client_get_partition_type_and_subtype_for_display
|
|
|
170140 |
udisks_client_get_partition_table_type_for_display
|
|
|
170140 |
udisks_client_get_partition_table_subtype_for_display
|
|
|
170140 |
<SUBSECTION Standard>
|
|
|
170140 |
diff --git a/udisks/udisksclient.c b/udisks/udisksclient.c
|
|
|
170140 |
index aca946c..f7eaa04 100644
|
|
|
170140 |
--- a/udisks/udisksclient.c
|
|
|
170140 |
+++ b/udisks/udisksclient.c
|
|
|
170140 |
@@ -2395,6 +2395,48 @@ udisks_client_get_partition_type_for_display (UDisksClient *client,
|
|
|
170140 |
return ret;
|
|
|
170140 |
}
|
|
|
170140 |
|
|
|
170140 |
+/**
|
|
|
170140 |
+ * udisks_client_get_partition_type_and_subtype_for_display:
|
|
|
170140 |
+ * @client: A #UDisksClient.
|
|
|
170140 |
+ * @partition_table_type: A partitioning type e.g. 'dos' or 'gpt'.
|
|
|
170140 |
+ * @partition_table_subtype: A partitioning subtype or %NULL.
|
|
|
170140 |
+ * @partition_type: A partition type.
|
|
|
170140 |
+ *
|
|
|
170140 |
+ * Like udisks_client_get_partition_type_for_display() but also takes
|
|
|
170140 |
+ * the partition table subtype into account, if available. This is
|
|
|
170140 |
+ * useful in scenarios where different subtypes is using the same
|
|
|
170140 |
+ * partition type.
|
|
|
170140 |
+ *
|
|
|
170140 |
+ * Returns: A description of @partition_type or %NULL if unknown.
|
|
|
170140 |
+ *
|
|
|
170140 |
+ * Since: 2.1.1
|
|
|
170140 |
+ */
|
|
|
170140 |
+const gchar *
|
|
|
170140 |
+udisks_client_get_partition_type_and_subtype_for_display (UDisksClient *client,
|
|
|
170140 |
+ const gchar *partition_table_type,
|
|
|
170140 |
+ const gchar *partition_table_subtype,
|
|
|
170140 |
+ const gchar *partition_type)
|
|
|
170140 |
+{
|
|
|
170140 |
+ const gchar *ret = NULL;
|
|
|
170140 |
+ guint n;
|
|
|
170140 |
+
|
|
|
170140 |
+ for (n = 0; known_partition_types[n].name != NULL; n++)
|
|
|
170140 |
+ {
|
|
|
170140 |
+ if (g_strcmp0 (known_partition_types[n].table_type, partition_table_type) == 0 &&
|
|
|
170140 |
+ g_strcmp0 (known_partition_types[n].type, partition_type) == 0)
|
|
|
170140 |
+ {
|
|
|
170140 |
+ if (partition_table_subtype != NULL &&
|
|
|
170140 |
+ g_strcmp0 (known_partition_types[n].table_subtype, partition_table_subtype) != 0)
|
|
|
170140 |
+ continue;
|
|
|
170140 |
+ ret = g_dpgettext2 (GETTEXT_PACKAGE, "part-type", known_partition_types[n].name);
|
|
|
170140 |
+ goto out;
|
|
|
170140 |
+ }
|
|
|
170140 |
+ }
|
|
|
170140 |
+
|
|
|
170140 |
+ out:
|
|
|
170140 |
+ return ret;
|
|
|
170140 |
+}
|
|
|
170140 |
+
|
|
|
170140 |
/* ---------------------------------------------------------------------------------------------------- */
|
|
|
170140 |
|
|
|
170140 |
/**
|
|
|
170140 |
diff --git a/udisks/udisksclient.h b/udisks/udisksclient.h
|
|
|
170140 |
index 93dfddf..121efc3 100644
|
|
|
170140 |
--- a/udisks/udisksclient.h
|
|
|
170140 |
+++ b/udisks/udisksclient.h
|
|
|
170140 |
@@ -136,6 +136,12 @@ const gchar *udisks_client_get_partition_type_for_display (UDisksCl
|
|
|
170140 |
const gchar *partition_table_type,
|
|
|
170140 |
const gchar *partition_type);
|
|
|
170140 |
|
|
|
170140 |
+const gchar *udisks_client_get_partition_type_and_subtype_for_display (UDisksClient *client,
|
|
|
170140 |
+ const gchar *partition_table_type,
|
|
|
170140 |
+ const gchar *partition_table_subtype,
|
|
|
170140 |
+ const gchar *partition_type);
|
|
|
170140 |
+
|
|
|
170140 |
+
|
|
|
170140 |
const gchar *udisks_client_get_partition_table_type_for_display (UDisksClient *client,
|
|
|
170140 |
const gchar *partition_table_type);
|
|
|
170140 |
|
|
|
170140 |
--
|
|
|
170140 |
cgit v0.9.0.2-2-gbebe
|