aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2009-01-31 01:08:23 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-31 01:08:23 +0800
commit81562d740490d4032d93a6aaa8c32b7310023745 (patch)
tree4297de34f6cbb969f99713d7e7965ed35c41094a /src
parent62fe3985b8fdca2ccc40030a46def1c73ec1430f (diff)
downloadgsoc2013-empathy-81562d740490d4032d93a6aaa8c32b7310023745.tar
gsoc2013-empathy-81562d740490d4032d93a6aaa8c32b7310023745.tar.gz
gsoc2013-empathy-81562d740490d4032d93a6aaa8c32b7310023745.tar.bz2
gsoc2013-empathy-81562d740490d4032d93a6aaa8c32b7310023745.tar.lz
gsoc2013-empathy-81562d740490d4032d93a6aaa8c32b7310023745.tar.xz
gsoc2013-empathy-81562d740490d4032d93a6aaa8c32b7310023745.tar.zst
gsoc2013-empathy-81562d740490d4032d93a6aaa8c32b7310023745.zip
Update the pixbuf when we receive an event update.
svn path=/trunk/; revision=2300
Diffstat (limited to 'src')
-rw-r--r--src/empathy-status-icon.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index 5d04e4b57..ceae25474 100644
--- a/src/empathy-status-icon.c
+++ b/src/empathy-status-icon.c
@@ -109,43 +109,52 @@ status_icon_notification_closed_cb (NotifyNotification *notification,
}
}
+static GdkPixbuf *
+get_pixbuf_for_event (EmpathyEvent *event)
+{
+ GdkPixbuf *pixbuf = NULL;
+
+ if (event->contact != NULL) {
+ pixbuf = empathy_pixbuf_avatar_from_contact_scaled (event->contact,
+ 48, 48);
+ }
+
+ if (!pixbuf) {
+ pixbuf = empathy_pixbuf_from_icon_name_sized
+ (event->icon_name, 48);
+ }
+
+ return pixbuf;
+}
+
static void
status_icon_update_notification (EmpathyStatusIcon *icon)
{
EmpathyStatusIconPriv *priv = GET_PRIV (icon);
+ GdkPixbuf *pixbuf = NULL;
if (priv->event) {
+ pixbuf = get_pixbuf_for_event (priv->event);
+
if (priv->notification) {
notify_notification_update (priv->notification,
priv->event->header, priv->event->message,
NULL);
} else {
- GdkPixbuf *pixbuf = NULL;
-
- if (priv->event->contact != NULL) {
- pixbuf = empathy_pixbuf_avatar_from_contact_scaled (priv->event->contact,
- 48, 48);
- }
-
- if (!pixbuf) {
- pixbuf = empathy_pixbuf_from_icon_name_sized
- (priv->event->icon_name, 48);
- }
-
priv->notification = notify_notification_new_with_status_icon
(priv->event->header, priv->event->message, NULL, priv->icon);
notify_notification_set_timeout (priv->notification,
NOTIFY_EXPIRES_DEFAULT);
- notify_notification_set_icon_from_pixbuf (priv->notification,
- pixbuf);
g_signal_connect (priv->notification, "closed",
G_CALLBACK (status_icon_notification_closed_cb), icon);
- g_object_unref (pixbuf);
}
-
+ notify_notification_set_icon_from_pixbuf (priv->notification,
+ pixbuf);
notify_notification_show (priv->notification, NULL);
+
+ g_object_unref (pixbuf);
} else {
if (priv->notification) {
notify_notification_close (priv->notification, NULL);