Enlightenment CVS committal

Author  : lok
Project : e_modules
Module  : notification

Dir     : e_modules/notification/src


Modified Files:
        e_mod_main.c e_mod_popup.c 


Log Message:
The theme can now specify the maximum size of the icon to show in the popup.

===================================================================
RCS file: /cvs/e/e_modules/notification/src/e_mod_main.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- e_mod_main.c        7 Mar 2008 18:02:59 -0000       1.9
+++ e_mod_main.c        8 Mar 2008 00:24:03 -0000       1.10
@@ -127,7 +127,9 @@
    o = edje_object_add(evas);
    snprintf(buf, sizeof(buf), "%s/e-module-notification.edj",
            e_module_dir_get(notification_mod));
-   edje_object_file_set(o, buf, "icon");
+   if (!e_theme_edje_object_set(o, "base/theme/modules/notification",
+                                "icon"))
+     edje_object_file_set(o, buf, "icon");
    return o;
 }
 
===================================================================
RCS file: /cvs/e/e_modules/notification/src/e_mod_popup.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_mod_popup.c       7 Mar 2008 18:02:59 -0000       1.2
+++ e_mod_popup.c       8 Mar 2008 00:24:03 -0000       1.3
@@ -202,9 +202,10 @@
 _notification_popup_refresh(Popup_Data *popup)
 {
   const char *icon_path;
+  const char *app_icon_max;
   char *msg;
   void *img;
-  int w, h;
+  int w, h, width = 80, height = 80;
 
   if (!popup) return;
 
@@ -217,6 +218,26 @@
       popup->app_icon = NULL;
     }
 
+  app_icon_max = edje_object_data_get(popup->theme, "app_icon_max");
+  if (app_icon_max)
+    {
+      char *endptr;
+
+      errno = 0;
+      width = strtol(app_icon_max, &endptr, 10);
+      if (errno != 0 && width == 0 || endptr == app_icon_max) 
+        {
+          width = 80;
+          height = 80;
+        }
+      else
+        {
+          endptr++;
+          if (endptr) height = strtol(endptr, NULL, 10);
+          else height = 80;
+        }
+    }
+
   /* Check if the app specify an icon either by a path or by a hint */
   if ((icon_path = e_notification_app_icon_get(popup->notif)) && *icon_path)
     {
@@ -224,23 +245,12 @@
       popup->app_icon = evas_object_image_add(popup->e);
       evas_object_image_file_set(popup->app_icon, icon_path, NULL);
       evas_object_image_size_get(popup->app_icon, &w, &h);
-      if (w > 80 || h > 80)
-        {
-          int v;
-          v = w > h ? w : h;
-          h = h * 80 / v;
-          w = w * 80 / v;
-        }
       evas_object_image_fill_set(popup->app_icon, 0, 0, w, h);
-      edje_extern_object_min_size_set(popup->app_icon, w, h);
-      edje_extern_object_max_size_set(popup->app_icon, w, h);
     }
   else if ((img = e_notification_hint_icon_data_get(popup->notif)))
     {
       popup->app_icon = e_notification_image_evas_object_add(popup->e, img);
       evas_object_image_size_get(popup->app_icon, &w, &h);
-      edje_extern_object_min_size_set(popup->app_icon, w, h);
-      edje_extern_object_max_size_set(popup->app_icon, w, h);
     }
   else
     {
@@ -251,11 +261,27 @@
       if (!e_theme_edje_object_set(popup->app_icon, 
"base/theme/modules/notification",
                                    "modules/notification/logo"))
         edje_object_file_set(popup->app_icon, buf, 
"modules/notification/logo");
-      evas_object_resize(popup->app_icon, 80, 80);
-      edje_extern_object_min_size_set(popup->app_icon, 80, 80);
-      edje_extern_object_max_size_set(popup->app_icon, 80, 80);
+      w = width; h = height;
     }
 
+  if (w > width || h > height)
+    {
+      int v;
+      v = w > h ? w : h;
+      h = h * height / v;
+      w = w * width / v;
+      evas_object_image_fill_set(popup->app_icon, 0, 0, w, h);
+      evas_object_resize(popup->app_icon, w, h);
+      edje_extern_object_min_size_set(popup->app_icon, w, h);
+      edje_extern_object_max_size_set(popup->app_icon, w, h);
+    }
+  else
+    {
+      evas_object_resize(popup->app_icon, w, h);
+      edje_extern_object_min_size_set(popup->app_icon, w, h);
+      edje_extern_object_max_size_set(popup->app_icon, w, h);
+    }
+  
   edje_object_calc_force(popup->theme);
   edje_object_part_swallow(popup->theme, "notification.swallow.app_icon", 
popup->app_icon);
   edje_object_signal_emit(popup->theme, "notification,icon", "notification");



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to