Reduce the duplicated code to launch app control 75/133175/3
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 9 Jun 2017 06:13:31 +0000 (15:13 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 9 Jun 2017 06:56:13 +0000 (15:56 +0900)
Change-Id: Ia4349ec3151b6f7b58fc8714d808215a9a231a83
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
ism/extras/efl_panel/isf_panel_efl.cpp

index 42de097..b82b302 100644 (file)
@@ -284,6 +284,7 @@ static void       create_notification                  (NotificationData *noti_d
 static void       show_ime_selector_notification       (void);
 #endif
 static void       set_language_and_locale              (void);
+static void       app_control_launch                   (const char *app_id);
 
 /////////////////////////////////////////////////////////////////////////////
 // Declaration of internal variables.
@@ -5569,7 +5570,6 @@ static void slot_show_helper_ise_list (void)
 {
     // Launch IME List application; e.g., org.tizen.inputmethod-setting-list
     int ret;
-    app_control_h app_control;
     char *app_id = NULL;
 #ifdef HAVE_PKGMGR_INFO
     pkgmgrinfo_appinfo_filter_h handle;
@@ -5592,39 +5592,7 @@ static void slot_show_helper_ise_list (void)
 #endif
 
     if (app_id) {
-        ret = app_control_create (&app_control);
-        if (ret != APP_CONTROL_ERROR_NONE) {
-            LOGW ("app_control_create returned %d\n", ret);
-            free(app_id);
-            return;
-        }
-
-        ret = app_control_set_operation (app_control, APP_CONTROL_OPERATION_DEFAULT);
-        if (ret != APP_CONTROL_ERROR_NONE) {
-            LOGW ("app_control_set_operation returned %d\n", ret);
-            app_control_destroy(app_control);
-            free(app_id);
-            return;
-        }
-
-        ret = app_control_set_app_id (app_control, app_id);
-        if (ret != APP_CONTROL_ERROR_NONE) {
-            LOGW ("app_control_set_app_id returned %d\n", ret);
-            app_control_destroy(app_control);
-            free(app_id);
-            return;
-        }
-
-        ret = app_control_send_launch_request (app_control, NULL, NULL);
-        if (ret != APP_CONTROL_ERROR_NONE) {
-            LOGW ("app_control_send_launch_request returned %d, app_id=%s\n", ret, app_id);
-            app_control_destroy(app_control);
-            free(app_id);
-            return;
-        }
-
-        app_control_destroy (app_control);
-        SECURE_LOGD ("Launch %s\n", app_id);
+        app_control_launch (app_id);
         free(app_id);
     }
     else {
@@ -5639,7 +5607,6 @@ static void slot_show_helper_ise_selector (void)
 {
     // Launch IME Selector application; e.g., org.tizen.inputmethod-setting-selector
     int ret;
-    app_control_h app_control;
     char *app_id = NULL;
 #ifdef HAVE_PKGMGR_INFO
     pkgmgrinfo_appinfo_filter_h handle;
@@ -5662,39 +5629,7 @@ static void slot_show_helper_ise_selector (void)
 #endif
 
     if (app_id) {
-        ret = app_control_create (&app_control);
-        if (ret != APP_CONTROL_ERROR_NONE) {
-            LOGW ("app_control_create returned %d\n", ret);
-            free(app_id);
-            return;
-        }
-
-        ret = app_control_set_operation (app_control, APP_CONTROL_OPERATION_DEFAULT);
-        if (ret != APP_CONTROL_ERROR_NONE) {
-            LOGW ("app_control_set_operation returned %d\n", ret);
-            app_control_destroy(app_control);
-            free(app_id);
-            return;
-        }
-
-        ret = app_control_set_app_id (app_control, app_id);
-        if (ret != APP_CONTROL_ERROR_NONE) {
-            LOGW ("app_control_set_app_id returned %d\n", ret);
-            app_control_destroy(app_control);
-            free(app_id);
-            return;
-        }
-
-        ret = app_control_send_launch_request(app_control, NULL, NULL);
-        if (ret != APP_CONTROL_ERROR_NONE) {
-            LOGW ("app_control_send_launch_request returned %d, app_id=%s\n", ret, app_id);
-            app_control_destroy(app_control);
-            free(app_id);
-            return;
-        }
-
-        app_control_destroy(app_control);
-        SECURE_LOGD ("Launch %s\n", app_id);
+        app_control_launch (app_id);
         free(app_id);
     }
     else {