[gnome-disk-utility/udisks2-port] Convey that the on-disk passphrase won't be changed when editing crypttab



commit 02b32d1abb74aac8ddae94c693ba8e04699b7898
Author: David Zeuthen <davidz redhat com>
Date:   Wed Dec 7 14:20:03 2011 -0500

    Convey that the on-disk passphrase won't be changed when editing crypttab
    
    ... but only if there was a passphrase in crypttab to start with.
    
    http://people.freedesktop.org/~david/gdu2-crypttab-etc-vs-ondisk-cluebar.png
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 data/ui/edit-crypttab-dialog.ui    |   22 ++++++++++++++++++++--
 src/palimpsest/gducrypttabdialog.c |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/edit-crypttab-dialog.ui b/data/ui/edit-crypttab-dialog.ui
index 47efd40..17f567b 100644
--- a/data/ui/edit-crypttab-dialog.ui
+++ b/data/ui/edit-crypttab-dialog.ui
@@ -61,6 +61,21 @@
             <property name="orientation">vertical</property>
             <property name="spacing">12</property>
             <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">0</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkCheckButton" id="crypttab-configure-checkbutton">
                 <property name="label" translatable="yes">Config_ure passphrase and options</property>
                 <property name="visible">True</property>
@@ -76,7 +91,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
@@ -137,6 +152,7 @@
                         <property name="has_tooltip">True</property>
                         <property name="tooltip_markup" translatable="yes">The name to use for the unlocked device - the device is set up as the name prefixed with &lt;b&gt;/dev/mapper/&lt;/b&gt;</property>
                         <property name="tooltip_text" translatable="yes">The name to use for the unlocked device - the device is set up as the name prefixed with /dev/mapper/</property>
+                        <property name="hexpand">True</property>
                         <property name="invisible_char">â</property>
                         <property name="invisible_char_set">True</property>
                       </object>
@@ -154,6 +170,7 @@
                         <property name="has_tooltip">True</property>
                         <property name="tooltip_markup" translatable="yes">Options to use when unlocking the device</property>
                         <property name="tooltip_text" translatable="yes">Options to use when unlocking the device</property>
+                        <property name="hexpand">True</property>
                         <property name="invisible_char">â</property>
                         <property name="invisible_char_set">True</property>
                       </object>
@@ -190,6 +207,7 @@
                         <property name="has_tooltip">True</property>
                         <property name="tooltip_markup" translatable="yes">Passphrase of the device or empty to request from user when setting up the device</property>
                         <property name="tooltip_text" translatable="yes">Passphrase of the device or empty to request from user when setting up the device</property>
+                        <property name="hexpand">True</property>
                         <property name="invisible_char">â</property>
                         <property name="invisible_char_set">True</property>
                       </object>
@@ -289,7 +307,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
           </object>
diff --git a/src/palimpsest/gducrypttabdialog.c b/src/palimpsest/gducrypttabdialog.c
index 56c0a71..cc4c786 100644
--- a/src/palimpsest/gducrypttabdialog.c
+++ b/src/palimpsest/gducrypttabdialog.c
@@ -41,6 +41,10 @@ typedef struct
 
   GtkBuilder *builder;
   GtkWidget *dialog;
+
+  GtkWidget *infobar_vbox;
+  GtkWidget *passphrase_warning_infobar;
+
   GtkWidget *configure_checkbutton;
   GtkWidget *grid;
 
@@ -416,6 +420,10 @@ crypttab_dialog_on_get_secrets_cb (UDisksBlock       *block,
     }
   g_variant_unref (configuration);
 
+  /* Do show the warning "Passphrase isn't changed on-disk" warning */
+  gtk_widget_set_no_show_all (data->passphrase_warning_infobar, FALSE);
+  gtk_widget_show (data->passphrase_warning_infobar);
+
   crypttab_dialog_present (data);
 
  out:
@@ -458,6 +466,7 @@ gdu_crypttab_dialog_show (GduWindow    *window,
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
 
   data->dialog = dialog;
+  data->infobar_vbox = GTK_WIDGET (gtk_builder_get_object (data->builder, "infobar-vbox"));
   data->configure_checkbutton = GTK_WIDGET (gtk_builder_get_object (data->builder, "crypttab-configure-checkbutton"));
   data->grid = GTK_WIDGET (gtk_builder_get_object (data->builder, "crypttab-grid"));
   data->name_entry = GTK_WIDGET (gtk_builder_get_object (data->builder, "crypttab-name-entry"));
@@ -467,6 +476,33 @@ gdu_crypttab_dialog_show (GduWindow    *window,
   data->show_passphrase_checkbutton = GTK_WIDGET (gtk_builder_get_object (data->builder, "crypttab-show-passphrase-checkbutton"));
   data->passphrase_path_value_label = GTK_WIDGET (gtk_builder_get_object (data->builder, "crypttab-passphrase-path-value-label"));
 
+  /* do infobar stuff manually because of glade-hate ! #$ :-/ */
+  data->passphrase_warning_infobar = gtk_info_bar_new ();
+  gtk_info_bar_set_message_type (GTK_INFO_BAR (data->passphrase_warning_infobar),
+                                 GTK_MESSAGE_INFO);
+  {
+    GtkWidget *hbox;
+    GtkWidget *label;
+    GtkWidget *image;
+
+    /* don't show by default (see crypttab_dialog_on_get_secrets_cb()) */
+    gtk_widget_set_no_show_all (data->passphrase_warning_infobar, TRUE);
+
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+    gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (data->passphrase_warning_infobar))),
+                        hbox, TRUE, TRUE, 0);
+
+    image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_BUTTON);
+    gtk_box_pack_start (GTK_BOX (hbox), image, TRUE, TRUE, 0);
+
+    label = gtk_label_new (NULL);
+    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+    gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+    gtk_label_set_markup (GTK_LABEL (label), _("<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."));
+    gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+  }
+  gtk_box_pack_start (GTK_BOX (data->infobar_vbox), data->passphrase_warning_infobar, TRUE, TRUE, 0);
+
   /* First check if there's an existing configuration */
   configured = FALSE;
   get_passphrase_contents = FALSE;



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