[empathy] Add an EmpathyIndividualMenu::link-contacts-activated signal



commit 5bd4329e0aab6dd6a4a8e084ff8c46873fdcc525
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Wed Sep 1 17:51:50 2010 +0100

    Add an EmpathyIndividualMenu::link-contacts-activated signal
    
    This is emitted each time the â??Link Contactsâ?¦â?? menu entry is activated.
    Helps: bgo#628133

 libempathy-gtk/empathy-individual-menu.c |   36 ++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 9 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c
index 622d278..b0d734e 100644
--- a/libempathy-gtk/empathy-individual-menu.c
+++ b/libempathy-gtk/empathy-individual-menu.c
@@ -62,6 +62,13 @@ enum {
   PROP_FEATURES,
 };
 
+enum {
+  SIGNAL_LINK_CONTACTS_ACTIVATED,
+  LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
 G_DEFINE_TYPE (EmpathyIndividualMenu, empathy_individual_menu, GTK_TYPE_MENU);
 
 static void
@@ -189,6 +196,16 @@ individual_menu_add_personas (GtkMenuShell *menu,
 }
 
 static void
+individual_link_menu_item_activate_cb (EmpathyIndividualMenu *self)
+{
+  EmpathyIndividualMenuPriv *priv = GET_PRIV (self);
+  GtkWidget *dialog;
+
+  dialog = empathy_linking_dialog_show (priv->individual, NULL);
+  g_signal_emit (self, signals[SIGNAL_LINK_CONTACTS_ACTIVATED], 0, dialog);
+}
+
+static void
 empathy_individual_menu_init (EmpathyIndividualMenu *self)
 {
   EmpathyIndividualMenuPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
@@ -295,6 +312,10 @@ constructed (GObject *object)
     {
       item = empathy_individual_link_menu_item_new (individual);
       gtk_menu_shell_append (shell, item);
+
+      g_signal_connect_swapped (item, "activate",
+          (GCallback) individual_link_menu_item_activate_cb, object);
+
       gtk_widget_show (item);
     }
 
@@ -408,6 +429,12 @@ empathy_individual_menu_class_init (EmpathyIndividualMenuClass *klass)
           EMPATHY_INDIVIDUAL_FEATURE_NONE,
           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
 
+  signals[SIGNAL_LINK_CONTACTS_ACTIVATED] =
+      g_signal_new ("link-contacts-activated", G_OBJECT_CLASS_TYPE (klass),
+          G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+          g_cclosure_marshal_VOID__OBJECT,
+          G_TYPE_NONE, 1, EMPATHY_TYPE_LINKING_DIALOG);
+
   g_type_class_add_private (object_class, sizeof (EmpathyIndividualMenuPriv));
 }
 
@@ -966,12 +993,6 @@ empathy_individual_edit_menu_item_new (FolksIndividual *individual)
   return item;
 }
 
-static void
-individual_link_menu_item_activate_cb (FolksIndividual *individual)
-{
-  empathy_linking_dialog_show (individual, NULL);
-}
-
 GtkWidget *
 empathy_individual_link_menu_item_new (FolksIndividual *individual)
 {
@@ -994,9 +1015,6 @@ empathy_individual_link_menu_item_new (FolksIndividual *individual)
       folks_individual_get_trust_level (individual) ==
           FOLKS_TRUST_LEVEL_PERSONAS);
 
-  g_signal_connect_swapped (item, "activate",
-      G_CALLBACK (individual_link_menu_item_activate_cb), individual);
-
   return item;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]