]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-irc-network-chooser-dialog.c
debug-window: fix typo
[empathy.git] / libempathy-gtk / empathy-irc-network-chooser-dialog.c
index 5e4cb35838e654b006acd2474476f3839d92c917..00e9bf0eba36e16be58af257db9d0296975dd695 100644 (file)
 
 #include "config.h"
 
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
 #include <glib/gi18n-lib.h>
-#include <gtk/gtk.h>
 
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-irc-network-manager.h>
 
 #include "empathy-irc-network-dialog.h"
-#include "empathy-ui-utils.h"
 #include "empathy-live-search.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT | EMPATHY_DEBUG_IRC
@@ -498,16 +492,6 @@ search_text_notify_cb (EmpathyLiveSearch *search,
   gtk_widget_set_sensitive (priv->select_button, sensitive);
 }
 
-static void
-dialog_destroy_cb (GtkWidget *widget,
-    EmpathyIrcNetworkChooserDialog *self)
-{
-  EmpathyIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-
-  g_signal_handler_disconnect (priv->search, priv->search_sig);
-  g_signal_handler_disconnect (priv->search, priv->activate_sig);
-}
-
 static void
 add_clicked_cb (GtkToolButton *button,
     EmpathyIrcNetworkChooserDialog *self)
@@ -642,8 +626,6 @@ empathy_irc_network_chooser_dialog_constructed (GObject *object)
 
   g_signal_connect (self, "response",
       G_CALLBACK (dialog_response_cb), self);
-  g_signal_connect (self, "destroy",
-      G_CALLBACK (dialog_destroy_cb), self);
 
   /* Request a side ensuring to display at least some networks */
   gtk_widget_set_size_request (GTK_WIDGET (self), -1, 300);
@@ -657,6 +639,26 @@ empathy_irc_network_chooser_dialog_dispose (GObject *object)
   EmpathyIrcNetworkManager *self = (EmpathyIrcNetworkManager *) object;
   EmpathyIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
 
+  if (priv->search_sig != 0)
+    {
+      g_signal_handler_disconnect (priv->search, priv->search_sig);
+      priv->search_sig = 0;
+    }
+
+  if (priv->activate_sig != 0)
+    {
+      g_signal_handler_disconnect (priv->search, priv->activate_sig);
+      priv->activate_sig = 0;
+    }
+
+  if (priv->search != NULL)
+    {
+      empathy_live_search_set_hook_widget (EMPATHY_LIVE_SEARCH (priv->search),
+          NULL);
+
+      priv->search = NULL;
+    }
+
   tp_clear_object (&priv->settings);
   tp_clear_object (&priv->network);
   tp_clear_object (&priv->network_manager);