Hitting Return or Enter in a Preferences entry applies it

This commit is contained in:
Christian Dywan 2008-10-16 20:36:42 +02:00
parent 43b1959762
commit a12f3d10e0

View file

@ -59,6 +59,16 @@ proxy_combo_box_text_changed_cb (GtkComboBox* button, GObject* object)
return FALSE; 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 static gboolean
proxy_entry_focus_out_event_cb (GtkEntry* entry, proxy_entry_focus_out_event_cb (GtkEntry* entry,
GdkEventFocus* event, GdkEventFocus* event,
@ -241,6 +251,8 @@ katze_property_proxy (gpointer object,
if (!string) if (!string)
string = g_strdup (G_PARAM_SPEC_STRING (pspec)->default_value); string = g_strdup (G_PARAM_SPEC_STRING (pspec)->default_value);
gtk_entry_set_text (GTK_ENTRY (widget), string ? string : ""); 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_signal_connect (widget, "focus-out-event",
G_CALLBACK (proxy_entry_focus_out_event_cb), object); G_CALLBACK (proxy_entry_focus_out_event_cb), object);
} }