Ok, I don't see what's your point with that, you set the escaped
version than reset with your own escaping!

Attached is a patch I hacked quickly to add rich text as
http://galago-project.org/specs/notification/0.9/x161.html and also
added a lame copy of gnome-osd, with semi-transparent bg that fades on
mouse-in. Please build on this and send a nice good looking version
later :-)

Regards,


On Sun, Apr 19, 2009 at 5:50 AM, Amey Parulekar <amey....@gmail.com> wrote:
> Hi,
>
> Thanks, that fixed it
>
> Amey
>
> On Sun, Apr 19, 2009 at 2:15 PM, Gustavo Sverzut Barbieri
> <barbi...@profusion.mobi> wrote:
>>
>> On Sun, Apr 19, 2009 at 3:32 AM, Amey Parulekar <amey....@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > This patch uses the new "edje_object_part_text_unescaped_set" function
>> > to
>> > escape special characters from notification popup body. Also fixes
>> > ticket
>> > #277.
>>
>> no pathc, make sure your firefox recognizes .diff and .patch as
>> text/something, otherwise mail list will strip attachments.
>>
>> add to /etc/mime.types:
>>
>>   text/x-diff                                     diff patch
>>
>>
>> --
>> Gustavo Sverzut Barbieri
>> http://profusion.mobi embedded systems
>> --------------------------------------
>> MSN: barbi...@gmail.com
>> Skype: gsbarbieri
>> Mobile: +55 (19) 9225-2202
>
>



-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
Index: e-module-notification.edc
===================================================================
--- e-module-notification.edc	(revision 40179)
+++ e-module-notification.edc	(working copy)
@@ -30,13 +30,29 @@
 styles {
    style {
       name: "notification_style";
-      base: "font=Edje-Vera font_size=11 align=left color=#3c3c3c wrap=word text_class=module_normal";
-      tag:  "subject"  "+ text_class=module_large font_size=16"; 
-      tag:  "/subject" "- text_class=module_large font_size=16"; 
-      tag:  "body"  "+ text_class=module_normal font_size=13"; 
-      tag:  "/body" "- text_class=module_normal"; 
+      base: "font=Sans font_size=11 align=left color=#3c3c3c wrap=word text_class=module_normal";
+      tag:  "subject"  "+ text_class=module_large font_size=16";
+      tag:  "body"  "+ text_class=module_normal font_size=13";
       tag:  "br" "\n";
+      tag:  "b" "+ font=Sans:style=Bold text_class=module_bold";
+      tag:  "i" "+ font=Sans:style=Oblique text_class=module_bold";
+      tag:  "u" "+ underline=on";
+      tag:  "img" ""; /* images not supported */
+      tag:  "a" ""; /* links not supported */
    }
+
+   style {
+      name: "notification_style_alpha";
+      base: "font=Sans font_size=11 align=left color=#fcfcfc outline_color=#000 shadow_color=#333 style=outline_soft_shadow wrap=word text_class=module_normal";
+      tag:  "subject"  "+ text_class=module_large font_size=16";
+      tag:  "body"  "+ text_class=module_normal font_size=13";
+      tag:  "br" "\n";
+      tag:  "b" "+ font=Sans:style=Bold text_class=module_bold";
+      tag:  "i" "+ font=Sans:style=Oblique text_class=module_bold";
+      tag:  "u" "+ underline=on";
+      tag:  "img" ""; /* images not supported */
+      tag:  "a" ""; /* links not supported */
+   }
 }
 
 collections {
@@ -79,7 +95,7 @@
    group {
       name: "modules/notification/main";
       data {
-        item: "app_icon_max" "80 80";
+        item: "app_icon_max" "48 48";
       }
       parts {
          part { name: "base";
@@ -219,41 +235,62 @@
             description {
                state: "default" 0.0;
                align: 0.0 0.5;
-               fixed: 1 1;
                aspect: 1 1;
                aspect_preference: BOTH;
 
                color: 255 0 150 255;
                rel1 {
-                  relative: 0.0 0.0;
-                  offset: 5 -127;
+                  relative: 0.0 1.0;
+                  offset: 5 5;
+                  to_y: "title_back";
                }
-
                rel2 {
                   relative: 0.0 1.0;
-                  offset: 85 -127;
+                  offset: 52 52;
+                  to_y: "title_back";
                }
             }
             description {
                state: "high" 0.0;
                inherit: "default" 0.0;
-               rel1.offset: 5  -63;
-               rel2.offset: 85 -63;
+               rel1 {
+                  relative: 0.0 0.0;
+                  offset: 5 -48;
+                  to_y: "title_back";
+               }
+               rel2 {
+                  relative: 0.0 0.0;
+                  offset: 52 -1;
+                  to_y: "title_back";
+               }
             }
             description {
                state: "medium" 0.0;
                inherit: "default" 0.0;
-               rel1.offset: 5  -23;
-               rel2.offset: 85 -23;
+               rel1 {
+                  relative: 0.0 0.0;
+                  offset: 5 -28;
+                  to_y: "title_back";
+               }
+               rel2 {
+                  relative: 0.0 0.0;
+                  offset: 52 -21;
+                  to_y: "title_back";
+               }
             }
             description {
                state: "low" 0.0;
                inherit: "default" 0.0;
                rel1 {
-                   to_y: "title_back";
-                   offset: 5 1;
+                  relative: 0.0 0.0;
+                  offset: 5 -14;
+                  to_y: "title_back";
                }
-               rel2.offset: 85 -5;
+               rel2 {
+                  relative: 0.0 0.0;
+                  offset: 52 33;
+                  to_y: "title_back";
+               }
             }
             description {
                state: "underground" 0.0;
@@ -280,16 +317,16 @@
                align: 0.0 0.5;
                //fixed: 1 1;
 
-               rel1 { 
+               rel1 {
                   to_x: "notification.swallow.app_icon";
-                  to_y: "bt_close_shadow";
-                  relative: 1.0 1;
-                  offset: 10 1; 
+                  to_y: "title_back";
+                  relative: 1.0 1.0;
+                  offset: 10 5;
                }
 
-               rel2 { 
-                  relative: 1.0 0.5;
-                  offset: -10 0; 
+               rel2 {
+                  relative: 1.0 1.0;
+                  offset: -10 -1;
                }
 
                text {
@@ -304,38 +341,44 @@
             name: "bounce";
             signal: "notification,new";
             source: "notification";
-            action: STATE_SET "low" 0.0;
-            transition: ACCELERATE 0.4;
+            action: STATE_SET "high" 0.0;
             target: "notification.swallow.app_icon";
             after: "bounce_2";
          }
          program {
             name: "bounce_2";
-            action: STATE_SET "high" 0.0;
-            transition: DECELERATE 0.2;
+            action: STATE_SET "default" 0.0;
+            transition: ACCELERATE 0.3;
             target: "notification.swallow.app_icon";
             after: "bounce_3";
          }
          program {
             name: "bounce_3";
-            action: STATE_SET "low" 0.0;
-            transition: ACCELERATE 0.2;
+            action: STATE_SET "medium" 0.0;
+            transition: DECELERATE 0.2;
             target: "notification.swallow.app_icon";
             after: "bounce_4";
          }
          program {
             name: "bounce_4";
-            action: STATE_SET "medium" 0.0;
-            transition: DECELERATE 0.1;
+            action: STATE_SET "default" 0.0;
+            transition: ACCELERATE 0.2;
             target: "notification.swallow.app_icon";
             after: "bounce_5";
          }
          program {
             name: "bounce_5";
             action: STATE_SET "low" 0.0;
-            transition: LINEAR 0.1;
+            transition: DECELERATE 0.1;
             target: "notification.swallow.app_icon";
+            after: "bounce_6";
          }
+         program {
+            name: "bounce_6";
+            action: STATE_SET "default" 0.0;
+            transition: DECELERATE 0.1;
+            target: "notification.swallow.app_icon";
+         }
 
          program {
             name: "fall";
@@ -384,4 +427,244 @@
          }
       }
    }
+
+   group {
+      name: "modules/notification/main/alpha";
+      data {
+        item: "app_icon_max" "48 48";
+        item: "shaped" "1";
+      }
+      parts {
+         part {
+            name: "base";
+            type: RECT;
+            mouse_events: 1;
+            description {
+               state: "default" 0.0;
+               color: 0 0 0 200;
+            }
+            description {
+               state: "mouse_over" 0.0;
+               color: 0 0 0 64;
+            }
+            description {
+               state: "hidden" 0.0;
+               color: 0 0 0 0;
+               visible: 0;
+            }
+         }
+
+         programs {
+            program {
+               signal: "mouse,in";
+               source: "base";
+               action: STATE_SET "mouse_over" 0.0;
+               transition: ACCELERATE 0.2;
+               target: "base";
+               after: "show_base";
+            }
+            program {
+               name: "show_base";
+               in: 1.5 0.0;
+               action: STATE_SET "default" 0.0;
+               transition: ACCELERATE 0.5;
+               target: "base";
+            }
+         }
+
+         part {
+            name: "notification.text.title";
+            type: TEXT;
+            mouse_events: 0;
+            scale: 1;
+            effect: SOFT_SHADOW;
+            description {
+               state: "default" 0.0;
+               fixed: 1 1;
+               visible: 1;
+               align: 0.5 0.0;
+               rel1 {
+                  relative: 0.0 0.0;
+                  offset: 5 0;
+               }
+               rel2 {
+                  relative: 1.0 0.0;
+                  offset: -20 20;
+               }
+               color: 224 224 224 255;
+               color3: 0 0 0 64;
+               color_class: "menu_title_active";
+               text {
+                  text_source: "notification.text.title";
+                  font: "Sans:style=Bold";
+                  size: 10;
+                  align: 0.5 0.0;
+                  min: 1 1;
+                  text_class: "menu_title";
+               }
+            }
+         }
+
+         /* Close Button */
+         part {
+            name: "bt_close_shadow";
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               align: 1.0 0.5;
+               min: 22 22;
+               max: 22 22;
+               fixed: 1 1;
+               aspect: 1.0 1.0;
+               aspect_preference: VERTICAL;
+               rel1 {
+                  relative: 1 0;
+                  offset: -15 5;
+               }
+               rel2 {
+                  relative: 1 0;
+                  offset:  -2 15;
+               }
+               image.normal: "bd_button_close_shadow.png";
+            }
+         }
+         part { name: "notification.close_btn";
+            description { state: "default" 0.0;
+               rel1.to: "bt_close_shadow";
+               rel2.to: "bt_close_shadow";
+               image.normal: "bd_button_close_focused.png";
+            }
+            description { state: "active" 0.0;
+               inherit: "default" 0.0;
+               rel1.offset: 0 1;
+               rel2.offset: -1 0;
+            }
+         }
+
+         part {
+            name: "clipper_app_icon";
+            type: RECT;
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               color: 255 255 255 255;
+               rel1 {
+                  relative: 0.0 0.0;
+                  offset: 0 0;
+               }
+               rel2 {
+                  relative: 1.0 1.0;
+                  offset: -1 -1;
+               }
+            }
+            description {
+               state: "hidden" 0.0;
+               inherit: "default" 0.0;
+               color: 255 255 255 0;
+               visible: 0;
+            }
+         }
+
+         part {
+            name: "notification.swallow.app_icon";
+            type: SWALLOW;
+            mouse_events:  0;
+            clip_to: "clipper_app_icon";
+            description {
+               state: "default" 0.0;
+               align: 0.0 0.5;
+               aspect: 1 1;
+               aspect_preference: BOTH;
+               rel1 {
+                  to_y: "notification.text.title";
+                  relative: 0.0 1.0;
+                  offset: 5 5;
+               }
+               rel2 {
+                  to_y: "notification.text.title";
+                  relative: 0.0 1.0;
+                  offset: 52 52;
+               }
+            }
+         }
+
+         /* Message text */
+         part {
+            name: "notification.textblock.message";
+            type: TEXTBLOCK;
+            mouse_events: 0;
+
+            description {
+               state: "default" 0.0;
+               align: 0.0 0.5;
+               rel1 {
+                  to_x: "notification.swallow.app_icon";
+                  to_y: "notification.text.title";
+                  relative: 1.0 1.0;
+                  offset: 10 5;
+               }
+               rel2 {
+                  relative: 1.0 1.0;
+                  offset: -10 -1;
+               }
+               text {
+                  style: "notification_style_alpha";
+                  min: 1 1;
+               }
+            }
+         }
+      }
+      programs {
+         program {
+            name: "notification,new";
+            signal: "notification,new";
+            source: "notification";
+            action: STATE_SET "hidden" 0.0;
+            target: "clipper_app_icon";
+            target: "base";
+            after: "notification,new,2";
+         }
+         program {
+            name: "notification,new,2";
+            action: STATE_SET "default" 0.0;
+            transition: SINUSOIDAL 0.5;
+            target: "clipper_app_icon";
+            target: "base";
+         }
+
+         program {
+            name: "notification,del";
+            signal: "notification,del";
+            source: "notification";
+            action: STATE_SET "hidden" 0.0;
+            transition: ACCELERATE 0.4;
+            target: "clipper_app_icon";
+         }
+
+         program {
+            name: "close";
+            signal: "mouse,down,1";
+            source: "notification.close_btn";
+            action: SIGNAL_EMIT "notification,close" "theme";
+            after: "close_aft";
+         }
+         program {
+            name: "close_aft";
+            action: STATE_SET "active" 0.0;
+            target: "notification.close_btn";
+         }
+         program { name: "bt_close_up";
+            signal: "mouse,up,*";
+            source: "notification.close_btn";
+            action: STATE_SET "default" 0.0;
+            target: "notification.close_btn";
+         }
+
+         program {
+            name: "find";
+            signal: "mouse,down,1";
+            source: "base";
+            action: SIGNAL_EMIT "notification,find" "theme";
+         }
+      }
+   }
 }
Index: src/e_mod_popup.c
===================================================================
--- src/e_mod_popup.c	(revision 40179)
+++ src/e_mod_popup.c	(working copy)
@@ -116,7 +116,6 @@
   E_Container *con;
   Popup_Data *popup;
   char buf[PATH_MAX];
-  const char *shape_option;
   int shaped;
 
   popup = calloc(1, sizeof(Popup_Data));
@@ -134,40 +133,64 @@
   /* Setup the theme */
   snprintf(buf, sizeof(buf), "%s/e-module-notification.edj", notification_mod->dir);
   popup->theme = edje_object_add(popup->e);
-  if (!e_theme_edje_object_set(popup->theme, "base/theme/modules/notification",
-                               "modules/notification/main"))
-    edje_object_file_set(popup->theme, buf, "modules/notification/main");
-  evas_object_show(popup->theme);
-  edje_object_signal_callback_add(popup->theme, "notification,deleted", "theme", 
-                                  _notification_theme_cb_deleted, popup);
-  edje_object_signal_callback_add(popup->theme, "notification,close", "theme", 
-                                  _notification_theme_cb_close, popup);
-  edje_object_signal_callback_add(popup->theme, "notification,find", "theme", 
-                                  _notification_theme_cb_find, popup);
 
-  shape_option = edje_object_data_get(popup->theme, "shaped");
-  if (shape_option)
+  shaped = 0;
+  if (e_config->use_composite)
     {
-      if (!strcmp(shape_option, "1"))
-        shaped = 1;
-      else
-        shaped = 0;
-      if (e_config->use_composite)
-        {
-          ecore_evas_alpha_set(popup->win->ecore_evas, shaped);
-          e_container_window_raise(con,
-                                   ecore_evas_software_x11_window_get(popup->win->ecore_evas),
-                                   ecore_evas_layer_get(popup->win->ecore_evas));
-        }
-      else
-        {
-          ecore_evas_shaped_set(popup->win->ecore_evas, shaped);
-          ecore_evas_avoid_damage_set(popup->win->ecore_evas, shaped);
-        }
+       if (e_theme_edje_object_set(popup->theme,
+				   "base/theme/modules/notification",
+				   "modules/notification/main/alpha"))
+	 shaped = 1;
+       else if (edje_object_file_set(popup->theme, buf,
+				     "modules/notification/main/alpha"))
+	 shaped = 1;
     }
+
+  if ((!e_config->use_composite) ||
+      (edje_object_load_error_get(popup->theme) != EDJE_LOAD_ERROR_NONE))
+    {
+       const char *shape_option;
+
+       if (!e_theme_edje_object_set(popup->theme,
+				   "base/theme/modules/notification",
+				   "modules/notification/main"))
+	 edje_object_file_set(popup->theme, buf, "modules/notification/main");
+
+       shape_option = edje_object_data_get(popup->theme, "shaped");
+       if (shape_option)
+	 {
+	    if (!strcmp(shape_option, "1"))
+	      shaped = 1;
+	    else
+	      shaped = 0;
+	 }
+    }
+
+  if (e_config->use_composite)
+    {
+       ecore_evas_alpha_set(popup->win->ecore_evas, shaped);
+    }
+  else
+    {
+       ecore_evas_shaped_set(popup->win->ecore_evas, shaped);
+       ecore_evas_avoid_damage_set(popup->win->ecore_evas, shaped);
+    }
+
+  evas_object_show(popup->theme);
+  edje_object_signal_callback_add
+    (popup->theme, "notification,deleted", "theme",
+     _notification_theme_cb_deleted, popup);
+  edje_object_signal_callback_add
+    (popup->theme, "notification,close", "theme",
+     _notification_theme_cb_close, popup);
+  edje_object_signal_callback_add
+    (popup->theme, "notification,find", "theme",
+     _notification_theme_cb_find, popup);
+
   _notification_popup_refresh(popup);
   _notification_popup_place(popup, eina_list_count(notification_cfg->popups));
   e_popup_show(popup->win);
+  e_popup_layer_set(popup->win, 999);
 
   return popup;
 }
@@ -376,47 +399,12 @@
 static void
 _notification_format_message(Popup_Data *popup)
 {
-  E_Notification *n = popup->notif;
-  char *msg;
-  const char *orig;
-  char *dest;
-  int len = 6;
-  int size = 512;
+  Evas_Object *o = popup->theme;
+  const char *title = e_notification_summary_get(popup->notif);
+  const char *message = e_notification_body_get(popup->notif);
 
-  edje_object_part_text_set(popup->theme, "notification.text.title",
-          e_notification_summary_get(n));
-  msg = calloc(1, 512);
-  snprintf(msg, 511, "<body>");
-
-  for (orig = e_notification_body_get(n), dest = msg + strlen(msg); orig && *orig; orig++)
-    {
-      if (len >= size - 4)
-        {
-          size = len + 512;
-          msg = realloc(msg, size);
-          msg = memset(msg + len, 0, size - len);
-          dest = msg + len;
-        }
-
-      if (*orig == '\n')
-        {
-          dest[0] = '<'; 
-          dest[1] = 'b'; 
-          dest[2] = 'r'; 
-          dest[3] = '>';
-          len += 4;
-          dest += 4;
-        }
-      else
-        {
-          *dest = *orig;
-          len++;
-          dest++;
-        }
-    }
-
-  edje_object_part_text_set(popup->theme, "notification.textblock.message", msg);
-  free(msg);
+  edje_object_part_text_set(o, "notification.text.title", title);
+  edje_object_part_text_set(o, "notification.textblock.message", message);
 }
 
 static void
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to