X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-value-entry.c;h=2ff858e3328c94e5b7823a0fbf8568c8115f0db9;hb=39e99af63f3280cd2d2d822eb2734371278de9df;hp=a21f10b84b9bba0ce736524d5789040422881d08;hpb=bc30bc5e0a4d8bdfc56e43ccd1403c070a71dec8;p=pspp diff --git a/src/ui/gui/psppire-value-entry.c b/src/ui/gui/psppire-value-entry.c index a21f10b84b..2ff858e332 100644 --- a/src/ui/gui/psppire-value-entry.c +++ b/src/ui/gui/psppire-value-entry.c @@ -48,6 +48,12 @@ enum PROP_WIDTH }; +enum {EDIT_DONE, /* Emitted when the entry has changed and is ready to be fetched */ + n_SIGNALS}; + +static guint signals [n_SIGNALS]; + + static void psppire_value_entry_set_property (GObject *object, guint prop_id, @@ -137,6 +143,11 @@ psppire_value_entry_text_changed (GtkEntryBuffer *buffer, obj->cur_value = NULL; } +static void +on_entry_activate (GtkWidget *w) +{ + g_signal_emit (w, signals [EDIT_DONE], 0); +} static void on_realize (GtkWidget *w) @@ -149,6 +160,9 @@ on_realize (GtkWidget *w) g_signal_connect (buffer, "notify::text", G_CALLBACK (psppire_value_entry_text_changed), w); + g_signal_connect_swapped (entry, "activate", + G_CALLBACK (on_entry_activate), w); + gtk_widget_set_can_focus (GTK_WIDGET (entry), TRUE); GTK_WIDGET_CLASS (psppire_value_entry_parent_class)->realize (w); @@ -243,6 +257,16 @@ psppire_value_entry_class_init (PsppireValueEntryClass *class) 0, MAX_STRING, 0, G_PARAM_READABLE | G_PARAM_WRITABLE)); + + signals [EDIT_DONE] = + g_signal_new ("edit-done", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); } static void @@ -493,7 +517,7 @@ psppire_value_entry_get_value (PsppireValueEntry *obj, new_text = gtk_entry_get_text (entry); return data_in_msg (ss_cstr (new_text), UTF8, - obj->format.type, + obj->format.type, settings_get_fmt_settings (), value, width, obj->encoding); } }