+2008-02-08 John Darrington <john@darrington.wattle.id.au>
+
+ * sort-cases-dialog.c transpose-dialog.c: Added dialog_valid
+ predicates.
+
2008-02-04 John Darrington <john@darrington.wattle.id.au>
* checkbox-treeview.c: In toggle callback, use the treeview's
GtkToggleButton *ascending;
};
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+ struct sort_cases_dialog *scd = data;
+ GtkTreeModel *model = gtk_tree_view_get_model (scd->tv);
+
+ gint n_rows = gtk_tree_model_iter_n_children (model, NULL);
+
+ if ( n_rows == 0 )
+ return FALSE;
+
+ return TRUE;
+}
+
static char *
generate_syntax (const struct sort_cases_dialog *scd)
{
scd.ascending =
GTK_TOGGLE_BUTTON (get_widget_assert (xml, "sort-cases-radiobutton0"));
+
+ psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
+ dialog_state_valid, &scd);
+
+
response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
gtk_entry_set_text (GTK_ENTRY (entry), "");
}
+static gboolean
+dialog_state_valid (gpointer data)
+{
+ GladeXML *xml = data;
+
+ GtkWidget *tv = get_widget_assert (xml, "variables-treeview");
+ GtkWidget *entry = get_widget_assert (xml, "new-name-entry");
+
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (tv));
+
+ gint n_rows = gtk_tree_model_iter_n_children (model, NULL);
+
+ if ( n_rows == 0 )
+ return FALSE;
+
+ if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (entry))))
+ return FALSE;
+
+ return TRUE;
+}
+
+
void
transpose_dialog (GObject *o, gpointer data)
{
gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+ psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
+ dialog_state_valid, xml);
+
response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
switch (response)