[gnome-disk-utility/udisks2-port] Show an infobar in the Change Passphrase dialog



commit f553137ddbc019a27e7ce249acf190d2c99a44f6
Author: David Zeuthen <davidz redhat com>
Date:   Thu Dec 8 10:24:26 2011 -0500

    Show an infobar in the Change Passphrase dialog
    
    http://people.freedesktop.org/~david/gdu2-change-passphrase-infobar.png
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 data/ui/change-passphrase-dialog.ui        |   22 ++++++++++++++++++++--
 src/palimpsest/gduchangepassphrasedialog.c |   15 ++++++++++++++-
 src/palimpsest/gducrypttabdialog.c         |    2 +-
 3 files changed, 35 insertions(+), 4 deletions(-)
---
diff --git a/data/ui/change-passphrase-dialog.ui b/data/ui/change-passphrase-dialog.ui
index 5358874..3f56238 100644
--- a/data/ui/change-passphrase-dialog.ui
+++ b/data/ui/change-passphrase-dialog.ui
@@ -56,6 +56,21 @@
           </packing>
         </child>
         <child>
+          <object class="GtkBox" id="infobar-vbox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <placeholder/>
+            </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="label2">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
@@ -66,7 +81,7 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
+            <property name="position">2</property>
           </packing>
         </child>
         <child>
@@ -101,6 +116,7 @@
                 <property name="has_tooltip">True</property>
                 <property name="tooltip_markup" translatable="yes">Enter passphrase used to protect the data</property>
                 <property name="tooltip_text" translatable="yes">Enter passphrase used to protect the data</property>
+                <property name="hexpand">True</property>
                 <property name="visibility">False</property>
                 <property name="invisible_char">â</property>
                 <property name="activates_default">True</property>
@@ -159,6 +175,7 @@
                 <property name="has_tooltip">True</property>
                 <property name="tooltip_markup" translatable="yes">Confirm passphrase entered above</property>
                 <property name="tooltip_text" translatable="yes">Confirm passphrase entered above</property>
+                <property name="hexpand">True</property>
                 <property name="visibility">False</property>
                 <property name="invisible_char">â</property>
                 <property name="activates_default">True</property>
@@ -179,6 +196,7 @@
                 <property name="has_tooltip">True</property>
                 <property name="tooltip_markup" translatable="yes">Enter passphrase used to protect the data</property>
                 <property name="tooltip_text" translatable="yes">Enter passphrase used to protect the data</property>
+                <property name="hexpand">True</property>
                 <property name="visibility">False</property>
                 <property name="invisible_char">â</property>
                 <property name="activates_default">True</property>
@@ -258,7 +276,7 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">2</property>
+            <property name="position">3</property>
           </packing>
         </child>
       </object>
diff --git a/src/palimpsest/gduchangepassphrasedialog.c b/src/palimpsest/gduchangepassphrasedialog.c
index e8a3718..edde6f4 100644
--- a/src/palimpsest/gduchangepassphrasedialog.c
+++ b/src/palimpsest/gduchangepassphrasedialog.c
@@ -28,6 +28,7 @@
 #include "gduwindow.h"
 #include "gduchangepassphrasedialog.h"
 #include "gdupasswordstrengthwidget.h"
+#include "gduutils.h"
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -46,6 +47,7 @@ typedef struct
   GtkBuilder *builder;
   GtkWidget *dialog;
 
+  GtkWidget *infobar_vbox;
   GtkWidget *existing_passphrase_entry;
   GtkWidget *passphrase_entry;
   GtkWidget *confirm_passphrase_entry;
@@ -139,7 +141,8 @@ has_passphrase_in_configuration (ChangePassphraseData *data)
       if (g_strcmp0 (type, "crypttab") == 0)
         {
           const gchar *passphrase_path;
-          if (g_variant_lookup (details, "passphrase-path", "^&ay", &passphrase_path))
+          if (g_variant_lookup (details, "passphrase-path", "^&ay", &passphrase_path) &&
+              strlen (passphrase_path) > 0)
             {
               g_variant_unref (details);
               ret = TRUE;
@@ -325,6 +328,16 @@ gdu_change_passphrase_dialog_show (GduWindow    *window,
                                              "change-passphrase-dialog",
                                              &data->builder);
 
+  data->infobar_vbox = GTK_WIDGET (gtk_builder_get_object (data->builder, "infobar-vbox"));
+  if (data->has_passphrase_in_configuration)
+    {
+      GtkWidget *infobar;
+      infobar = gdu_utils_create_info_bar (GTK_MESSAGE_INFO,
+                                           _("Changing the passphrase for this device, will also update the passphrase referenced by the <i>/etc/crypttab</i> file"),
+                                           NULL);
+      gtk_box_pack_start (GTK_BOX (data->infobar_vbox), infobar, TRUE, TRUE, 0);
+    }
+
   data->existing_passphrase_entry = GTK_WIDGET (gtk_builder_get_object (data->builder, "existing-passphrase-entry"));
   g_signal_connect (data->existing_passphrase_entry, "notify::text", G_CALLBACK (on_property_changed), data);
 
diff --git a/src/palimpsest/gducrypttabdialog.c b/src/palimpsest/gducrypttabdialog.c
index 5b50f52..c3e0d61 100644
--- a/src/palimpsest/gducrypttabdialog.c
+++ b/src/palimpsest/gducrypttabdialog.c
@@ -478,7 +478,7 @@ gdu_crypttab_dialog_show (GduWindow    *window,
 
   /* do infobar stuff manually because of glade-hate ! #$ :-/ */
   data->passphrase_warning_infobar = gdu_utils_create_info_bar (GTK_MESSAGE_INFO,
-                                                                _("<b>NOTE:</b> Only the passphrase referenced by the <i>/etc/crypttab</i> file will be changed. To change the on-disk passphrase, use the <i>Change Passphrase...</i> menu item."),
+                                                                _("Only the passphrase referenced by the <i>/etc/crypttab</i> file will be changed. To change the on-disk passphrase, use <i>Change Passphrase...</i>"),
                                                                 NULL);
   /* don't show by default (see crypttab_dialog_on_get_secrets_cb()) */
   gtk_widget_set_no_show_all (data->passphrase_warning_infobar, TRUE);



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