edbus: register interface before name

Else will clients activating a service fail, as the dbus expects to know
available interfaces on name request.

SVN revision: 78811
This commit is contained in:
Sebastian Dransfeld 2012-11-02 01:46:56 +00:00
parent 593b9c00e0
commit 75579a775b
2 changed files with 7 additions and 6 deletions

View File

@ -350,7 +350,6 @@ static const EDBus_Service_Interface_Desc iface_desc = {
static void static void
on_name_request(void *data, const EDBus_Message *msg, EDBus_Pending *pending) on_name_request(void *data, const EDBus_Message *msg, EDBus_Pending *pending)
{ {
EDBus_Connection *conn = data;
unsigned int flag; unsigned int flag;
resp2 = malloc(sizeof(char) * 5); resp2 = malloc(sizeof(char) * 5);
@ -373,8 +372,6 @@ on_name_request(void *data, const EDBus_Message *msg, EDBus_Pending *pending)
printf("error name already in use\n"); printf("error name already in use\n");
return; return;
} }
edbus_service_interface_register(conn, PATH, &iface_desc);
} }
int int
@ -387,7 +384,8 @@ main(void)
conn = edbus_connection_get(EDBUS_CONNECTION_TYPE_SESSION); conn = edbus_connection_get(EDBUS_CONNECTION_TYPE_SESSION);
edbus_name_request(conn, BUS, EDBUS_NAME_REQUEST_FLAG_DO_NOT_QUEUE, on_name_request, conn); edbus_service_interface_register(conn, PATH, &iface_desc);
edbus_name_request(conn, BUS, EDBUS_NAME_REQUEST_FLAG_DO_NOT_QUEUE, on_name_request, NULL);
ecore_main_loop_begin(); ecore_main_loop_begin();

View File

@ -195,6 +195,7 @@ on_name_request(void *data, const EDBus_Message *msg, EDBus_Pending *pending)
EDBus_Service_Interface *iface; EDBus_Service_Interface *iface;
unsigned int flag; unsigned int flag;
iface = data;
if (edbus_message_error_get(msg, NULL, NULL)) if (edbus_message_error_get(msg, NULL, NULL))
{ {
printf("error on on_name_request\n"); printf("error on on_name_request\n");
@ -213,7 +214,6 @@ on_name_request(void *data, const EDBus_Message *msg, EDBus_Pending *pending)
return; return;
} }
iface = edbus_service_interface_register(conn, PATH, &iface_desc);
ecore_timer_add(5, send_signal_alive, iface); ecore_timer_add(5, send_signal_alive, iface);
ecore_timer_add(6, send_signal_hello, iface); ecore_timer_add(6, send_signal_hello, iface);
} }
@ -221,13 +221,16 @@ on_name_request(void *data, const EDBus_Message *msg, EDBus_Pending *pending)
int int
main(void) main(void)
{ {
EDBus_Service_Interface *iface;
ecore_init(); ecore_init();
edbus_init(); edbus_init();
conn = edbus_connection_get(EDBUS_CONNECTION_TYPE_SESSION); conn = edbus_connection_get(EDBUS_CONNECTION_TYPE_SESSION);
iface = edbus_service_interface_register(conn, PATH, &iface_desc);
edbus_name_request(conn, BUS, EDBUS_NAME_REQUEST_FLAG_DO_NOT_QUEUE, edbus_name_request(conn, BUS, EDBUS_NAME_REQUEST_FLAG_DO_NOT_QUEUE,
on_name_request, NULL); on_name_request, iface);
ecore_main_loop_begin(); ecore_main_loop_begin();