diff options
author | Eduardo Lima (Etrunko) <eduardo.lima@intel.com> | 2013-10-09 16:08:07 -0300 |
---|---|---|
committer | Eduardo Lima (Etrunko) <eduardo.lima@intel.com> | 2013-10-09 16:08:07 -0300 |
commit | f4fde198d49529b6380e55a6aa554a0a390088e9 (patch) | |
tree | 0c329fa398477446de0d2938ec3756519af84b15 /src | |
parent | 94ebd52137746f2e4a577abb16d74e988c32f4ef (diff) | |
download | weekeyboard-f4fde198d49529b6380e55a6aa554a0a390088e9.tar.gz weekeyboard-f4fde198d49529b6380e55a6aa554a0a390088e9.tar.bz2 weekeyboard-f4fde198d49529b6380e55a6aa554a0a390088e9.zip |
Add events to notify of IBus connect/disconnect
Change-Id: I1fb68f1840cb10a5517640221d132201c00e8235
Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/wkb-ibus.c | 16 | ||||
-rw-r--r-- | src/wkb-ibus.h | 3 |
2 files changed, 18 insertions, 1 deletions
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); |