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
{
gtk_widget_set_sensitive (dialog->change_button, TRUE);
gtk_widget_set_sensitive (dialog->add_button, FALSE);
{
gtk_widget_set_sensitive (dialog->change_button, TRUE);
gtk_widget_set_sensitive (dialog->add_button, FALSE);
gtk_widget_set_sensitive (dialog->change_button, FALSE);
gtk_widget_set_sensitive (dialog->add_button, TRUE);
}
gtk_widget_set_sensitive (dialog->change_button, FALSE);
gtk_widget_set_sensitive (dialog->add_button, TRUE);
}
struct val_labs_dialog *dialog = data;
const gchar *text = gtk_entry_get_text (GTK_ENTRY (dialog->value_entry));
union value v;
struct val_labs_dialog *dialog = data;
const gchar *text = gtk_entry_get_text (GTK_ENTRY (dialog->value_entry));
union value v;
{
gtk_entry_set_text (GTK_ENTRY (dialog->label_entry), s);
gtk_widget_set_sensitive (dialog->add_button, FALSE);
{
gtk_entry_set_text (GTK_ENTRY (dialog->label_entry), s);
gtk_widget_set_sensitive (dialog->add_button, FALSE);
g_signal_handler_unblock (GTK_ENTRY (dialog->label_entry),
dialog->change_handler_id);
g_signal_handler_unblock (GTK_ENTRY (dialog->label_entry),
dialog->change_handler_id);
on_cancel (GtkWidget *w, gpointer data)
{
struct val_labs_dialog *dialog = data;
val_labs_cancel (dialog);
on_cancel (GtkWidget *w, gpointer data)
{
struct val_labs_dialog *dialog = data;
val_labs_cancel (dialog);
gtk_tree_model_get_value (model, &iter, 1, &the_value);
gtk_tree_model_get_value (model, &iter, 1, &the_value);
}
static void repopulate_dialog (struct val_labs_dialog *dialog);
/* Callback which occurs when the "Change" button is clicked */
}
static void repopulate_dialog (struct val_labs_dialog *dialog);
/* Callback which occurs when the "Change" button is clicked */
on_change (GtkWidget *w, gpointer data)
{
struct val_labs_dialog *dialog = data;
on_change (GtkWidget *w, gpointer data)
{
struct val_labs_dialog *dialog = data;
gtk_entry_get_text (GTK_ENTRY (dialog->label_entry)));
gtk_widget_set_sensitive (dialog->change_button, FALSE);
repopulate_dialog (dialog);
gtk_entry_get_text (GTK_ENTRY (dialog->label_entry)));
gtk_widget_set_sensitive (dialog->change_button, FALSE);
repopulate_dialog (dialog);
on_add (GtkWidget *w, gpointer data)
{
struct val_labs_dialog *dialog = data;
on_add (GtkWidget *w, gpointer data)
{
struct val_labs_dialog *dialog = data;
- if ( ! val_labs_add (dialog->labs, v,
- gtk_entry_get_text
- ( GTK_ENTRY (dialog->label_entry)) ) )
- return FALSE;
-
- gtk_widget_set_sensitive (dialog->add_button, FALSE);
+ if (val_labs_add (dialog->labs, &v,
+ gtk_entry_get_text
+ ( GTK_ENTRY (dialog->label_entry)) ) )
+ {
+ gtk_widget_set_sensitive (dialog->add_button, FALSE);
on_remove (GtkWidget *w, gpointer data)
{
struct val_labs_dialog *dialog = data;
on_remove (GtkWidget *w, gpointer data)
{
struct val_labs_dialog *dialog = data;
- val_labs_remove (dialog->labs, vl->value);
+ get_selected_tuple (dialog, &value, NULL);
+ vl = val_labs_lookup (dialog->labs, &value);
+ if (vl != NULL)
+ val_labs_remove (dialog->labs, vl);
- gchar *const text = value_to_text (vl->value,
- *var_get_write_format (dialog->pv));
+ gchar *text;
+
+ get_selected_tuple (dialog, &value, &label);
+ text = value_to_text (value, dialog->dict, *var_get_write_format (dialog->pv));
g_signal_handler_block (GTK_ENTRY (dialog->value_entry),
dialog->value_handler_id);
g_signal_handler_block (GTK_ENTRY (dialog->value_entry),
dialog->value_handler_id);
g_signal_handler_block (GTK_ENTRY (dialog->label_entry),
dialog->change_handler_id);
g_signal_handler_block (GTK_ENTRY (dialog->label_entry),
dialog->change_handler_id);
g_signal_handler_unblock (GTK_ENTRY (dialog->label_entry),
dialog->change_handler_id);
g_signal_handler_unblock (GTK_ENTRY (dialog->label_entry),
dialog->change_handler_id);
dialog->window = get_widget_assert (xml,"val_labs_dialog");
dialog->value_entry = get_widget_assert (xml,"value_entry");
dialog->label_entry = get_widget_assert (xml,"label_entry");
gtk_window_set_transient_for
dialog->window = get_widget_assert (xml,"val_labs_dialog");
dialog->value_entry = get_widget_assert (xml,"value_entry");
dialog->label_entry = get_widget_assert (xml,"label_entry");
gtk_window_set_transient_for
- (GTK_WINDOW (dialog->window),
- GTK_WINDOW (get_widget_assert (xml, "data_editor")));
+ (GTK_WINDOW (dialog->window), toplevel);
dialog->add_button = get_widget_assert (xml, "val_labs_add");
dialog->remove_button = get_widget_assert (xml, "val_labs_remove");
dialog->add_button = get_widget_assert (xml, "val_labs_add");
dialog->remove_button = get_widget_assert (xml, "val_labs_remove");
- g_signal_connect (GTK_OBJECT (dialog->window), "delete-event",
- GTK_SIGNAL_FUNC (on_delete), dialog);
+ g_signal_connect (dialog->window, "delete-event",
+ G_CALLBACK (on_delete), dialog);
- g_signal_connect (GTK_OBJECT (dialog->treeview), "cursor-changed",
- GTK_SIGNAL_FUNC (on_select_row), dialog);
+ g_signal_connect (dialog->remove_button, "clicked",
+ G_CALLBACK (on_remove), dialog);
- g_signal_connect (GTK_OBJECT (dialog->remove_button), "clicked",
- GTK_SIGNAL_FUNC (on_remove), dialog);
+ g_signal_connect (dialog->add_button, "clicked",
+ G_CALLBACK (on_add), dialog);
g_signal_handler_unblock (GTK_ENTRY (dialog->label_entry),
dialog->change_handler_id);
g_signal_handler_unblock (GTK_ENTRY (dialog->label_entry),
dialog->change_handler_id);
-
- for (vl = val_labs_first_sorted (dialog->labs, &vli);
- vl;
- vl = val_labs_next (dialog->labs, &vli))
+ labels = val_labs_sorted (dialog->labs);
+ n_labels = val_labs_count (dialog->labs);
+ for (i = 0; i < n_labels; i++)
- gchar *labeltext =
- pspp_locale_to_utf8 (vl->label, -1, 0);
-
- gchar *const text = g_strdup_printf ("%s = \"%s\"",
- vstr, labeltext);
-
+ gchar *const text = g_strdup_printf (_("%s = `%s'"), vstr,
+ val_lab_get_escaped_label (vl));
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->treeview),
GTK_TREE_MODEL (list_store));
gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->treeview),
GTK_TREE_MODEL (list_store));
gtk_widget_set_sensitive (dialog->change_button, FALSE);
gtk_widget_set_sensitive (dialog->add_button, FALSE);
gtk_widget_set_sensitive (dialog->change_button, FALSE);
gtk_widget_set_sensitive (dialog->add_button, FALSE);