[gnome-disk-utility/udisks2-port] Unify volume and drive information by including the drive in the grid
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility/udisks2-port] Unify volume and drive information by including the drive in the grid
- Date: Fri, 11 Mar 2011 16:26:42 +0000 (UTC)
commit 413952330bf65d4a0f407c4b6889f69e2e5c6242
Author: David Zeuthen <davidz redhat com>
Date: Fri Mar 11 11:26:08 2011 -0500
Unify volume and drive information by including the drive in the grid
This saves a whole lot of space
http://people.freedesktop.org/~david/palimpsest-udisks2-1.png
Signed-off-by: David Zeuthen <davidz redhat com>
data/ui/palimpsest.ui | 660 ++++++++++++++++------------------------
src/palimpsest/gduenums.h | 1 +
src/palimpsest/gduvolumegrid.c | 265 ++++++++++++-----
src/palimpsest/gduvolumegrid.h | 24 +-
src/palimpsest/gduwindow.c | 488 +++++++++++++++++-------------
5 files changed, 756 insertions(+), 682 deletions(-)
---
diff --git a/data/ui/palimpsest.ui b/data/ui/palimpsest.ui
index 5fdcd31..cdeac56 100644
--- a/data/ui/palimpsest.ui
+++ b/data/ui/palimpsest.ui
@@ -117,12 +117,13 @@
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
- <object class="GtkLabel" id="devtab-disk-label">
+ <object class="GtkLabel" id="devtab-details-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes"><b>Device</b></property>
+ <property name="label" translatable="yes"><b>_Details</b></property>
<property name="use_markup">True</property>
+ <property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -136,332 +137,7 @@
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkTable" id="devtab-table">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="n_rows">8</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">10</property>
- <child>
- <object class="GtkLabel" id="devtab-model-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">Model</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-model-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-write-cache-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">_Write Cache</property>
- <property name="use_underline">True</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="GtkHBox" id="devtab-write-cache-hbox">
- <property name="visible">True</property>
- <property name="can_focus">False</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-wwn-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">World Wide Name</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-firmware-version-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">Firmware Version</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-serial-number-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">Serial Number</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-wwn-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-firmware-version-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>
- <child>
- <object class="GtkLabel" id="devtab-serial-number-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-size-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">Size</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-size-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-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">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-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">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-backing-file-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">Backing File</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-backing-file-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>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="devtab-volumes-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><b>_Volumes</b></property>
- <property name="use_markup">True</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkVBox" id="vbox2">
+ <object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -482,18 +158,18 @@
</packing>
</child>
<child>
- <object class="GtkTable" id="devtab-volume-table">
+ <object class="GtkTable" id="devtab-table">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="n_rows">9</property>
+ <property name="n_rows">14</property>
<property name="n_columns">2</property>
<property name="column_spacing">10</property>
<child>
- <object class="GtkLabel" id="devtab-volume-type-label">
+ <object class="GtkLabel" id="devtab-model-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Type</property>
+ <property name="label" translatable="yes">Model</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
@@ -505,7 +181,7 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-volume-type-value-label">
+ <object class="GtkLabel" id="devtab-model-value-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -522,30 +198,54 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-volume-name-value-label">
+ <object class="GtkLabel" id="devtab-write-cache-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>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Write Cache</property>
+ <property name="use_underline">True</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="GtkHBox" id="devtab-write-cache-hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</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="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-device-label">
+ <object class="GtkLabel" id="devtab-wwn-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Device</property>
+ <property name="label" translatable="yes">World Wide Name</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
@@ -559,61 +259,62 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-volume-capacity-label">
+ <object class="GtkLabel" id="devtab-firmware-version-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Capacity</property>
+ <property name="label" translatable="yes">Firmware Version</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
</object>
<packing>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</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>
<child>
- <object class="GtkLabel" id="devtab-volume-mount-point-label">
+ <object class="GtkLabel" id="devtab-serial-number-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>
+ <property name="label" translatable="yes">Serial Number</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
</object>
<packing>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</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-name-label">
+ <object class="GtkLabel" id="devtab-wwn-value-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>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ <property name="ellipsize">end</property>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <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-device-value-label">
+ <object class="GtkLabel" id="devtab-firmware-version-value-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -624,15 +325,15 @@
<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="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-capacity-value-label">
+ <object class="GtkLabel" id="devtab-serial-number-value-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -643,15 +344,33 @@
<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="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-mount-point-value-label">
+ <object class="GtkLabel" id="devtab-size-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Size</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-size-value-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -662,19 +381,19 @@
<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="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-uuid-label">
+ <object class="GtkLabel" id="devtab-device-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">UUID</property>
+ <property name="label" translatable="yes">Device</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
@@ -688,7 +407,7 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-volume-uuid-value-label">
+ <object class="GtkLabel" id="devtab-device-value-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -707,11 +426,11 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-volume-partition-type-label">
+ <object class="GtkLabel" id="devtab-backing-file-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>
+ <property name="label" translatable="yes">Backing File</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
@@ -725,7 +444,7 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-volume-partition-type-value-label">
+ <object class="GtkLabel" id="devtab-backing-file-value-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -744,37 +463,90 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-volume-partition-name-label">
+ <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">Partition Name</property>
+ <property name="label" translatable="yes">Type</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
</object>
<packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</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-partition-name-value-label">
+ <object class="GtkLabel" id="devtab-volume-label-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>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Label</property>
+ <attributes>
+ <attribute name="foreground" value="#555555555555"/>
+ </attributes>
</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="top_attach">9</property>
+ <property name="bottom_attach">10</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">10</property>
+ <property name="bottom_attach">11</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">11</property>
+ <property name="bottom_attach">12</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-label-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Partition Label</property>
+ <attributes>
+ <attribute name="foreground" value="#555555555555"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="top_attach">12</property>
+ <property name="bottom_attach">13</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_padding">4</property>
@@ -791,8 +563,103 @@
</attributes>
</object>
<packing>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">13</property>
+ <property name="bottom_attach">14</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-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">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-label-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">9</property>
+ <property name="bottom_attach">10</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">10</property>
+ <property name="bottom_attach">11</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">11</property>
+ <property name="bottom_attach">12</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-label-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">12</property>
+ <property name="bottom_attach">13</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_padding">4</property>
@@ -810,8 +677,8 @@
<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="top_attach">13</property>
+ <property name="bottom_attach">14</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_padding">4</property>
@@ -819,20 +686,29 @@
</child>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">1</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="position">1</property>
diff --git a/src/palimpsest/gduenums.h b/src/palimpsest/gduenums.h
index f87df65..0ea71ad 100644
--- a/src/palimpsest/gduenums.h
+++ b/src/palimpsest/gduenums.h
@@ -29,6 +29,7 @@ G_BEGIN_DECLS
typedef enum
{
+ GDU_VOLUME_GRID_ELEMENT_TYPE_CONTAINER,
GDU_VOLUME_GRID_ELEMENT_TYPE_NO_MEDIA,
GDU_VOLUME_GRID_ELEMENT_TYPE_FREE_SPACE,
GDU_VOLUME_GRID_ELEMENT_TYPE_DEVICE
diff --git a/src/palimpsest/gduvolumegrid.c b/src/palimpsest/gduvolumegrid.c
index cecb158..ec3bce2 100644
--- a/src/palimpsest/gduvolumegrid.c
+++ b/src/palimpsest/gduvolumegrid.c
@@ -50,6 +50,7 @@ struct GridElement
GduVolumeGridElementType type;
/* these values are set in recompute_grid() */
+ gint fixed_width;
gdouble size_ratio;
GDBusObjectProxy *object_proxy;
guint64 offset;
@@ -67,7 +68,8 @@ struct GridElement
guint height;
GridEdgeFlags edge_flags;
- gchar *text;
+ gchar *markup;
+ GIcon *icon;
gboolean show_spinner;
gboolean show_padlock_open;
@@ -80,9 +82,11 @@ struct GridElement
static void
grid_element_free (GridElement *element)
{
+ if (element->icon != NULL)
+ g_object_unref (element->icon);
if (element->object_proxy != NULL)
g_object_unref (element->object_proxy);
- g_free (element->text);
+ g_free (element->markup);
g_list_foreach (element->embedded_elements, (GFunc) grid_element_free, NULL);
g_list_free (element->embedded_elements);
@@ -99,6 +103,10 @@ struct _GduVolumeGrid
UDisksClient *client;
GDBusObjectProxy *block_device;
+ gboolean container_visible;
+ gchar *container_markup;
+ GIcon *container_icon;
+
GList *elements;
GridElement *selected;
@@ -180,6 +188,10 @@ gdu_volume_grid_finalize (GObject *object)
GduVolumeGrid *grid = GDU_VOLUME_GRID (object);
GDBusProxyManager *proxy_manager;
+ if (grid->container_icon != NULL)
+ g_object_unref (grid->container_icon);
+ g_free (grid->container_markup);
+
proxy_manager = udisks_client_get_proxy_manager (grid->client);
g_signal_handlers_disconnect_by_func (proxy_manager,
G_CALLBACK (on_object_proxy_added),
@@ -521,9 +533,15 @@ gdu_volume_grid_get_preferred_width (GtkWidget *widget,
GduVolumeGrid *grid = GDU_VOLUME_GRID (widget);
guint num_elements;
gint width;
+ GList *l;
num_elements = get_num_elements_for_slice (grid->elements);
width = num_elements * ELEMENT_MINIMUM_WIDTH;
+ for (l = grid->elements; l != NULL; l = l->next)
+ {
+ GridElement *element = l->data;
+ width += element->fixed_width;
+ }
*minimal_width = *natural_width = width;
}
@@ -623,16 +641,11 @@ gdu_volume_grid_set_block_device (GduVolumeGrid *grid,
g_object_unref (grid->block_device);
grid->block_device = block_device != NULL ? g_object_ref (block_device) : NULL;
+ /* this causes recompute_grid() to select the first element */
+ grid->selected = NULL;
+ grid->focused = NULL;
recompute_grid (grid);
- /* select the first element */
- if (grid->elements != NULL)
- {
- GridElement *element = grid->elements->data;
- grid->selected = element;
- grid->focused = element;
- }
-
g_object_notify (G_OBJECT (grid), "block-device");
g_signal_emit (grid,
@@ -678,18 +691,25 @@ recompute_size_for_slice (GList *elements,
{
GList *l;
gint x;
- gint pixels_left;
- guint num_elements;
+ gint extra;
- /* first steal all the allocated minimum width - then distribute remaining pixels
- * based on the size_ratio and add the allocated minimum width.
+ /* first steal all the allocated minimum width OR fixed_width for each element - then
+ * distribute remaining pixels based on the size_ratio and add
+ * the allocated minimum width.
*/
- num_elements = get_num_elements_for_slice (elements);
- width -= num_elements * ELEMENT_MINIMUM_WIDTH;
+ extra = width;
+ for (l = elements; l != NULL; l = l->next)
+ {
+ GridElement *element = l->data;
+ if (element->fixed_width > 0)
+ extra -= element->fixed_width;
+ else
+ extra -= get_num_elements_for_slice (element->embedded_elements) * ELEMENT_MINIMUM_WIDTH;
+ }
+
g_warn_if_fail (width >= 0);
x = 0;
- pixels_left = width;
for (l = elements; l != NULL; l = l->next)
{
GridElement *element = l->data;
@@ -704,20 +724,22 @@ recompute_size_for_slice (GList *elements,
if (is_last)
{
- element_width = pixels_left;
- pixels_left = 0;
+ element_width = width - x;
}
else
{
- element_width = element->size_ratio * width;
- if (element_width > pixels_left)
- element_width = pixels_left;
- pixels_left -= element_width;
+ if (element->fixed_width > 0)
+ {
+ g_warn_if_fail (element->size_ratio == 0.0);
+ element_width = element->fixed_width;
+ }
+ else
+ {
+ element_width = element->size_ratio * extra;
+ element_width += get_num_elements_for_slice (element->embedded_elements) * ELEMENT_MINIMUM_WIDTH;
+ }
}
- num_elements = get_num_elements_for_slice (element->embedded_elements);
- element_width += num_elements * ELEMENT_MINIMUM_WIDTH;
-
element->x = x + offset_x;
element->y = offset_y;
element->width = element_width;
@@ -934,12 +956,6 @@ render_element (GduVolumeGrid *grid,
gdouble focus_rect_red;
gdouble focus_rect_green;
gdouble focus_rect_blue;
- gdouble focus_rect_selected_red;
- gdouble focus_rect_selected_green;
- gdouble focus_rect_selected_blue;
- gdouble focus_rect_selected_not_focused_red;
- gdouble focus_rect_selected_not_focused_green;
- gdouble focus_rect_selected_not_focused_blue;
gdouble stroke_red;
gdouble stroke_green;
gdouble stroke_blue;
@@ -961,6 +977,12 @@ render_element (GduVolumeGrid *grid,
PangoLayout *layout;
PangoFontDescription *desc;
gint width, height;
+ GdkPixbuf *icon_pixbuf;
+ gint icon_width;
+ gint icon_height;
+ gint icon_offset;
+ GPtrArray *pixbufs_to_render;
+ guint n;
need_animation_timeout = FALSE;
@@ -977,12 +999,6 @@ render_element (GduVolumeGrid *grid,
focus_rect_red = 0.75;
focus_rect_green = 0.75;
focus_rect_blue = 0.75;
- focus_rect_selected_red = 0.70;
- focus_rect_selected_green = 0.70;
- focus_rect_selected_blue = 0.80;
- focus_rect_selected_not_focused_red = 0.70;
- focus_rect_selected_not_focused_green = 0.70;
- focus_rect_selected_not_focused_blue = 0.70;
stroke_red = 0.75;
stroke_green = 0.75;
stroke_blue = 0.75;
@@ -1002,11 +1018,9 @@ render_element (GduVolumeGrid *grid,
text_selected_not_focused_green = 1;
text_selected_not_focused_blue = 1;
-#if 0
- g_debug ("rendering element: x=%d w=%d",
- element->x,
- element->width);
-#endif
+ //g_debug ("rendering element: x=%d w=%d",
+ // element->x,
+ // element->width);
cairo_save (cr);
cairo_rectangle (cr,
@@ -1136,8 +1150,10 @@ render_element (GduVolumeGrid *grid,
{
cairo_set_source_rgb (cr, text_red, text_green, text_blue);
}
+
+ /* text + icon */
layout = pango_cairo_create_layout (cr);
- pango_layout_set_text (layout, element->text != NULL ? element->text : "", -1);
+ pango_layout_set_markup (layout, element->markup != NULL ? element->markup : "", -1);
desc = pango_font_description_from_string ("Sans 7.0");
pango_layout_set_font_description (layout, desc);
pango_font_description_free (desc);
@@ -1145,16 +1161,42 @@ render_element (GduVolumeGrid *grid,
pango_layout_set_width (layout, pango_units_from_double (element->width));
pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
pango_layout_get_size (layout, &width, &height);
+
+ icon_width = 0;
+ icon_height = 0;
+ icon_pixbuf = NULL;
+ if (element->icon != NULL)
+ {
+ GtkIconInfo *icon_info;
+ icon_info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (),
+ element->icon,
+ 24,
+ 0); /* GtkIconLookupFlags */
+ if (icon_info != NULL)
+ {
+ icon_pixbuf = gtk_icon_info_load_icon (icon_info, NULL); /* GError */
+ icon_width = gdk_pixbuf_get_height (icon_pixbuf);
+ icon_height = gdk_pixbuf_get_height (icon_pixbuf);
+ gtk_icon_info_free (icon_info);
+ }
+ }
+ if (icon_pixbuf != NULL)
+ {
+ cairo_save (cr);
+ render_pixbuf (cr,
+ ceil (element->x + element->width/2.0 - icon_width/2.0),
+ ceil (element->y + element->height/2.0 - pango_units_to_double (height)/2.0 - icon_height/2.0),
+ icon_pixbuf);
+ cairo_restore (cr);
+ g_object_unref (icon_pixbuf);
+ }
+
cairo_move_to (cr,
- ceil(element->x),
- ceil (element->y + element->height / 2 - pango_units_to_double (height) / 2));
+ ceil (element->x),
+ ceil (element->y + element->height/2.0 - pango_units_to_double (height)/2.0 + icon_height/2.0));
pango_cairo_show_layout (cr, layout);
g_object_unref (layout);
- gint icon_offset;
- GPtrArray *pixbufs_to_render;
- guint n;
-
icon_offset = 0;
if (element->show_spinner)
@@ -1610,14 +1652,14 @@ recompute_grid (GduVolumeGrid *grid)
GDBusObjectProxy *cur_selected_object_proxy;
GDBusObjectProxy *cur_focused_object_proxy;
- cur_selected_offset = 0;
+ cur_selected_offset = G_MAXUINT64;
cur_selected_object_proxy = NULL;
if (grid->selected != NULL)
{
cur_selected_offset = grid->selected->offset;
cur_selected_object_proxy = grid->selected->object_proxy;
}
- cur_focused_offset = 0;
+ cur_focused_offset = G_MAXUINT64;
cur_focused_object_proxy = NULL;
if (grid->focused != NULL)
{
@@ -1630,11 +1672,22 @@ recompute_grid (GduVolumeGrid *grid)
g_list_free (grid->elements);
grid->elements = NULL;
-#if 0
- g_debug ("TODO: recompute grid for %s",
- grid->block_device != NULL ?
- g_dbus_object_proxy_get_object_path (grid->block_device) : "<nothing selected>");
-#endif
+ //g_debug ("TODO: recompute grid for %s, container_visible=%d",
+ // grid->block_device != NULL ?
+ // g_dbus_object_proxy_get_object_path (grid->block_device) : "<nothing selected>",
+ // grid->container_visible);
+
+ if (grid->container_visible)
+ {
+ element = g_new0 (GridElement, 1);
+ element->type = GDU_VOLUME_GRID_ELEMENT_TYPE_CONTAINER;
+ element->fixed_width = 150;
+ element->offset = 0;
+ element->size = 0;
+ element->markup = g_strdup (grid->container_markup);
+ element->icon = grid->container_icon != NULL ? g_object_ref (grid->container_icon) : NULL;
+ grid->elements = g_list_append (grid->elements, element);
+ }
if (grid->block_device == NULL)
{
@@ -1643,6 +1696,11 @@ recompute_grid (GduVolumeGrid *grid)
element->size_ratio = 1.0;
element->offset = 0;
element->size = 0;
+ if (grid->elements != NULL)
+ {
+ ((GridElement *) grid->elements->data)->next = element;
+ element->prev = ((GridElement *) grid->elements->data);
+ }
grid->elements = g_list_append (grid->elements, element);
grid_element_set_details (grid, element);
goto out;
@@ -1708,7 +1766,12 @@ recompute_grid (GduVolumeGrid *grid)
element->type = GDU_VOLUME_GRID_ELEMENT_TYPE_NO_MEDIA;
element->size_ratio = 1.0;
element->offset = 0;
- element->size = 0;
+ element->size = top_size;
+ if (grid->elements != NULL)
+ {
+ ((GridElement *) grid->elements->data)->next = element;
+ element->prev = ((GridElement *) grid->elements->data);
+ }
grid->elements = g_list_append (grid->elements, element);
grid_element_set_details (grid, element);
}
@@ -1720,6 +1783,11 @@ recompute_grid (GduVolumeGrid *grid)
element->offset = 0;
element->size = top_size;
element->object_proxy = g_object_ref (grid->block_device);
+ if (grid->elements != NULL)
+ {
+ ((GridElement *) grid->elements->data)->next = element;
+ element->prev = ((GridElement *) grid->elements->data);
+ }
grid->elements = g_list_append (grid->elements, element);
grid_element_set_details (grid, element);
maybe_add_crypto (grid, element);
@@ -1727,15 +1795,22 @@ recompute_grid (GduVolumeGrid *grid)
}
else
{
- grid->elements = recompute_grid_add_partitions (grid,
- top_size,
- NULL,
- free_space_slack,
- 0,
- top_size,
- partitions,
- extended_partition,
- logical_partitions);
+ GList *result;
+ result = recompute_grid_add_partitions (grid,
+ top_size,
+ NULL,
+ free_space_slack,
+ 0,
+ top_size,
+ partitions,
+ extended_partition,
+ logical_partitions);
+ if (grid->elements != NULL)
+ {
+ ((GridElement *) grid->elements->data)->next = ((GridElement *) result->data);
+ ((GridElement *) result->data)->prev =((GridElement *) grid->elements->data);
+ }
+ grid->elements = g_list_concat (grid->elements, result);
}
g_list_free (logical_partitions);
@@ -1797,17 +1872,21 @@ grid_element_set_details (GduVolumeGrid *grid,
{
switch (element->type)
{
+ case GDU_VOLUME_GRID_ELEMENT_TYPE_CONTAINER:
+ g_assert_not_reached ();
+ break;
+
case GDU_VOLUME_GRID_ELEMENT_TYPE_NO_MEDIA:
- element->text = g_strdup (_("No Media"));
+ element->markup = g_strdup (_("No Media"));
break;
case GDU_VOLUME_GRID_ELEMENT_TYPE_FREE_SPACE:
{
gchar *size_str;
size_str = udisks_util_get_size_for_display (element->size, FALSE, FALSE);
- element->text = g_strdup_printf ("%s\n%s",
- C_("volume-grid", "Free Space"),
- size_str);
+ element->markup = g_strdup_printf ("%s\n%s",
+ C_("volume-grid", "Free Space"),
+ size_str);
g_free (size_str);
}
break;
@@ -1864,7 +1943,7 @@ grid_element_set_details (GduVolumeGrid *grid,
C_("volume-grid", "Unknown"),
size_str);
}
- element->text = s;
+ element->markup = s;
g_free (size_str);
}
break;
@@ -1926,6 +2005,7 @@ maybe_update (GduVolumeGrid *grid,
}
goto out;
+
update:
recompute_grid (grid);
@@ -1983,3 +2063,44 @@ on_interface_proxy_properties_changed (GDBusProxyManager *manager,
GduVolumeGrid *grid = GDU_VOLUME_GRID (user_data);
maybe_update (grid, object_proxy);
}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+void
+gdu_volume_grid_set_container_visible (GduVolumeGrid *grid,
+ gboolean visible)
+{
+ g_return_if_fail (GDU_IS_VOLUME_GRID (grid));
+ if (!!grid->container_visible != !!visible)
+ {
+ grid->container_visible = visible;
+ recompute_grid (grid);
+ }
+}
+
+void
+gdu_volume_grid_set_container_markup (GduVolumeGrid *grid,
+ const gchar *markup)
+{
+ g_return_if_fail (GDU_IS_VOLUME_GRID (grid));
+ if (g_strcmp0 (grid->container_markup, markup) != 0)
+ {
+ g_free (grid->container_markup);
+ grid->container_markup = g_strdup (markup);
+ recompute_grid (grid);
+ }
+}
+
+void
+gdu_volume_grid_set_container_icon (GduVolumeGrid *grid,
+ GIcon *icon)
+{
+ g_return_if_fail (GDU_IS_VOLUME_GRID (grid));
+ if (!g_icon_equal (grid->container_icon, icon))
+ {
+ if (grid->container_icon != NULL)
+ g_object_unref (grid->container_icon);
+ grid->container_icon = icon != NULL ? g_object_ref (icon) : NULL;
+ recompute_grid (grid);
+ }
+}
diff --git a/src/palimpsest/gduvolumegrid.h b/src/palimpsest/gduvolumegrid.h
index 71109bc..384726e 100644
--- a/src/palimpsest/gduvolumegrid.h
+++ b/src/palimpsest/gduvolumegrid.h
@@ -32,15 +32,21 @@ G_BEGIN_DECLS
#define GDU_VOLUME_GRID(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDU_TYPE_VOLUME_GRID, GduVolumeGrid))
#define GDU_IS_VOLUME_GRID(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDU_TYPE_VOLUME_GRID))
-GType gdu_volume_grid_get_type (void) G_GNUC_CONST;
-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);
-guint64 gdu_volume_grid_get_selected_size (GduVolumeGrid *grid);
+GType gdu_volume_grid_get_type (void) G_GNUC_CONST;
+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);
+void gdu_volume_grid_set_container_visible (GduVolumeGrid *grid,
+ gboolean visible);
+void gdu_volume_grid_set_container_markup (GduVolumeGrid *grid,
+ const gchar *text);
+void gdu_volume_grid_set_container_icon (GduVolumeGrid *grid,
+ GIcon *icon);
+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);
+guint64 gdu_volume_grid_get_selected_size (GduVolumeGrid *grid);
G_END_DECLS
diff --git a/src/palimpsest/gduwindow.c b/src/palimpsest/gduwindow.c
index ae8bd33..93332f0 100644
--- a/src/palimpsest/gduwindow.c
+++ b/src/palimpsest/gduwindow.c
@@ -358,7 +358,7 @@ gdu_window_constructed (GObject *object)
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")),
+ gtk_label_set_mnemonic_widget (GTK_LABEL (gdu_window_get_widget (window, "devtab-details-label")),
window->volume_grid);
g_signal_connect (window->volume_grid,
"changed",
@@ -602,16 +602,6 @@ block_device_compare_on_preferred (GDBusObjectProxy *a,
}
static void
-set_disk_label (GduWindow *window,
- const gchar *text)
-{
- gchar *s;
- s = g_strdup_printf ("<b>%s</b>", text);
- gtk_label_set_markup (GTK_LABEL (gdu_window_get_widget (window, "devtab-disk-label")), s);
- g_free (s);
-}
-
-static void
setup_device_page (GduWindow *window,
GDBusObjectProxy *object_proxy)
{
@@ -633,99 +623,54 @@ setup_device_page (GduWindow *window,
if (lun != NULL)
{
- const gchar *lun_vendor;
- const gchar *lun_model;
- gchar *s;
GList *block_devices;
- GList *l;
GString *str;
+ gchar *lun_name;
+ gchar *lun_desc;
+ GIcon *lun_icon;
+ GIcon *lun_media_icon;
/* TODO: for multipath, ensure e.g. mpathk is before sda, sdb */
block_devices = get_top_level_block_devices_for_lun (window, g_dbus_object_proxy_get_object_path (object_proxy));
block_devices = g_list_sort (block_devices, (GCompareFunc) block_device_compare_on_preferred);
- str = g_string_new (NULL);
+ udisks_util_get_lun_info (lun,
+ &lun_name,
+ &lun_desc,
+ &lun_icon,
+ &lun_media_icon);
+ str = g_string_new (NULL);
+ g_string_append_printf (str,
+ "<b>"
+ "%s\n"
+ "%s",
+ lun_desc,
+ lun_name);
+ g_string_append (str, "</b>");
+ gdu_volume_grid_set_container_markup (GDU_VOLUME_GRID (window->volume_grid),
+ str->str);
+ gdu_volume_grid_set_container_icon (GDU_VOLUME_GRID (window->volume_grid),
+ lun_icon);
+ g_string_free (str, TRUE);
+
+ gdu_volume_grid_set_container_visible (GDU_VOLUME_GRID (window->volume_grid), TRUE);
if (block_devices != NULL)
gdu_volume_grid_set_block_device (GDU_VOLUME_GRID (window->volume_grid), block_devices->data);
else
gdu_volume_grid_set_block_device (GDU_VOLUME_GRID (window->volume_grid), NULL);
- for (l = block_devices; l != NULL; l = l->next)
- {
- GDBusObjectProxy *block_object_proxy = G_DBUS_OBJECT_PROXY (l->data);
- if (str->len > 0)
- g_string_append_c (str, ' ');
- g_string_append (str, udisks_block_device_get_preferred_device (UDISKS_PEEK_BLOCK_DEVICE (block_object_proxy)));
- }
- s = g_string_free (str, FALSE);
- set_string (window,
- "devtab-device-label",
- "devtab-device-value-label",
- s, TRUE);
- g_free (s);
+ g_free (lun_name);
+ g_free (lun_desc);
+ g_object_unref (lun_icon);
+ g_object_unref (lun_media_icon);
+
g_list_foreach (block_devices, (GFunc) g_object_unref, NULL);
g_list_free (block_devices);
-
- lun_vendor = udisks_lun_get_vendor (lun);
- lun_model = udisks_lun_get_model (lun);
- if (strlen (lun_vendor) == 0)
- s = g_strdup (lun_model);
- else if (strlen (lun_model) == 0)
- s = g_strdup (lun_vendor);
- else
- s = g_strconcat (lun_vendor, " ", lun_model, NULL);
- set_string (window,
- "devtab-model-label",
- "devtab-model-value-label", s, FALSE);
- g_free (s);
- set_string (window,
- "devtab-serial-number-label",
- "devtab-serial-number-value-label",
- udisks_lun_get_serial (lun), FALSE);
- set_string (window,
- "devtab-firmware-version-label",
- "devtab-firmware-version-value-label",
- udisks_lun_get_revision (lun), FALSE);
- set_string (window,
- "devtab-wwn-label",
- "devtab-wwn-value-label",
- udisks_lun_get_wwn (lun), FALSE);
- set_size (window,
- "devtab-size-label",
- "devtab-size-value-label",
- udisks_lun_get_size (lun));
- /* TODO: get this from udisks */
- 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_all (gdu_window_get_widget (window, "devtab-write-cache-hbox"));
-
- set_disk_label (window, _("Drive"));
}
else if (block != NULL)
{
- const gchar *backing_file;
+ gdu_volume_grid_set_container_visible (GDU_VOLUME_GRID (window->volume_grid), FALSE);
gdu_volume_grid_set_block_device (GDU_VOLUME_GRID (window->volume_grid), object_proxy);
- set_string (window,
- "devtab-device-label",
- "devtab-device-value-label",
- udisks_block_device_get_preferred_device (block), FALSE);
- set_size (window,
- "devtab-size-label",
- "devtab-size-value-label",
- udisks_block_device_get_size (block));
- backing_file = udisks_block_device_get_loop_backing_file (block);
- if (strlen (backing_file) > 0)
- {
- set_string (window,
- "devtab-backing-file-label",
- "devtab-backing-file-value-label",
- backing_file, FALSE);
- set_disk_label (window, _("Loop Device"));
- }
- else
- {
- set_disk_label (window, _("Block Device"));
- }
}
else
{
@@ -848,19 +793,221 @@ on_interface_proxy_properties_changed (GDBusProxyManager *manager,
}
static void
-on_volume_grid_changed (GduVolumeGrid *grid,
- gpointer user_data)
+update_devtab_for_lun (GduWindow *window,
+ GDBusObjectProxy *object_proxy,
+ UDisksLun *lun)
+{
+ gchar *s;
+ GList *block_devices;
+ GList *l;
+ GString *str;
+ const gchar *lun_vendor;
+ const gchar *lun_model;
+
+ //g_debug ("In update_devtab_for_lun() - selected=%s",
+ // object_proxy != NULL ? g_dbus_object_proxy_get_object_path (object_proxy) : "<nothing>");
+
+ /* TODO: for multipath, ensure e.g. mpathk is before sda, sdb */
+ block_devices = get_top_level_block_devices_for_lun (window, g_dbus_object_proxy_get_object_path (object_proxy));
+ block_devices = g_list_sort (block_devices, (GCompareFunc) block_device_compare_on_preferred);
+
+ lun_vendor = udisks_lun_get_vendor (lun);
+ lun_model = udisks_lun_get_model (lun);
+
+ str = g_string_new (NULL);
+ for (l = block_devices; l != NULL; l = l->next)
+ {
+ GDBusObjectProxy *block_object_proxy = G_DBUS_OBJECT_PROXY (l->data);
+ if (str->len > 0)
+ g_string_append_c (str, ' ');
+ g_string_append (str, udisks_block_device_get_preferred_device (UDISKS_PEEK_BLOCK_DEVICE (block_object_proxy)));
+ }
+ s = g_string_free (str, FALSE);
+ set_string (window,
+ "devtab-device-label",
+ "devtab-device-value-label",
+ s, TRUE);
+ g_free (s);
+ g_list_foreach (block_devices, (GFunc) g_object_unref, NULL);
+ g_list_free (block_devices);
+
+ if (strlen (lun_vendor) == 0)
+ s = g_strdup (lun_model);
+ else if (strlen (lun_model) == 0)
+ s = g_strdup (lun_vendor);
+ else
+ s = g_strconcat (lun_vendor, " ", lun_model, NULL);
+ set_string (window,
+ "devtab-model-label",
+ "devtab-model-value-label", s, FALSE);
+ g_free (s);
+ set_string (window,
+ "devtab-serial-number-label",
+ "devtab-serial-number-value-label",
+ udisks_lun_get_serial (lun), FALSE);
+ set_string (window,
+ "devtab-firmware-version-label",
+ "devtab-firmware-version-value-label",
+ udisks_lun_get_revision (lun), FALSE);
+ set_string (window,
+ "devtab-wwn-label",
+ "devtab-wwn-value-label",
+ udisks_lun_get_wwn (lun), FALSE);
+ set_size (window,
+ "devtab-size-label",
+ "devtab-size-value-label",
+ udisks_lun_get_size (lun));
+ /* TODO: get this from udisks */
+ 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_all (gdu_window_get_widget (window, "devtab-write-cache-hbox"));
+}
+
+static void
+update_devtab_for_block (GduWindow *window,
+ GDBusObjectProxy *object_proxy,
+ UDisksBlockDevice *block,
+ guint64 size)
+{
+ const gchar *backing_file;
+ const gchar *usage;
+ const gchar *type;
+ gint partition_type;
+ gchar *s;
+
+ //g_debug ("In update_devtab_for_block() - size=%" G_GUINT64_FORMAT " selected=%s",
+ // size,
+ // object_proxy != NULL ? g_dbus_object_proxy_get_object_path (object_proxy) : "<nothing>");
+
+ set_string (window,
+ "devtab-device-label",
+ "devtab-device-value-label",
+ udisks_block_device_get_preferred_device (block), FALSE);
+ set_size (window,
+ "devtab-size-label",
+ "devtab-size-value-label",
+ size);
+ backing_file = udisks_block_device_get_loop_backing_file (block);
+ if (strlen (backing_file) > 0)
+ {
+ set_string (window,
+ "devtab-backing-file-label",
+ "devtab-backing-file-value-label",
+ backing_file, FALSE);
+ }
+
+ 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-label-label",
+ "devtab-volume-label-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-label-label",
+ "devtab-volume-partition-label-value-label",
+ partition_label, FALSE);
+ set_string (window,
+ "devtab-volume-partition-uuid-label",
+ "devtab-volume-partition-uuid-value-label",
+ partition_uuid, FALSE);
+ }
+}
+
+static void
+update_devtab_for_no_media (GduWindow *window,
+ GDBusObjectProxy *object_proxy,
+ UDisksBlockDevice *block)
+{
+ //g_debug ("In update_devtab_for_no_media() - selected=%s",
+ // object_proxy != NULL ? g_dbus_object_proxy_get_object_path (object_proxy) : "<nothing>");
+}
+
+static void
+update_devtab_for_free_space (GduWindow *window,
+ GDBusObjectProxy *object_proxy,
+ UDisksBlockDevice *block,
+ guint64 size)
+{
+ //g_debug ("In update_devtab_for_free_space() - size=%" G_GUINT64_FORMAT " selected=%s",
+ // size,
+ // object_proxy != NULL ? g_dbus_object_proxy_get_object_path (object_proxy) : "<nothing>");
+
+ set_string (window,
+ "devtab-device-label",
+ "devtab-device-value-label",
+ udisks_block_device_get_preferred_device (block), FALSE);
+ set_size (window,
+ "devtab-size-label",
+ "devtab-size-value-label",
+ size);
+ set_string (window,
+ "devtab-volume-type-label",
+ "devtab-volume-type-value-label",
+ _("Unallocated Space"), TRUE);
+}
+
+static void
+update_devtab (GduWindow *window)
{
- GduWindow *window = GDU_WINDOW (user_data);
GDBusObjectProxy *object_proxy;
GList *children;
GList *l;
GduVolumeGridElementType type;
UDisksBlockDevice *block;
+ UDisksLun *lun;
guint64 size;
/* first hide everything */
- children = gtk_container_get_children (GTK_CONTAINER (gdu_window_get_widget (window, "devtab-volume-table")));
+ children = gtk_container_get_children (GTK_CONTAINER (gdu_window_get_widget (window, "devtab-table")));
for (l = children; l != NULL; l = l->next)
{
GtkWidget *child = GTK_WIDGET (l->data);
@@ -868,130 +1015,53 @@ on_volume_grid_changed (GduVolumeGrid *grid,
}
g_list_free (children);
- size = gdu_volume_grid_get_selected_size (GDU_VOLUME_GRID (window->volume_grid));
+ object_proxy = window->current_object_proxy;
+ lun = UDISKS_PEEK_LUN (window->current_object_proxy);
+ block = UDISKS_PEEK_BLOCK_DEVICE (window->current_object_proxy);
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);
+ size = gdu_volume_grid_get_selected_size (GDU_VOLUME_GRID (window->volume_grid));
- /* Always show size if > 0 */
- if (size > 0)
+ if (type == GDU_VOLUME_GRID_ELEMENT_TYPE_CONTAINER)
{
- 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);
+ if (lun != NULL)
+ update_devtab_for_lun (window, object_proxy, lun);
+ else if (block != NULL)
+ update_devtab_for_block (window, object_proxy, block, size);
}
-
-
- switch (type)
+ else
{
- 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;
+ 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)
+ {
+ block = UDISKS_PEEK_BLOCK_DEVICE (object_proxy);
+ switch (type)
+ {
+ case GDU_VOLUME_GRID_ELEMENT_TYPE_CONTAINER:
+ g_assert_not_reached (); /* already handled above */
+ break;
+
+ case GDU_VOLUME_GRID_ELEMENT_TYPE_DEVICE:
+ update_devtab_for_block (window, object_proxy, block, size);
+ break;
+
+ case GDU_VOLUME_GRID_ELEMENT_TYPE_NO_MEDIA:
+ update_devtab_for_no_media (window, object_proxy, block);
+ break;
+
+ case GDU_VOLUME_GRID_ELEMENT_TYPE_FREE_SPACE:
+ update_devtab_for_free_space (window, object_proxy, block, size);
+ break;
+ }
+ }
}
+}
- out:
- ;
+static void
+on_volume_grid_changed (GduVolumeGrid *grid,
+ gpointer user_data)
+{
+ GduWindow *window = GDU_WINDOW (user_data);
+ update_devtab (window);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]