[gnome-robots] Prohibit super safe moves without safe moves



commit 5f5749ca747a8c14ca03400ad70d75a0e8d64911
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Mar 9 23:34:11 2014 -0500

    Prohibit super safe moves without safe moves
    
    This combination of checkboxes makes no sense. Discovered by Anna in
    bgo#722998

 src/properties.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/properties.c b/src/properties.c
index bb5a107..722918d 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -226,7 +226,7 @@ type_selection (GtkWidget * widget, gpointer data)
 /**
  * safe_cb
  * @widget: widget
- * @data: callback data
+ * @data: the super safe moves checkbox
  *
  * Description:
  * handles message from the 'safe moves' checkbox
@@ -234,8 +234,11 @@ type_selection (GtkWidget * widget, gpointer data)
 static void
 safe_cb (GtkWidget * widget, gpointer data)
 {
+  GtkWidget *super_safe_chkbox;
+  super_safe_chkbox = GTK_WIDGET (data);
   properties.safe_moves = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
   conf_set_use_safe_moves (properties.safe_moves);
+  gtk_widget_set_sensitive (super_safe_chkbox, properties.safe_moves);
 }
 
 
@@ -380,6 +383,7 @@ show_properties_dialog (void)
   GtkWidget *typemenu;
   GtkWidget *pmapmenu;
   GtkWidget *chkbox;
+  GtkWidget *safe_chkbox;
   GtkWidget *grid;
   GtkWidget *dbut;
   GtkWidget *w;
@@ -426,11 +430,10 @@ show_properties_dialog (void)
   chkbox = gtk_check_button_new_with_mnemonic (_("_Use safe moves"));
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkbox),
                                properties.safe_moves);
-  g_signal_connect (G_OBJECT (chkbox), "clicked",
-                   (GCallback) safe_cb, NULL);
   gtk_grid_attach (GTK_GRID (grid), chkbox, 0, 1, 2, 1);
   gtk_widget_set_tooltip_text (chkbox,
                                _("Prevent accidental moves that result in getting killed."));
+  safe_chkbox = chkbox;
 
   chkbox = gtk_check_button_new_with_mnemonic (_("U_se super safe moves"));
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkbox),
@@ -440,6 +443,10 @@ show_properties_dialog (void)
   gtk_grid_attach (GTK_GRID (grid), chkbox, 0, 2, 2, 1);
   gtk_widget_set_tooltip_text (chkbox,
                                _("Prevents all moves that result in getting killed."));
+  gtk_widget_set_sensitive (chkbox, properties.safe_moves);
+
+  g_signal_connect (G_OBJECT (safe_chkbox), "clicked",
+                   (GCallback) safe_cb, (gpointer) chkbox);
 
   chkbox = gtk_check_button_new_with_mnemonic (_("_Enable sounds"));
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkbox), properties.sound);


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