[gnome-disk-utility] Fix bug when updating negative checkbutton options



commit 4d0d31401878c6a888b52a97cf8cadb6ee99caa5
Author: David Zeuthen <davidz redhat com>
Date:   Tue Feb 21 13:28:22 2012 -0500

    Fix bug when updating negative checkbutton options
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 src/palimpsest/gduutils.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/palimpsest/gduutils.c b/src/palimpsest/gduutils.c
index 3166032..c0f88be 100644
--- a/src/palimpsest/gduutils.c
+++ b/src/palimpsest/gduutils.c
@@ -316,20 +316,21 @@ gdu_options_update_check_option (GtkWidget       *options_entry,
   gboolean opts, ui;
   opts = !! has_option (options_entry, option, FALSE, NULL);
   ui = !! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_button));
-  if (negate)
-    ui = !ui;
-  if (opts != ui)
+  if ((!negate && (opts != ui)) || (negate && (opts == ui)))
     {
       if (widget == check_button)
         {
-          if (ui)
+          if ((!negate && ui) || (negate && !ui))
             add_option (options_entry, "", option, add_to_front);
           else
             remove_option (options_entry, option, FALSE);
         }
       else
         {
-          gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), opts);
+          if (negate)
+            gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), !opts);
+          else
+            gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), opts);
         }
     }
 }



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