From: Christian Dywan Date: Thu, 16 Oct 2008 18:36:42 +0000 (+0200) Subject: Hitting Return or Enter in a Preferences entry applies it X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a12f3d10e0874818794585c9f44776b59f8f6c57;p=midori Hitting Return or Enter in a Preferences entry applies it --- diff --git a/katze/katze-utils.c b/katze/katze-utils.c index af2d3857..ce619781 100644 --- a/katze/katze-utils.c +++ b/katze/katze-utils.c @@ -59,6 +59,16 @@ proxy_combo_box_text_changed_cb (GtkComboBox* button, GObject* object) return FALSE; } +static gboolean +proxy_entry_activate_cb (GtkEntry* entry, + GObject* object) +{ + const gchar* text = gtk_entry_get_text (entry); + const gchar* property = g_object_get_data (G_OBJECT (entry), "property"); + g_object_set (object, property, text, NULL); + return FALSE; +} + static gboolean proxy_entry_focus_out_event_cb (GtkEntry* entry, GdkEventFocus* event, @@ -241,6 +251,8 @@ katze_property_proxy (gpointer object, if (!string) string = g_strdup (G_PARAM_SPEC_STRING (pspec)->default_value); gtk_entry_set_text (GTK_ENTRY (widget), string ? string : ""); + g_signal_connect (widget, "activate", + G_CALLBACK (proxy_entry_activate_cb), object); g_signal_connect (widget, "focus-out-event", G_CALLBACK (proxy_entry_focus_out_event_cb), object); }