forked from enlightenment/efl
efreet: Unregister when client connection die
Patch by: José Roberto de Souza <zehortigoza@profusion.mobi> SVN revision: 80950
This commit is contained in:
parent
5338a060db
commit
e9afafc21b
|
@ -39,6 +39,22 @@ disconnected(void *context __UNUSED__, EDBus_Connection *connection __UNUSED__,
|
||||||
quit();
|
quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
client_name_owner_changed_cb(void *data, const char *bus, const char *old_id, const char *new_id)
|
||||||
|
{
|
||||||
|
if (new_id[0])
|
||||||
|
return;
|
||||||
|
edbus_name_owner_changed_callback_del(conn, bus,
|
||||||
|
client_name_owner_changed_cb, NULL);
|
||||||
|
clients--;
|
||||||
|
if (clients <= 0)
|
||||||
|
{
|
||||||
|
clients = 0;
|
||||||
|
if (shutdown) ecore_timer_del(shutdown);
|
||||||
|
shutdown = ecore_timer_add(10.0, do_shutdown, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static EDBus_Message *
|
static EDBus_Message *
|
||||||
do_register(const EDBus_Service_Interface *ifc __UNUSED__, const EDBus_Message *message)
|
do_register(const EDBus_Service_Interface *ifc __UNUSED__, const EDBus_Message *message)
|
||||||
{
|
{
|
||||||
|
@ -55,24 +71,16 @@ do_register(const EDBus_Service_Interface *ifc __UNUSED__, const EDBus_Message *
|
||||||
clients++;
|
clients++;
|
||||||
if (shutdown) ecore_timer_del(shutdown);
|
if (shutdown) ecore_timer_del(shutdown);
|
||||||
shutdown = NULL;
|
shutdown = NULL;
|
||||||
|
|
||||||
|
edbus_name_owner_changed_callback_add(conn,
|
||||||
|
edbus_message_sender_get(message),
|
||||||
|
client_name_owner_changed_cb, NULL,
|
||||||
|
EINA_FALSE);
|
||||||
reply = edbus_message_method_return_new(message);
|
reply = edbus_message_method_return_new(message);
|
||||||
edbus_message_arguments_set(reply, "b", cache_desktop_exists());
|
edbus_message_arguments_set(reply, "b", cache_desktop_exists());
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
static EDBus_Message *
|
|
||||||
do_unregister(const EDBus_Service_Interface *ifc __UNUSED__, const EDBus_Message *message __UNUSED__)
|
|
||||||
{
|
|
||||||
clients--;
|
|
||||||
if (clients <= 0)
|
|
||||||
{
|
|
||||||
clients = 0;
|
|
||||||
if (shutdown) ecore_timer_del(shutdown);
|
|
||||||
shutdown = ecore_timer_add(10.0, do_shutdown, NULL);
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static EDBus_Message *
|
static EDBus_Message *
|
||||||
add_desktop_dirs(const EDBus_Service_Interface *ifc __UNUSED__, const EDBus_Message *message)
|
add_desktop_dirs(const EDBus_Service_Interface *ifc __UNUSED__, const EDBus_Message *message)
|
||||||
{
|
{
|
||||||
|
@ -160,10 +168,6 @@ static const EDBus_Method methods[] = {
|
||||||
"Register", EDBUS_ARGS({"s", "lang info"}), EDBUS_ARGS({"b", "cache exists"}),
|
"Register", EDBUS_ARGS({"s", "lang info"}), EDBUS_ARGS({"b", "cache exists"}),
|
||||||
do_register, 0
|
do_register, 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Unregister", NULL, NULL,
|
|
||||||
do_unregister, 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"AddDesktopDirs", EDBUS_ARGS({"as", "dirs"}), NULL,
|
"AddDesktopDirs", EDBUS_ARGS({"as", "dirs"}), NULL,
|
||||||
add_desktop_dirs, EDBUS_METHOD_FLAG_NOREPLY
|
add_desktop_dirs, EDBUS_METHOD_FLAG_NOREPLY
|
||||||
|
|
|
@ -213,7 +213,6 @@ efreet_cache_shutdown(void)
|
||||||
if (conn)
|
if (conn)
|
||||||
{
|
{
|
||||||
EDBus_Object *obj = edbus_proxy_object_get(proxy);
|
EDBus_Object *obj = edbus_proxy_object_get(proxy);
|
||||||
edbus_proxy_call(proxy, "Unregister", NULL, NULL, -1, "");
|
|
||||||
edbus_proxy_unref(proxy);
|
edbus_proxy_unref(proxy);
|
||||||
edbus_object_unref(obj);
|
edbus_object_unref(obj);
|
||||||
edbus_connection_unref(conn);
|
edbus_connection_unref(conn);
|
||||||
|
|
Loading…
Reference in New Issue