Empathy Hard code freeze exception request: Hard to accept incoming calls and file transfer (#645932)



Hey,

https://bugzilla.gnome.org/show_bug.cgi?id=645932#c18

Atm it's very hard for users to notice incoming calls, file transfer,
muc invitations, etc because the Shell blacklist all the notifications
from Empathy. It should only ignore the chat ones (as they are replaced
by the message tray) so I cooked 2 branches doing that:

http://git.collabora.co.uk/?p=user/cassidy/empathy;a=shortlog;h=refs/heads/shell-notif-645932
http://git.collabora.co.uk/?p=user/cassidy/gnome-shell;a=shortlog;h=refs/heads/empathy-notif-645932


I still have to ask Owen before considering merging the shell branch,
but we could already merge the Empathy one.
Even if the Shell patch is not merged for 3.0, merging the Empathy
patches shouldn't hurt and will ensure that Empathy 3.0 is ready.

Jonny already reviewed the patches.


	G.

-- 
Guillaume Desmottes <gdesmott gnome org>
Jabber <cassidy jabber belnet be>
GPG 1024D/711E31B1 | 1B5A 1BA8 11AA F0F1 2169  E28A AC55 8671 711E 31B1
>From c607c2da6d2e7d4407752f9b8b38e54d76efd8db Mon Sep 17 00:00:00 2001
From: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Tue, 29 Mar 2011 09:48:22 +0200
Subject: [PATCH 1/3] set urgency hint on urgent notifications

This will ensure that they stay visible in the Shell and that their actions
buttons are displayed as well (#645932).
---
 src/empathy-notifications-approver.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/src/empathy-notifications-approver.c b/src/empathy-notifications-approver.c
index e0d540c..9f1774a 100644
--- a/src/empathy-notifications-approver.c
+++ b/src/empathy-notifications-approver.c
@@ -222,6 +222,28 @@ add_notification_actions (EmpathyNotificationsApprover *self,
   }
 }
 
+static gboolean
+notification_is_urgent (EmpathyNotificationsApprover *self,
+    NotifyNotification *notification)
+{
+  /* Mark as urgent all the notifications with which user should
+   * interact ASAP */
+  switch (self->priv->event->type) {
+    case EMPATHY_EVENT_TYPE_CHAT:
+    case EMPATHY_EVENT_TYPE_VOIP:
+    case EMPATHY_EVENT_TYPE_TRANSFER:
+    case EMPATHY_EVENT_TYPE_INVITATION:
+    case EMPATHY_EVENT_TYPE_AUTH:
+      return TRUE;
+
+    case EMPATHY_EVENT_TYPE_SUBSCRIPTION:
+    case EMPATHY_EVENT_TYPE_PRESENCE:
+      return FALSE;
+  }
+
+  return FALSE;
+}
+
 static void
 update_notification (EmpathyNotificationsApprover *self)
 {
@@ -288,6 +310,9 @@ update_notification (EmpathyNotificationsApprover *self)
       if (empathy_notify_manager_has_capability (self->priv->notify_mgr,
             EMPATHY_NOTIFY_MANAGER_CAP_ACTIONS))
         add_notification_actions (self, notification);
+
+      if (notification_is_urgent (self, notification))
+        notify_notification_set_urgency (notification, NOTIFY_URGENCY_CRITICAL);
     }
 
   pixbuf = empathy_notify_manager_get_pixbuf_for_notification (
-- 
1.7.4.1

>From 6eb4b232c739430da0dfcc4204b244ebff277024 Mon Sep 17 00:00:00 2001
From: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Tue, 29 Mar 2011 10:07:01 +0200
Subject: [PATCH 2/3] set a category on chat related notifications

That can be used by the Shell to filter out notifications it's handling itself
directly (#645932).
---
 libempathy-gtk/empathy-notify-manager.h |    1 +
 src/empathy-notifications-approver.c    |   25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/libempathy-gtk/empathy-notify-manager.h b/libempathy-gtk/empathy-notify-manager.h
index f7c5e4c..dd7565c 100644
--- a/libempathy-gtk/empathy-notify-manager.h
+++ b/libempathy-gtk/empathy-notify-manager.h
@@ -32,6 +32,7 @@ G_BEGIN_DECLS
 #define EMPATHY_NOTIFY_MANAGER_CAP_BODY_HYPERLINKS     "body-hyperlinks"
 #define EMPATHY_NOTIFY_MANAGER_CAP_BODY_IMAGES         "body-images"
 #define EMPATHY_NOTIFY_MANAGER_CAP_BODY_MARKUP         "body-markup"
+#define EMPATHY_NOTIFY_MANAGER_CAP_CATEGORY            "category"
 #define EMPATHY_NOTIFY_MANAGER_CAP_ICON_MULTI          "icon-multi"
 #define EMPATHY_NOTIFY_MANAGER_CAP_ICON_STATIC         "icon-static"
 #define EMPATHY_NOTIFY_MANAGER_CAP_IMAGE_SVG_XML       "image/svg+xml"
diff --git a/src/empathy-notifications-approver.c b/src/empathy-notifications-approver.c
index 9f1774a..4bfe23c 100644
--- a/src/empathy-notifications-approver.c
+++ b/src/empathy-notifications-approver.c
@@ -244,6 +244,24 @@ notification_is_urgent (EmpathyNotificationsApprover *self,
   return FALSE;
 }
 
+static const gchar *
+get_category_for_event_type (EmpathyEventType type)
+{
+  switch (type) {
+    case EMPATHY_EVENT_TYPE_CHAT:
+      return "im.received";
+    case EMPATHY_EVENT_TYPE_VOIP:
+    case EMPATHY_EVENT_TYPE_TRANSFER:
+    case EMPATHY_EVENT_TYPE_INVITATION:
+    case EMPATHY_EVENT_TYPE_AUTH:
+    case EMPATHY_EVENT_TYPE_SUBSCRIPTION:
+    case EMPATHY_EVENT_TYPE_PRESENCE:
+      return NULL;
+  }
+
+  return NULL;
+}
+
 static void
 update_notification (EmpathyNotificationsApprover *self)
 {
@@ -283,6 +301,8 @@ update_notification (EmpathyNotificationsApprover *self)
     }
   else
     {
+      const gchar *category;
+
       /* if the notification server supports x-canonical-append,
        * the hint will be added, so that the message from the
        * just created notification will be automatically appended
@@ -313,6 +333,11 @@ update_notification (EmpathyNotificationsApprover *self)
 
       if (notification_is_urgent (self, notification))
         notify_notification_set_urgency (notification, NOTIFY_URGENCY_CRITICAL);
+
+      category = get_category_for_event_type (self->priv->event->type);
+      if (category != NULL)
+        notify_notification_set_hint_string (notification,
+            EMPATHY_NOTIFY_MANAGER_CAP_CATEGORY, category);
     }
 
   pixbuf = empathy_notify_manager_get_pixbuf_for_notification (
-- 
1.7.4.1

>From 8743067d1ebe7f4c02081d51bb8738bf02b63006 Mon Sep 17 00:00:00 2001
From: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Wed, 30 Mar 2011 09:51:29 +0200
Subject: [PATCH 3/3] set a category on presence notifications

---
 src/empathy-event-manager.c          |    6 ++++--
 src/empathy-event-manager.h          |    3 ++-
 src/empathy-notifications-approver.c |    8 ++++++--
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index e2ad93d..342d3e1 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -1121,7 +1121,8 @@ event_manager_presence_changed_cb (EmpathyContact *contact,
                 EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT))
             {
               event_manager_add (manager, NULL, contact,
-                  EMPATHY_EVENT_TYPE_PRESENCE, EMPATHY_IMAGE_AVATAR_DEFAULT,
+                  EMPATHY_EVENT_TYPE_PRESENCE_OFFLINE,
+                  EMPATHY_IMAGE_AVATAR_DEFAULT,
                   empathy_contact_get_alias (contact), _("Disconnected"),
                   NULL, NULL, NULL);
             }
@@ -1141,7 +1142,8 @@ event_manager_presence_changed_cb (EmpathyContact *contact,
                 EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN))
             {
               event_manager_add (manager, NULL, contact,
-                  EMPATHY_EVENT_TYPE_PRESENCE, EMPATHY_IMAGE_AVATAR_DEFAULT,
+                  EMPATHY_EVENT_TYPE_PRESENCE_ONLINE,
+                  EMPATHY_IMAGE_AVATAR_DEFAULT,
                   empathy_contact_get_alias (contact), _("Connected"),
                   NULL, NULL, NULL);
             }
diff --git a/src/empathy-event-manager.h b/src/empathy-event-manager.h
index 16d97c6..c8b032a 100644
--- a/src/empathy-event-manager.h
+++ b/src/empathy-event-manager.h
@@ -53,7 +53,8 @@ typedef enum {
     EMPATHY_EVENT_TYPE_VOIP,
     EMPATHY_EVENT_TYPE_TRANSFER,
     EMPATHY_EVENT_TYPE_SUBSCRIPTION,
-    EMPATHY_EVENT_TYPE_PRESENCE,
+    EMPATHY_EVENT_TYPE_PRESENCE_ONLINE,
+    EMPATHY_EVENT_TYPE_PRESENCE_OFFLINE,
     EMPATHY_EVENT_TYPE_INVITATION,
     EMPATHY_EVENT_TYPE_AUTH,
 } EmpathyEventType;
diff --git a/src/empathy-notifications-approver.c b/src/empathy-notifications-approver.c
index 4bfe23c..af07447 100644
--- a/src/empathy-notifications-approver.c
+++ b/src/empathy-notifications-approver.c
@@ -237,7 +237,8 @@ notification_is_urgent (EmpathyNotificationsApprover *self,
       return TRUE;
 
     case EMPATHY_EVENT_TYPE_SUBSCRIPTION:
-    case EMPATHY_EVENT_TYPE_PRESENCE:
+    case EMPATHY_EVENT_TYPE_PRESENCE_ONLINE:
+    case EMPATHY_EVENT_TYPE_PRESENCE_OFFLINE:
       return FALSE;
   }
 
@@ -250,12 +251,15 @@ get_category_for_event_type (EmpathyEventType type)
   switch (type) {
     case EMPATHY_EVENT_TYPE_CHAT:
       return "im.received";
+    case EMPATHY_EVENT_TYPE_PRESENCE_ONLINE:
+      return "presence.online";
+    case EMPATHY_EVENT_TYPE_PRESENCE_OFFLINE:
+      return "presence.offline";
     case EMPATHY_EVENT_TYPE_VOIP:
     case EMPATHY_EVENT_TYPE_TRANSFER:
     case EMPATHY_EVENT_TYPE_INVITATION:
     case EMPATHY_EVENT_TYPE_AUTH:
     case EMPATHY_EVENT_TYPE_SUBSCRIPTION:
-    case EMPATHY_EVENT_TYPE_PRESENCE:
       return NULL;
   }
 
-- 
1.7.4.1



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