diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-03-28 19:29:23 -0400 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-03-28 19:29:23 -0400 |
commit | 69012ceacae43466b54cfba6e9c113e51977ea35 (patch) | |
tree | 7bd67612e5e1b8a1305c1025b7e87ebe05bec106 /gladeui/glade-base-editor.c | |
parent | 5def911c59d18adb6fcb333c23112edd99689ab2 (diff) | |
download | glade-69012ceacae43466b54cfba6e9c113e51977ea35.tar.gz |
2010-03-28 Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
* gladeui/glade-base-editor.c: Avoid GtkEntry feedback loop with g_signal_handlers_block_by_func(),
fixes bug 609612.
Diffstat (limited to 'gladeui/glade-base-editor.c')
-rw-r--r-- | gladeui/glade-base-editor.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/gladeui/glade-base-editor.c b/gladeui/glade-base-editor.c index 40a2b90c..37924fe7 100644 --- a/gladeui/glade-base-editor.c +++ b/gladeui/glade-base-editor.c @@ -316,22 +316,28 @@ glade_base_editor_get_child_selected (GladeBaseEditor *e, GtkTreeIter *iter) return gtk_tree_selection_get_selected (sel, NULL, iter); } +/* Forward declaration for glade_base_editor_project_widget_name_changed */ +static void +glade_base_editor_project_widget_name_changed (GladeProject *project, + GladeWidget *widget, + GladeBaseEditor *editor); + static void glade_base_editor_name_activate (GtkEntry *entry, GladeWidget *gchild) { const gchar *text = gtk_entry_get_text (GTK_ENTRY (entry)); - + GladeBaseEditor *editor = g_object_get_data (G_OBJECT (entry), "editor"); + if (strcmp (glade_widget_get_name (gchild), text)) + { + g_signal_handlers_block_by_func (gchild->project, + glade_base_editor_project_widget_name_changed, + editor); glade_command_set_name (gchild, text); -} - -static gboolean -glade_base_editor_name_focus_out (GtkWidget *entry, - GdkEventFocus *event, - GladeWidget *gchild) -{ - glade_base_editor_name_activate (GTK_ENTRY (entry), gchild); - return FALSE; + g_signal_handlers_unblock_by_func (gchild->project, + glade_base_editor_project_widget_name_changed, + editor); + } } static void @@ -1976,8 +1982,9 @@ glade_base_editor_add_default_properties (GladeBaseEditor *editor, entry = gtk_entry_new (); gtk_entry_set_text (GTK_ENTRY (entry), glade_widget_get_name (gchild)); + g_object_set_data (G_OBJECT (entry), "editor", editor); g_signal_connect (entry, "activate", G_CALLBACK (glade_base_editor_name_activate), gchild); - g_signal_connect (entry, "focus-out-event", G_CALLBACK (glade_base_editor_name_focus_out), gchild); + g_signal_connect (entry, "changed", G_CALLBACK (glade_base_editor_name_activate), gchild); glade_base_editor_table_attach (editor, label, entry); if (child_class && gtk_tree_model_iter_n_children (child_class, NULL) > 1) |