]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-contact-menu.c
Fix memleak in empathy_contact_invite_menu_item_new. Just calling
[empathy.git] / libempathy-gtk / empathy-contact-menu.c
index e3fb3c9f766a6b60015fce20785cb44307a1c12c..ed46d9a53b21de1d1eb3df9437e9455a4f1e7cad 100644 (file)
@@ -26,6 +26,7 @@
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 
+#include <libempathy/empathy-call-factory.h>
 #include <libempathy/empathy-log-manager.h>
 #include <libempathy/empathy-dispatcher.h>
 #include <libempathy/empathy-utils.h>
@@ -110,6 +111,14 @@ empathy_contact_menu_new (EmpathyContact             *contact,
        return menu;
 }
 
+static void
+empathy_contact_chat_menu_item_activated (GtkMenuItem *item,
+       EmpathyContact *contact)
+{
+  empathy_dispatcher_chat_with_contact (contact, NULL, NULL);
+}
+
+
 GtkWidget *
 empathy_contact_chat_menu_item_new (EmpathyContact *contact)
 {
@@ -124,13 +133,23 @@ empathy_contact_chat_menu_item_new (EmpathyContact *contact)
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
        gtk_widget_show (image);
 
-       g_signal_connect_swapped (item, "activate",
-                                 G_CALLBACK (empathy_dispatcher_chat_with_contact),
+       g_signal_connect (item, "activate",
+                                 G_CALLBACK (empathy_contact_chat_menu_item_activated),
                                  contact);
        
        return item;
 }
 
+static void
+empathy_contact_call_menu_item_activated (GtkMenuItem *item,
+       EmpathyContact *contact)
+{
+       EmpathyCallFactory *factory;
+
+       factory = empathy_call_factory_get ();
+       empathy_call_factory_new_call (factory, contact);
+}
+
 GtkWidget *
 empathy_contact_call_menu_item_new (EmpathyContact *contact)
 {
@@ -146,8 +165,8 @@ empathy_contact_call_menu_item_new (EmpathyContact *contact)
        gtk_widget_set_sensitive (item, empathy_contact_can_voip (contact));
        gtk_widget_show (image);
 
-       g_signal_connect_swapped (item, "activate",
-                                 G_CALLBACK (empathy_start_call_with_contact),
+       g_signal_connect (item, "activate",
+                                 G_CALLBACK (empathy_contact_call_menu_item_activated),
                                  contact);
        
        return item;
@@ -376,7 +395,9 @@ empathy_contact_invite_menu_item_new (EmpathyContact *contact)
                gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
        } else {
                gtk_widget_set_sensitive (item, FALSE);
-               gtk_widget_destroy (submenu);
+        g_object_ref_sink (submenu);
+        gtk_widget_destroy (submenu);
+               g_object_unref (submenu);
        }
 
        gtk_widget_show (image);