diff options
author | Seungha Son <seungha.son@samsung.com> | 2017-05-14 00:01:22 +0900 |
---|---|---|
committer | Seungha Son <seungha.son@samsung.com> | 2017-05-15 11:17:07 +0900 |
commit | f22fa151ddb4793c4d9fab63dc7e9d07720f8a7f (patch) | |
tree | 0fade72c406ef71dad10dc63a08eb930eb1974ee | |
parent | 4dfcf4ce2da88f4d3a84e063fb836fa0e8162a67 (diff) | |
download | shortcut-f22fa151ddb4793c4d9fab63dc7e9d07720f8a7f.tar.gz shortcut-f22fa151ddb4793c4d9fab63dc7e9d07720f8a7f.tar.bz2 shortcut-f22fa151ddb4793c4d9fab63dc7e9d07720f8a7f.zip |
Refactor ipc init logic
Signed-off-by: Seungha Son <seungha.son@samsung.com>
Change-Id: I7b0f460c9213c433dc71de1e863171aaa93b5a5e
-rwxr-xr-x | lib/src/shortcut_manager.c | 51 |
1 files changed, 17 insertions, 34 deletions
diff --git a/lib/src/shortcut_manager.c b/lib/src/shortcut_manager.c index 2ef372d..efba17a 100755 --- a/lib/src/shortcut_manager.c +++ b/lib/src/shortcut_manager.c @@ -36,13 +36,10 @@ #define SHORTCUT_IS_WIDGET_SIZE(size) (!!((size) & WIDGET_SIZE_DEFAULT)) #define REQUEST_ID_LEN 40 -EAPI int shortcut_set_request_cb(shortcut_request_cb request_cb, void *data) +static int __shortcut_init_ipc_process() { int ret; - if (request_cb == NULL) - return SHORTCUT_ERROR_INVALID_PARAMETER; /* LCOV_EXCL_LINE */ - ret = _dbus_init(); if (ret != SHORTCUT_ERROR_NONE) { /* LCOV_EXCL_START */ @@ -75,6 +72,20 @@ EAPI int shortcut_set_request_cb(shortcut_request_cb request_cb, void *data) /* LCOV_EXCL_STOP */ } + return SHORTCUT_ERROR_NONE; +} + +EAPI int shortcut_set_request_cb(shortcut_request_cb request_cb, void *data) +{ + int ret; + + if (request_cb == NULL) + return SHORTCUT_ERROR_INVALID_PARAMETER; /* LCOV_EXCL_LINE */ + + ret = __shortcut_init_ipc_process(); + if (ret != SHORTCUT_ERROR_NONE) + return ret; + _set_request_cb(request_cb, data); return SHORTCUT_ERROR_NONE; @@ -92,37 +103,9 @@ EAPI int shortcut_set_remove_cb(shortcut_remove_cb remove_cb, void *data) if (remove_cb == NULL) return SHORTCUT_ERROR_INVALID_PARAMETER; - ret = _dbus_init(); - if (ret != SHORTCUT_ERROR_NONE) { - /* LCOV_EXCL_START */ - SHORTCUT_ERR("Can't init dbus %d", ret); - return ret; - /* LCOV_EXCL_STOP */ - } - - ret = _dbus_signal_init(); - if (ret != SHORTCUT_ERROR_NONE) { - /* LCOV_EXCL_START */ - SHORTCUT_ERR("Can't init dbus_signal %d", ret); - return ret; - /* LCOV_EXCL_STOP */ - } - - ret = _send_service_register(); - if (ret != SHORTCUT_ERROR_NONE) { - /* LCOV_EXCL_START */ - SHORTCUT_ERR("Can't init ipc_monitor_register %d", ret); - return ret; - /* LCOV_EXCL_STOP */ - } - - ret = _dbus_set_watch_name(); - if (ret != SHORTCUT_ERROR_NONE) { - /* LCOV_EXCL_START */ - SHORTCUT_ERR("Can't init _dbus_set_watch_name %d", ret); + ret = __shortcut_init_ipc_process(); + if (ret != SHORTCUT_ERROR_NONE) return ret; - /* LCOV_EXCL_STOP */ - } _set_remove_cb(remove_cb, data); |