[gnome-disk-utility/udisks2-port] Ensure that fstab 'defaults' option is always added to the front



commit 442b166f1ff6ab26c767b44eaf8291f1cde30c42
Author: David Zeuthen <davidz redhat com>
Date:   Thu Jan 19 14:00:35 2012 -0500

    Ensure that fstab 'defaults' option is always added to the front
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 src/palimpsest/gducrypttabdialog.c |    4 ++--
 src/palimpsest/gdufstabdialog.c    |   10 +++++-----
 src/palimpsest/gduutils.c          |   14 ++++++++------
 src/palimpsest/gduutils.h          |    3 ++-
 4 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/src/palimpsest/gducrypttabdialog.c b/src/palimpsest/gducrypttabdialog.c
index 559c76e..a414c5e 100644
--- a/src/palimpsest/gducrypttabdialog.c
+++ b/src/palimpsest/gducrypttabdialog.c
@@ -155,8 +155,8 @@ update (CrypttabDialogData *data,
   g_free (s);
 
   g_object_freeze_notify (G_OBJECT (data->options_entry));
-  gdu_options_update_check_option (data->options_entry, "noauto", widget, data->noauto_checkbutton);
-  gdu_options_update_check_option (data->options_entry, "x-udisks-auth", widget, data->auth_checkbutton);
+  gdu_options_update_check_option (data->options_entry, "noauto", widget, data->noauto_checkbutton, FALSE);
+  gdu_options_update_check_option (data->options_entry, "x-udisks-auth", widget, data->auth_checkbutton, FALSE);
   g_object_thaw_notify (G_OBJECT (data->options_entry));
 
   can_apply = FALSE;
diff --git a/src/palimpsest/gdufstabdialog.c b/src/palimpsest/gdufstabdialog.c
index 6d06d1c..95076d5 100644
--- a/src/palimpsest/gdufstabdialog.c
+++ b/src/palimpsest/gdufstabdialog.c
@@ -96,11 +96,11 @@ update (FstabDialogData *data,
   ui_opts = gtk_entry_get_text (GTK_ENTRY (data->options_entry));
 
   g_object_freeze_notify (G_OBJECT (data->options_entry));
-  gdu_options_update_check_option (data->options_entry, "defaults", widget, data->defaults_checkbutton);
-  gdu_options_update_check_option (data->options_entry, "noauto", widget, data->noauto_checkbutton);
-  gdu_options_update_check_option (data->options_entry, "comment=udisks-auth", widget, data->auth_checkbutton);
-  gdu_options_update_check_option (data->options_entry, "comment=gvfs-show", widget, data->show_checkbutton);
-  gdu_options_update_check_option (data->options_entry, "comment=gvfs-hide", widget, data->hide_checkbutton);
+  gdu_options_update_check_option (data->options_entry, "defaults", widget, data->defaults_checkbutton, TRUE);
+  gdu_options_update_check_option (data->options_entry, "noauto", widget, data->noauto_checkbutton, FALSE);
+  gdu_options_update_check_option (data->options_entry, "comment=udisks-auth", widget, data->auth_checkbutton, FALSE);
+  gdu_options_update_check_option (data->options_entry, "comment=gvfs-show", widget, data->show_checkbutton, FALSE);
+  gdu_options_update_check_option (data->options_entry, "comment=gvfs-hide", widget, data->hide_checkbutton, FALSE);
   gdu_options_update_entry_option (data->options_entry, "comment=gvfs-name=", widget, data->name_entry);
   gdu_options_update_entry_option (data->options_entry, "comment=gvfs-icon=", widget, data->icon_entry);
   g_object_thaw_notify (G_OBJECT (data->options_entry));
diff --git a/src/palimpsest/gduutils.c b/src/palimpsest/gduutils.c
index e3a08a0..2d69e86 100644
--- a/src/palimpsest/gduutils.c
+++ b/src/palimpsest/gduutils.c
@@ -259,16 +259,17 @@ has_option (GtkWidget       *options_entry,
 static void
 add_option (GtkWidget       *options_entry,
             const gchar     *prefix,
-            const gchar     *option)
+            const gchar     *option,
+            gboolean         add_to_front)
 {
   gchar *s;
   const gchar *text;
   text = gtk_entry_get_text (GTK_ENTRY (options_entry));
   s = g_strdup_printf ("%s%s%s%s",
-                       text,
+                       add_to_front ? option : text,
                        strlen (text) > 0 ? "," : "",
                        prefix,
-                       option);
+                       add_to_front ? text : option);
   gtk_entry_set_text (GTK_ENTRY (options_entry), s);
   g_free (s);
 }
@@ -308,7 +309,8 @@ void
 gdu_options_update_check_option (GtkWidget       *options_entry,
                                  const gchar     *option,
                                  GtkWidget       *widget,
-                                 GtkWidget       *check_button)
+                                 GtkWidget       *check_button,
+                                 gboolean         add_to_front)
 {
   gboolean opts, ui;
   opts = !! has_option (options_entry, option, FALSE, NULL);
@@ -318,7 +320,7 @@ gdu_options_update_check_option (GtkWidget       *options_entry,
       if (widget == check_button)
         {
           if (ui)
-            add_option (options_entry, "", option);
+            add_option (options_entry, "", option, add_to_front);
           else
             remove_option (options_entry, option, FALSE);
         }
@@ -351,7 +353,7 @@ gdu_options_update_entry_option (GtkWidget       *options_entry,
           if (strlen (ui_escaped) > 0)
             {
               remove_option (options_entry, option, TRUE);
-              add_option (options_entry, option, ui_escaped);
+              add_option (options_entry, option, ui_escaped, FALSE);
             }
           else
             {
diff --git a/src/palimpsest/gduutils.h b/src/palimpsest/gduutils.h
index e9659a4..fc66b75 100644
--- a/src/palimpsest/gduutils.h
+++ b/src/palimpsest/gduutils.h
@@ -46,7 +46,8 @@ gchar *gdu_utils_unfuse_path (const gchar *path);
 void gdu_options_update_check_option (GtkWidget       *options_entry,
                                       const gchar     *option,
                                       GtkWidget       *widget,
-                                      GtkWidget       *check_button);
+                                      GtkWidget       *check_button,
+                                      gboolean         add_to_front);
 
 void gdu_options_update_entry_option (GtkWidget       *options_entry,
                                       const gchar     *option,



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