[gnome-disk-utility] Catch up with the udisks changes for the UDisksObjectInfo type



commit 84221f48f9b2db5cabcaa3d48b3122cb579ce1c2
Author: David Zeuthen <zeuthen gmail com>
Date:   Tue Nov 20 14:22:15 2012 -0500

    Catch up with the udisks changes for the UDisksObjectInfo type
    
    See http://cgit.freedesktop.org/udisks/commit/?id=395eeb8c0e80eeae534fac66a9a4d5c8eccda1a3
    
    Signed-off-by: David Zeuthen <zeuthen gmail com>

 src/disks/gdubenchmarkdialog.c        |   26 ++------------------------
 src/disks/gducreatediskimagedialog.c  |    4 ++--
 src/disks/gdudevicetreemodel.c        |   13 ++++++-------
 src/disks/gdumdraiddisksdialog.c      |   21 ++++++++++-----------
 src/disks/gdurestorediskimagedialog.c |    4 ++--
 src/disks/gduwindow.c                 |   13 ++++++-------
 src/libgdu/gduutils.c                 |    6 +++---
 7 files changed, 31 insertions(+), 56 deletions(-)
---
diff --git a/src/disks/gdubenchmarkdialog.c b/src/disks/gdubenchmarkdialog.c
index 14d2960..8e02e3d 100644
--- a/src/disks/gdubenchmarkdialog.c
+++ b/src/disks/gdubenchmarkdialog.c
@@ -821,7 +821,6 @@ update_dialog (DialogData *data)
   gdouble access_time_avg = 0.0;
   gchar *s = NULL;
   UDisksDrive *drive = NULL;
-  const gchar *drive_revision = NULL;
   UDisksObjectInfo *info = NULL;
 
   G_LOCK (bm_lock);
@@ -856,30 +855,10 @@ update_dialog (DialogData *data)
 
   /* disk / device label */
   drive = udisks_client_get_drive_for_block (gdu_window_get_client (data->window), data->block);
-  if (drive != NULL)
-    drive_revision = udisks_drive_get_revision (drive);
   info = udisks_client_get_object_info (gdu_window_get_client (data->window), data->object);
-  if (drive_revision != NULL && strlen (drive_revision) > 0)
-    {
-      /* Translators: Shown for "Disk / Device" field.
-       *              The first %s is the description of the object (e.g. "80 GB Disk").
-       *              The second %s is the name of the object (e.g. "INTEL SSDSA2MH080G1GC").
-       *              The third %s is the fw revision (e.g "45ABX21").
-       */
-      s = g_strdup_printf (C_("benchmark", "%s â %s (%s)"), info->description, info->name, drive_revision);
-    }
-  else
-    {
-      /* Translators: Shown for "Disk / Device" field.
-       *              The first %s is the description of the object (e.g. "80 GB Disk").
-       *              The second %s is the name of the object (e.g. "INTEL SSDSA2MH080G1GC").
-       */
-      s = g_strdup_printf (C_("benchmark", "%s â %s"), info->description, info->name);
-    }
-  gtk_label_set_text (GTK_LABEL (data->device_label), s);
+  gtk_label_set_text (GTK_LABEL (data->device_label), udisks_object_info_get_one_liner (info));
   g_free (s);
 
-
   G_LOCK (bm_lock);
 
   if (data->bm_in_progress)
@@ -952,8 +931,7 @@ update_dialog (DialogData *data)
     gdk_window_invalidate_rect (window, NULL, TRUE);
 
   g_clear_object (&drive);
-  if (info != NULL)
-    udisks_object_info_unref (info);
+  g_clear_object (&info);
 }
 
 
diff --git a/src/disks/gducreatediskimagedialog.c b/src/disks/gducreatediskimagedialog.c
index 9bffe00..0b21991 100644
--- a/src/disks/gducreatediskimagedialog.c
+++ b/src/disks/gducreatediskimagedialog.c
@@ -272,8 +272,8 @@ create_disk_image_populate (DialogData *data)
 
   /* Source label */
   info = udisks_client_get_object_info (gdu_window_get_client (data->window), data->object);
-  gtk_label_set_text (GTK_LABEL (data->source_label), info->one_liner);
-  udisks_object_info_unref (info);
+  gtk_label_set_text (GTK_LABEL (data->source_label), udisks_object_info_get_one_liner (info));
+  g_clear_object (&info);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/disks/gdudevicetreemodel.c b/src/disks/gdudevicetreemodel.c
index 5fa737f..d281f69 100644
--- a/src/disks/gdudevicetreemodel.c
+++ b/src/disks/gdudevicetreemodel.c
@@ -930,15 +930,15 @@ update_drive (GduDeviceTreeModel *model,
        */
       s = g_strdup_printf ("<span foreground=\"#ff0000\">%s</span>\n"
                            "<small><span foreground=\"#ff0000\">%s</span></small>",
-                           info->description,
-                           info->name);
+                           udisks_object_info_get_description (info),
+                           udisks_object_info_get_name (info));
     }
   else
     {
       s = g_strdup_printf ("%s\n"
                            "<small>%s</small>",
-                           info->description,
-                           info->name);
+                           udisks_object_info_get_description (info),
+                           udisks_object_info_get_name (info));
     }
 
   jobs_running = drive_has_jobs (model->client, drive);
@@ -954,7 +954,7 @@ update_drive (GduDeviceTreeModel *model,
 
   gtk_tree_store_set (GTK_TREE_STORE (model),
                       &iter,
-                      GDU_DEVICE_TREE_MODEL_COLUMN_ICON, info->icon,
+                      GDU_DEVICE_TREE_MODEL_COLUMN_ICON, udisks_object_info_get_icon (info),
                       GDU_DEVICE_TREE_MODEL_COLUMN_NAME, s,
                       GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, sort_key,
                       GDU_DEVICE_TREE_MODEL_COLUMN_WARNING, warning,
@@ -975,8 +975,7 @@ update_drive (GduDeviceTreeModel *model,
 
  out:
   g_clear_object (&block);
-  if (info != NULL)
-    udisks_object_info_unref (info);
+  g_clear_object (&info);
   g_free (sort_key);
   g_free (s);
   return jobs_running;
diff --git a/src/disks/gdumdraiddisksdialog.c b/src/disks/gdumdraiddisksdialog.c
index ae19512..c297c3f 100644
--- a/src/disks/gdumdraiddisksdialog.c
+++ b/src/disks/gdumdraiddisksdialog.c
@@ -278,11 +278,13 @@ update_dialog_labels (DialogData *data)
        *              The first %s is the name of the object (e.g. "INTEL SSDSA2MH080G1GC").
        *              The second %s is the fw revision (e.g "45ABX21").
        */
-      model_markup = g_strdup_printf (C_("mdraid-disks", "%s (%s)"), info->name, drive_revision);
+      model_markup = g_strdup_printf (C_("mdraid-disks", "%s (%s)"),
+                                      udisks_object_info_get_name (info),
+                                      drive_revision);
     }
   else
     {
-      model_markup = g_strdup (info->name);
+      model_markup = g_strdup (udisks_object_info_get_name (info));
     }
 
  out:
@@ -295,8 +297,7 @@ update_dialog_labels (DialogData *data)
   g_free (device_markup);
   g_free (serial_markup);
   g_free (assessment_markup);
-  if (info != NULL)
-    udisks_object_info_unref (info);
+  g_clear_object (&info);
   g_clear_object (&drive);
   g_clear_object (&object);
   g_clear_object (&block);
@@ -506,8 +507,8 @@ pixbuf_cell_func (GtkTreeViewColumn *column,
     goto out;
 
   info = udisks_client_get_object_info (data->client, object);
-  if (info->icon != NULL)
-    icon = g_object_ref (info->icon);
+  if (udisks_object_info_get_icon (info) != NULL)
+    icon = g_object_ref (udisks_object_info_get_icon (info));
 
   if (icon == NULL)
     icon = g_themed_icon_new ("drive-removable-media"); /* fallback - for now */
@@ -520,8 +521,7 @@ pixbuf_cell_func (GtkTreeViewColumn *column,
   g_clear_object (&icon);
   g_clear_object (&object);
   g_clear_object (&block);
-  if (info != NULL)
-    udisks_object_info_unref (info);
+  g_clear_object (&info);
 }
 
 static void
@@ -550,7 +550,7 @@ name_cell_func (GtkTreeViewColumn *column,
     goto out;
 
   info = udisks_client_get_object_info (data->client, object);
-  markup = g_strdup (info->description);
+  markup = g_strdup (udisks_object_info_get_description (info));
 
  out:
 
@@ -561,8 +561,7 @@ name_cell_func (GtkTreeViewColumn *column,
   g_free (markup);
   g_clear_object (&object);
   g_clear_object (&block);
-  if (info != NULL)
-    udisks_object_info_unref (info);
+  g_clear_object (&info);
 }
 
 static void
diff --git a/src/disks/gdurestorediskimagedialog.c b/src/disks/gdurestorediskimagedialog.c
index 2ccc4ff..2c7c90e 100644
--- a/src/disks/gdurestorediskimagedialog.c
+++ b/src/disks/gdurestorediskimagedialog.c
@@ -321,8 +321,8 @@ restore_disk_image_populate (DialogData *data)
 
   /* Destination label */
   info = udisks_client_get_object_info (gdu_window_get_client (data->window), data->object);
-  gtk_label_set_text (GTK_LABEL (data->destination_label), info->one_liner);
-  udisks_object_info_unref (info);
+  gtk_label_set_text (GTK_LABEL (data->destination_label), udisks_object_info_get_one_liner (info));
+  g_clear_object (&info);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index 02de890..f5171e4 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -2546,7 +2546,7 @@ update_device_page_for_drive (GduWindow      *window,
       g_string_append (str, s);
       g_free (s);
     }
-  s = g_strdup_printf ("<big><b>%s</b></big>", info->description);
+  s = g_strdup_printf ("<big><b>%s</b></big>", udisks_object_info_get_description (info));
   gtk_label_set_markup (GTK_LABEL (window->devtab_drive_desc_label), s);
   gtk_widget_show (window->devtab_drive_desc_label);
   g_free (s);
@@ -2561,10 +2561,10 @@ update_device_page_for_drive (GduWindow      *window,
   gtk_widget_show (window->devtab_drive_eject_button);
   gtk_widget_show (window->devtab_drive_generic_button);
 
-  if (info->media_icon != NULL)
-    gtk_image_set_from_gicon (GTK_IMAGE (window->devtab_drive_image), info->media_icon, GTK_ICON_SIZE_DIALOG);
+  if (udisks_object_info_get_media_icon (info) != NULL)
+    gtk_image_set_from_gicon (GTK_IMAGE (window->devtab_drive_image), udisks_object_info_get_media_icon (info), GTK_ICON_SIZE_DIALOG);
   else
-    gtk_image_set_from_gicon (GTK_IMAGE (window->devtab_drive_image), info->icon, GTK_ICON_SIZE_DIALOG);
+    gtk_image_set_from_gicon (GTK_IMAGE (window->devtab_drive_image), udisks_object_info_get_icon (info), GTK_ICON_SIZE_DIALOG);
   gtk_widget_show (window->devtab_drive_image);
 
   str = g_string_new (NULL);
@@ -2710,7 +2710,7 @@ update_device_page_for_drive (GduWindow      *window,
       set_markup (window,
                   "devtab-drive-media-label",
                   "devtab-drive-media-value-label",
-                  info->media_description, SET_MARKUP_FLAGS_NONE);
+                  udisks_object_info_get_media_description (info), SET_MARKUP_FLAGS_NONE);
     }
   else
     {
@@ -2759,8 +2759,7 @@ update_device_page_for_drive (GduWindow      *window,
 
   g_list_foreach (blocks, (GFunc) g_object_unref, NULL);
   g_list_free (blocks);
-  if (info != NULL)
-    udisks_object_info_unref (info);
+  g_clear_object (&info);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/libgdu/gduutils.c b/src/libgdu/gduutils.c
index c6167de..56ed2d9 100644
--- a/src/libgdu/gduutils.c
+++ b/src/libgdu/gduutils.c
@@ -631,15 +631,15 @@ get_widget_for_object (UDisksClient *client,
 
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
 
-  image = gtk_image_new_from_gicon (info->icon, GTK_ICON_SIZE_SMALL_TOOLBAR);
+  image = gtk_image_new_from_gicon (udisks_object_info_get_icon (info), GTK_ICON_SIZE_SMALL_TOOLBAR);
   gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
 
-  label = gtk_label_new (info->one_liner);
+  label = gtk_label_new (udisks_object_info_get_one_liner (info));
   gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_MIDDLE);
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
   gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
 
-  udisks_object_info_unref (info);
+  g_object_unref (info);
 
   return hbox;
 }



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