[empathy] Hook up the callback to throw up the standard Add Contact dialog



commit 4e13ee5ecdbeb71559b76ee2080c9e58385c3ad8
Author: Davyd Madeley <davyd madeley id au>
Date:   Tue Feb 24 14:56:26 2009 +0900

    Hook up the callback to throw up the standard Add Contact dialog

 libempathy-gtk/empathy-contact-dialogs.c |    9 ++++++++-
 libempathy-gtk/empathy-contact-dialogs.h |    7 ++++++-
 libempathy-gtk/empathy-contact-menu.c    |   17 ++++++++++++++---
 3 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c
index 0155f61..5636714 100644
--- a/libempathy-gtk/empathy-contact-dialogs.c
+++ b/libempathy-gtk/empathy-contact-dialogs.c
@@ -370,6 +370,13 @@ new_contact_response_cb (GtkDialog *dialog,
 void
 empathy_new_contact_dialog_show (GtkWindow *parent)
 {
+	empathy_new_contact_dialog_show_with_contact (parent, NULL);
+}
+
+void
+empathy_new_contact_dialog_show_with_contact (GtkWindow *parent,
+                                              EmpathyContact *contact)
+{
 	GtkWidget *dialog;
 	GtkWidget *button;
 	GtkWidget *contact_widget;
@@ -402,7 +409,7 @@ empathy_new_contact_dialog_show (GtkWindow *parent)
 	gtk_widget_show (button);
 
 	/* Contact info widget */
-	contact_widget = empathy_contact_widget_new (NULL,
+	contact_widget = empathy_contact_widget_new (contact,
 						     EMPATHY_CONTACT_WIDGET_EDIT_ALIAS |
 						     EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT |
 						     EMPATHY_CONTACT_WIDGET_EDIT_ID |
diff --git a/libempathy-gtk/empathy-contact-dialogs.h b/libempathy-gtk/empathy-contact-dialogs.h
index c714c6b..5e881ab 100644
--- a/libempathy-gtk/empathy-contact-dialogs.h
+++ b/libempathy-gtk/empathy-contact-dialogs.h
@@ -35,7 +35,12 @@ void empathy_contact_information_dialog_show (EmpathyContact *contact,
 void empathy_contact_edit_dialog_show        (EmpathyContact *contact,
 					      GtkWindow      *parent);
 void empathy_contact_personal_dialog_show    (GtkWindow      *parent);
-void empathy_new_contact_dialog_show         (GtkWindow      *parent);
+					      GtkWindow     *parent,
+					      gboolean       edit,
+					      gboolean       is_user);
+void empathy_new_contact_dialog_show         (GtkWindow     *parent);
+void empathy_new_contact_dialog_show_with_contact (GtkWindow     *parent,
+                                                   EmpathyContact *contact);
 
 G_END_DECLS
 
diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c
index 9969f3d..44b0016 100644
--- a/libempathy-gtk/empathy-contact-menu.c
+++ b/libempathy-gtk/empathy-contact-menu.c
@@ -126,10 +126,12 @@ empathy_contact_menu_new (EmpathyContact             *contact,
 }
 
 static void
-empathy_contact_chat_menu_item_activated (GtkMenuItem *item,
+empathy_contact_add_menu_item_activated (GtkMenuItem *item,
 	EmpathyContact *contact)
 {
-  empathy_dispatcher_chat_with_contact (contact, NULL, NULL);
+	/* FIXME - attempt to get parent */
+	/* FIXME - the contact dialog doesn't set the source account right */
+	empathy_new_contact_dialog_show_with_contact (NULL, contact);
 }
 
 GtkWidget *
@@ -163,11 +165,20 @@ empathy_contact_add_menu_item_new (EmpathyContact *contact)
 					      GTK_ICON_SIZE_MENU);
 	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
 
-	/* FIXME - callback */
+	g_signal_connect (item, "activate",
+			G_CALLBACK (empathy_contact_add_menu_item_activated),
+			contact);
 
 	return item;
 }
 
+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)
 {



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