From: Seungha Son Date: Sat, 13 May 2017 15:01:22 +0000 (+0900) Subject: Refactor ipc init logic X-Git-Tag: submit/tizen/20170519.015707~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f22fa151ddb4793c4d9fab63dc7e9d07720f8a7f;p=platform%2Fcore%2Fappfw%2Fshortcut.git Refactor ipc init logic Signed-off-by: Seungha Son Change-Id: I7b0f460c9213c433dc71de1e863171aaa93b5a5e --- 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);