From: Eduardo Lima (Etrunko) Date: Wed, 9 Oct 2013 19:08:07 +0000 (-0300) Subject: Add events to notify of IBus connect/disconnect X-Git-Tag: v0.0.2~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f4fde198d49529b6380e55a6aa554a0a390088e9;p=profile%2Fivi%2Fweekeyboard.git Add events to notify of IBus connect/disconnect Change-Id: I1fb68f1840cb10a5517640221d132201c00e8235 Signed-off-by: Eduardo Lima (Etrunko) --- diff --git a/src/wkb-ibus.c b/src/wkb-ibus.c index eee552b..f4513c9 100644 --- a/src/wkb-ibus.c +++ b/src/wkb-ibus.c @@ -39,6 +39,9 @@ DBG("Message '%s' with signature '%s'", eldbus_message_member_get(_msg), eldbus_message_signature_get(_msg)); \ } while (0) +int WKB_IBUS_CONNECTED = 0; +int WKB_IBUS_DISCONNECTED = 0; + struct _wkb_ibus_context { char *address; @@ -321,6 +324,8 @@ wkb_ibus_connect(void) ELDBUS_NAME_REQUEST_FLAG_REPLACE_EXISTING | ELDBUS_NAME_REQUEST_FLAG_DO_NOT_QUEUE, _wkb_name_request_cb, ctx); + ecore_event_add(WKB_IBUS_CONNECTED, (void *) ctx->conn, NULL, NULL); + return EINA_TRUE; } @@ -354,6 +359,8 @@ wkb_ibus_init(void) goto calloc_err; } + WKB_IBUS_CONNECTED = ecore_event_type_new(); + WKB_IBUS_DISCONNECTED = ecore_event_type_new(); _wkb_ibus_query_address(); end: @@ -415,6 +422,13 @@ end: } void +_wkb_ibus_disconnect_free(void *data, void *func_data) +{ + DBG("Eldbus connection unref"); + eldbus_connection_unref(ctx->conn); +} + +void wkb_ibus_disconnect(void) { if (!ctx->conn) @@ -443,7 +457,7 @@ wkb_ibus_disconnect(void) ctx->config = NULL; } - eldbus_connection_unref(ctx->conn); + ecore_event_add(WKB_IBUS_DISCONNECTED, (void *) ctx->conn, _wkb_ibus_disconnect_free, NULL); } Eina_Bool diff --git a/src/wkb-ibus.h b/src/wkb-ibus.h index 1d92eef..8e3cc70 100644 --- a/src/wkb-ibus.h +++ b/src/wkb-ibus.h @@ -24,6 +24,9 @@ extern "C" { #endif +extern int WKB_IBUS_CONNECTED; +extern int WKB_IBUS_DISCONNECTED; + int wkb_ibus_init(void); void wkb_ibus_shutdown(void);