ROC dialog: Disable reference button when curve is not drawn
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 12 Dec 2009 20:35:23 +0000 (21:35 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 12 Dec 2009 20:35:23 +0000 (21:35 +0100)
src/ui/gui/roc-dialog.c
src/ui/gui/roc.ui

index 6896ef7b2d183997c63dc5183eec9f192e8af811..4d1a7d30b18ad435bf2b54decf5b755f48237269 100644 (file)
@@ -100,6 +100,22 @@ dialog_state_valid (gpointer data)
   return TRUE;
 }
 
+static void
+on_curve_button_toggle  (GtkCheckButton *curve, struct roc *rd)
+{
+  if ( !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (curve)))
+    {
+      if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->reference)))
+       g_object_set (rd->reference, "inconsistent", TRUE, NULL);
+      g_object_set (rd->reference, "sensitive", FALSE, NULL);
+    }
+  else 
+    {
+      g_object_set (rd->reference, "inconsistent", FALSE, NULL);
+      g_object_set (rd->reference, "sensitive", TRUE, NULL);
+    }
+}
+
 
 /* Pops up the Roc dialog box */
 void
@@ -132,6 +148,8 @@ roc_dialog (GObject *o, gpointer data)
   g_object_get (vs, "dictionary", &rd.dict, NULL);
   g_object_set (source, "model", rd.dict, NULL);
 
+  g_signal_connect (rd.curve, "toggled", G_CALLBACK (on_curve_button_toggle), &rd);
+
   g_signal_connect_swapped (dialog, "refresh", G_CALLBACK (refresh),  &rd);
 
   psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
index 8bb82cc887403b17f64d90f54a39de1de7ff6509..a3aee25abef68c8073bf4118de4d0b295ed74ba5 100644 (file)
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkCheckButton" id="reference-line">
-                                <property name="label" translatable="yes">_With diagonal reference line</property>
+                              <object class="GtkHBox" id="hbox2">
                                 <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="use_underline">True</property>
-                                <property name="xalign">0</property>
-                                <property name="draw_indicator">True</property>
+                                <child>
+                                  <object class="GtkCheckButton" id="reference-line">
+                                    <property name="label" translatable="yes">_With diagonal reference line</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="draw_indicator">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="padding">12</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
                                 <property name="fill">False</property>
-                                <property name="padding">12</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>