projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'origin/master' into gtk3
[pspp]
/
src
/
ui
/
gui
/
val-labs-dialog.c
diff --git
a/src/ui/gui/val-labs-dialog.c
b/src/ui/gui/val-labs-dialog.c
index 0d7f41307be271079ee2c08e6933928bdcf8c984..56399aa271f3b3b6ee4739c33b3640a008c6472b 100644
(file)
--- a/
src/ui/gui/val-labs-dialog.c
+++ b/
src/ui/gui/val-labs-dialog.c
@@
-1,5
+1,5
@@
/* PSPPIRE - a graphical user interface for PSPP.
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2005, 2009, 2010, 2011, 2012 Free Software Foundation
+ Copyright (C) 2005, 2009, 2010, 2011, 2012
, 2015
Free Software Foundation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-142,7
+142,6
@@
psppire_val_labs_dialog_new (const struct variable *var)
{
return PSPPIRE_VAL_LABS_DIALOG (
g_object_new (PSPPIRE_TYPE_VAL_LABS_DIALOG,
{
return PSPPIRE_VAL_LABS_DIALOG (
g_object_new (PSPPIRE_TYPE_VAL_LABS_DIALOG,
- "orientation", PSPPIRE_HORIZONTAL,
"variable", var,
NULL));
}
"variable", var,
NULL));
}
@@
-279,7
+278,7
@@
on_value_entry_change (GtkEntry *entry, gpointer data)
/* Return the value-label pair currently selected in the dialog box */
/* Return the value-label pair currently selected in the dialog box */
-static
void
+static
gboolean
get_selected_tuple (PsppireValLabsDialog *dialog,
union value *valuep, const char **label)
{
get_selected_tuple (PsppireValLabsDialog *dialog,
union value *valuep, const char **label)
{
@@
-293,7
+292,8
@@
get_selected_tuple (PsppireValLabsDialog *dialog,
GtkTreeModel * model = gtk_tree_view_get_model (treeview);
GtkTreeModel * model = gtk_tree_view_get_model (treeview);
- gtk_tree_selection_get_selected (sel, &model, &iter);
+ if (! gtk_tree_selection_get_selected (sel, &model, &iter))
+ return FALSE;
gtk_tree_model_get_value (model, &iter, 1, &the_value);
gtk_tree_model_get_value (model, &iter, 1, &the_value);
@@
-308,6
+308,8
@@
get_selected_tuple (PsppireValLabsDialog *dialog,
if (vl != NULL)
*label = val_lab_get_escaped_label (vl);
}
if (vl != NULL)
*label = val_lab_get_escaped_label (vl);
}
+
+ return TRUE;
}
}
@@
-370,7
+372,9
@@
on_remove (GtkWidget *w, gpointer data)
union value value;
struct val_lab *vl;
union value value;
struct val_lab *vl;
- get_selected_tuple (dialog, &value, NULL);
+ if (! get_selected_tuple (dialog, &value, NULL))
+ return;
+
vl = val_labs_lookup (dialog->labs, &value);
if (vl != NULL)
val_labs_remove (dialog->labs, vl);
vl = val_labs_lookup (dialog->labs, &value);
if (vl != NULL)
val_labs_remove (dialog->labs, vl);
@@
-395,7
+399,9
@@
on_select_row (GtkTreeView *treeview, gpointer data)
gchar *text;
gchar *text;
- get_selected_tuple (dialog, &value, &label);
+ if (! get_selected_tuple (dialog, &value, &label))
+ return;
+
text = value_to_text__ (value, &dialog->format, dialog->encoding);
g_signal_handler_block (GTK_ENTRY (dialog->value_entry),
text = value_to_text__ (value, &dialog->format, dialog->encoding);
g_signal_handler_block (GTK_ENTRY (dialog->value_entry),
@@
-443,7
+449,7
@@
psppire_val_labs_dialog_constructor (GType type,
type, n_properties, properties);
dialog = PSPPIRE_VAL_LABS_DIALOG (obj);
type, n_properties, properties);
dialog = PSPPIRE_VAL_LABS_DIALOG (obj);
- content_area = GTK_CONTAINER (PSPPIRE_DIALOG (dialog)
->box
);
+ content_area = GTK_CONTAINER (PSPPIRE_DIALOG (dialog));
gtk_container_add (GTK_CONTAINER (content_area),
get_widget_assert (xml, "val-labs-dialog"));
gtk_container_add (GTK_CONTAINER (content_area),
get_widget_assert (xml, "val-labs-dialog"));