]> spindle.queued.net Git - midori/commitdiff
Hitting Return or Enter in a Preferences entry applies it
authorChristian Dywan <christian@twotoasts.de>
Thu, 16 Oct 2008 18:36:42 +0000 (20:36 +0200)
committerChristian Dywan <christian@twotoasts.de>
Thu, 16 Oct 2008 18:36:42 +0000 (20:36 +0200)
katze/katze-utils.c

index af2d3857b4079044b5a117044eae100041b1ce1b..ce619781c03b02156111e24c5c58b599ae29ead1 100644 (file)
@@ -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);
     }