Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Fri, 10 Feb 2012 17:24:10 Commit: b0b0ebb469a6b7eb74d321e6f5d7fe6f0bfcf6ba https://github.com/geany/geany/commit/b0b0ebb469a6b7eb74d321e6f5d7fe6f0bfcf6...
Log Message: ----------- Make sure not to emit activation/change signals twice from entry action
If connect_proxy() get called twice, then the handlers would have been connected twice, leading to wrongly emit activation/change signals twice for a single input signal.
For whatever reason connect_proxy() is actually called twice for the quick search entry on Windows (but not on Linux), so this fixes the search entry behavior on Windows.
Modified Paths: -------------- src/geanyentryaction.c
Modified: src/geanyentryaction.c 22 files changed, 15 insertions(+), 7 deletions(-) =================================================================== @@ -40,6 +40,7 @@ struct _GeanyEntryActionPrivate { GtkWidget *entry; gboolean numeric; + gboolean connected; };
enum @@ -108,13 +109,19 @@ static void geany_entry_action_connect_proxy(GtkAction *action, GtkWidget *widge { GeanyEntryActionPrivate *priv = GEANY_ENTRY_ACTION_GET_PRIVATE(action);
- if (priv->numeric) - g_signal_connect(priv->entry, "insert-text", - G_CALLBACK(ui_editable_insert_text_callback), NULL); - g_signal_connect(priv->entry, "changed", G_CALLBACK(delegate_entry_changed_cb), action); - g_signal_connect(priv->entry, "activate", G_CALLBACK(delegate_entry_activate_cb), action); - g_signal_connect(priv->entry, "activate-backward", - G_CALLBACK(delegate_entry_activate_backward_cb), action); + /* make sure not to connect handlers twice */ + if (! priv->connected) + { + if (priv->numeric) + g_signal_connect(priv->entry, "insert-text", + G_CALLBACK(ui_editable_insert_text_callback), NULL); + g_signal_connect(priv->entry, "changed", G_CALLBACK(delegate_entry_changed_cb), action); + g_signal_connect(priv->entry, "activate", G_CALLBACK(delegate_entry_activate_cb), action); + g_signal_connect(priv->entry, "activate-backward", + G_CALLBACK(delegate_entry_activate_backward_cb), action); + + priv->connected = TRUE; + }
GTK_ACTION_CLASS(geany_entry_action_parent_class)->connect_proxy(action, widget); } @@ -167,6 +174,7 @@ static void geany_entry_action_init(GeanyEntryAction *action) priv = action->priv; priv->entry = NULL; priv->numeric = FALSE; + priv->connected = FALSE; }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).