[gnome-disk-utility] update for daemon ABI changes for device-mount-path -> device-mount-paths



commit 9fcac198a426c15a9648f59d673e46ed53f021d1
Author: David Zeuthen <davidz redhat com>
Date:   Thu Apr 2 14:02:52 2009 -0400

    update for daemon ABI changes for device-mount-path -> device-mount-paths
    
    http://cgit.freedesktop.org/DeviceKit/DeviceKit-disks/commit/?id=52443c7793ca55cf53036ecb29a6032e9823b7dd
    
    http://people.freedesktop.org/~david/gdu-multiple-mount-points.png
    
    We're keeping gdu_device_get_mount_path() around for the time being to
    avoid breaking too much ABI in libgdu.
---
 src/gdu/gdu-device.c       |   19 ++++++++++++++-----
 src/gdu/gdu-device.h       |    1 +
 src/palimpsest/gdu-shell.c |   27 ++++++++++++++++-----------
 3 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/src/gdu/gdu-device.c b/src/gdu/gdu-device.c
index bc79c69..e6767db 100644
--- a/src/gdu/gdu-device.c
+++ b/src/gdu/gdu-device.c
@@ -67,7 +67,7 @@ typedef struct
         gboolean device_is_busy;
         gboolean device_is_linux_md_component;
         gboolean device_is_linux_md;
-        char    *device_mount_path;
+        char   **device_mount_paths;
         uid_t    device_mounted_by_uid;
         char    *device_presentation_name;
         char    *device_presentation_icon_name;
@@ -219,8 +219,8 @@ collect_props (const char *key, const GValue *value, DeviceProperties *props)
                 props->device_is_mounted = g_value_get_boolean (value);
         else if (strcmp (key, "device-is-busy") == 0)
                 props->device_is_busy = g_value_get_boolean (value);
-        else if (strcmp (key, "device-mount-path") == 0)
-                props->device_mount_path = g_strdup (g_value_get_string (value));
+        else if (strcmp (key, "device-mount-paths") == 0)
+                props->device_mount_paths = g_strdupv (g_value_get_boxed (value));
         else if (strcmp (key, "device-mounted-by-uid") == 0)
                 props->device_mounted_by_uid = g_value_get_uint (value);
         else if (strcmp (key, "device-presentation-name") == 0)
@@ -433,7 +433,7 @@ device_properties_free (DeviceProperties *props)
         g_free (props->device_file);
         g_strfreev (props->device_file_by_id);
         g_strfreev (props->device_file_by_path);
-        g_free (props->device_mount_path);
+        g_strfreev (props->device_mount_paths);
         g_free (props->device_presentation_name);
         g_free (props->device_presentation_icon_name);
         g_free (props->job_id);
@@ -861,10 +861,19 @@ gdu_device_is_busy (GduDevice *device)
         return device->priv->props->device_is_busy;
 }
 
+/* keep this around for a while to avoid breaking ABI */
 const char *
 gdu_device_get_mount_path (GduDevice *device)
 {
-        return device->priv->props->device_mount_path;
+        if (device->priv->props->device_mount_paths == NULL || device->priv->props->device_mount_paths[0] == NULL)
+                return NULL;
+        return (const char *) device->priv->props->device_mount_paths[0];
+}
+
+char **
+gdu_device_get_mount_paths (GduDevice *device)
+{
+        return device->priv->props->device_mount_paths;
 }
 
 const char *
diff --git a/src/gdu/gdu-device.h b/src/gdu/gdu-device.h
index 33a42c9..776f939 100644
--- a/src/gdu/gdu-device.h
+++ b/src/gdu/gdu-device.h
@@ -89,6 +89,7 @@ gboolean gdu_device_is_linux_md (GduDevice *device);
 gboolean gdu_device_is_mounted (GduDevice *device);
 gboolean gdu_device_is_busy (GduDevice *device);
 const char *gdu_device_get_mount_path (GduDevice *device);
+char **gdu_device_get_mount_paths (GduDevice *device);
 uid_t gdu_device_get_mounted_by_uid (GduDevice *device);
 const char *gdu_device_get_presentation_name (GduDevice *device);
 const char *gdu_device_get_presentation_icon_name (GduDevice *device);
diff --git a/src/palimpsest/gdu-shell.c b/src/palimpsest/gdu-shell.c
index c5ddb19..464171a 100644
--- a/src/palimpsest/gdu-shell.c
+++ b/src/palimpsest/gdu-shell.c
@@ -184,7 +184,6 @@ details_update (GduShell *shell)
         gboolean ret;
         char *s;
         char *p;
-        char *url;
         char *detail_color;
         char *name;
         GIcon *icon;
@@ -390,16 +389,22 @@ details_update (GduShell *shell)
                 }
 
                 if (gdu_device_is_mounted (device)) {
-                        p = s;
-			url = g_strconcat ("<a href=\"file://",
-                                           gdu_device_get_mount_path (device),
-                                           "\">",
-                                           gdu_device_get_mount_path (device),
-                                           "</a>",
-                                           NULL);
-                        s = g_strdup_printf (_("%s mounted at %s"), s, url);
-                        g_free (p);
-                        g_free (url);
+                        gchar **mount_paths;
+                        GString *str;
+
+                        mount_paths = gdu_device_get_mount_paths (device);
+
+                        str = g_string_new (s);
+                        g_free (s);
+                        g_string_append (str, " mounted at ");
+                        for (n = 0; mount_paths[n] != NULL; n++) {
+                                if (n > 0)
+                                        g_string_append (str, ", ");
+                                g_string_append_printf (str, "<a href=\"file://%s\">%s</a>",
+                                                        mount_paths[n],
+                                                        mount_paths[n]);
+                        }
+                        s = g_string_free (str, FALSE);
                 }
                 g_ptr_array_add (details, s);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]