From 3e53d46bb756fad2fc25c70f1923af01f9b0574e Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 25 Jul 2003 17:03:50 +0000 Subject: Make sure to remove the timeout on widget destruction 2003-07-25 Marco Pesenti Gritti * lib/widgets/ephy-search-entry.c: (ephy_search_entry_destroy_cb), (ephy_search_entry_init): Make sure to remove the timeout on widget destruction --- lib/widgets/ephy-search-entry.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'lib/widgets') diff --git a/lib/widgets/ephy-search-entry.c b/lib/widgets/ephy-search-entry.c index 9837da909..e1b106594 100644 --- a/lib/widgets/ephy-search-entry.c +++ b/lib/widgets/ephy-search-entry.c @@ -125,34 +125,29 @@ ephy_search_entry_changed_cb (GtkEditable *editable, entry->priv->timeout = g_timeout_add (300, (GSourceFunc) ephy_search_entry_timeout_cb, entry); } -static gboolean -ephy_search_entry_focus_out_event_cb (GtkWidget *widget, - GdkEventFocus *event, - EphySearchEntry *entry) +static void +ephy_search_entry_destroy_cb (GtkEditable *editable, + EphySearchEntry *entry) { - if (entry->priv->timeout == 0) - return FALSE; - - g_source_remove (entry->priv->timeout); - entry->priv->timeout = 0; - - g_signal_emit (G_OBJECT (entry), ephy_search_entry_signals[SEARCH], 0, - gtk_entry_get_text (GTK_ENTRY (entry))); - - return FALSE; + if (entry->priv->timeout) + { + g_source_remove (entry->priv->timeout); + entry->priv->timeout = 0; + } } + static void ephy_search_entry_init (EphySearchEntry *entry) { entry->priv = g_new0 (EphySearchEntryPrivate, 1); g_signal_connect (G_OBJECT (entry), - "changed", - G_CALLBACK (ephy_search_entry_changed_cb), + "destroy", + G_CALLBACK (ephy_search_entry_destroy_cb), entry); g_signal_connect (G_OBJECT (entry), - "focus_out_event", - G_CALLBACK (ephy_search_entry_focus_out_event_cb), + "changed", + G_CALLBACK (ephy_search_entry_changed_cb), entry); } -- cgit v1.2.3