Populate select dialog's dialog_is_valid function
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 16 Jan 2016 08:32:30 +0000 (09:32 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 16 Jan 2016 08:32:30 +0000 (09:32 +0100)
Closes bug #46901

src/ui/gui/psppire-dialog-action-select.c

index d3eee6570dcf242ff19516122ce52d9c597c0956..376cc9f59c2b1ae294fd307e03fe4808f31eaa4e 100644 (file)
@@ -47,6 +47,18 @@ G_DEFINE_TYPE (PsppireDialogActionSelect, psppire_dialog_action_select, PSPPIRE_
 static gboolean
 dialog_state_valid (gpointer data)
 {
+  PsppireDialogActionSelect *act = PSPPIRE_DIALOG_ACTION_SELECT (data);
+  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->radiobutton_all)))
+    {
+      return TRUE;
+    }
+  else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->radiobutton_filter_variable)))
+    {
+      const gchar *text = gtk_entry_get_text (GTK_ENTRY (act->entry));
+      if (!psppire_dict_lookup_var (PSPPIRE_DIALOG_ACTION (act)->dict, text))
+       return FALSE;
+    }
+
   return TRUE;
 }