[gnome-disk-utility] Update SMART dialog



commit f64500f31b7ee966d38305d7702203a1ccc34efa
Author: David Zeuthen <zeuthen gmail com>
Date:   Tue Nov 20 11:05:02 2012 -0500

    Update SMART dialog
    
    Stuff all the information an attribute into the tree-view. In
    particular, this avoids the behavior where the height of the dialog
    changes when another attribute is selected.
    
    The down-side to this change is that the dialog is a bit wider than
    before but, hey, it still fits in 1024x768.
    
    http://people.freedesktop.org/~david/gnome-disks-refreshed-smart-dialog.png
    
    Signed-off-by: David Zeuthen <zeuthen gmail com>

 data/ui/disks.ui              |    2 +-
 data/ui/smart-dialog.ui       |  504 +++++++++++++++--------------------------
 src/disks/gduatasmartdialog.c |  192 +++++++---------
 3 files changed, 272 insertions(+), 426 deletions(-)
---
diff --git a/data/ui/disks.ui b/data/ui/disks.ui
index fbe8d6e..19fde4f 100644
--- a/data/ui/disks.ui
+++ b/data/ui/disks.ui
@@ -1738,7 +1738,7 @@
       <object class="GtkMenuItem" id="generic-drive-menu-item-view-smart">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="label" translatable="yes">SMART Data...</property>
+        <property name="label" translatable="yes">SMART Data &amp; Self-Tests...</property>
       </object>
     </child>
     <child>
diff --git a/data/ui/smart-dialog.ui b/data/ui/smart-dialog.ui
index d73fe16..770145c 100644
--- a/data/ui/smart-dialog.ui
+++ b/data/ui/smart-dialog.ui
@@ -4,7 +4,7 @@
   <object class="GtkDialog" id="dialog1">
     <property name="can_focus">False</property>
     <property name="border_width">12</property>
-    <property name="title" translatable="yes">SMART Data</property>
+    <property name="title" translatable="yes">SMART Data &amp; Self-Tests</property>
     <property name="resizable">False</property>
     <property name="modal">True</property>
     <property name="destroy_with_parent">True</property>
@@ -21,10 +21,11 @@
             <child>
               <object class="GtkMenuButton" id="start-selftest-button">
                 <property name="menu">selftest-menu</property>
-                <property name="label" translatable="yes">_Start Self-test...</property>
+                <property name="label" translatable="yes">_Start Self-test</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
+                <property name="tooltip_text" translatable="yes">Click to start a SMART self-test</property>
                 <property name="use_underline">True</property>
               </object>
               <packing>
@@ -40,6 +41,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
+                <property name="tooltip_text" translatable="yes">Click to stop the SMART self-test currently in progress</property>
                 <property name="use_underline">True</property>
               </object>
               <packing>
@@ -69,6 +71,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
+                <property name="tooltip_text" translatable="yes">Click to force re-reading SMART data from the hard disk</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -97,317 +100,50 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <child>
-                  <object class="GtkLabel" id="label10">
+                  <object class="GtkGrid" id="status-grid">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">_Enabled</property>
-                    <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">enabled-switch</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkSwitch" id="enabled-switch">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="tooltip_text" translatable="yes">Whether SMART is enabled for this disk</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="pack_type">end</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkGrid" id="status-grid">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_left">24</property>
-                <property name="row_spacing">10</property>
-                <property name="column_spacing">10</property>
-                <child>
-                  <object class="GtkLabel" id="label3">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Powered On</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="powered-on-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="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label2">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Updated</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="updated-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="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label7">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Temperature</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">1</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="temperature-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="top_attach">1</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label5">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Self-test Result</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">2</property>
-                    <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label6">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Self-assessment</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">2</property>
-                    <property name="top_attach">1</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label4">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Overall Assessment</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">2</property>
-                    <property name="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="self-test-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">3</property>
-                    <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="self-assessment-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">3</property>
-                    <property name="top_attach">1</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="overall-assessment-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">3</property>
-                    <property name="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="attributes-label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">_Attributes</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">attributes-treeview</property>
-                <attributes>
-                  <attribute name="weight" value="bold"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkVBox" id="attributes-vbox">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_left">24</property>
-                <property name="margin_top">6</property>
-                <property name="spacing">10</property>
-                <child>
-                  <object class="GtkScrolledWindow" id="scrolledwindow1">
-                    <property name="width_request">700</property>
-                    <property name="height_request">200</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="shadow_type">in</property>
+                    <property name="row_spacing">10</property>
+                    <property name="column_spacing">10</property>
                     <child>
-                      <object class="GtkTreeView" id="attributes-treeview">
+                      <object class="GtkLabel" id="label3">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="rules_hint">True</property>
-                        <property name="enable_search">False</property>
-                        <child internal-child="selection">
-                          <object class="GtkTreeSelection" id="treeview-selection1"/>
-                        </child>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">1</property>
+                        <property name="label" translatable="yes">Powered On</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
                       </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">2</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
                     </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkGrid" id="grid2">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="row_spacing">10</property>
-                    <property name="column_spacing">10</property>
                     <child>
-                      <object class="GtkLabel" id="label8">
+                      <object class="GtkLabel" id="powered-on-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="top_attach">2</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label2">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">1</property>
-                        <property name="label" translatable="yes">Value</property>
+                        <property name="label" translatable="yes">Updated</property>
                         <style>
                           <class name="dim-label"/>
                         </style>
@@ -420,7 +156,7 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="attr-value-label">
+                      <object class="GtkLabel" id="updated-label">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
@@ -436,12 +172,11 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="label12">
+                      <object class="GtkLabel" id="label7">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">1</property>
-                        <property name="yalign">0</property>
-                        <property name="label" translatable="yes">Type</property>
+                        <property name="label" translatable="yes">Temperature</property>
                         <style>
                           <class name="dim-label"/>
                         </style>
@@ -454,7 +189,7 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="attr-type-label">
+                      <object class="GtkLabel" id="temperature-label">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
@@ -470,35 +205,100 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="label9">
+                      <object class="GtkLabel" id="label5">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">1</property>
-                        <property name="yalign">0</property>
-                        <property name="label" translatable="yes">Description</property>
+                        <property name="label" translatable="yes">Self-test Result</property>
                         <style>
                           <class name="dim-label"/>
                         </style>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">2</property>
+                        <property name="top_attach">3</property>
                         <property name="width">1</property>
                         <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="attr-long-description-label">
+                      <object class="GtkLabel" id="label6">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">1</property>
+                        <property name="label" translatable="yes">Self-assessment</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">4</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label4">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">1</property>
+                        <property name="label" translatable="yes">Overall Assessment</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">5</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="self-test-label">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
                         <property name="xalign">0</property>
-                        <property name="wrap">True</property>
                         <property name="selectable">True</property>
+                        <property name="ellipsize">end</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">2</property>
+                        <property name="top_attach">3</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="self-assessment-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="top_attach">4</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="overall-assessment-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="top_attach">5</property>
                         <property name="width">1</property>
                         <property name="height">1</property>
                       </packing>
@@ -507,6 +307,20 @@
                   <packing>
                     <property name="expand">True</property>
                     <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSwitch" id="enabled-switch">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="tooltip_text" translatable="yes">Click to toggle whether SMART is enabled for the hard disk</property>
+                    <property name="valign">start</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="pack_type">end</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -514,7 +328,64 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">3</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="attributes-label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">SMART _Attributes</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">attributes-treeview</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVBox" id="attributes-vbox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">24</property>
+                <property name="margin_top">6</property>
+                <property name="spacing">10</property>
+                <child>
+                  <object class="GtkScrolledWindow" id="scrolledwindow1">
+                    <property name="width_request">900</property>
+                    <property name="height_request">300</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="shadow_type">in</property>
+                    <child>
+                      <object class="GtkTreeView" id="attributes-treeview">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="rules_hint">True</property>
+                        <property name="enable_search">False</property>
+                        <child internal-child="selection">
+                          <object class="GtkTreeSelection" id="treeview-selection1"/>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
               </packing>
             </child>
           </object>
@@ -527,7 +398,6 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="0">start-selftest-button</action-widget>
       <action-widget response="1">stop-selftest-button</action-widget>
       <action-widget response="-7">button1</action-widget>
       <action-widget response="2">refresh-button</action-widget>
diff --git a/src/disks/gduatasmartdialog.c b/src/disks/gduatasmartdialog.c
index 43c4a79..a2828f5 100644
--- a/src/disks/gduatasmartdialog.c
+++ b/src/disks/gduatasmartdialog.c
@@ -25,6 +25,8 @@ enum
   NORMALIZED_COLUMN,
   THRESHOLD_COLUMN,
   WORST_COLUMN,
+  TYPE_COLUMN,
+  UPDATES_COLUMN,
   FLAGS_COLUMN,
   N_COLUMNS,
 };
@@ -52,10 +54,6 @@ typedef struct
   GtkWidget *self_assessment_label;
   GtkWidget *overall_assessment_label;
 
-  GtkWidget *attr_value_label;
-  GtkWidget *attr_type_label;
-  GtkWidget *attr_long_description_label;
-
   GtkWidget *attributes_treeview;
 
   GtkWidget *start_selftest_button;
@@ -89,9 +87,6 @@ static const struct {
   {G_STRUCT_OFFSET (DialogData, selftest_short_menuitem), "selftest-short-menuitem"},
   {G_STRUCT_OFFSET (DialogData, selftest_extended_menuitem), "selftest-extended-menuitem"},
   {G_STRUCT_OFFSET (DialogData, selftest_conveyance_menuitem), "selftest-conveyance-menuitem"},
-  {G_STRUCT_OFFSET (DialogData, attr_value_label), "attr-value-label"},
-  {G_STRUCT_OFFSET (DialogData, attr_type_label), "attr-type-label"},
-  {G_STRUCT_OFFSET (DialogData, attr_long_description_label), "attr-long-description-label"},
 
   {G_STRUCT_OFFSET (DialogData, start_selftest_button), "start-selftest-button"},
   {G_STRUCT_OFFSET (DialogData, stop_selftest_button), "stop-selftest-button"},
@@ -580,7 +575,7 @@ static const SmartDetails smart_details[] = {
 static gboolean
 attribute_get_details (const gchar  *name,
                        const gchar **out_name,
-                       const gchar **out_description)
+                       const gchar **out_desc)
 {
   SmartDetails *details;
   static volatile gsize have_hash = 0;
@@ -607,15 +602,14 @@ attribute_get_details (const gchar  *name,
     {
       if (out_name != NULL)
         *out_name = gettext (details->pretty_name);
-      if (out_description != NULL)
-        *out_description = gettext (details->desc);;
+      if (out_desc != NULL)
+        *out_desc = gettext (details->desc);
       ret = TRUE;
     }
 
   return ret;
 }
 
-
 /* ---------------------------------------------------------------------------------------------------- */
 
 static gchar *
@@ -641,17 +635,13 @@ static gchar *
 attr_format_desc (gint id, const gchar *name)
 {
   const gchar *localized_name;
-  const gchar *localized_desc;
   gchar *ret;
 
-  if (!attribute_get_details (name, &localized_name, &localized_desc))
+  if (!attribute_get_details (name, &localized_name, NULL))
     {
       localized_name = name;
-      localized_desc = "";
     }
-
   ret = g_strdup (localized_name);
-
   return ret;
 }
 
@@ -750,92 +740,6 @@ pretty_to_string (guint64 pretty,
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-/* called whenever a new attribute is selected */
-static void
-update_attr (DialogData *data)
-{
-  gboolean prefail;
-  gboolean online;
-  const gchar *prefail_str;
-  const gchar *online_str;
-  gchar *pretty = NULL;
-  gchar *type_str = NULL;
-  gint normalized, threshold, worst;
-  gint flags;
-  GtkTreeIter tree_iter;
-  gchar *value_str = NULL;
-  gchar *long_description_str = NULL;
-
-  if (!gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (data->attributes_treeview)),
-                                        NULL,
-                                        &tree_iter))
-    goto out;
-
-  gtk_tree_model_get (GTK_TREE_MODEL (data->attributes_list),
-                      &tree_iter,
-                      PRETTY_COLUMN, &pretty,
-                      NORMALIZED_COLUMN, &normalized,
-                      THRESHOLD_COLUMN, &threshold,
-                      WORST_COLUMN, &worst,
-                      FLAGS_COLUMN, &flags,
-                      LONG_DESC_COLUMN, &long_description_str,
-                      -1);
-
-  /* Translators: The first %s is the pretty value (such as '300
-   * sectors' or '2.5 years' or '53Â C / 127Â F').
-   *
-   * The three %d are the normalized, threshold and worst values -
-   * these are all decimal numbers.
-   */
-  value_str = g_strdup_printf (_("%s <span size=\"small\">(Normalized: %d, Threshold: %d, Worst: %d)</span>"),
-                               pretty, normalized, threshold, worst);
-
-  prefail = (flags & 0x0001);
-  online = (flags & 0x0002);
-
-  if (prefail)
-    {
-      /* Translators: Please keep "(Pre-Fail)" in English
-       */
-      prefail_str = _("Failure is a sign the disk will fail within 24 hours <span size=\"small\">(Pre-Fail)</span>");
-    }
-  else
-    {
-      /* Translators: Please keep "(Old-Age)" in English
-       */
-      prefail_str = _("Failure is a sign the disk exceeded its intended design life period <span size=\"small\">(Old-Age)</span>");
-    }
-
-  if (online)
-    {
-      /* Translators: Please keep "(Online)" in English
-       */
-      online_str = _("Updated every time data is collected <span size=\"small\">(Online)</span>");
-    }
-  else
-    {
-      /* Translators: Please keep "(Not Online)" in English
-       */
-      online_str = _("Updated only during off-line activities <span size=\"small\">(Not Online)</span>");
-    }
-
-  type_str = g_strdup_printf ("%s\n%s",
-                              prefail_str,
-                              online_str);
-
- out:
-  gtk_label_set_markup (GTK_LABEL (data->attr_value_label), value_str);
-  gtk_label_set_markup (GTK_LABEL (data->attr_type_label), type_str);
-  gtk_label_set_markup (GTK_LABEL (data->attr_long_description_label), long_description_str);
-
-  g_free (long_description_str);
-  g_free (value_str);
-  g_free (type_str);
-  g_free (pretty);
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
 static gchar *
 calculate_self_test (UDisksDriveAta *ata,
                      gboolean       *out_selftest_running)
@@ -1172,12 +1076,24 @@ update_attributes_list (DialogData *data,
           gchar *desc_str;
           gchar *assessment_str;
           gchar *pretty_str;
+          const gchar *type_str;
+          const gchar *updates_str;
 
           desc_str = attr_format_desc (id, name);
           long_desc_str = attr_format_long_desc (id, name);
           assessment_str = attr_format_assessment (current, worst, threshold, flags);
           pretty_str = pretty_to_string (pretty, pretty_unit);
 
+          if (flags & 0x0001)
+            type_str = _("Pre-Fail");
+          else
+            type_str = _("Old-Age");
+
+          if (flags & 0x0002)
+            updates_str = _("Online");
+          else
+            updates_str = _("Offline");
+
           gtk_list_store_append (data->attributes_list, &titer);
           gtk_list_store_set (data->attributes_list, &titer,
                               ID_COLUMN, (gint) id,
@@ -1188,14 +1104,16 @@ update_attributes_list (DialogData *data,
                               NORMALIZED_COLUMN, current,
                               THRESHOLD_COLUMN, threshold,
                               WORST_COLUMN, worst,
+                              TYPE_COLUMN, type_str,
+                              UPDATES_COLUMN, updates_str,
                               FLAGS_COLUMN, flags,
                               -1);
 
           if (id == selected_id)
             tree_iter_to_select = gtk_tree_iter_copy (&titer);
 
-          g_free (long_desc_str);
           g_free (desc_str);
+          g_free (long_desc_str);
           g_free (assessment_str);
           g_free (pretty_str);
 
@@ -1313,9 +1231,6 @@ update_dialog (DialogData *data)
       gtk_label_set_markup (GTK_LABEL (data->powered_on_label), "â");
       gtk_label_set_markup (GTK_LABEL (data->self_assessment_label), "â");
       gtk_label_set_markup (GTK_LABEL (data->overall_assessment_label), "â");
-      gtk_label_set_markup (GTK_LABEL (data->attr_value_label), "â");
-      gtk_label_set_markup (GTK_LABEL (data->attr_type_label), "â");
-      gtk_label_set_markup (GTK_LABEL (data->attr_long_description_label), "â");
     }
   gtk_widget_set_sensitive (data->status_grid, enabled);
   gtk_widget_set_sensitive (data->attributes_label, enabled);
@@ -1468,8 +1383,7 @@ static void
 on_tree_selection_changed (GtkTreeSelection *tree_selection,
                            gpointer          user_data)
 {
-  DialogData *data = user_data;
-  update_attr (data);
+  /* DialogData *data = user_data;*/
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -1553,6 +1467,8 @@ gdu_ata_smart_dialog_show (GduWindow    *window,
                                               G_TYPE_INT,         /* normalized */
                                               G_TYPE_INT,         /* threshold */
                                               G_TYPE_INT,         /* worst */
+                                              G_TYPE_STRING,      /* type */
+                                              G_TYPE_STRING,      /* updates */
                                               G_TYPE_INT);        /* flags */
   gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (data->attributes_list),
                                         ID_COLUMN,
@@ -1603,6 +1519,66 @@ gdu_ata_smart_dialog_show (GduWindow    *window,
 
   column = gtk_tree_view_column_new ();
   gtk_tree_view_append_column (GTK_TREE_VIEW (data->attributes_treeview), column);
+  /* Translators: This string is used as the column title in the treeview for the normalized value */
+  gtk_tree_view_column_set_title (column, _("Normalized"));
+  renderer = gtk_cell_renderer_text_new ();
+  g_object_set (G_OBJECT (renderer),
+                "yalign", 0.5,
+                NULL);
+  gtk_tree_view_column_pack_start (column, renderer, TRUE);
+  gtk_tree_view_column_set_attributes (column, renderer,
+                                       "markup", NORMALIZED_COLUMN, NULL);
+
+  column = gtk_tree_view_column_new ();
+  gtk_tree_view_append_column (GTK_TREE_VIEW (data->attributes_treeview), column);
+  /* Translators: This string is used as the column title in the treeview for the threshold value */
+  gtk_tree_view_column_set_title (column, _("Threshold"));
+  renderer = gtk_cell_renderer_text_new ();
+  g_object_set (G_OBJECT (renderer),
+                "yalign", 0.5,
+                NULL);
+  gtk_tree_view_column_pack_start (column, renderer, TRUE);
+  gtk_tree_view_column_set_attributes (column, renderer,
+                                       "markup", THRESHOLD_COLUMN, NULL);
+
+  column = gtk_tree_view_column_new ();
+  gtk_tree_view_append_column (GTK_TREE_VIEW (data->attributes_treeview), column);
+  /* Translators: This string is used as the column title in the treeview for the worst value */
+  gtk_tree_view_column_set_title (column, _("Worst"));
+  renderer = gtk_cell_renderer_text_new ();
+  g_object_set (G_OBJECT (renderer),
+                "yalign", 0.5,
+                NULL);
+  gtk_tree_view_column_pack_start (column, renderer, TRUE);
+  gtk_tree_view_column_set_attributes (column, renderer,
+                                       "markup", WORST_COLUMN, NULL);
+
+  column = gtk_tree_view_column_new ();
+  gtk_tree_view_append_column (GTK_TREE_VIEW (data->attributes_treeview), column);
+  /* Translators: This string is used as the column title in the treeview for the type */
+  gtk_tree_view_column_set_title (column, _("Type"));
+  renderer = gtk_cell_renderer_text_new ();
+  g_object_set (G_OBJECT (renderer),
+                "yalign", 0.5,
+                NULL);
+  gtk_tree_view_column_pack_start (column, renderer, TRUE);
+  gtk_tree_view_column_set_attributes (column, renderer,
+                                       "markup", TYPE_COLUMN, NULL);
+
+  column = gtk_tree_view_column_new ();
+  gtk_tree_view_append_column (GTK_TREE_VIEW (data->attributes_treeview), column);
+  /* Translators: This string is used as the column title in the treeview for the update type (Online / Offline) */
+  gtk_tree_view_column_set_title (column, _("Updates"));
+  renderer = gtk_cell_renderer_text_new ();
+  g_object_set (G_OBJECT (renderer),
+                "yalign", 0.5,
+                NULL);
+  gtk_tree_view_column_pack_start (column, renderer, TRUE);
+  gtk_tree_view_column_set_attributes (column, renderer,
+                                       "markup", UPDATES_COLUMN, NULL);
+
+  column = gtk_tree_view_column_new ();
+  gtk_tree_view_append_column (GTK_TREE_VIEW (data->attributes_treeview), column);
   /* Translators: This string is used as the column title in the treeview for the assessment of the attribute */
   gtk_tree_view_column_set_title (column, _("Assessment"));
   renderer = gtk_cell_renderer_text_new ();



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