[empathy: 1/3] empathy_subscription_dialog_show: display user's message if any (#630707)



commit e390a8a182a198b0e7a8f60a760773019f6d4e08
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Wed Oct 27 18:57:08 2010 +0200

    empathy_subscription_dialog_show: display user's message if any (#630707)

 libempathy-gtk/empathy-contact-dialogs.c |   25 ++++++++++++++++++++++++-
 libempathy-gtk/empathy-contact-dialogs.h |    1 +
 src/empathy-event-manager.c              |    2 +-
 3 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c
index 9189d41..a5ae51d 100644
--- a/libempathy-gtk/empathy-contact-dialogs.c
+++ b/libempathy-gtk/empathy-contact-dialogs.c
@@ -91,11 +91,13 @@ subscription_dialog_response_cb (GtkDialog *dialog,
 
 void
 empathy_subscription_dialog_show (EmpathyContact *contact,
+				  const gchar *message,
 				  GtkWindow     *parent)
 {
 	GtkBuilder *gui;
 	GtkWidget *dialog;
 	GtkWidget *hbox_subscription;
+	GtkWidget *vbox;
 	GtkWidget *contact_widget;
 	GList     *l;
 	gchar     *filename;
@@ -119,16 +121,37 @@ empathy_subscription_dialog_show (EmpathyContact *contact,
 	g_free (filename);
 	g_object_unref (gui);
 
+	vbox = gtk_vbox_new (FALSE, 6);
+
+	gtk_box_pack_end (GTK_BOX (hbox_subscription), vbox,
+			  TRUE, TRUE, 0);
+
 	/* Contact info widget */
 	contact_widget = empathy_contact_widget_new (contact,
 						     EMPATHY_CONTACT_WIDGET_NO_SET_ALIAS |
 						     EMPATHY_CONTACT_WIDGET_EDIT_ALIAS |
 						     EMPATHY_CONTACT_WIDGET_EDIT_GROUPS);
-	gtk_box_pack_end (GTK_BOX (hbox_subscription),
+	gtk_box_pack_start (GTK_BOX (vbox),
 			  contact_widget,
 			  TRUE, TRUE,
 			  0);
+
+	if (!tp_str_empty (message)) {
+		GtkWidget *label;
+		gchar *tmp;
+
+		label = gtk_label_new ("");
+		tmp = g_strdup_printf ("<i>%s</i>", message);
+
+		gtk_label_set_markup (GTK_LABEL (label), tmp);
+		g_free (tmp);
+		gtk_widget_show (label);
+
+		gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+	}
+
 	gtk_widget_show (contact_widget);
+	gtk_widget_show (vbox);
 
 	g_object_set_data (G_OBJECT (dialog), "contact_widget", contact_widget);
 	subscription_dialogs = g_list_prepend (subscription_dialogs, dialog);
diff --git a/libempathy-gtk/empathy-contact-dialogs.h b/libempathy-gtk/empathy-contact-dialogs.h
index 21aa5ce..8c3ffc6 100644
--- a/libempathy-gtk/empathy-contact-dialogs.h
+++ b/libempathy-gtk/empathy-contact-dialogs.h
@@ -29,6 +29,7 @@
 G_BEGIN_DECLS
 
 void empathy_subscription_dialog_show        (EmpathyContact *contact,
+				              const gchar *message,
 				              GtkWindow      *parent);
 void empathy_contact_information_dialog_show (EmpathyContact *contact,
 					      GtkWindow      *parent);
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index 1145d1b..afd9432 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -976,7 +976,7 @@ out:
 static void
 event_pending_subscribe_func (EventPriv *event)
 {
-  empathy_subscription_dialog_show (event->public.contact, NULL);
+  empathy_subscription_dialog_show (event->public.contact, NULL, NULL);
   event_remove (event);
 }
 



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