[gnome-disk-utility/udisks2-port] Show volume properties



commit be15dea089f85efe7596d71809fc2a5a2dbb0d05
Author: David Zeuthen <davidz redhat com>
Date:   Thu Mar 10 17:57:29 2011 -0500

    Show volume properties
    
    A little too busy/crowded but a good start.
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 data/ui/palimpsest.ui          |  371 ++++++++++++++++++++++++++++++++++++++--
 src/palimpsest/gduvolumegrid.c |   12 ++-
 src/palimpsest/gduvolumegrid.h |    1 +
 src/palimpsest/gduwindow.c     |  174 ++++++++++++++++++-
 4 files changed, 539 insertions(+), 19 deletions(-)
---
diff --git a/data/ui/palimpsest.ui b/data/ui/palimpsest.ui
index 35a597f..5fdcd31 100644
--- a/data/ui/palimpsest.ui
+++ b/data/ui/palimpsest.ui
@@ -182,7 +182,6 @@
                             <property name="xalign">1</property>
                             <property name="label" translatable="yes">_Write Cache</property>
                             <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">devtab-write-cache-switch</property>
                             <attributes>
                               <attribute name="foreground" value="#555555555555"/>
                             </attributes>
@@ -199,16 +198,6 @@
                           <object class="GtkHBox" id="devtab-write-cache-hbox">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <child>
-                              <object class="GtkSwitch" id="devtab-write-cache-switch">
-                                <property name="visible">True</property>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
@@ -472,14 +461,368 @@
                     <property name="can_focus">False</property>
                     <property name="left_padding">12</property>
                     <child>
-                      <object class="GtkHBox" id="devtab-grid-hbox">
+                      <object class="GtkVBox" id="vbox2">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <child>
-                          <placeholder/>
+                          <object class="GtkHBox" id="devtab-grid-hbox">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
                         </child>
                         <child>
-                          <placeholder/>
+                          <object class="GtkTable" id="devtab-volume-table">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="n_rows">9</property>
+                            <property name="n_columns">2</property>
+                            <property name="column_spacing">10</property>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-type-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="label" translatable="yes">Type</property>
+                                <attributes>
+                                  <attribute name="foreground" value="#555555555555"/>
+                                </attributes>
+                              </object>
+                              <packing>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-type-value-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="selectable">True</property>
+                                <property name="ellipsize">end</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-name-value-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="selectable">True</property>
+                                <property name="ellipsize">end</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-device-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="label" translatable="yes">Device</property>
+                                <attributes>
+                                  <attribute name="foreground" value="#555555555555"/>
+                                </attributes>
+                              </object>
+                              <packing>
+                                <property name="top_attach">6</property>
+                                <property name="bottom_attach">7</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-capacity-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="label" translatable="yes">Capacity</property>
+                                <attributes>
+                                  <attribute name="foreground" value="#555555555555"/>
+                                </attributes>
+                              </object>
+                              <packing>
+                                <property name="top_attach">7</property>
+                                <property name="bottom_attach">8</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-mount-point-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="label" translatable="yes">Mount Point</property>
+                                <attributes>
+                                  <attribute name="foreground" value="#555555555555"/>
+                                </attributes>
+                              </object>
+                              <packing>
+                                <property name="top_attach">8</property>
+                                <property name="bottom_attach">9</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-name-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="label" translatable="yes">Name</property>
+                                <attributes>
+                                  <attribute name="foreground" value="#555555555555"/>
+                                </attributes>
+                              </object>
+                              <packing>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-device-value-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="selectable">True</property>
+                                <property name="ellipsize">end</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">6</property>
+                                <property name="bottom_attach">7</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-capacity-value-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="selectable">True</property>
+                                <property name="ellipsize">end</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">7</property>
+                                <property name="bottom_attach">8</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-mount-point-value-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="selectable">True</property>
+                                <property name="ellipsize">end</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">8</property>
+                                <property name="bottom_attach">9</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-uuid-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="label" translatable="yes">UUID</property>
+                                <attributes>
+                                  <attribute name="foreground" value="#555555555555"/>
+                                </attributes>
+                              </object>
+                              <packing>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-uuid-value-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="selectable">True</property>
+                                <property name="ellipsize">end</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-partition-type-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="label" translatable="yes">Partition Type</property>
+                                <attributes>
+                                  <attribute name="foreground" value="#555555555555"/>
+                                </attributes>
+                              </object>
+                              <packing>
+                                <property name="top_attach">3</property>
+                                <property name="bottom_attach">4</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-partition-type-value-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="selectable">True</property>
+                                <property name="ellipsize">end</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">3</property>
+                                <property name="bottom_attach">4</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-partition-name-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="label" translatable="yes">Partition Name</property>
+                                <attributes>
+                                  <attribute name="foreground" value="#555555555555"/>
+                                </attributes>
+                              </object>
+                              <packing>
+                                <property name="top_attach">4</property>
+                                <property name="bottom_attach">5</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-partition-name-value-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="selectable">True</property>
+                                <property name="ellipsize">end</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">4</property>
+                                <property name="bottom_attach">5</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-partition-uuid-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="label" translatable="yes">Partition UUID</property>
+                                <attributes>
+                                  <attribute name="foreground" value="#555555555555"/>
+                                </attributes>
+                              </object>
+                              <packing>
+                                <property name="top_attach">5</property>
+                                <property name="bottom_attach">6</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="devtab-volume-partition-uuid-value-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="selectable">True</property>
+                                <property name="ellipsize">end</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">5</property>
+                                <property name="bottom_attach">6</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                                <property name="y_padding">4</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
                         </child>
                       </object>
                     </child>
diff --git a/src/palimpsest/gduvolumegrid.c b/src/palimpsest/gduvolumegrid.c
index fab7cc7..cecb158 100644
--- a/src/palimpsest/gduvolumegrid.c
+++ b/src/palimpsest/gduvolumegrid.c
@@ -603,6 +603,13 @@ gdu_volume_grid_new (UDisksClient *client)
                                    NULL));
 }
 
+GDBusObjectProxy *
+gdu_volume_grid_get_block_device (GduVolumeGrid *grid)
+{
+  g_return_val_if_fail (GDU_IS_VOLUME_GRID (grid), NULL);
+  return grid->block_device;
+}
+
 void
 gdu_volume_grid_set_block_device (GduVolumeGrid     *grid,
                                   GDBusObjectProxy  *block_device)
@@ -627,6 +634,10 @@ gdu_volume_grid_set_block_device (GduVolumeGrid     *grid,
     }
 
   g_object_notify (G_OBJECT (grid), "block-device");
+
+  g_signal_emit (grid,
+                 signals[CHANGED_SIGNAL],
+                 0);
  out:
   ;
 }
@@ -1846,7 +1857,6 @@ grid_element_set_details (GduVolumeGrid  *grid,
             s = g_strdup_printf ("%s\n%s",
                                  C_("volume-grid", "Encrypted"),
                                  size_str);
-            /* TODO: emblems for locked/unlocked */
           }
         else
           {
diff --git a/src/palimpsest/gduvolumegrid.h b/src/palimpsest/gduvolumegrid.h
index 7545c1f..71109bc 100644
--- a/src/palimpsest/gduvolumegrid.h
+++ b/src/palimpsest/gduvolumegrid.h
@@ -36,6 +36,7 @@ GType                     gdu_volume_grid_get_type            (void) G_GNUC_CONS
 GtkWidget*                gdu_volume_grid_new                 (UDisksClient        *client);
 void                      gdu_volume_grid_set_block_device    (GduVolumeGrid       *grid,
                                                                GDBusObjectProxy    *block_device);
+GDBusObjectProxy         *gdu_volume_grid_get_block_device    (GduVolumeGrid       *grid);
 GduVolumeGridElementType  gdu_volume_grid_get_selected_type   (GduVolumeGrid       *grid);
 GDBusObjectProxy         *gdu_volume_grid_get_selected_device (GduVolumeGrid       *grid);
 guint64                   gdu_volume_grid_get_selected_offset (GduVolumeGrid       *grid);
diff --git a/src/palimpsest/gduwindow.c b/src/palimpsest/gduwindow.c
index 6404feb..ae8bd33 100644
--- a/src/palimpsest/gduwindow.c
+++ b/src/palimpsest/gduwindow.c
@@ -21,6 +21,9 @@
  */
 
 #include "config.h"
+#include <string.h>
+#include <stdlib.h>
+
 #include <glib/gi18n.h>
 
 #include "gduapplication.h"
@@ -50,6 +53,7 @@ struct _GduWindow
   GDBusObjectProxy *current_object_proxy;
 
   GtkWidget *volume_grid;
+  GtkWidget *write_cache_switch;
 };
 
 typedef struct
@@ -64,6 +68,9 @@ enum
   PROP_CLIENT
 };
 
+static void on_volume_grid_changed (GduVolumeGrid  *grid,
+                                    gpointer        user_data);
+
 G_DEFINE_TYPE (GduWindow, gdu_window, GTK_TYPE_WINDOW);
 
 static void
@@ -345,13 +352,25 @@ gdu_window_constructed (GObject *object)
                     G_CALLBACK (on_interface_proxy_properties_changed),
                     window);
 
+  /* set up non-standard widgets that isn't in the .ui file */
+
   window->volume_grid = gdu_volume_grid_new (window->client);
   gtk_box_pack_start (GTK_BOX (gdu_window_get_widget (window, "devtab-grid-hbox")),
                       window->volume_grid,
                       TRUE, TRUE, 0);
-
   gtk_label_set_mnemonic_widget (GTK_LABEL (gdu_window_get_widget (window, "devtab-volumes-label")),
                                  window->volume_grid);
+  g_signal_connect (window->volume_grid,
+                    "changed",
+                    G_CALLBACK (on_volume_grid_changed),
+                    window);
+
+  window->write_cache_switch = gtk_switch_new ();
+  gtk_box_pack_start (GTK_BOX (gdu_window_get_widget (window, "devtab-write-cache-hbox")),
+                      window->write_cache_switch,
+                      FALSE, TRUE, 0);
+  gtk_label_set_mnemonic_widget (GTK_LABEL (gdu_window_get_widget (window, "devtab-write-cache-label")),
+                                 window->write_cache_switch);
 }
 
 static void
@@ -676,10 +695,9 @@ setup_device_page (GduWindow         *window,
                 "devtab-size-value-label",
                 udisks_lun_get_size (lun));
       /* TODO: get this from udisks */
-      gtk_switch_set_active (GTK_SWITCH (gdu_window_get_widget (window, "devtab-write-cache-switch")), TRUE);
+      gtk_switch_set_active (GTK_SWITCH (window->write_cache_switch), TRUE);
       gtk_widget_show (gdu_window_get_widget (window, "devtab-write-cache-label"));
-      gtk_widget_show (gdu_window_get_widget (window, "devtab-write-cache-switch"));
-      gtk_widget_show (gdu_window_get_widget (window, "devtab-write-cache-hbox"));
+      gtk_widget_show_all (gdu_window_get_widget (window, "devtab-write-cache-hbox"));
 
       set_disk_label (window, _("Drive"));
     }
@@ -829,3 +847,151 @@ on_interface_proxy_properties_changed (GDBusProxyManager   *manager,
   update_all (window, object_proxy);
 }
 
+static void
+on_volume_grid_changed (GduVolumeGrid  *grid,
+                        gpointer        user_data)
+{
+  GduWindow *window = GDU_WINDOW (user_data);
+  GDBusObjectProxy *object_proxy;
+  GList *children;
+  GList *l;
+  GduVolumeGridElementType type;
+  UDisksBlockDevice *block;
+  guint64 size;
+
+  /* first hide everything */
+  children = gtk_container_get_children (GTK_CONTAINER (gdu_window_get_widget (window, "devtab-volume-table")));
+  for (l = children; l != NULL; l = l->next)
+    {
+      GtkWidget *child = GTK_WIDGET (l->data);
+      gtk_widget_hide (child);
+    }
+  g_list_free (children);
+
+  size = gdu_volume_grid_get_selected_size (GDU_VOLUME_GRID (window->volume_grid));
+  type = gdu_volume_grid_get_selected_type (GDU_VOLUME_GRID (window->volume_grid));
+  object_proxy = gdu_volume_grid_get_selected_device (GDU_VOLUME_GRID (window->volume_grid));
+  if (object_proxy == NULL)
+    object_proxy = gdu_volume_grid_get_block_device (GDU_VOLUME_GRID (window->volume_grid));
+  if (object_proxy == NULL)
+    goto out;
+
+  block = UDISKS_PEEK_BLOCK_DEVICE (object_proxy);
+
+  g_debug ("In on_volume_grid_changed() - selected=%s",
+           object_proxy != NULL ? g_dbus_object_proxy_get_object_path (object_proxy) : "<nothing>");
+
+  /* Always show the device kv-pair */
+  set_string (window,
+              "devtab-volume-device-label",
+              "devtab-volume-device-value-label",
+              udisks_block_device_get_preferred_device (block), TRUE);
+
+  /* Always show size if > 0 */
+  if (size > 0)
+    {
+      gchar *size_str;
+      size_str = udisks_util_get_size_for_display (size, FALSE, TRUE);
+      set_string (window,
+                  "devtab-volume-capacity-label",
+                  "devtab-volume-capacity-value-label",
+                  size_str, TRUE);
+      g_free (size_str);
+    }
+
+
+  switch (type)
+    {
+    case GDU_VOLUME_GRID_ELEMENT_TYPE_NO_MEDIA:
+      set_string (window,
+                  "devtab-volume-type-label",
+                  "devtab-volume-type-value-label",
+                  "", TRUE);
+      break;
+
+    case GDU_VOLUME_GRID_ELEMENT_TYPE_FREE_SPACE:
+      set_string (window,
+                  "devtab-volume-type-label",
+                  "devtab-volume-type-value-label",
+                  _("Unallocated Space"), TRUE);
+      break;
+
+    case GDU_VOLUME_GRID_ELEMENT_TYPE_DEVICE:
+      {
+        const gchar *usage;
+        const gchar *type;
+        gint partition_type;
+        gchar *s;
+
+        usage = udisks_block_device_get_id_usage (block);
+        type = udisks_block_device_get_id_type (block);
+        partition_type = strtol (udisks_block_device_get_part_entry_type (block), NULL, 0);
+
+        if (udisks_block_device_get_part_entry (block) &&
+            g_strcmp0 (udisks_block_device_get_part_entry_scheme (block), "mbr") == 0 &&
+            (partition_type == 0x05 || partition_type == 0x0f || partition_type == 0x85))
+          {
+            s = g_strdup (_("Extended Partition"));
+          }
+        else if (g_strcmp0 (usage, "filesystem") == 0)
+          {
+            /* TODO: map type to something localizable/nicer */
+            s = g_strdup_printf (_("%s Filesystem"), type);
+          }
+        else if (g_strcmp0 (usage, "other") == 0 && g_strcmp0 (type, "swap") == 0)
+          {
+            s = g_strdup_printf (_("Swap Space"));
+          }
+        else if (g_strcmp0 (usage, "crypto") == 0)
+          {
+            s = g_strdup (_("Encrypted"));
+          }
+        else
+          {
+            s = g_strdup (_("Unknown"));
+          }
+
+        set_string (window,
+                    "devtab-volume-type-label",
+                    "devtab-volume-type-value-label",
+                    s, TRUE);
+
+        set_string (window,
+                    "devtab-volume-name-label",
+                    "devtab-volume-name-value-label",
+                    udisks_block_device_get_id_label (block), FALSE);
+
+        set_string (window,
+                    "devtab-volume-uuid-label",
+                    "devtab-volume-uuid-value-label",
+                    udisks_block_device_get_id_uuid (block), FALSE);
+
+        if (udisks_block_device_get_part_entry (block))
+          {
+            const gchar *partition_type;
+            const gchar *partition_label;
+            const gchar *partition_uuid;
+            /* TODO: map part type to something localizable/nicer */
+            partition_type = udisks_block_device_get_part_entry_type (block);
+            partition_label = udisks_block_device_get_part_entry_label (block);
+            partition_uuid = udisks_block_device_get_part_entry_uuid (block);
+            set_string (window,
+                        "devtab-volume-partition-type-label",
+                        "devtab-volume-partition-type-value-label",
+                        partition_type, FALSE);
+            set_string (window,
+                        "devtab-volume-partition-name-label",
+                        "devtab-volume-partition-name-value-label",
+                        partition_label, FALSE);
+            set_string (window,
+                        "devtab-volume-partition-uuid-label",
+                        "devtab-volume-partition-uuid-value-label",
+                        partition_uuid, FALSE);
+          }
+      }
+      break;
+    }
+
+ out:
+  ;
+}



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