]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-contact-list-view.c
Add en_GB in gitignore
[empathy.git] / libempathy-gtk / empathy-contact-list-view.c
index 2d6b1703fae624eba58cf40abf1aa7baccebbe3e..b7a6601c6e4b6ca2961377461d46a2f60112f5fe 100644 (file)
 
 #include <string.h>
 
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 #include <glade/glade.h>
 
 #include <libmissioncontrol/mc-account.h>
 
+#include <libempathy/empathy-call-factory.h>
 #include <libempathy/empathy-contact-factory.h>
 #include <libempathy/empathy-contact-list.h>
 #include <libempathy/empathy-contact-groups.h>
@@ -114,6 +115,19 @@ static guint signals[LAST_SIGNAL];
 
 G_DEFINE_TYPE (EmpathyContactListView, empathy_contact_list_view, GTK_TYPE_TREE_VIEW);
 
+static void
+contact_list_view_tooltip_destroy_cb (GtkWidget              *widget,
+                                     EmpathyContactListView *view)
+{
+       EmpathyContactListViewPriv *priv = GET_PRIV (view);
+       
+       if (priv->tooltip_widget) {
+               DEBUG ("Tooltip destroyed");
+               priv->tooltip_widget = NULL;
+               g_object_unref (widget);
+       }
+}
+
 static gboolean
 contact_list_view_query_tooltip_cb (EmpathyContactListView *view,
                                    gint                    x,
@@ -152,8 +166,10 @@ contact_list_view_query_tooltip_cb (EmpathyContactListView *view,
        if (!priv->tooltip_widget) {
                priv->tooltip_widget = empathy_contact_widget_new (contact,
                        EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP);
-               g_object_add_weak_pointer (G_OBJECT (priv->tooltip_widget),
-                                          (gpointer) &priv->tooltip_widget);
+               g_object_ref (priv->tooltip_widget);
+               g_signal_connect (priv->tooltip_widget, "destroy",
+                                 G_CALLBACK (contact_list_view_tooltip_destroy_cb),
+                                 view);
        } else {
                empathy_contact_widget_set_contact (priv->tooltip_widget,
                                                    contact);
@@ -198,7 +214,7 @@ contact_list_view_drag_data_received (GtkWidget         *widget,
                id);
 
        strv = g_strsplit (id, "/", 2);
-       factory = empathy_contact_factory_new ();
+       factory = empathy_contact_factory_dup_singleton ();
        account = mc_account_lookup (strv[0]);
        if (account) {
                contact = empathy_contact_factory_get_from_id (factory,
@@ -527,7 +543,7 @@ contact_list_view_row_activated (GtkTreeView       *view,
 
        if (contact) {
                DEBUG ("Starting a chat");
-               empathy_dispatcher_chat_with_contact (contact);
+               empathy_dispatcher_chat_with_contact (contact, NULL, NULL);
                g_object_unref (contact);
        }
 }
@@ -556,7 +572,11 @@ contact_list_view_voip_activated_cb (EmpathyCellRendererActivatable *cell,
                            -1);
 
        if (contact) {
-               empathy_dispatcher_call_with_contact (contact);
+               EmpathyCallFactory *factory;
+
+               factory = empathy_call_factory_get ();
+               empathy_call_factory_new_call (factory, contact);
+
                g_object_unref (contact);
        }
 }
@@ -777,7 +797,7 @@ contact_list_view_row_has_child_toggled_cb (GtkTreeModel          *model,
                            EMPATHY_CONTACT_LIST_STORE_COL_NAME, &name,
                            -1);
 
-       if (!is_group || G_STR_EMPTY (name)) {
+       if (!is_group || EMP_STR_EMPTY (name)) {
                g_free (name);
                return;
        }
@@ -966,6 +986,9 @@ contact_list_view_finalize (GObject *object)
        if (priv->store) {
                g_object_unref (priv->store);
        }
+       if (priv->tooltip_widget) {
+               gtk_widget_destroy (priv->tooltip_widget);
+       }
 
        G_OBJECT_CLASS (empathy_contact_list_view_parent_class)->finalize (object);
 }