X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fval-labs-dialog.c;h=5b226eb6b807b191362659eec72422caad7c8e1c;hb=d8659cda7d193dd3e6e035cd0b1b40493d360f0b;hp=92a7fe8e0c77c7a5096e46c23cd6e45b4a2b4088;hpb=83df73bacd2cd3abd177e6a8ac1b76b072255025;p=pspp-builds.git diff --git a/src/ui/gui/val-labs-dialog.c b/src/ui/gui/val-labs-dialog.c index 92a7fe8e..5b226eb6 100644 --- a/src/ui/gui/val-labs-dialog.c +++ b/src/ui/gui/val-labs-dialog.c @@ -71,9 +71,10 @@ on_label_entry_change (GtkEntry *entry, gpointer data) text = gtk_entry_get_text (GTK_ENTRY (dialog->value_entry)); - text_to_value (text, &v, - *var_get_write_format (dialog->pv)); - + text_to_value (text, + dialog->var_store->dict, + dialog->pv, + &v); if (val_labs_find (dialog->labs, &v)) { @@ -85,6 +86,8 @@ on_label_entry_change (GtkEntry *entry, gpointer data) gtk_widget_set_sensitive (dialog->change_button, FALSE); gtk_widget_set_sensitive (dialog->add_button, TRUE); } + + value_destroy (&v, var_get_width (dialog->pv)); } @@ -141,8 +144,10 @@ on_value_entry_change (GtkEntry *entry, gpointer data) const gchar *text = gtk_entry_get_text (GTK_ENTRY (dialog->value_entry)); union value v; - text_to_value (text, &v, - *var_get_write_format (dialog->pv)); + text_to_value (text, + dialog->var_store->dict, + dialog->pv, + &v); g_signal_handler_block (GTK_ENTRY (dialog->label_entry), @@ -166,6 +171,8 @@ on_value_entry_change (GtkEntry *entry, gpointer data) g_signal_handler_unblock (GTK_ENTRY (dialog->label_entry), dialog->change_handler_id); + + value_destroy (&v, var_get_width (dialog->pv)); } @@ -202,14 +209,12 @@ val_labs_cancel (struct val_labs_dialog *dialog) /* Callback for when the Value Labels dialog is closed using the Cancel button.*/ -static gint +static void on_cancel (GtkWidget *w, gpointer data) { struct val_labs_dialog *dialog = data; val_labs_cancel (dialog); - - return FALSE; } @@ -258,7 +263,7 @@ get_selected_tuple (struct val_labs_dialog *dialog, static void repopulate_dialog (struct val_labs_dialog *dialog); /* Callback which occurs when the "Change" button is clicked */ -static gint +static void on_change (GtkWidget *w, gpointer data) { struct val_labs_dialog *dialog = data; @@ -267,8 +272,10 @@ on_change (GtkWidget *w, gpointer data) union value v; - text_to_value (val_text, &v, - *var_get_write_format (dialog->pv)); + text_to_value (val_text, + dialog->var_store->dict, + dialog->pv, + &v); val_labs_replace (dialog->labs, &v, gtk_entry_get_text (GTK_ENTRY (dialog->label_entry))); @@ -278,11 +285,11 @@ on_change (GtkWidget *w, gpointer data) repopulate_dialog (dialog); gtk_widget_grab_focus (dialog->value_entry); - return FALSE; + value_destroy (&v, var_get_width (dialog->pv)); } /* Callback which occurs when the "Add" button is clicked */ -static gint +static void on_add (GtkWidget *w, gpointer data) { struct val_labs_dialog *dialog = data; @@ -291,25 +298,26 @@ on_add (GtkWidget *w, gpointer data) const gchar *text = gtk_entry_get_text (GTK_ENTRY (dialog->value_entry)); - text_to_value (text, &v, - *var_get_write_format (dialog->pv)); - + text_to_value (text, + dialog->var_store->dict, + dialog->pv, + &v); - 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); - repopulate_dialog (dialog); - gtk_widget_grab_focus (dialog->value_entry); + repopulate_dialog (dialog); + gtk_widget_grab_focus (dialog->value_entry); + } - return FALSE; + value_destroy (&v, var_get_width (dialog->pv)); } /* Callback which occurs when the "Remove" button is clicked */ -static gint +static void on_remove (GtkWidget *w, gpointer data) { struct val_labs_dialog *dialog = data; @@ -326,8 +334,6 @@ on_remove (GtkWidget *w, gpointer data) gtk_widget_grab_focus (dialog->value_entry); gtk_widget_set_sensitive (dialog->remove_button, FALSE); - - return FALSE; } @@ -412,38 +418,38 @@ val_labs_dialog_create (GtkWindow *toplevel, PsppireVarStore *var_store) g_signal_connect (get_widget_assert (xml, "val_labs_cancel"), "clicked", - GTK_SIGNAL_FUNC (on_cancel), dialog); + G_CALLBACK (on_cancel), dialog); g_signal_connect (dialog->window, "delete-event", - GTK_SIGNAL_FUNC (on_delete), dialog); + G_CALLBACK (on_delete), dialog); g_signal_connect (get_widget_assert (xml, "val_labs_ok"), "clicked", - GTK_SIGNAL_FUNC (val_labs_ok), dialog); + G_CALLBACK (val_labs_ok), dialog); dialog->change_handler_id = g_signal_connect (dialog->label_entry, "changed", - GTK_SIGNAL_FUNC (on_label_entry_change), dialog); + G_CALLBACK (on_label_entry_change), dialog); dialog->value_handler_id = g_signal_connect (dialog->value_entry, "changed", - GTK_SIGNAL_FUNC (on_value_entry_change), dialog); + G_CALLBACK (on_value_entry_change), dialog); g_signal_connect (dialog->change_button, "clicked", - GTK_SIGNAL_FUNC (on_change), dialog); + G_CALLBACK (on_change), dialog); g_signal_connect (dialog->treeview, "cursor-changed", - GTK_SIGNAL_FUNC (on_select_row), dialog); + G_CALLBACK (on_select_row), dialog); g_signal_connect (dialog->remove_button, "clicked", - GTK_SIGNAL_FUNC (on_remove), dialog); + G_CALLBACK (on_remove), dialog); g_signal_connect (dialog->add_button, "clicked", - GTK_SIGNAL_FUNC (on_add), dialog); + G_CALLBACK (on_add), dialog); dialog->labs = 0;