From: raster Date: Tue, 26 Jul 2011 07:49:50 +0000 (+0000) Subject: From: "Libor Zoubek" X-Git-Tag: 2.0_alpha~43^2~79 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=736e5b1e16e03aba22b45a45e299bfca18a1bda0;p=framework%2Fuifw%2Fedbus.git From: "Libor Zoubek" Subject: Re: [E-devel] [patch] e_dbus notification I've reported a bug http://trac.enlightenment.org/e/ticket/775 Please review/apply attached patch that fixes above bug. I am using libnotify 0.7.2. e_module-notification does not react on anyhing like notify-send -u critical "hello" "hello" This prevents working notification when using for example xchat-2.8.8. I was watching dbus-monitor and found out, that e_dbus does not return proper values when getServerInformation is called. By this spec (v1.2) getServerInformation should return 4 string values, not 3 as it was in v0.9 Please apply attached patch which fixes this bug git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/e_dbus@61731 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/notification/E_Notification_Daemon.h b/src/lib/notification/E_Notification_Daemon.h index 9285373..fc530ba 100644 --- a/src/lib/notification/E_Notification_Daemon.h +++ b/src/lib/notification/E_Notification_Daemon.h @@ -2,7 +2,7 @@ #define E_NOTIFICATION_DAEMON_H #define E_NOTIFICATION_DAEMON_VERSION "0.9" - +#define E_NOTIFICATION_DAEMON_SUPPORTS_SPEC_VERSION "1.2" #include #ifdef EAPI diff --git a/src/lib/notification/E_Notify.h b/src/lib/notification/E_Notify.h index 9acaa15..157d83d 100644 --- a/src/lib/notification/E_Notify.h +++ b/src/lib/notification/E_Notify.h @@ -76,6 +76,7 @@ struct E_Notification_Return_Get_Server_Information const char *name; const char *vendor; const char *version; + const char *spec_version; }; /* signals */ diff --git a/src/lib/notification/daemon.c b/src/lib/notification/daemon.c index 2e4127b..cf389bb 100644 --- a/src/lib/notification/daemon.c +++ b/src/lib/notification/daemon.c @@ -68,7 +68,7 @@ method_get_server_information(E_DBus_Object *obj, DBusMessage *message) daemon = e_dbus_object_data_get(obj); - return e_notify_marshal_get_server_information_return(message, daemon->name, daemon->vendor, E_NOTIFICATION_DAEMON_VERSION); + return e_notify_marshal_get_server_information_return(message, daemon->name, daemon->vendor, E_NOTIFICATION_DAEMON_VERSION, E_NOTIFICATION_DAEMON_SUPPORTS_SPEC_VERSION); } @@ -126,7 +126,7 @@ e_notification_daemon_add(const char *name, const char *vendor) e_dbus_interface_method_add(daemon->iface, "GetCapabilities", "", "as", method_get_capabilities); e_dbus_interface_method_add(daemon->iface, "Notify", "susssasa{sv}i", "u", method_notify); e_dbus_interface_method_add(daemon->iface, "CloseNotification", "u", "u", method_close_notification); - e_dbus_interface_method_add(daemon->iface, "GetServerInformation", "", "sss", method_get_server_information); + e_dbus_interface_method_add(daemon->iface, "GetServerInformation", "", "ssss", method_get_server_information); return daemon; } diff --git a/src/lib/notification/e_notify_private.h b/src/lib/notification/e_notify_private.h index 250f6d5..6879a2d 100644 --- a/src/lib/notification/e_notify_private.h +++ b/src/lib/notification/e_notify_private.h @@ -23,7 +23,7 @@ DBusMessage * e_notify_marshal_get_capabilities_return(DBusMessage *method_call, void * e_notify_unmarshal_get_capabilities_return(DBusMessage *msg, DBusError *err); void e_notify_free_get_capabilities_return(void *data); 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); +DBusMessage * e_notify_marshal_get_server_information_return(DBusMessage *method_call, const char *name, const char *vendor, const char *version, const char *spec_version); void * e_notify_unmarshal_get_server_information_return(DBusMessage *msg, DBusError *err); void e_notify_free_get_server_information_return(void *data); DBusMessage * e_notify_marshal_close_notification(dbus_uint32_t id); diff --git a/src/lib/notification/marshal.c b/src/lib/notification/marshal.c index 91b9389..fc009fa 100644 --- a/src/lib/notification/marshal.c +++ b/src/lib/notification/marshal.c @@ -178,11 +178,11 @@ 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_notify_marshal_get_server_information_return(DBusMessage *method_call, const char *name, const char *vendor, const char *version, const char *spec_version) { DBusMessage *msg; msg = dbus_message_new_method_return(method_call); - dbus_message_append_args(msg, DBUS_TYPE_STRING, &name, DBUS_TYPE_STRING, &vendor, DBUS_TYPE_STRING, &version, DBUS_TYPE_INVALID); + dbus_message_append_args(msg, DBUS_TYPE_STRING, &name, DBUS_TYPE_STRING, &vendor, DBUS_TYPE_STRING, &version, DBUS_TYPE_STRING, &spec_version, DBUS_TYPE_INVALID); return msg; } @@ -190,21 +190,37 @@ void * e_notify_unmarshal_get_server_information_return(DBusMessage *msg, DBusError *err) { E_Notification_Return_Get_Server_Information *info; - 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_TYPE_STRING, &(info->name), - DBUS_TYPE_STRING, &(info->vendor), - DBUS_TYPE_STRING, &(info->version), - DBUS_TYPE_INVALID - ); + if (dbus_message_has_signature(msg, "ssss")) + { + info = calloc(1, sizeof(E_Notification_Return_Get_Server_Information)); + dbus_message_get_args(msg, err, + DBUS_TYPE_STRING, &(info->name), + DBUS_TYPE_STRING, &(info->vendor), + DBUS_TYPE_STRING, &(info->version), + DBUS_TYPE_STRING, &(info->spec_version), + DBUS_TYPE_INVALID + ); + } + else if (dbus_message_has_signature(msg,"sss")) + { + // stay combatible with servers <= 0.9 spec + info = calloc(1, sizeof(E_Notification_Return_Get_Server_Information)); + dbus_message_get_args(msg, err, + DBUS_TYPE_STRING, &(info->name), + DBUS_TYPE_STRING, &(info->vendor), + DBUS_TYPE_STRING, &(info->version), + DBUS_TYPE_INVALID + ); + } + else + { + return NULL; + } if (dbus_error_is_set(err)) { free(info); return NULL; } - return info; }