discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=5f1a0b4dcd6459700cf6b1802843b28c92afe4da

commit 5f1a0b4dcd6459700cf6b1802843b28c92afe4da
Author: Mike Blumenkrantz <[email protected]>
Date:   Sun Dec 28 17:25:59 2014 -0500

    add back notification merging
    
    this was removed without warning or explanation in r82118:
    
        e: Change notification module to use internal notification API
        Patch by: José Roberto de Souza  <[email protected]>
    
    currently broken by T1954 for lines longer than 36 characters
---
 src/modules/notification/e_mod_popup.c | 56 ++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/src/modules/notification/e_mod_popup.c 
b/src/modules/notification/e_mod_popup.c
index b54a33d..a1826e0 100644
--- a/src/modules/notification/e_mod_popup.c
+++ b/src/modules/notification/e_mod_popup.c
@@ -28,6 +28,57 @@ _notification_timer_cb(Popup_Data *popup)
    return EINA_FALSE;
 }
 
+static Popup_Data *
+_notification_popup_merge(E_Notification_Notify *n)
+{
+   Eina_List *l;
+   Popup_Data *popup;
+   char *body_final;
+   size_t len;
+
+   if (!n->app_name) return NULL;
+
+   EINA_LIST_FOREACH(notification_cfg->popups, l, popup)
+     {
+        if (!popup->notif) continue;
+        if (popup->notif->app_name == n->app_name) break;
+     }
+
+   if (!popup)
+     {
+        /* printf("- no poup to merge\n"); */
+        return NULL;
+     }
+
+   if (n->summary && (n->summary != popup->notif->summary))
+     {
+        /* printf("- summary doesn match, %s, %s\n", str1, str2); */
+        return NULL;
+     }
+
+   /* TODO  p->n is not fallback alert..*/
+   /* TODO  both allow merging */
+
+   len = strlen(popup->notif->body);
+   len += strlen(n->body);
+   len += 5; /* \xE2\x80\xA9 or <PS/> */
+   if (len < 8192) body_final = alloca(len + 1);
+   else body_final = malloc(len + 1);
+   /* Hack to allow e to include markup */
+   snprintf(body_final, len + 1, "%s<ps/>%s", popup->notif->body, n->body);
+
+   /* printf("set body %s\n", body_final); */
+
+   eina_stringshare_replace(&n->body, body_final);
+
+   e_object_del(E_OBJECT(popup->notif));
+   popup->notif = n;
+   if (len >= 8192) free(body_final);
+
+   return popup;
+}
+
+
 void
 notification_popup_notify(E_Notification_Notify *n,
                           unsigned int id)
@@ -60,6 +111,11 @@ notification_popup_notify(E_Notification_Notify *n,
         popup->id = id;
         _notification_popup_refresh(popup);
      }
+   else if (!n->replaces_id)
+     {
+        if ((popup = _notification_popup_merge(n)))
+          _notification_popup_refresh(popup);
+     }
 
    if (!popup)
      {

-- 


Reply via email to