aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-status-icon.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2009-01-31 01:07:12 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-31 01:07:12 +0800
commitaec95ff0ec211bb0c5d65e599033e9e60f18b29c (patch)
treee9aeb2ed9d055f184c2fff0beee67e9864425d3f /src/empathy-status-icon.c
parenta7b83a0c05d85d2fd562139906f4006af9fa843e (diff)
downloadgsoc2013-empathy-aec95ff0ec211bb0c5d65e599033e9e60f18b29c.tar.gz
gsoc2013-empathy-aec95ff0ec211bb0c5d65e599033e9e60f18b29c.tar.zst
gsoc2013-empathy-aec95ff0ec211bb0c5d65e599033e9e60f18b29c.zip
Split the event description into header and message body.
Add a way to update a pending event. svn path=/trunk/; revision=2278
Diffstat (limited to 'src/empathy-status-icon.c')
-rw-r--r--src/empathy-status-icon.c68
1 files changed, 46 insertions, 22 deletions
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index 1951e419f..6635b91be 100644
--- a/src/empathy-status-icon.c
+++ b/src/empathy-status-icon.c
@@ -106,28 +106,34 @@ status_icon_update_notification (EmpathyStatusIcon *icon)
EmpathyStatusIconPriv *priv = GET_PRIV (icon);
if (priv->event) {
- GdkPixbuf *pixbuf = NULL;
-
- if (g_strcmp0 (priv->event->icon_name, EMPATHY_IMAGE_NEW_MESSAGE) == 0) {
- pixbuf = empathy_pixbuf_avatar_from_contact_scaled (priv->event->contact,
- 48, 48);
- }
-
- if (!pixbuf) {
- /* we use INVALID here so we fall pack to 48px */
- pixbuf = empathy_pixbuf_from_icon_name (priv->event->icon_name,
- GTK_ICON_SIZE_INVALID);
- }
-
- 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);
+ if (priv->notification) {
+ notify_notification_update (priv->notification,
+ priv->event->header, priv->event->message,
+ NULL);
+ } else {
+ GdkPixbuf *pixbuf = NULL;
+
+ if (g_strcmp0 (priv->event->icon_name, EMPATHY_IMAGE_NEW_MESSAGE) == 0) {
+ pixbuf = empathy_pixbuf_avatar_from_contact_scaled (priv->event->contact,
+ 48, 48);
+ }
+
+ if (!pixbuf) {
+ /* we use INVALID here so we fall pack to 48px */
+ pixbuf = empathy_pixbuf_from_icon_name (priv->event->icon_name,
+ GTK_ICON_SIZE_INVALID);
+ }
+
+ 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);
+ }
notify_notification_show (priv->notification, NULL);
} else {
@@ -242,6 +248,21 @@ status_icon_event_removed_cb (EmpathyEventManager *manager,
}
static void
+status_icon_event_updated_cb (EmpathyEventManager *manager,
+ EmpathyEvent *event,
+ EmpathyStatusIcon *icon)
+{
+ EmpathyStatusIconPriv *priv = GET_PRIV (icon);
+
+ if (event != priv->event) {
+ return;
+ }
+
+ status_icon_update_notification (icon);
+ status_icon_update_tooltip (icon);
+}
+
+static void
status_icon_set_visibility (EmpathyStatusIcon *icon,
gboolean visible,
gboolean store)
@@ -506,6 +527,9 @@ empathy_status_icon_init (EmpathyStatusIcon *icon)
g_signal_connect (priv->event_manager, "event-removed",
G_CALLBACK (status_icon_event_removed_cb),
icon);
+ g_signal_connect (priv->event_manager, "event-updated",
+ G_CALLBACK (status_icon_event_updated_cb),
+ icon);
g_signal_connect (priv->icon, "activate",
G_CALLBACK (status_icon_activate_cb),
icon);