Enlightenment CVS committal

Author  : lok
Project : e_modules
Module  : notification

Dir     : e_modules/notification/src


Modified Files:
        e_mod_box.c e_mod_box.h 


Log Message:
Do not create a new icon in the shelf if a notification use replaces_id.

===================================================================
RCS file: /cvs/e/e_modules/notification/src/e_mod_box.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_mod_box.c 11 Jun 2008 23:04:23 -0000      1.4
+++ e_mod_box.c 3 Jul 2008 10:56:53 -0000       1.5
@@ -13,14 +13,16 @@
 /* Notification box icons protos */
 static Notification_Box_Icon *_notification_box_icon_new         
(Notification_Box *b, 
                                                                   
E_Notification *n, 
-                                                                  E_Border 
*bd);
+                                                                  E_Border *bd,
+                                                                  unsigned int 
id);
 static void                   _notification_box_icon_free        
(Notification_Box_Icon *ic);
 static void                   _notification_box_icon_fill        
(Notification_Box_Icon *ic, 
                                                                   
E_Notification *n);
 static void                   _notification_box_icon_fill_label  
(Notification_Box_Icon *ic);
 static void                   _notification_box_icon_empty       
(Notification_Box_Icon *ic);
 static Notification_Box_Icon *_notification_box_icon_find        
(Notification_Box *b, 
-                                                                  E_Border 
*bd);
+                                                                  E_Border *bd,
+                                                                  unsigned int 
n_id);
 static void                   _notification_box_icon_signal_emit 
(Notification_Box_Icon *ic, 
                                                                   char *sig, 
                                                                   char *src);
@@ -66,8 +68,8 @@
 
 int 
 notification_box_notify(E_Notification *n, 
-                        unsigned int replaces_id __UNUSED__, 
-                        unsigned int id __UNUSED__)
+                        unsigned int replaces_id, 
+                        unsigned int id)
 {
   Evas_List *l, *n_box;
   E_Border *bd;
@@ -81,19 +83,20 @@
       Notification_Box_Icon *ic = NULL;
 
       b = l->data;
-      if (bd)
-        ic = _notification_box_icon_find(b, bd);
+      if (bd || replaces_id)
+        ic = _notification_box_icon_find(b, bd, replaces_id);
       if (ic) 
         {
           e_notification_unref(ic->notif);
           e_notification_ref(n);
           ic->notif = n;
+          ic->n_id = id;
           _notification_box_icon_empty(ic);
           _notification_box_icon_fill(ic, n);
         }
       else
         {
-          ic = _notification_box_icon_new(b, n, bd);
+          ic = _notification_box_icon_new(b, n, bd, id);
           if (!ic) continue;
           b->icons = evas_list_append(b->icons, ic);
           e_box_pack_end(b->o_box, ic->o_holder);
@@ -275,7 +278,7 @@
       if (!(inst = l->data)) continue;
       b = inst->n_box;
 
-      ic = _notification_box_icon_find(b, ev->border);
+      ic = _notification_box_icon_find(b, ev->border, 0);
       if (!ic) continue;
       b->icons = evas_list_remove(b->icons, ic);
       _notification_box_icon_free(ic);
@@ -333,7 +336,7 @@
       ic = l->data;
       if (!ic) continue;
 
-      new_ic = _notification_box_icon_new(b, ic->notif, ic->border);
+      new_ic = _notification_box_icon_new(b, ic->notif, ic->border, ic->n_id);
       _notification_box_icon_free(ic);
       new_icons = evas_list_append(new_icons, new_ic);
 
@@ -441,7 +444,7 @@
 }
 
 static Notification_Box_Icon *
-_notification_box_icon_new(Notification_Box *b, E_Notification *n, E_Border 
*bd)
+_notification_box_icon_new(Notification_Box *b, E_Notification *n, E_Border 
*bd, unsigned int id)
 {
   Notification_Box_Icon *ic;
 
@@ -450,6 +453,7 @@
   e_notification_ref(n);
   ic->label = e_notification_app_name_get(n);
   ic->n_box = b;
+  ic->n_id = id;
   ic->border = bd;
   ic->notif = n;
   ic->o_holder = edje_object_add(evas_object_evas_get(b->o_box));
@@ -575,7 +579,7 @@
 }
 
 static Notification_Box_Icon *
-_notification_box_icon_find(Notification_Box *b, E_Border *bd)
+_notification_box_icon_find(Notification_Box *b, E_Border *bd, unsigned int 
n_id)
 {
   Evas_List *l;
 
@@ -584,7 +588,7 @@
       Notification_Box_Icon *ic;
 
       if (!(ic = l->data)) continue;
-      if (ic->border == bd)
+      if (ic->border == bd || ic->n_id == n_id)
         return ic;
     }
 
===================================================================
RCS file: /cvs/e/e_modules/notification/src/e_mod_box.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_mod_box.h 2 Mar 2008 01:33:28 -0000       1.1
+++ e_mod_box.h 3 Jul 2008 10:56:53 -0000       1.2
@@ -13,13 +13,14 @@
 struct _Notification_Box_Icon
 {
   Notification_Box *n_box;
-  const char     *label;
-  Evas_Object    *o_holder;
-  Evas_Object    *o_icon;
-  Evas_Object    *o_holder2;
-  Evas_Object    *o_icon2;
-  E_Border       *border;
-  E_Notification *notif;
+  unsigned int      n_id;
+  const char       *label;
+  Evas_Object      *o_holder;
+  Evas_Object      *o_icon;
+  Evas_Object      *o_holder2;
+  Evas_Object      *o_icon2;
+  E_Border         *border;
+  E_Notification   *notif;
 
   int             popup;
   Ecore_Timer    *mouse_in_timer;



-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to