Remove the dependency on ui-gadget 68/41768/1
authorSungmin Kwak <sungmin.kwak@samsung.com>
Thu, 4 Jun 2015 12:39:50 +0000 (21:39 +0900)
committerLi Zhang <li2012.zhang@samsung.com>
Wed, 17 Jun 2015 09:42:11 +0000 (17:42 +0800)
Change-Id: I55f0da0f11d51fa735de02caadc3575001bb564d

configure.ac
ism/demos/Makefile.am
ism/demos/isf_demo_efl.cpp
ism/extras/efl_panel/Makefile.am

index 37f69dc..e3847e6 100644 (file)
@@ -252,11 +252,6 @@ PKG_CHECK_MODULES(X11, [x11],
                   [ISF_HAS_X11=yes],
                   [ISF_HAS_X11=no])
 
-# Check ui-gadget library
-PKG_CHECK_MODULES(UIGADGET, [ui-gadget-1],
-                  [ISF_HAS_UIGADGET=yes],
-                  [ISF_HAS_UIGADGET=no])
-
 # Check utilX library
 PKG_CHECK_MODULES(UTILX, [utilX],
                   [ISF_HAS_UTILX=yes],
@@ -338,10 +333,6 @@ if test "$ISF_HAS_NOTIFICATION" = "yes"; then
   AC_DEFINE(HAVE_NOTIFICATION,1,[Have Notification functions.])
 fi
 
-if test "$ISF_HAS_UIGADGET" = "yes"; then
-  AC_DEFINE(HAVE_UIGADGET,1,[Have UI gadget functions.])
-fi
-
 if test "$ISF_HAS_PKGMGR_INFO" = "yes"; then
   AC_DEFINE(HAVE_PKGMGR_INFO,1,[Have Package manager functions.])
 fi
index c6d7ba3..e0e9f7f 100644 (file)
@@ -45,7 +45,6 @@ isf_demo_efl_SOURCES  = isf_demo_efl.cpp \
 isf_demo_efl_CXXFLAGS = @EFL_CFLAGS@ \
                         @ECOREX_CFLAGS@ \
                         @APPCORE_EFL_CFLAGS@ \
-                        @UIGADGET_CFLAGS@ \
                         @VCONF_CFLAGS@ \
                         @PRIVILEGE_CONTROL_CFLAGS@ \
                         @EFL_EXTENSION_CFLAGS@ \
@@ -57,7 +56,6 @@ isf_demo_efl_LDFLAGS  = @EFL_LIBS@ @LTLIBINTL@ -rpath $(libdir) \
                         @ECOREX_LIBS@ \
                         @VCONF_LIBS@ \
                         @APPCORE_EFL_LIBS@ \
-                        @UIGADGET_LIBS@ \
                         @PRIVILEGE_CONTROL_LIBS@ \
                         @EFL_EXTENSION_LIBS@ \
                         @DLOG_LIBS@ \
index 7c6e2ee..ec3926e 100644 (file)
 #include "isf_ondemand_efl.h"
 #include "isf_input_hint_efl.h"
 #include "isf_password_mode_efl.h"
-
-#if HAVE_UIGADGET
-#include <ui-gadget.h>
+#include <pkgmgr-info.h>
+#include <app_control.h>
 
 static void isfsetting_bt (void *data, Evas_Object *obj, void *event_info);
-#endif
 
 static struct _menu_item isf_demo_menu_its[] = {
     { "ISF Layout", ise_layout_bt },
@@ -67,9 +65,7 @@ static struct _menu_item isf_demo_menu_its[] = {
     { "ISF Focus Movement", isf_focus_movement_bt },
     { "ISF Event", isf_event_demo_bt },
     { "ISF IM Control", imcontrolapi_bt },
-#if HAVE_UIGADGET
     { "ISF Setting", isfsetting_bt },
-#endif
 
     /* do not delete below */
     { NULL, NULL }
@@ -94,69 +90,71 @@ static void _list_click (void *data, Evas_Object *obj, void *event_info)
         elm_list_item_selected_set (it, EINA_FALSE);
 }
 
-#if HAVE_UIGADGET
-static void layout_cb (ui_gadget_h ug, enum ug_mode mode, void *priv)
+/**
+ * @brief Finds appid with specific category
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative
+ */
+static int _find_appid_from_category(const pkgmgrinfo_appinfo_h handle, void *user_data)
 {
-    struct appdata *ad = NULL;
-    Evas_Object *base = NULL;
-
-    if (ug == NULL || priv == NULL)
-        return;
-
-    ad = (appdata *)priv;
-
-    base = (Evas_Object *)ug_get_layout (ug);
-    if (base == NULL)
-        return;
-
-    switch (mode) {
-    case UG_MODE_FULLVIEW:
-        evas_object_size_hint_weight_set (base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-        elm_win_resize_object_add (ad->win_main, base);
-        evas_object_show (base);
-        break;
-    case UG_MODE_FRAMEVIEW:
-        LOGD ("please set ug mode to UG_MODE_FULLVIEW!\n");
-        break;
-    default:
-        break;
+    if (user_data) {
+        char **result = (char **)user_data;
+        char *appid = NULL;
+        int ret = 0;
+
+        /* Get appid */
+        ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
+        if (ret == PMINFO_R_OK) {
+            *result = strdup(appid);
+        }
+        else {
+            LOGW("pkgmgrinfo_appinfo_get_appid failed!");
+        }
     }
-}
-
-static void result_cb (ui_gadget_h ug, app_control_h s, void *priv)
-{
-    char *name = NULL;
-    app_control_get_extra_data (s, "name", &name);
-
-    if (name) {
-        free (name);
+    else {
+        LOGW("user_data is null!");
     }
-}
 
-static void destroy_cb (ui_gadget_h ug, void *priv)
-{
-    if (ug == NULL)
-        return;
-
-    ug_destroy (ug);
+    return -1;  // This callback is no longer called.
 }
 
 static void isfsetting_bt (void *data, Evas_Object *obj, void *event_info)
 {
-    struct appdata *ad = (struct appdata *)data;
-    struct ug_cbs cbs = {0, 0, 0, 0, 0, {0, 0, 0}};
-
-    UG_INIT_EFL (ad->win_main, UG_OPT_INDICATOR_ENABLE);
+    // Launch IME List application; e.g., org.tizen.inputmethod-setting-list
+    int ret;
+    app_control_h app_control;
+    char *app_id = NULL;
+    pkgmgrinfo_appinfo_filter_h handle;
+
+    // Find appid with "http://tizen.org/category/ime-list" category; appid might be different in models.
+    ret = pkgmgrinfo_appinfo_filter_create(&handle);
+    if (ret == PMINFO_R_OK) {
+        ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_CATEGORY, "http://tizen.org/category/ime-list");
+        if (ret == PMINFO_R_OK) {
+            ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, _find_appid_from_category, &app_id);
+        }
+        pkgmgrinfo_appinfo_filter_destroy(handle);
+    }
 
-    cbs.layout_cb  = layout_cb;
-    cbs.result_cb  = result_cb;
-    cbs.destroy_cb = destroy_cb;
-    cbs.priv       = ad;
-    ug_create (NULL, "isfsetting-efl",
-               UG_MODE_FULLVIEW,
-               NULL, &cbs);
+    if (app_id) {
+        ret = app_control_create(&app_control);
+        if (ret == APP_CONTROL_ERROR_NONE) {
+            app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
+            app_control_set_app_id(app_control, app_id);
+            app_control_add_extra_data(app_control, "caller", "settings");  // Indicates Settings application is caller.
+            app_control_set_launch_mode(app_control, APP_CONTROL_LAUNCH_MODE_GROUP);
+            ret = app_control_send_launch_request(app_control, NULL, NULL);
+            if (ret != APP_CONTROL_ERROR_NONE) {
+                LOGW("app_control_send_launch_request failed(%d): %s", ret, app_id);
+            }
+            app_control_destroy(app_control);
+        }
+        free(app_id);
+    }
+    else {
+        LOGW("AppID with http://tizen.org/category/ime-list category is not available");
+    }
 }
-#endif
 
 static int create_demo_view (struct appdata *ad)
 {
@@ -192,9 +190,6 @@ static int create_demo_view (struct appdata *ad)
 
 static int lang_changed (void *event_info, void *data)
 {
-#if HAVE_UIGADGET
-    ug_send_event (UG_EVENT_LANG_CHANGE);
-#endif
     return 0;
 }
 
index 3fa90de..489b74d 100644 (file)
@@ -40,7 +40,6 @@ isf_panel_efl_CXXFLAGS = @EFL_CFLAGS@ \
                          @EDBUS_CFLAGS@ \
                          @BLUETOOTH_CFLAGS@ \
                          @FEEDBACK_CFLAGS@ \
-                         @UIGADGET_CFLAGS@ \
                          @PACKAGE_MANAGER_CFLAGS@ \
                          @PKGMGR_INFO_CFLAGS@ \
                          @APP_CONTROL_CFLAGS@ \
@@ -58,7 +57,6 @@ isf_panel_efl_LDFLAGS  = @EFL_LIBS@ @LTLIBINTL@ -rpath $(libdir) \
                          @EDBUS_LIBS@ \
                          @BLUETOOTH_LIBS@ \
                          @FEEDBACK_LIBS@ \
-                         @UIGADGET_LIBS@ \
                          @PACKAGE_MANAGER_LIBS@ \
                          @PKGMGR_INFO_LIBS@ \
                          @APP_CONTROL_LIBS@ \