Enlightenment CVS committal

Author  : rephorm
Project : e17
Module  : proto

Dir     : e17/proto/e_dbus/src/lib/notification


Modified Files:
        e_notify_private.h marshal.c 


Log Message:
include errors in method return callbacks

===================================================================
RCS file: /cvs/e/e17/proto/e_dbus/src/lib/notification/e_notify_private.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_notify_private.h  11 Jul 2007 00:46:13 -0000      1.2
+++ e_notify_private.h  11 Jul 2007 00:47:19 -0000      1.3
@@ -1,11 +1,11 @@
 #ifndef E_NOTIFY_PRIVATE_H
 #define E_NOTIFY_PRIVATE_H
 
+#define E_NOTIFICATION_BUS_NAME "org.freedesktop.Notifications"
 #define E_NOTIFICATION_INTERFACE "org.freedesktop.Notifications"
-#define E_NOTIFICATION_DESTINATION "org.freedesktop.Notifications"
 #define E_NOTIFICATION_PATH "/org/freedesktop/Notifications"
 
-#define e_notification_call_new(member) 
dbus_message_new_method_call(E_NOTIFICATION_DESTINATION, E_NOTIFICATION_PATH, 
E_NOTIFICATION_INTERFACE, member)
+#define e_notification_call_new(member) 
dbus_message_new_method_call(E_NOTIFICATION_BUS_NAME, E_NOTIFICATION_PATH, 
E_NOTIFICATION_INTERFACE, member)
 
 typedef void (*E_DBus_Variant_Marshaller) (DBusMessageIter *iter, void *data);
 #define E_DBUS_VARIANT_MARSHALLER(x) ((E_DBus_Variant_Marshaller)(x))
@@ -16,23 +16,23 @@
 void e_notify_marshal_dict_int(DBusMessageIter *iter, const char *key, int 
value);
 
 void e_notify_marshal_string_list_as_array(DBusMessageIter *iter, Ecore_List 
*strings);
-Ecore_List * e_notify_unmarshal_string_array_as_list(DBusMessageIter *iter);
+Ecore_List * e_notify_unmarshal_string_array_as_list(DBusMessageIter *iter, 
DBusError *err);
 DBusMessage * e_notify_marshal_get_capabilities();
 DBusMessage * e_notify_marshal_get_capabilities_return(DBusMessage 
*method_call, Ecore_List *capabilities);
-E_Notification_Return_Get_Capabilities * 
e_notify_unmarshal_get_capabilities_return(DBusMessage *msg);
+E_Notification_Return_Get_Capabilities * 
e_notify_unmarshal_get_capabilities_return(DBusMessage *msg, DBusError *err);
 DBusMessage * e_notify_marshal_get_server_information();
 DBusMessage * e_notify_marshal_get_server_information_return(DBusMessage 
*method_call, const char *name, const char *vendor, const char *version);
-E_Notification_Return_Get_Server_Information * 
e_notify_unmarshal_get_server_information_return(DBusMessage *msg);
+E_Notification_Return_Get_Server_Information * 
e_notify_unmarshal_get_server_information_return(DBusMessage *msg, DBusError 
*err);
 DBusMessage * e_notify_marshal_close_notification(dbus_uint32_t id);
-dbus_uint32_t e_notify_unmarshal_close_notification(DBusMessage *msg);
+dbus_uint32_t e_notify_unmarshal_close_notification(DBusMessage *msg, 
DBusError *err);
 DBusMessage * e_notify_marshal_notification_closed_signal(dbus_uint32_t id, 
dbus_uint32_t reason);
-E_Notification_Event_Notification_Closed * 
e_notify_unmarshal_notification_closed_signal(DBusMessage *msg);
+E_Notification_Event_Notification_Closed * 
e_notify_unmarshal_notification_closed_signal(DBusMessage *msg, DBusError *err);
 DBusMessage * e_notify_marshal_action_invoked_signal(dbus_uint32_t id, const 
char *action_id);
-E_Notification_Event_Action_Invoked * 
e_notify_unmarshal_action_invoked_signal(DBusMessage *msg);
+E_Notification_Event_Action_Invoked * 
e_notify_unmarshal_action_invoked_signal(DBusMessage *msg, DBusError *err);
 DBusMessage * e_notify_marshal_notify(E_Notification *n);
-E_Notification * e_notify_unmarshal_notify(DBusMessage *msg);
+E_Notification * e_notify_unmarshal_notify(DBusMessage *msg, DBusError *err);
 DBusMessage * e_notify_marshal_notify_return(DBusMessage *method_call, 
dbus_uint32_t notification_id);
-E_Notification_Return_Notify * e_notify_unmarshal_notify_return(DBusMessage 
*msg);
+E_Notification_Return_Notify * e_notify_unmarshal_notify_return(DBusMessage 
*msg, DBusError *err);
 Ecore_List * e_notify_unmarshal_notify_actions(E_Notification *n, 
DBusMessageIter *iter);
 Ecore_List * e_notify_unmarshal_notify_hints(E_Notification *n, 
DBusMessageIter *iter);
 void e_notify_marshal_hint_image(DBusMessageIter *iter, E_Notification_Image 
*img);
===================================================================
RCS file: /cvs/e/e17/proto/e_dbus/src/lib/notification/marshal.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- marshal.c   11 Jul 2007 00:46:13 -0000      1.4
+++ marshal.c   11 Jul 2007 00:47:19 -0000      1.5
@@ -75,7 +75,7 @@
 }
 
 Ecore_List *
-e_notify_unmarshal_string_array_as_list(DBusMessageIter *iter)
+e_notify_unmarshal_string_array_as_list(DBusMessageIter *iter, DBusError *err)
 {
   Ecore_List *strings;
   char *sig;
@@ -126,7 +126,7 @@
 }
 
 E_Notification_Return_Get_Capabilities *
-e_notify_unmarshal_get_capabilities_return(DBusMessage *msg)
+e_notify_unmarshal_get_capabilities_return(DBusMessage *msg, DBusError *err)
 {
   DBusMessageIter iter, arr;
   E_Notification_Return_Get_Capabilities *ret;
@@ -136,7 +136,7 @@
 
   ret = calloc(1, sizeof(E_Notification_Return_Get_Capabilities));
   dbus_message_iter_init(msg, &iter);
-  ret->capabilities = e_notify_unmarshal_string_array_as_list(&iter);
+  ret->capabilities = e_notify_unmarshal_string_array_as_list(&iter, err);
 
   return ret;
 }
@@ -160,23 +160,21 @@
 }
 
 E_Notification_Return_Get_Server_Information *
-e_notify_unmarshal_get_server_information_return(DBusMessage *msg)
+e_notify_unmarshal_get_server_information_return(DBusMessage *msg, DBusError 
*err)
 {
   E_Notification_Return_Get_Server_Information *info;
-  DBusError err;
-  dbus_error_init(&err);
   if (!dbus_message_has_signature(msg, "sss")) return NULL;
 
   info = calloc(1, sizeof(E_Notification_Return_Get_Server_Information));
-  dbus_message_get_args(msg, &err,
+  dbus_message_get_args(msg, err,
     DBUS_TYPE_STRING, &(info->name),
     DBUS_TYPE_STRING, &(info->vendor),
     DBUS_TYPE_STRING, &(info->version),
     DBUS_TYPE_INVALID
   );
-  if (dbus_error_is_set(&err))
+  if (dbus_error_is_set(err))
   {
-    dbus_error_free(&err);
+    free(info);
     return NULL;
   }
 
@@ -195,18 +193,14 @@
 }
 
 dbus_uint32_t
-e_notify_unmarshal_close_notification(DBusMessage *msg)
+e_notify_unmarshal_close_notification(DBusMessage *msg, DBusError *err)
 {
   dbus_uint32_t id;
-  DBusError err;
-  dbus_error_init(&err);
   if (!dbus_message_has_signature(msg, "u")) return 0;
-  dbus_message_get_args(msg, &err, DBUS_TYPE_UINT32, &id, DBUS_TYPE_INVALID);
-  if (dbus_error_is_set(&err))
-  {
-    dbus_error_free(&err);
+  dbus_message_get_args(msg, err, DBUS_TYPE_UINT32, &id, DBUS_TYPE_INVALID);
+  if (dbus_error_is_set(err))
     return 0;
-  }
+
   return id;
 }
 
@@ -220,20 +214,23 @@
 }
 
 E_Notification_Event_Notification_Closed *
-e_notify_unmarshal_notification_closed_signal(DBusMessage *msg)
+e_notify_unmarshal_notification_closed_signal(DBusMessage *msg, DBusError *err)
 {
   E_Notification_Event_Notification_Closed *ev;
-  DBusError err;
-  dbus_error_init(&err);
 
-  if (!dbus_message_has_signature(msg, "uu")) return NULL;
+  if (!dbus_message_has_signature(msg, "uu")) 
+  {
+    dbus_set_error(err, DBUS_ERROR_INVALID_SIGNATURE, "");
+    return NULL;
+  }
   ev = calloc(1, sizeof(E_Notification_Event_Notification_Closed));
-  dbus_message_get_args(msg, &err, DBUS_TYPE_UINT32, &(ev->notification_id), 
DBUS_TYPE_UINT32, &(ev->reason), DBUS_TYPE_INVALID);
-  if (dbus_error_is_set(&err))
+  dbus_message_get_args(msg, err, DBUS_TYPE_UINT32, &(ev->notification_id), 
DBUS_TYPE_UINT32, &(ev->reason), DBUS_TYPE_INVALID);
+  if (dbus_error_is_set(err))
   {
-    dbus_error_free(&err);
+    free(ev);
     return NULL;
   }
+  return ev;
 }
 
 DBusMessage *
@@ -246,18 +243,20 @@
 }
 
 E_Notification_Event_Action_Invoked *
-e_notify_unmarshal_action_invoked_signal(DBusMessage *msg)
+e_notify_unmarshal_action_invoked_signal(DBusMessage *msg, DBusError *err)
 {
   E_Notification_Event_Action_Invoked *ev;
-  DBusError err;
-  dbus_error_init(&err);
 
-  if (!dbus_message_has_signature(msg, "us")) return NULL;
+  if (!dbus_message_has_signature(msg, "us")) 
+  {
+    dbus_set_error(err, DBUS_ERROR_INVALID_SIGNATURE, "");
+    return NULL;
+  }
   ev = calloc(1, sizeof(E_Notification_Event_Action_Invoked));
-  dbus_message_get_args(msg, &err, DBUS_TYPE_UINT32, &(ev->notification_id), 
DBUS_TYPE_STRING, &(ev->action_id), DBUS_TYPE_INVALID);
-  if (dbus_error_is_set(&err))
+  dbus_message_get_args(msg, err, DBUS_TYPE_UINT32, &(ev->notification_id), 
DBUS_TYPE_STRING, &(ev->action_id), DBUS_TYPE_INVALID);
+  if (dbus_error_is_set(err))
   {
-    dbus_error_free(&err);
+    free(ev);
     return NULL;
   }
   return ev;
@@ -319,7 +318,7 @@
 }
 
 E_Notification *
-e_notify_unmarshal_notify(DBusMessage *msg)
+e_notify_unmarshal_notify(DBusMessage *msg, DBusError *err)
 {
   E_Notification *n;
   const char *s_val;
@@ -374,16 +373,14 @@
 }
 
 E_Notification_Return_Notify *
-e_notify_unmarshal_notify_return(DBusMessage *msg)
+e_notify_unmarshal_notify_return(DBusMessage *msg, DBusError *err)
 {
   E_Notification_Return_Notify *ret;
-  DBusError err;
-  dbus_error_init(&err);
   ret = calloc(1, sizeof(E_Notification_Return_Notify));
-  dbus_message_get_args(msg, &err, DBUS_TYPE_UINT32, &(ret->notification_id), 
DBUS_TYPE_INVALID);
-  if (dbus_error_is_set(&err))
+  dbus_message_get_args(msg, err, DBUS_TYPE_UINT32, &(ret->notification_id), 
DBUS_TYPE_INVALID);
+  if (dbus_error_is_set(err))
   {
-    dbus_error_free(&err);
+    free(ret);
     return NULL;
   }
   return ret;



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to