finally add a function to set image data to a notification
authordiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 6 Nov 2011 12:42:51 +0000 (12:42 +0000)
committerdiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 6 Nov 2011 12:42:51 +0000 (12:42 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/e_dbus@64815 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/notification/E_Notify.h
src/lib/notification/notification.c

index 1f75d4c..f9f8f00 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,3 +32,7 @@
 2011-11-04 Sanjeev BA <iamsanjeev@gmail.com>
 
         * Exported e_dbus_connection_dbus_connection_get()
+
+2011-11-06  Mike Blumenkrantz
+
+        * Add e_notification_image_init for filling in values from an Evas_Object
index 7d7b8be..31937f7 100644 (file)
@@ -99,8 +99,8 @@ struct E_Notification_Event_Action_Invoked
 extern "C" {
 #endif
 
-   EAPI int e_notification_init();
-   EAPI int e_notification_shutdown();
+   EAPI int e_notification_init(void);
+   EAPI int e_notification_shutdown(void);
 
 /* client */
    EAPI void e_notification_send(E_Notification *n, E_DBus_Callback_Func func, void *data);
@@ -110,7 +110,7 @@ extern "C" {
 
 /* Notifications */
 
-   EAPI E_Notification *e_notification_new();
+   EAPI E_Notification *e_notification_new(void);
    EAPI void e_notification_ref(E_Notification *n);
    EAPI void e_notification_unref(E_Notification *n);
    EAPI void e_notification_free(E_Notification *n);
@@ -174,8 +174,9 @@ extern "C" {
    EAPI E_Notification_Image *e_notification_hint_icon_data_get(E_Notification *n);
 
 /* image hint */
-   EAPI E_Notification_Image *e_notification_image_new();
+   EAPI E_Notification_Image *e_notification_image_new(void);
    EAPI void e_notification_image_free(E_Notification_Image *img);
+   EAPI Eina_Bool e_notification_image_init(E_Notification_Image *img, Evas_Object *obj);
    EAPI Evas_Object *e_notification_image_evas_object_add(Evas *evas, E_Notification_Image *img);
 
 #ifdef __cplusplus
index 6d4b90a..d2c5b97 100644 (file)
@@ -370,9 +370,24 @@ e_notification_image_new(void)
    E_Notification_Image *img;
 
    img = calloc(1, sizeof(E_Notification_Image));
+   img->bits_per_sample = 8;
    return img;
 }
 
+EAPI Eina_Bool
+e_notification_image_init(E_Notification_Image *img, Evas_Object *obj)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(img, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
+   evas_object_geometry_get(obj, NULL, NULL, &img->width, &img->height);
+   img->has_alpha = !!evas_object_image_alpha_get(obj);
+   img->channels = img->has_alpha ? 4 : 3;
+   img->rowstride = evas_object_image_stride_get(obj);
+   img->data = evas_object_image_data_get(obj, EINA_FALSE);
+   evas_object_image_data_set(obj, img->data);
+   return EINA_TRUE;
+}
+
 EAPI void
 e_notification_image_free(E_Notification_Image *img)
 {