Enlightenment CVS committal
Author : lok
Project : e17
Module : libs/e_dbus
Dir : e17/libs/e_dbus/src/lib/notification
Modified Files:
E_Notification_Daemon.h E_Notify.h e_notify_private.h
marshal.c notification.c
Log Message:
Added the support of the icon_data.
Change every notification id to unisgned int.
Can now convert image/icon_data (GdkPixbuf format) to an evas image object.
===================================================================
RCS file: /cvs/e/e17/libs/e_dbus/src/lib/notification/E_Notification_Daemon.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- E_Notification_Daemon.h 6 Nov 2007 23:58:57 -0000 1.4
+++ E_Notification_Daemon.h 16 Jan 2008 19:22:16 -0000 1.5
@@ -31,7 +31,7 @@
/* daemon callbacks */
typedef int (*E_Notification_Daemon_Callback_Notify) (E_Notification_Daemon
*daemon, E_Notification *notification);
-typedef void (*E_Notification_Daemon_Callback_Close_Notification)
(E_Notification_Daemon *daemon, int notification_id);
+typedef void (*E_Notification_Daemon_Callback_Close_Notification)
(E_Notification_Daemon *daemon, unsigned int notification_id);
/* gui */
typedef struct E_Notification_View E_Notification_View;
===================================================================
RCS file: /cvs/e/e17/libs/e_dbus/src/lib/notification/E_Notify.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- E_Notify.h 6 Nov 2007 23:58:57 -0000 1.4
+++ E_Notify.h 16 Jan 2008 19:22:16 -0000 1.5
@@ -96,13 +96,13 @@
/* signals */
struct E_Notification_Event_Notification_Closed
{
- int notification_id;
+ unsigned int notification_id;
E_Notification_Closed_Reason reason;
};
struct E_Notification_Event_Action_Invoked
{
- int notification_id;
+ unsigned int notification_id;
char *action_id;
};
@@ -174,11 +174,12 @@
EAPI char e_notification_hint_suppress_sound_get(E_Notification *n);
EAPI int e_notification_hint_xy_get(E_Notification *n, int *x, int *y);
EAPI E_Notification_Image
*e_notification_hint_image_data_get(E_Notification *n);
+ EAPI E_Notification_Image *e_notification_hint_icon_data_get(E_Notification
*n);
/* image hint */
EAPI E_Notification_Image *e_notification_image_new();
EAPI void e_notification_image_free(E_Notification_Image *img);
- EAPI Evas_Object *e_notification_image_object_add(Evas *evas,
E_Notification_Image *img);
+ EAPI Evas_Object *e_notification_image_evas_object_add(Evas *evas,
E_Notification_Image *img);
#ifdef __cplusplus
}
===================================================================
RCS file: /cvs/e/e17/libs/e_dbus/src/lib/notification/e_notify_private.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_notify_private.h 29 Oct 2007 02:20:48 -0000 1.1
+++ e_notify_private.h 16 Jan 2008 19:22:16 -0000 1.2
@@ -50,7 +50,7 @@
char has_alpha;
int bits_per_sample;
int channels;
- int *data;
+ unsigned char *data;
};
struct E_Notification
@@ -74,6 +74,7 @@
char suppress_sound;
int x, y;
E_Notification_Image *image_data;
+ E_Notification_Image *icon_data;
} hints;
int hint_flags;
===================================================================
RCS file: /cvs/e/e17/libs/e_dbus/src/lib/notification/marshal.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- marshal.c 12 Jan 2008 16:53:15 -0000 1.3
+++ marshal.c 16 Jan 2008 19:22:16 -0000 1.4
@@ -333,6 +333,8 @@
e_notify_marshal_dict_string(&sub, "desktop_entry", n->hints.desktop);
if (n->hints.image_data)
e_notify_marshal_dict_variant(&sub, "image_data", "(iiibiiay)",
E_DBUS_VARIANT_MARSHALLER(e_notify_marshal_hint_image), n->hints.image_data);
+ if (n->hints.icon_data)
+ e_notify_marshal_dict_variant(&sub, "icon_data", "(iiibiiay)",
E_DBUS_VARIANT_MARSHALLER(e_notify_marshal_hint_image), n->hints.icon_data);
if (n->hints.sound_file)
e_notify_marshal_dict_string(&sub, "sound_file", n->hints.sound_file);
if (n->hints.suppress_sound) /* we only need to send this if its true */
@@ -450,11 +452,11 @@
int x_set = 0, y_set = 0;
int x, y;
dbus_message_iter_recurse(iter, &arr);
- while (dbus_message_iter_has_next(&arr))
+ do
{
DBusMessageIter dict;
dbus_message_iter_recurse(&arr, &dict);
- while (dbus_message_iter_has_next(&dict))
+ do
{
DBusMessageIter variant;
const char *s_val;
@@ -465,35 +467,31 @@
dbus_message_iter_get_basic(&dict, &key);
dbus_message_iter_next(&dict);
dbus_message_iter_recurse(&dict, &variant);
- if (dbus_message_iter_get_arg_type(&variant) != DBUS_TYPE_INVALID)
- continue;
- switch (dbus_message_iter_get_element_type(&variant))
- {
- case DBUS_TYPE_STRING:
- dbus_message_iter_get_basic(&variant, &s_val);
- break;
- case DBUS_TYPE_BOOLEAN:
- dbus_message_iter_get_basic(&variant, &b_val);
- break;
- case DBUS_TYPE_BYTE:
- dbus_message_iter_get_basic(&variant, &y_val);
- break;
- case DBUS_TYPE_INT32:
- dbus_message_iter_get_basic(&variant, &i_val);
- break;
- default:
- break;
- }
+
if (!strcmp(key, "urgency"))
- e_notification_hint_urgency_set(n, y_val);
+ {
+ dbus_message_iter_get_basic(&variant, &y_val);
+ e_notification_hint_urgency_set(n, y_val);
+ }
else if (!strcmp(key, "category"))
- e_notification_hint_category_set(n, s_val);
+ {
+ dbus_message_iter_get_basic(&variant, &s_val);
+ e_notification_hint_category_set(n, s_val);
+ }
else if (!strcmp(key, "desktop-entry"))
- e_notification_hint_desktop_set(n, s_val);
+ {
+ e_notification_hint_desktop_set(n, s_val);
+ }
else if (!strcmp(key, "sound-file"))
- e_notification_hint_sound_file_set(n, s_val);
+ {
+ dbus_message_iter_get_basic(&variant, &s_val);
+ e_notification_hint_sound_file_set(n, s_val);
+ }
else if (!strcmp(key, "suppress-sound"))
- e_notification_hint_suppress_sound_set(n, b_val);
+ {
+ dbus_message_iter_get_basic(&variant, &b_val);
+ e_notification_hint_suppress_sound_set(n, b_val);
+ }
else if (!strcmp(key, "x"))
{
x = i_val;
@@ -505,10 +503,19 @@
y_set = 1;
}
else if (!strcmp(key, "image_data"))
- n->hints.image_data = e_notify_unmarshal_hint_image(&variant);
+ {
+ dbus_message_iter_recurse(&dict, &variant);
+ n->hints.image_data = e_notify_unmarshal_hint_image(&variant);
+ }
+ else if (!strcmp(key, "icon_data"))
+ {
+ dbus_message_iter_recurse(&dict, &variant);
+ n->hints.icon_data = e_notify_unmarshal_hint_image(&variant);
+ }
}
- dbus_message_iter_next(&arr);
- }
+ while (dbus_message_iter_next(&dict));
+ }
+ while (dbus_message_iter_next(&arr));
if (x_set && y_set)
e_notification_hint_xy_set(n, x, y);
@@ -546,7 +553,7 @@
sig = dbus_message_iter_get_signature(iter);
sig_matches = strcmp(sig, "(iiibiiay)");
dbus_free(sig);
- if (!sig_matches) return NULL;
+ if (sig_matches) return NULL;
img = e_notification_image_new();
if (!img) return NULL;
===================================================================
RCS file: /cvs/e/e17/libs/e_dbus/src/lib/notification/notification.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- notification.c 4 Nov 2007 07:51:37 -0000 1.2
+++ notification.c 16 Jan 2008 19:22:16 -0000 1.3
@@ -2,6 +2,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <inttypes.h>
#include <Ecore_Data.h>
#include "e_notify_private.h"
@@ -70,6 +71,7 @@
if (n->hints.desktop) free(n->hints.desktop);
if (n->hints.sound_file) free(n->hints.sound_file);
if (n->hints.image_data) e_notification_image_free(n->hints.image_data);
+ if (n->hints.icon_data) e_notification_image_free(n->hints.icon_data);
free(n);
}
@@ -330,6 +332,12 @@
EAPI E_Notification_Image *
+e_notification_hint_icon_data_get(E_Notification *n)
+{
+ return n->hints.icon_data;
+}
+
+EAPI E_Notification_Image *
e_notification_image_new()
{
E_Notification_Image *img;
@@ -349,44 +357,46 @@
EAPI Evas_Object *
e_notification_image_evas_object_add(Evas *evas, E_Notification_Image *img)
{
-#if 0
- unsigned int *imgdata;
-
- imgdata = malloc(img.width * img.height * 4);
+ int *imgdata;
+ Evas_Object *o = NULL;
+
+ if (!evas || !img) return NULL;
+
+ o = evas_object_image_add(evas);
+ evas_object_resize(o, img->width, img->height);
+ evas_object_image_alpha_set(o, img->has_alpha);
+ evas_object_image_size_set(o, img->width, img->height);
+ evas_object_image_fill_set(o, 0, 0, img->width, img->height);
+ imgdata = evas_object_image_data_get(o, 1);
- // evas requires 32 bit RGBA data, with no padding after rows
if (img->bits_per_sample == 8)
- {
- if (img->channels == 4)
{
- /* RGBA data */
- if (img->rowstride == 4 * width)
- {
- // data is already in format we need
- memcpy(imgdata, img->data, 4 * img.width * img.height)
- }
- else
- {
- /* rowstride unneccesarily too long? */
- int i;
- for (i = 0; i < img->height; i++)
+ /* Although not specified.
+ * The data are very likely to come from a GdkPixbuf
+ * which align each row on a 4-bytes boundary when using RGB.
+ * And is RGBA otherwise.
+ */
+ int x, y;
+ int32_t *dest;
+ unsigned char *src;
+ for (y = 0; y < img->height; y++)
{
- }
- }
- }
- else if (img->channels == 3)
- {
- unsigned int val;
- unsigned int i, j;
+ src = img->data + y * img->rowstride;
+ dest = imgdata + y * img->width;
- for ()
- {
- }
+ for (x = 0; x < img->width; x++, src += img->channels, dest++)
+ {
+ *dest = *(src + 2);
+ *dest += *(src + 1) << 8;
+ *dest += *(src + 0) << 16;
+ if (img->has_alpha)
+ *dest += *(src + 3) << 24;
+ else
+ *dest += 0 << 24;
+ }
+ }
}
- }
- else
- {
- }
-#endif
- return NULL;
+ evas_object_image_data_update_add(o, 0, 0, img->width, img->height);
+ evas_object_image_data_set(o, imgdata);
+ return o;
}
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs