/pidgin/main: 0145b9f2d77c: GTK Notify: decorete purple_notify_m...

Tomasz Wasilczyk twasilczyk at pidgin.im
Sat Sep 21 06:26:34 EDT 2013


Changeset: 0145b9f2d77c33093f505c662d51ad9ff3d77593
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2013-09-21 12:26 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/0145b9f2d77c

Description:

GTK Notify: decorete purple_notify_message windows with account icon

diffstat:

 pidgin/gtknotify.c |  32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diffs (49 lines):

diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c
--- a/pidgin/gtknotify.c
+++ b/pidgin/gtknotify.c
@@ -507,6 +507,35 @@ searchresults_callback_wrapper_cb(GtkWid
 	g_list_free(row);
 }
 
+/* copy-paste from gtkrequest.c */
+static void
+pidgin_widget_decorate_account(GtkWidget *cont, PurpleAccount *account)
+{
+	GtkWidget *image;
+	GdkPixbuf *pixbuf;
+
+	if (!account)
+		return;
+
+	pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL);
+	image = gtk_image_new_from_pixbuf(pixbuf);
+	g_object_unref(G_OBJECT(pixbuf));
+
+	gtk_widget_set_tooltip_text(image,
+		purple_account_get_username(account));
+
+	if (GTK_IS_DIALOG(cont)) {
+		gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(
+			GTK_DIALOG(cont))), image, FALSE, TRUE, 0);
+		gtk_box_reorder_child(GTK_BOX(gtk_dialog_get_action_area(
+			GTK_DIALOG(cont))), image, 0);
+	} else if (GTK_IS_HBOX(cont)) {
+		gtk_misc_set_alignment(GTK_MISC(image), 0, 0);
+		gtk_box_pack_end(GTK_BOX(cont), image, FALSE, TRUE, 0);
+	}
+	gtk_widget_show(image);
+}
+
 static void *
 pidgin_notify_message(PurpleNotifyMsgType type, const char *title,
 	const char *primary, const char *secondary,
@@ -568,6 +597,9 @@ pidgin_notify_message(PurpleNotifyMsgTyp
 	if (img != NULL)
 		gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
 
+	pidgin_widget_decorate_account(hbox,
+		purple_request_cpar_get_account(cpar));
+
 	primary_esc = g_markup_escape_text(primary, -1);
 	secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL;
 	g_snprintf(label_text, sizeof(label_text),



More information about the Commits mailing list