summaryrefslogtreecommitdiff
path: root/src/lib/eldbus/eldbus_service.c
diff options
context:
space:
mode:
authorJosé Roberto de Souza <zehortigoza@gmail.com>2013-03-23 01:36:48 -0300
committerLucas De Marchi <lucas.de.marchi@gmail.com>2013-05-04 10:38:55 -0300
commit9e4dc299a73d81cfa2c0fa32db1d2179ade21617 (patch)
tree8880f7e0d677d39ead4852c6d13b5f20fce487a3 /src/lib/eldbus/eldbus_service.c
parentd6c773293123e8834e0b94dd2f3c6d1eb4d3bb94 (diff)
eldbus: Fix eldbus_service_*_get() functions over FDO interfaces
Diffstat (limited to 'src/lib/eldbus/eldbus_service.c')
-rw-r--r--src/lib/eldbus/eldbus_service.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/src/lib/eldbus/eldbus_service.c b/src/lib/eldbus/eldbus_service.c
index e6946c21b1..b42b16e0b7 100644
--- a/src/lib/eldbus/eldbus_service.c
+++ b/src/lib/eldbus/eldbus_service.c
@@ -66,9 +66,9 @@ static DBusObjectPathVTable vtable = {
66 NULL 66 NULL
67}; 67};
68 68
69Eldbus_Service_Interface *introspectable; 69static Eldbus_Service_Interface *introspectable;
70Eldbus_Service_Interface *properties_iface; 70static Eldbus_Service_Interface *properties_iface;
71Eldbus_Service_Interface *objmanager; 71static Eldbus_Service_Interface *objmanager;
72 72
73static inline void 73static inline void
74_introspect_arguments_append(Eina_Strbuf *buf, const Eldbus_Arg_Info *args, 74_introspect_arguments_append(Eina_Strbuf *buf, const Eldbus_Arg_Info *args,
@@ -1147,41 +1147,29 @@ _object_handler(DBusConnection *conn EINA_UNUSED, DBusMessage *msg, void *user_d
1147 eldbus_msg = eldbus_message_new(EINA_FALSE); 1147 eldbus_msg = eldbus_message_new(EINA_FALSE);
1148 EINA_SAFETY_ON_NULL_RETURN_VAL(eldbus_msg, DBUS_HANDLER_RESULT_NEED_MEMORY); 1148 EINA_SAFETY_ON_NULL_RETURN_VAL(eldbus_msg, DBUS_HANDLER_RESULT_NEED_MEMORY);
1149 eldbus_msg->dbus_msg = msg; 1149 eldbus_msg->dbus_msg = msg;
1150 dbus_message_ref(eldbus_msg->dbus_msg);
1150 dbus_message_iter_init(eldbus_msg->dbus_msg, &eldbus_msg->iterator->dbus_iterator); 1151 dbus_message_iter_init(eldbus_msg->dbus_msg, &eldbus_msg->iterator->dbus_iterator);
1151 1152
1152 if (!_have_signature(method->in, eldbus_msg)) 1153 if (!_have_signature(method->in, eldbus_msg))
1153 { 1154 reply = eldbus_message_error_new(eldbus_msg, DBUS_ERROR_INVALID_SIGNATURE,
1154 reply = eldbus_message_error_new(eldbus_msg, 1155 "See introspectable to know the expected signature");
1155 DBUS_ERROR_INVALID_SIGNATURE,
1156 "See introspectable to know the expected signature");
1157 }
1158 else 1156 else
1159 { 1157 {
1160 if (iface->obj) 1158 if (iface->obj)
1161 reply = method->cb(iface, eldbus_msg); 1159 reply = method->cb(iface, eldbus_msg);
1162 else 1160 else
1163 { 1161 {
1164 //if iface does have obj it is some of FreeDesktop interfaces: 1162 /* if iface does have obj it is some of FreeDesktop interfaces:
1165 //Introspectable, Properties... 1163 Introspectable, Properties or ObjectManager */
1166 Eldbus_Service_Interface *cpy; 1164 iface->obj = obj;
1167 cpy = calloc(1, sizeof(Eldbus_Service_Interface)); 1165 reply = method->cb(iface, eldbus_msg);
1168 if (!cpy) 1166 iface->obj = NULL;
1169 {
1170 dbus_message_ref(eldbus_msg->dbus_msg);
1171 eldbus_message_unref(eldbus_msg);
1172 return DBUS_HANDLER_RESULT_NEED_MEMORY;
1173 }
1174 cpy->obj = obj;
1175 reply = method->cb(cpy, eldbus_msg);
1176 free(cpy);
1177 } 1167 }
1178 } 1168 }
1179 1169
1180 dbus_message_ref(eldbus_msg->dbus_msg);
1181 eldbus_message_unref(eldbus_msg); 1170 eldbus_message_unref(eldbus_msg);
1182 if (!reply) return DBUS_HANDLER_RESULT_HANDLED; 1171 if (reply)
1183 1172 _eldbus_connection_send(obj->conn, reply, NULL, NULL, -1);
1184 _eldbus_connection_send(obj->conn, reply, NULL, NULL, -1);
1185 1173
1186 return DBUS_HANDLER_RESULT_HANDLED; 1174 return DBUS_HANDLER_RESULT_HANDLED;
1187} 1175}