TizenRefApp-8167 [App Shortcut Widget] Implement application list update after edit... 04/119304/2
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Thu, 16 Mar 2017 08:47:57 +0000 (10:47 +0200)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Mon, 20 Mar 2017 10:51:55 +0000 (12:51 +0200)
Change-Id: Ie4a0b32ffec80ad67f40ae815c27a6efe35c09d2

14 files changed:
apptray-widget-app/CMakeLists.txt
apptray-widget-app/inc/app-widget-app_log.h
apptray-widget-app/inc/util.h
apptray-widget-app/org.tizen.apptray-widget.xml
apptray-widget-app/src/app-widget-app.c
apptray-widget-app/src/common/home_custom_scroller.c
apptray-widget-app/src/util.c
apptray-widget-app/tizen-manifest.xml
apptray-widget/CMakeLists.txt
apptray-widget/inc/apptray_widget_common_defines.h
apptray-widget/inc/apptray_widget_utils.h [new file with mode: 0755]
apptray-widget/src/apptray_widget.c
apptray-widget/src/apptray_widget_utils.c [new file with mode: 0755]
apptray-widget/tizen-manifest.xml

index bd50dcb3335b5370991ce33ccefe95a4eda867d3..9fc0373a65e5d398849c2a5509925a2878c1d49f 100755 (executable)
@@ -80,8 +80,6 @@ FIND_LIBRARY(LIB_M m)
 
 ADD_DEFINITIONS(${pkgs_CFLAGS})
 ADD_DEFINITIONS("-fpie")
-ADD_DEFINITIONS("-DRSSI_ANT_BAR=${RSSI_ANT_BAR}")
-MESSAGE("RSSI_ANT_BAR: ${RSSI_ANT_BAR}")
 
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
 ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
@@ -105,15 +103,6 @@ ADD_DEFINITIONS("-DPROJECT=\"${PROJECT_NAME}\"")
 ADD_EXECUTABLE(${PROJECT_NAME}-app ${SRCS})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME}-app ${pkgs_LDFLAGS} "-pie" ${LIB_M})
 
-IF("${RSSI_ANT_BAR}" STREQUAL "5")
-       SET(RSSI_IMAGE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data/groups/5level")
-ELSEIF("${RSSI_ANT_BAR}" STREQUAL "6")
-       SET(RSSI_IMAGE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data/groups/6level")
-ELSE()
-       SET(RSSI_IMAGE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data/groups/4level")
-ENDIF()
-
-
 
 # install files
 INSTALL(TARGETS ${PROJECT_NAME}-app DESTINATION ${BINDIR})
index a90f19ed1d3d78aba4de94f6ef29e8b3a651ae14..3b3f2fbb6b17710da7386f73be55123653dffed6 100755 (executable)
@@ -35,7 +35,7 @@
 #ifdef  LOG_TAG
 #undef  LOG_TAG
 #endif
-#define LOG_TAG "APPTRAY_WIDGET"
+#define LOG_TAG "APPTRAY_WIDGET_APP"
 
 #if !defined(PACKAGE)
 #define PACKAGE "org.example.app-widget-app"
 #define LOGE(fmt, arg...) dlog_print(DLOG_DEBUG, \
         LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
         __func__, __LINE__, ##arg)
-#endif        
-        
-#if !defined(_D)
+#endif
 
+#if !defined(_D)
 
 #define _D(fmt, arg...)  dlog_print(DLOG_DEBUG, \
         LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
index 79f64c4bbfce5edd97c3e9a639f3ee0f575e1818..00b79cc2f3821e89905b5e1032b322a04c84b790 100755 (executable)
@@ -244,7 +244,7 @@ enum {
 #if !defined(_EDJ)
 #define _EDJ(a) elm_layout_edje_get(a)
 #endif
-extern void _get_resource(const char *file_in, char *file_path_out, int file_path_max);
+extern void apptray_wgt_app_utils_get_resource(const char *file_in, char *file_path_out, int file_path_max);
 
 #if 0
 /* Functions */
index 66f8a97f42adcf47381b2c1b46e333e7b0cfc7fc..81aff2e0dfcc376763411ccb822aac981422b100 100755 (executable)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.tizen.apptray-widget" version="1.0.0">
     <profile name="wearable"/>
-    <ui-application appid="org.tizen.apptray-widget-app" exec="apptray-widget-app" multiple="false" nodisplay="true" taskmanage="true" type="capp">
+    <ui-application appid="org.tizen.apptray-widget-app" exec="apptray-widget-app" multiple="false" nodisplay="true" taskmanage="true" type="capp" hw-acceleration="on">
         <label>Apps</label>
         <icon>org.tizen.apptray-widget-app.png</icon>
     </ui-application>
@@ -16,7 +16,7 @@
         <privilege>http://tizen.org/privilege/message.read</privilege>
         <privilege>http://tizen.org/privilege/contact.read</privilege>
     </privileges>
-    <widget-application appid="org.tizen.apptray-widget" exec="apptray-widget" main="true" update-period="0">
+    <widget-application appid="org.tizen.apptray-widget" exec="apptray-widget" main="true" update-period="0" hw-acceleration="on">
         <label>apptray-widget</label>
         <icon>apps_widget_preview.png</icon>
         <support-size preview="apps_widget_preview.png">2x2</support-size>
index ef8669648f70d1baa08a44ba6cdda14920796993..266c129e06b1a8860fe1cad3cf36a0da6441a508 100755 (executable)
 #define LANGUAGE_ARABIC "ar"
 #define  PACKAGE_MANAGER_PKGINFO_PROP_NODISPALY  "PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING"
 #define APP_WIDGET_PKGID "org.tizen.app-widget"
-#define DEFAULT_APP_ORDER "org.tizen.apptray-widget-app empty org.tizen.watch-setting empty"
+#define DEFAULT_APP_ORDER "org.tizen.apptray-widget-app org.tizen.watch-setting empty empty"
 #define APPS_PKG "org.tizen.apptray-widget-app"
 #define APP_WIDGET_CONTENT_KEY "org.tizen.apptray-widget"
 
+#define BUNDLE_KEY_SHORTCUT_LIST               "shortcut_list"
+#define BUNDLE_KEY_WIDGET_INSTANCE_ID  "instance_id"
+
+typedef enum {
+       APPTRAY_WGT_APP_LAUNCH_TYPE_UNDEFINED = 0,
+       APPTRAY_WGT_APP_LAUNCH_TYPE_MAIN,
+       APPTRAY_WGT_APP_LAUNCH_TYPE_PICK
+} apptray_wgt_app_launch_type_e;
+
 typedef struct appdata {
        Evas_Object *edit_win;
        Evas_Object *select_win;
-       Ecore_X_Window xwin;
        Evas_Object *select_layout;
        Evas_Object *edit_layout;
        Evas_Object *scroller;
        Evas_Object *title;
-       char *widget_name;
+       char *widget_instance_id;
+       apptray_wgt_app_launch_type_e launch_type;
        char *index;
        Ecore_Event_Handler *press_handler;
        Ecore_Event_Handler *release_handler;
@@ -60,7 +69,7 @@ typedef struct appdata {
        Eina_List *item_list;
        char *appid_list[5];
        char *applabel_list[5];
-}appdata_s;
+} appdata_s;
 
 char *widget_id = NULL;
 int slot_index = 0;
@@ -82,9 +91,6 @@ static appdata_s *_get_info(void){
        return g_info;
 }
 
-
-
-
 static void _terminate_add_to_shortcut(void);
 Evas_Object *_set_app_slot(const char *appid, int pos);
 item_info_s *apps_apps_info_create(const char *appid);
@@ -93,21 +99,42 @@ static void _move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static void _down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static void _up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
 
+static void _process_pick_operation(appdata_s *info, app_control_h service);
+static void _process_main_operation(appdata_s *info, app_control_h service, const char *app_list);
 
-void updateContent()
+static char *strdup_s(const char *val)
+{
+       return (val ? strdup(val) : NULL);
+}
+
+static void _update_content(void)
 {
        _ENTER;
-       char content[255] = {0};
-       if(g_info)
-       {
-       snprintf(content, sizeof(content)-1, "%s %s %s %s", g_info->appid_list[0], g_info->appid_list[1], g_info->appid_list[2], g_info->appid_list[3]);
 
-       int ret = preference_set_string(widget_id, content);
-       _D("content: %s updated to preference file: ret:%d",content,ret);
+       if (g_info) {
+               int res = 0;
+               char content[1024] = {0};
 
-       }
-       else
-       {
+               snprintf(content, sizeof(content), "%s %s %s %s",
+                               g_info->appid_list[0],
+                               g_info->appid_list[1],
+                               g_info->appid_list[2],
+                               g_info->appid_list[3]);
+
+               bundle *b_tmp = bundle_create();
+               if (!b_tmp) {
+                       _E("bundle_create failed");
+                       return;
+               }
+               bundle_add_str(b_tmp, BUNDLE_KEY_SHORTCUT_LIST, content);
+               res = widget_service_trigger_update(APP_WIDGET_CONTENT_KEY, g_info->widget_instance_id, b_tmp, 1);
+               if (res != WIDGET_ERROR_NONE) {
+                       _E("Update widget instance [%s] of wgt app [%s] failed. res[%d]", g_info->widget_instance_id, APP_WIDGET_CONTENT_KEY, res);
+               }
+               bundle_free(b_tmp);
+
+
+       } else {
                _E("g_info is NULL");
        }
 }
@@ -156,72 +183,32 @@ static Eina_Bool _key_release_cb(void *data, int type, void *event)
 
        if (!strcmp(ev->keyname, /*KEY_BACK*/"XF86Back") || !strcmp(ev->keyname, /*KEY_POWER*/"XF86PowerOff")) {
                _D("back or home key cb");
-               if(evas_object_visible_get(g_info->select_win) == EINA_TRUE){
+               if(evas_object_visible_get(g_info->select_win) == EINA_TRUE
+                               && g_info->launch_type != APPTRAY_WGT_APP_LAUNCH_TYPE_PICK) {
                        evas_object_hide(g_info->select_win);
                        evas_object_show(g_info->edit_win);
-               }
-               else{
+               } else{
                        _terminate_add_to_shortcut();
                }
        }
        return ECORE_CALLBACK_PASS_ON;
 }
 
-static void _terminate_add_to_shortcut(void){
+static void _terminate_add_to_shortcut(void)
+{
        _ENTER;
 
        appdata_s *info = _get_info();
-       int i = 0;
 
-       if(empty_count == 4){
-               int ret = 0;
-               bundle *b = NULL;
-               b = bundle_create();
-               if(!b){
-                       _E("failed to create bundle");
-                       return;
-               }
-
-               bundle_add_str(b, "test", "delete");
-               updateContent();
-               if(WIDGET_ERROR_NONE != ret){
-                       _E("app-widget widget trigger failed %d", ret);
-               }
-               if(b){
-                       free(b);
-               }
-       }
-       else{
-               for(i = 0; i < 4 ; i++){
-                       _D("%s", g_info->appid_list[i]);
-               }
+       _update_content();
 
-               int ret = 0;
-               bundle *b = NULL;
-               b = bundle_create();
-               if(!b){
-                       _E("failed to create bundle");
-                       return;
-               }
-               char content[255] = {0};
-               snprintf(content, sizeof(content)-1, "%s %s %s %s", g_info->appid_list[0], g_info->appid_list[1], g_info->appid_list[2], g_info->appid_list[3]);
-               bundle_add_str(b, "test", content);
-               _D("content : %s", content);
-
-               updateContent();
-               if(WIDGET_ERROR_NONE != ret){
-                       _E("app widget widget trigger failed %d", ret);
-               }
-               if(b){
-                       free(b);
-               }
-       }
        evas_object_del(info->edit_win);
        info->edit_win = NULL;
 
        evas_object_del(info->select_win);
        info->select_win = NULL;
 
+       free(info->widget_instance_id);
 
        if (g_info->release_handler) {
                ecore_event_handler_del(g_info->release_handler);
@@ -230,35 +217,21 @@ static void _terminate_add_to_shortcut(void){
        elm_exit();
 }
 
-static void _create_edit_win(appdata_s *info, const char *name, const char *title)
+static Evas_Object *_create_win(appdata_s *info, const char *name, const char *title)
 {
        _ENTER;
-       info->edit_win = elm_win_add(NULL, name, ELM_WIN_BASIC);
-       ret_if(!info->edit_win);
-       evas_object_color_set(info->edit_win, 0, 0, 0, 0);
-       evas_object_resize(info->edit_win, 360, 360);
-
-       elm_win_title_set(info->edit_win, title);
-       elm_win_borderless_set(info->edit_win, EINA_TRUE);
-
-       _D("create window success");
-       return;
-}
 
-static void _create_select_win(appdata_s *info, const char *name, const char *title)
-{
-       _ENTER;
-       info->select_win = elm_win_add(NULL, name, ELM_WIN_BASIC);
-       ret_if(!info->select_win);
+       Evas_Object *eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+       retv_if(!eo, NULL);
 
-       evas_object_color_set(info->select_win, 0, 0, 0, 0);
-       evas_object_resize(info->select_win, 360, 360);
+       evas_object_color_set(eo, 0, 0, 0, 0);
+       evas_object_resize(eo, 360, 360);
 
-       elm_win_title_set(info->select_win, title);
-       elm_win_borderless_set(info->select_win, EINA_TRUE);
+       elm_win_title_set(eo, title);
+       elm_win_borderless_set(eo, EINA_TRUE);
 
        _D("create window success");
-       return;
+       return eo;
 }
 
 static Eina_Bool _longpress_timer_cb(void *data){
@@ -302,7 +275,7 @@ static void _mouse_clicked_cb(void *data, Evas_Object *o, const char *emission,
        evas_object_hide(g_info->select_win);
        evas_object_show(g_info->edit_win);
        evas_event_callback_add(evas_object_evas_get(g_info->edit_layout), EVAS_CALLBACK_RENDER_POST, _render_post_cb, (void *)slot);
-       updateContent();
+       _update_content();
 }
 
 static void _mouse_down_cb(void *data, Evas_Object *o, const char *emission, const char *source){
@@ -384,7 +357,7 @@ static void _del_mouse_clicked_cb(void *data, Evas_Object *o, const char *emissi
 
        slot = elm_layout_add(g_info->edit_layout);
        char full_path[PATH_MAX] = { 0, };
-       _get_resource(EDJE_FILE, full_path, sizeof(full_path));
+       apptray_wgt_app_utils_get_resource(EDJE_FILE, full_path, sizeof(full_path));
        _D("full_path:%s",full_path);
        ret = elm_layout_file_set(slot, full_path, "empty_slot");
        if(ret == EINA_FALSE){
@@ -401,7 +374,7 @@ static void _del_mouse_clicked_cb(void *data, Evas_Object *o, const char *emissi
        evas_object_show(slot);
        g_info->appid_list[slot_index] = strdup("empty");
        empty_count++;
-       updateContent();
+       _update_content();
 
 }
 
@@ -590,7 +563,7 @@ static void _up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
        evas_object_color_set(icon, 255, 255, 255, 255);
        elm_object_signal_emit(obj, "released", "widget_plus");
        elm_object_signal_emit(obj, "show", "slot");
-       updateContent();
+       _update_content();
 }
 
 static Evas_Object *_create_item(Evas_Object *scroller, item_info_s *item_info)
@@ -602,7 +575,7 @@ static Evas_Object *_create_item(Evas_Object *scroller, item_info_s *item_info)
        page = elm_layout_add(scroller);
        retv_if(!page, NULL);
        char full_path[PATH_MAX] = { 0, };
-       _get_resource(EDJE_FILE, full_path, sizeof(full_path));
+       apptray_wgt_app_utils_get_resource(EDJE_FILE, full_path, sizeof(full_path));
        _D("full_path:%s",full_path);
        int ret = elm_layout_file_set(page, full_path, "item");
        _D("ret:%d",ret);
@@ -681,7 +654,7 @@ Evas_Object *_set_app_slot(const char *appid, int pos){
                slot = elm_layout_add(g_info->edit_layout);
 
                char full_path[PATH_MAX] = { 0, };
-               _get_resource(EDJE_FILE, full_path, sizeof(full_path));
+               apptray_wgt_app_utils_get_resource(EDJE_FILE, full_path, sizeof(full_path));
                _D("full_path:%s",full_path);
                ret = elm_layout_file_set(slot, full_path, "empty_slot");
                if(ret == EINA_FALSE){
@@ -727,7 +700,7 @@ Evas_Object *_set_app_slot(const char *appid, int pos){
 
                slot = elm_layout_add(g_info->edit_layout);
                char full_path[PATH_MAX] = { 0, };
-               _get_resource(EDJE_FILE, full_path, sizeof(full_path));
+               apptray_wgt_app_utils_get_resource(EDJE_FILE, full_path, sizeof(full_path));
                _D("full_path:%s",full_path);
                ret = elm_layout_file_set(slot, full_path, "icon_slot");
                if(ret == EINA_FALSE){
@@ -773,7 +746,7 @@ static void _create_edit_layout(appdata_s *info){
        Evas_Object *layout = NULL;
        layout = elm_layout_add(info->edit_win);
        char full_path[PATH_MAX] = { 0, };
-       _get_resource(EDJE_FILE, full_path, sizeof(full_path));
+       apptray_wgt_app_utils_get_resource(EDJE_FILE, full_path, sizeof(full_path));
        _D("full_path:%s",full_path);
        ret = elm_layout_file_set(layout, full_path, "edit_layout");
        if(ret == EINA_FALSE){
@@ -796,7 +769,7 @@ static void _create_layout(appdata_s *info){
        item_info_s *item_info = NULL;
        layout = elm_layout_add(info->select_win);
        char full_path[PATH_MAX] = { 0, };
-       _get_resource(EDJE_FILE, full_path, sizeof(full_path));
+       apptray_wgt_app_utils_get_resource(EDJE_FILE, full_path, sizeof(full_path));
        _D("full_path:%s",full_path);
        ret = elm_layout_file_set(layout, full_path, "layout");
        if(ret == EINA_FALSE){
@@ -1156,10 +1129,6 @@ static int _apps_sort_cb(const void *d1, const void *d2)
 
        return strcmp(tmp1->name, tmp2->name);
 }
-#ifdef TELEPHONY_DISABLE
-#define MESSAGE_PKG "com.samsung.message"
-#define VCONFKEY_WMS_HOST_STATUS_VENDOR "db/wms/host_status/vendor"
-#endif
 
 static int _apps_all_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
 {
@@ -1202,246 +1171,193 @@ ERROR:
        return *list;
 }
 
-static Eina_Bool _load_list(void* data){
+static Eina_Bool _load_list(void* data)
+{
        Eina_List *pkgmgr_list = NULL;
        g_info->app_list = _read_all_apps(&pkgmgr_list);
        _create_layout(g_info);
        return ECORE_CALLBACK_CANCEL;
 }
 
-
-static void
-app_pause(void *data)
-{
-       _ENTER;
-       _D("check");
-}
-
-static void
-app_terminate(void *data)
-{
-       _ENTER;
-       _D("check");
-       _fini_theme();
-       feedback_deinitialize();
-}
-
-static void
-app_resume(void *data)
+static void _process_pick_operation(appdata_s *info, app_control_h service)
 {
        _ENTER;
-       _D("check");
-}
+        /* TODO: This is stub to leave application on peek operation
+               Need to implement in further according UI
+       */
 
-static void app_control(app_control_h service, void *data)
-{
-       _ENTER;
-       _D("test");
        char *content = NULL;
-
-       char *tmp = NULL;
-       char *first = NULL;
-       char* save = NULL;
+       char *save = NULL;
        int i = 0;
-       int reset = 0;
-       int ret = 0;
 
-       widget_id = strdup(APP_WIDGET_CONTENT_KEY);
-       bool prefkey_exist = false;
-       ret = preference_is_existing(widget_id, &prefkey_exist);
-       if(ret !=PREFERENCE_ERROR_NONE)
-       {
-               _E("preference_is_existing api failed ret:%d ",ret);
-               content = strdup(DEFAULT_APP_ORDER);
-       }
-       else
-       {
-               _D("preference_is_existing api success");
-               if(prefkey_exist)
-               {
-                       _D("preference key is already exist");
-                       ret = preference_get_string(widget_id, &content);
-                       if(ret != PREFERENCE_ERROR_NONE)
-                       {
-                               _E("preference_get_string api failed, so load default app order ret:%d",ret);
-                               content = strdup(DEFAULT_APP_ORDER);
-                       }
-               }
-               else
-               {
-                       _E("preference_key is not exist. check why key is not present. key should present always");
-                       ret = preference_set_string(widget_id, DEFAULT_APP_ORDER);
-                       if(ret != PREFERENCE_ERROR_NONE)
-                       {
-                               _E("preference_set_string api failed ret:%d",ret);
-                       }
-                       content = strdup(DEFAULT_APP_ORDER);
-               }
-       }
-       _D("content: %s",content);
+       _create_edit_layout(info);
+       evas_object_show(info->edit_win);
 
+       content = strdup_s("empty empty empty empty");
 
-       if(!content){
-               _E("there is no content info.");
-               tmp = strdup("empty empty empty empty");
-               content = strdup("empty empty empty empty");
-       }
-       else{
-               tmp = strdup(content);
+       if (!content) {
+               _D("Content is NULL. Set default applist");
+               content = strdup(DEFAULT_APP_ORDER);
        }
+       _D("Content [%s]", content);
 
-       for(i = 0 ; i < 4 ; i++){
-               if(i == 0){
-                       first = strtok_r(tmp, " ",&save);
-                       if(content)
-                       {
-                               if(!strcmp(first, content)){
-                                       _E("content info format is not proper");
-                                       reset = 1;
-                                       break;
-                               }
-                               else{
-                                       _set_app_slot(first, i);
-                               }
-                       }
-               }
-               else{
+       for (i = 0 ; i < 4 ; i++) {
+               if (i == 0) {
+                       _set_app_slot(strtok_r(content, " ",&save), i);
+               } else {
                        _set_app_slot(strtok_r(NULL, " ",&save), i);
                }
        }
 
-       if(reset == 1){
-               _E("reset the content value.");
-               if(tmp){
-                       free(tmp);
-                       tmp = NULL;
-               }
-               tmp = strdup(DEFAULT_APP_ORDER);
-               bundle *b = NULL;
-               b = bundle_create();
-               if(!b){
-                       _E("failed to create bundle");
-                       free(content);
-                       free(tmp);
-                       return;
-               }
+       free(content);
 
-               bundle_add_str(b, "test", tmp);
-               _D("content : %s", tmp);
+       ecore_idler_add(_load_list, NULL);
+}
 
-               if(WIDGET_ERROR_NONE != ret){
-                       _E("app-widget trigger failed %x", ret);
-               }
-               if(b){
-                       free(b);
-               }
+static void _process_main_operation(appdata_s *info, app_control_h service, const char *app_list)
+{
+       _ENTER;
 
-               for(i = 0 ; i < 4 ; i++){
-                       if(i == 0){
-                               first = strtok_r(tmp, " ",&save);
-                               _set_app_slot(first, i);
-                       }
-                       else{
-                               _set_app_slot(strtok_r(NULL, " ",&save), i);
-                       }
+       char *content = NULL;
+       char *save = NULL;
+       int i = 0;
+
+       _create_edit_layout(info);
+       evas_object_show(info->edit_win);
+
+       content = strdup_s(app_list);
+
+       if (!content) {
+               _D("Content is NULL. Set default applist");
+               content = strdup(DEFAULT_APP_ORDER);
+       }
+       _D("Content [%s]", content);
+
+       for (i = 0 ; i < 4 ; i++) {
+               if (i == 0) {
+                       _set_app_slot(strtok_r(content, " ",&save), i);
+               } else {
+                       _set_app_slot(strtok_r(NULL, " ",&save), i);
                }
-               updateContent();
        }
 
        free(content);
-       free(tmp);
+
        ecore_idler_add(_load_list, NULL);
 }
 
-static void
-ui_app_lang_changed(app_event_info_h event_info, void *user_data)
+static bool _app_create(void *data)
 {
        _ENTER;
-       /*APP_EVENT_LANGUAGE_CHANGED*/
-       char *locale = NULL;
-       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
-       elm_language_set(locale);
-       free(locale);
-       return;
-}
+       _D("check");
+       appdata_s *info = data;
 
-static void
-ui_app_orient_changed(app_event_info_h event_info, void *user_data)
-{
-       _ENTER;
-       /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
-       return;
+       g_info = info;
+
+       info->edit_win = _create_win(info, "__ADD_TO_SHORTCUT__", "__ADD_TO_SHORTCUT__");
+       retv_if(!info->edit_win, false);
+       info->select_win = _create_win(info, "__SELECT_LIST__", "_SELECT_LIST__");
+       retv_if(!info->select_win, false);
+
+       _init_theme();
+       feedback_initialize();
+
+       g_info->release_handler = ecore_event_handler_add(ECORE_EVENT_KEY_UP, _key_release_cb, NULL);
+       return true;
 }
 
-static void
-ui_app_region_changed(app_event_info_h event_info, void *user_data)
+static void _app_terminate(void *data)
 {
        _ENTER;
-       /*APP_EVENT_REGION_FORMAT_CHANGED*/
+       _D("check");
+       _fini_theme();
+       feedback_deinitialize();
 }
 
-static void
-ui_app_low_battery(app_event_info_h event_info, void *user_data)
+static void _app_pause(void *data)
 {
        _ENTER;
-       /*APP_EVENT_LOW_BATTERY*/
 }
 
-static void
-ui_app_low_memory(app_event_info_h event_info, void *user_data)
+static void _app_resume(void *data)
 {
        _ENTER;
-       /*APP_EVENT_LOW_MEMORY*/
 }
 
-static bool app_create(void *data)
+static void _app_control(app_control_h service, void *data)
 {
        _ENTER;
-       _D("check");
+
        appdata_s *info = data;
+       char *operation = NULL;
+       char *content_val = NULL;
+       char *tmp = NULL;
+       char *app_list = NULL;
+
+       app_control_get_extra_data(service, "content_info", &content_val);
+       if (content_val) {
+               bundle *tmp_b = bundle_decode((const bundle_raw *)content_val, strlen(content_val));
+               if (tmp_b) {
+                       bundle_get_str(tmp_b, BUNDLE_KEY_WIDGET_INSTANCE_ID, &tmp);
+                       _D("Widget instance id [%s]", tmp);
+                       info->widget_instance_id = strdup_s(tmp);
+                       bundle_get_str(tmp_b, BUNDLE_KEY_SHORTCUT_LIST, &tmp);
+                       _D("App shortcuts [%s]", tmp);
+                       app_list = strdup_s(tmp);
+               }
+               bundle_free(tmp_b);
+       }
 
-       g_info = info;
-       _create_edit_win(info, "__ADD_TO_SHORTCUT__", "__ADD_TO_SHORTCUT__");
-       _create_select_win(info, "__SELECT_LIST__", "_SELECT_LIST__");
-       _init_theme();
-       feedback_initialize();
+       app_control_get_operation(service, &operation);
+       if (!strcmp(operation, APP_CONTROL_OPERATION_PICK)) {
+               info->launch_type = APPTRAY_WGT_APP_LAUNCH_TYPE_PICK;
+               _process_pick_operation(info, service);
+       } else if (!strcmp(operation, APP_CONTROL_OPERATION_MAIN)) {
+               info->launch_type = APPTRAY_WGT_APP_LAUNCH_TYPE_MAIN;
+               _process_main_operation(info, service, app_list);
+       }
 
-       _create_edit_layout(info);
-       evas_object_show(info->edit_win);
+       free(app_list);
+}
 
+static void _app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+       _ENTER;
+       /*APP_EVENT_LANGUAGE_CHANGED*/
+       char *locale = NULL;
+       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+       elm_language_set(locale);
+       free(locale);
+       return;
+}
 
-       g_info->release_handler = ecore_event_handler_add(ECORE_EVENT_KEY_UP, _key_release_cb, NULL);
-       return true;
+static void _app_region_changed(app_event_info_h event_info, void *user_data)
+{
+       _ENTER;
 }
 
 int main(int argc, char *argv[])
 {
        _ENTER;
        _D("check");
-       appdata_s ad = {0,};
-               int ret = 0;
-
-               ui_app_lifecycle_callback_s event_callback = {0,};
-               app_event_handler_h handlers[5] = {NULL, };
-
-               event_callback.create = app_create;
-               event_callback.terminate = app_terminate;
-               event_callback.pause = app_pause;
-               event_callback.resume = app_resume;
-               event_callback.app_control = app_control;
-
-               ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
-               ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
-               ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
-               ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
-               ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
-
-               ret = ui_app_main(argc, argv, &event_callback, &ad);
-               if (ret != APP_ERROR_NONE) {
-                       _E("app_main() is failed. err = %d", ret);
-               }
+       appdata_s ad = { 0 };
+       int ret = 0;
+
+       ui_app_lifecycle_callback_s event_callback = {0,};
+       app_event_handler_h handlers[2] = { NULL };
 
-               return ret;
+       event_callback.create = _app_create;
+       event_callback.terminate = _app_terminate;
+       event_callback.pause = _app_pause;
+       event_callback.resume = _app_resume;
+       event_callback.app_control = _app_control;
 
+       ui_app_add_event_handler(&handlers[0], APP_EVENT_LANGUAGE_CHANGED, _app_lang_changed, &ad);
+       ui_app_add_event_handler(&handlers[1], APP_EVENT_REGION_FORMAT_CHANGED, _app_region_changed, &ad);
+
+       ret = ui_app_main(argc, argv, &event_callback, &ad);
+       if (ret != APP_ERROR_NONE) {
+               _E("app_main() is failed. err = %d", ret);
+       }
        return ret;
 }
index 64406d16f08378b1212cf9fc07a3a5173ec63304..2c39309d803c06440a91eee8f58529729901c934 100755 (executable)
@@ -265,7 +265,7 @@ Evas_Object *home_custom_scroller_add(Evas_Object *parent, scroller_info_s *scro
        goto_if(!box_layout, ERROR);
        _D("box layout is created for scroller");
        char full_path[PATH_MAX] = { 0, };
-       _get_resource(SCROLLER_LAYOUT_EDJE, full_path, sizeof(full_path));
+       apptray_wgt_app_utils_get_resource(SCROLLER_LAYOUT_EDJE, full_path, sizeof(full_path));
        _D("full_path:%s",full_path);
        elm_layout_file_set(box_layout, full_path, SCROLLER_LAYOUT_GROUP_NAME);
        evas_object_show(box_layout);
index a057cea8edf9cdb2a53837fe8d2d20351dc56211..75c39778b0efaddae94f7e13c7f6444b8f1d79d1 100755 (executable)
@@ -17,7 +17,7 @@
 #include <app_common.h>
 #include "util.h"
 
-void _get_resource(const char *file_in, char *file_path_out, int file_path_max)
+void apptray_wgt_app_utils_get_resource(const char *file_in, char *file_path_out, int file_path_max)
 {
        char *res_path = app_get_resource_path();
        if (res_path) {
index 6a6ca5683e00622f675965989dbd02df7415306a..0f7f4a1664ac105a82514af043b6e45098adc34f 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.tizen.apptray-widget-app" version="1.0.0">
     <profile name="wearable"/>
-    <ui-application appid="org.tizen.apptray-widget-app" exec="apptray-widget-app" multiple="false" nodisplay="true" taskmanage="true" type="capp">
+    <ui-application appid="org.tizen.apptray-widget-app" exec="apptray-widget-app" multiple="false" nodisplay="true" taskmanage="true" type="capp" hw-acceleration="on">
         <label>Apps</label>
         <icon>app-widget-app.png</icon>
     </ui-application>
index a00d912af368da89fb7909eadd2b52cc278e6b80..16a1091829aae8a3bb7f6a1ea62162d0b6800392 100755 (executable)
@@ -3,6 +3,7 @@ PROJECT(apptray-widget C)
 
 SET(SRCS
        src/apptray_widget.c
+       src/apptray_widget_utils.c
 )
 
 SET(VENDOR "tizen")
@@ -78,8 +79,6 @@ FIND_LIBRARY(LIB_M m)
 
 ADD_DEFINITIONS(${pkgs_CFLAGS})
 ADD_DEFINITIONS("-fpie")
-ADD_DEFINITIONS("-DRSSI_ANT_BAR=${RSSI_ANT_BAR}")
-MESSAGE("RSSI_ANT_BAR: ${RSSI_ANT_BAR}")
 
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
 ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
@@ -102,15 +101,7 @@ ADD_DEFINITIONS("-DWINDI_EDJ=\"${EDJDIR}/${PROJECT_NAME}.edj\"")
 ADD_DEFINITIONS("-DPROJECT=\"${PROJECT_NAME}\"")
 
 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} "-pie" ${LIB_M})
-
-IF("${RSSI_ANT_BAR}" STREQUAL "5")
-       SET(RSSI_IMAGE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data/groups/5level")
-ELSEIF("${RSSI_ANT_BAR}" STREQUAL "6")
-       SET(RSSI_IMAGE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data/groups/6level")
-ELSE()
-       SET(RSSI_IMAGE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data/groups/4level")
-ENDIF()
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} "-pie" ${LIB_M} -licui18n -licuuc)
 
 #edc compile
 
index 22fbb81ebcbfcdecc8fb97fd09d1906e43f6c93e..4b89191b5aa7303b997856c80e932e9dd80ba141 100644 (file)
@@ -31,7 +31,6 @@
 #define APPS_WIDGET "org.tizen.apptray-widget"
 #define VCONFKEY_WMS_HOST_STATUS_VENDOR "db/wms/host_status/vendor"
 #define APP_TYPE_WGT "wgt"
-#define APP_WIDGET_CONTENT_KEY "org.tizen.apptray-widget"
 #define APP_LAUNCH_KEY "launch_apps"
 #define WHOME_APP_CONTROL "home_op"
 
diff --git a/apptray-widget/inc/apptray_widget_utils.h b/apptray-widget/inc/apptray_widget_utils.h
new file mode 100755 (executable)
index 0000000..8885c35
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Samsung API
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APPTRAY_WIDGET_UTILS_H__
+#define __APPTRAY_WIDGET_UTILS_H__
+
+void apptray_wgt_utils_get_resource(const char *file_in, char *file_path_out, int file_path_max);
+
+char *apptray_wgt_utils_get_count_str_from_icu(int count);
+
+#endif /* __APPTRAY_WIDGET_UTILS_H__ */
index 2fa738da0b2e47265b2defadeef757bcd5c6f7e1..f957c7bff0738cfc862a8d242877c72598577bad 100755 (executable)
 #include <package-manager.h>
 #include <aul.h>
 #include <badge.h>
-#include <unicode/unum.h>
-#include <unicode/ustring.h>
-#include <app_preference.h>
 
 #ifndef TELEPHONY_DISABLE
 #include <feedback.h>
 #endif
 
-#include <apptray_widget_log.h>
-#include <apptray_widget_common_defines.h>
+#include "apptray_widget_log.h"
+#include "apptray_widget_common_defines.h"
+#include "apptray_widget_utils.h"
 
-#define LOCALE_LEN 32
+#define SLOT_INDEX_BUF_SIZE 10
+
+#define BUNDLE_KEY_SHORTCUT_LIST               "shortcut_list"
+#define BUNDLE_KEY_WIDGET_INSTANCE_ID  "instance_id"
 
 static Eina_List *s_list;
 
@@ -51,22 +52,20 @@ struct object_info {
 };
 
 struct info {
+       widget_context_h context;
        char* id;
-       int size_type;
        int w;
        int h;
-       Evas_Object *dbox_win;
+       Evas_Object *win;
        Evas_Object *bg;
        Evas_Object *layout;
        struct object_info obj[WIDGET_SLOTS_MAX_COUNT];
        int first_loaded;
        char *content_app_list[WIDGET_SLOTS_MAX_COUNT];
+       bundle *content;
 };
 
-static void _get_resource(const char *file_in, char *file_path_out, int file_path_max);
-static struct info *_find_item(const char* id);
-static void _preference_changed_cb(const char *key, void *user_data);
-static char *_util_get_count_str_from_icu(int count);
+static struct info *_find_instance_info(const char* id);
 
 static void _check_slots_on_package_remove_callback(const char *package);
 
@@ -80,7 +79,7 @@ static void _badge_changed_cb(unsigned int action, const char *appid, unsigned i
 
 static void _slot_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
 
-static int _update_all_slots(struct info *item);
+static void _update_all_slots(struct info *item);
 static bool _set_slot(struct info *item, const char *appid, int pos);
 static void _reset_slot_info(struct info *item, int index);
 static void _reset_all_slots_info(struct info *item);
@@ -90,9 +89,13 @@ static void _update_content_list(struct info *item, const char *content);
 static void _add_application_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
 
 static void _create_add_app_layout(struct info *item);
-static void _destroy_add_app_layout(struct info *item);
+static void _destroy_add_apps_layout(struct info *item);
+static void _set_main_layout_slot_count(struct info *item, int count);
+static void _set_main_layout_add_apps_mode(struct info *item);
+
+static bool _create_win(struct info *info);
 
-static Evas_Object *_create_win(widget_context_h context, int w, int h);
+static void _update_widget_content_app_list(struct info *info);
 
 static widget_class_h _widget_app_create(void *user_data);
 static void _widget_app_terminate(void *user_data);
@@ -106,17 +109,10 @@ static int _widget_instance_resume(widget_context_h context, void *user_data);
 static int _widget_instance_update(widget_context_h context, bundle *content, int force, void *user_data);
 static int _widget_instance_resize(widget_context_h context, int w, int h, void *user_data);
 
-static void _get_resource(const char *file_in, char *file_path_out, int file_path_max)
-{
-       _ENTER;
-       char *res_path = app_get_resource_path();
-       if (res_path) {
-               snprintf(file_path_out, file_path_max, "%s%s", res_path, file_in);
-               free(res_path);
-       }
-}
+static void _init_slots_data(struct info *info);
+static void _update_slots_data(struct info *info, bundle *content);
 
-static inline struct info *_find_item(const char* id)
+static inline struct info *_find_instance_info(const char* id)
 {
        _ENTER;
        struct info *item=NULL;
@@ -136,84 +132,6 @@ static inline struct info *_find_item(const char* id)
        return item;
 }
 
-static void _preference_changed_cb(const char *key, void *user_data)
-{
-       _ENTER;
-
-       char *id= *((char**)user_data);
-       _D("id:%s,  key:%s",id,key);
-       struct info *item;
-       char *content = NULL;
-
-       if(!id)
-       {
-               _E("id is null");
-               return;
-       }
-       item = _find_item((char*)id);
-       if (!item) {
-               _E("item is not found");
-               return;
-       }
-
-       _log_content_list(item);
-    preference_get_string(APP_WIDGET_CONTENT_KEY, &content);
-    _update_content_list(item, content);
-    free(content);
-
-       _update_all_slots(item);
-
-       _EXIT;
-}
-
-static char *_util_get_count_str_from_icu(int count)
-{
-       _ENTER;
-       char *p = NULL;
-       char *locale_tmp = NULL;
-       char locale[LOCALE_LEN] = { 0, };
-       char res[LOCALE_LEN] = { 0, };
-
-
-       strncpy(locale, locale_tmp, sizeof(locale));
-       free(locale_tmp);
-
-       if(locale[0] != '\0') {
-               p = strstr(locale, ".UTF-8");
-               if (p) *p = 0;
-       }
-
-       return strdup(res);
-}
-
-static int _widget_instance_destroy(widget_context_h context, widget_app_destroy_type_e reason, bundle *content, void *user_data)
-{
-       _ENTER;
-
-       struct info *item;
-       const char *id = widget_app_get_id(context);
-
-       item = _find_item((char *)id);
-       if (!item) {
-                _E("id is invalid");
-               return WIDGET_ERROR_NOT_EXIST;
-       }
-
-       s_list = eina_list_remove(s_list, item);
-
-       if (item->dbox_win) {
-               evas_object_del(item->dbox_win);
-       }
-
-    _free_content_list(item);
-       free(item->id);
-       free(item);
-
-       preference_unset_changed_cb(APP_WIDGET_CONTENT_KEY);
-
-       return WIDGET_ERROR_NONE;
-}
-
 static void _check_slots_on_package_remove_callback(const char *package)
 {
        _ENTER;
@@ -255,6 +173,7 @@ static void _check_slots_on_package_remove_callback(const char *package)
                if (update) {
                        update = 0;
                        _update_all_slots(item);
+                       _update_widget_content_app_list(item);
                }
        }
 }
@@ -296,7 +215,7 @@ static void _show_slot_item_badge(struct object_info *item, int count)
                count = MAX_BADGE_COUNT;
        }
 
-       str = _util_get_count_str_from_icu(count);
+       str = apptray_wgt_utils_get_count_str_from_icu(count);
        elm_object_part_text_set(item->eo, "badge_txt", str);
 
        if (count <= 0) {
@@ -369,21 +288,17 @@ static void _register_badge_changed_callback(void)
        _ENTER;
        badge_error_e err = badge_register_changed_cb(_badge_changed_cb, NULL);
        ret_if(BADGE_ERROR_NONE != err);
-       _EXIT;
 }
 
 static void _unregister_badge_changed_callback(void)
 {
        _ENTER;
-       badge_error_e err;
-
-       err = badge_unregister_changed_cb(_badge_changed_cb);
+       badge_error_e err = badge_unregister_changed_cb(_badge_changed_cb);
        ret_if(BADGE_ERROR_NONE != err);
 }
 
 static void _slot_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
 {
-       _D("icon clicked");
        _ENTER;
 
        struct info *item = (struct info *)data;
@@ -394,7 +309,7 @@ static void _slot_clicked_cb(void *data, Evas_Object *obj, const char *emission,
        ret_if(index <= 0);
 
        info = &item->obj[index - 1];
-       if(!strcmp(info->appid, APPS_PKG)){
+       if(!strcmp(info->appid, APPS_PKG)) {
                app_control_h service = NULL;
                char *type = APP_LAUNCH_KEY;
 
@@ -447,7 +362,41 @@ static void _slot_clicked_cb(void *data, Evas_Object *obj, const char *emission,
                        app_control_destroy(service);
                }
        }
+}
+
+static Evas_Object *_create_slot_layout(struct info *item, int pos)
+{
+       char full_path[PATH_MAX] = { 0 };
+       char index[SLOT_INDEX_BUF_SIZE] = { NULL };
+       Evas_Object *slot = NULL;
+
+       snprintf(index, sizeof(index), "slot_%d", pos + 1);
+
+       slot = elm_layout_add(item->layout);
+       retv_if(!slot, NULL);
+       apptray_wgt_utils_get_resource(EDJE_FILE, full_path, sizeof(full_path));
+       elm_layout_file_set(slot, full_path, "icon_slot");
+       evas_object_size_hint_weight_set(slot, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_resize(slot, SHORTCUT_W, SHORTCUT_H);
+       elm_object_part_content_set(item->layout, index, slot);
+       evas_object_show(slot);
+
+       return slot;
+}
+
+static Evas_Object *_create_slot_app_icon(struct info *item, int pos)
+{
+       Evas_Object *icon = NULL;
+
+       icon = evas_object_image_add(evas_object_evas_get(item->obj[pos].eo));
+       retv_if(!icon, NULL);
+       evas_object_repeat_events_set(icon, EINA_TRUE);
+       evas_object_image_file_set(icon, item->obj[pos].icon, NULL);
+       evas_object_image_filled_set(icon, EINA_TRUE);
+       elm_object_part_content_set(item->obj[pos].eo, "icon", icon);
+       evas_object_show(icon);
 
+       return icon;
 }
 
 static bool _set_slot(struct info *item, const char *appid, int pos)
@@ -456,14 +405,10 @@ static bool _set_slot(struct info *item, const char *appid, int pos)
 
        int ret = 0;
        int badge_count = 0;
-       Evas_Object *slot = NULL;
-       Evas_Object *icon = NULL;
        pkgmgrinfo_appinfo_h appinfo_h = NULL;
        pkgmgrinfo_pkginfo_h pkghandle = NULL;
        char *pkgid = NULL;
-       char full_path[PATH_MAX] = { NULL };
        char *label = NULL;
-       char index[10] = { NULL };
        char *type = NULL;
        char *icon_path_tmp = NULL;
 
@@ -474,20 +419,13 @@ static bool _set_slot(struct info *item, const char *appid, int pos)
                return false;
        }
 
-       snprintf(index, sizeof(index), "slot_%d", pos+1);
-
        item->obj[pos].appid = strdup(appid);
 
-       slot = elm_layout_add(item->layout);
-       item->obj[pos].eo = slot;
-       _get_resource(EDJE_FILE, full_path, sizeof(full_path));
-       if(!elm_layout_file_set(slot, full_path, "icon_slot")){
+       item->obj[pos].eo = _create_slot_layout(item, pos);
+       if (!item->obj[pos].eo) {
+               _E("Create slot layout failed");
                goto fail_return;
        }
-       evas_object_size_hint_weight_set(slot, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_resize(slot, SHORTCUT_W, SHORTCUT_H);
-       elm_object_part_content_set(item->layout, index, slot);
-       evas_object_show(slot);
 
        ret = pkgmgrinfo_appinfo_get_appinfo(appid, &appinfo_h);
        if (ret != PMINFO_R_OK) {
@@ -517,7 +455,7 @@ static bool _set_slot(struct info *item, const char *appid, int pos)
                item->obj[pos].label = strdup(label);
        }
 
-       elm_object_part_text_set(slot, "name", item->obj[pos].label);
+       elm_object_part_text_set(item->obj[pos].eo, "name", item->obj[pos].label);
 
        ret = pkgmgrinfo_pkginfo_get_type(pkghandle, &type);
        if (ret != PMINFO_R_OK) {
@@ -545,12 +483,10 @@ static bool _set_slot(struct info *item, const char *appid, int pos)
                item->obj[pos].icon = strdup(DEFAULT_ICON);
        }
 
-       icon = evas_object_image_add(evas_object_evas_get(slot));
-       evas_object_repeat_events_set(icon, EINA_TRUE);
-       evas_object_image_file_set(icon, item->obj[pos].icon, NULL);
-       evas_object_image_filled_set(icon, EINA_TRUE);
-       elm_object_part_content_set(slot, "icon", icon);
-       evas_object_show(icon);
+       if (!_create_slot_app_icon(item, pos)) {
+               _E("Create slot icon failed");
+               goto fail_return;
+       }
 
        badge_count = _get_slot_item_badge_count(&item->obj[pos]);
        if (badge_count) {
@@ -637,6 +573,7 @@ static void _update_content_list(struct info *item, const char *content)
        char *save = NULL;
        char *tmp_app_id = NULL;
        int i = 0;
+       int j = 0;
 
        ret_if(!content);
        ret_if(!item);
@@ -647,6 +584,10 @@ static void _update_content_list(struct info *item, const char *content)
        ret_if(!tmp);
 
        for (; i < WIDGET_SLOTS_MAX_COUNT; i++) {
+               FREE(item->content_app_list[i]);
+       }
+
+       for (i = 0, j = 0; i < WIDGET_SLOTS_MAX_COUNT; i++) {
                tmp_app_id = NULL;
                if (i == 0) {
                        tmp_app_id = strtok_r(tmp, " ", &save);
@@ -654,11 +595,16 @@ static void _update_content_list(struct info *item, const char *content)
                        tmp_app_id = strtok_r(NULL, " ", &save);
                }
 
-               FREE(item->content_app_list[i]);
-               if (tmp_app_id) {
-                       item->content_app_list[i] = strdup(tmp_app_id);
+               if (strcmp(tmp_app_id, "empty")) {
+                       item->content_app_list[j] = strdup(tmp_app_id);
+                       j++;
                }
        }
+
+       for (; j < WIDGET_SLOTS_MAX_COUNT; j++) {
+               item->content_app_list[j] = strdup("empty");
+       }
+
        _log_content_list(item);
 
        _EXIT;
@@ -666,20 +612,21 @@ static void _update_content_list(struct info *item, const char *content)
 
 static void _add_application_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
 {
-       // TODO: send correct launch request
-
        app_control_h service = NULL;
+       struct info *item = data;
+
+       ret_if(!item);
 
-       ret_if(APP_CONTROL_ERROR_NONE != app_control_create(&service));
-       ret_if(NULL == service);
+       ret_if(app_control_create(&service) != APP_CONTROL_ERROR_NONE);
+       ret_if(!service);
 
-       app_control_set_operation(service, APP_CONTROL_OPERATION_MAIN);
-       app_control_add_extra_data(service, "instance_id", APPS_WIDGET);
+       app_control_set_operation(service, APP_CONTROL_OPERATION_PICK);
+       app_control_add_extra_data(service, BUNDLE_KEY_WIDGET_INSTANCE_ID, item->id);
        app_control_set_app_id(service, APPS_PKG);
 
        int ret = app_control_send_launch_request(service, NULL, NULL);
-       if (APP_CONTROL_ERROR_NONE != ret) {
-               _E("error");
+       if (ret != APP_CONTROL_ERROR_NONE) {
+               _E("Failed to launch application");
        }
        app_control_destroy(service);
 }
@@ -688,7 +635,7 @@ static void _create_add_app_layout(struct info *item)
 {
        Evas_Object *eo = elm_layout_add(item->layout);
        char full_path[PATH_MAX] = { 0 };
-       _get_resource(EDJE_FILE, full_path, sizeof(full_path));
+       apptray_wgt_utils_get_resource(EDJE_FILE, full_path, sizeof(full_path));
        elm_layout_file_set(eo, full_path, "add_app_shorcuts");
        // TODO: need translation
        elm_object_translatable_part_text_set(eo, "txt", "Add app shortcuts");
@@ -698,20 +645,31 @@ static void _create_add_app_layout(struct info *item)
        evas_object_show(eo);
 }
 
-static void _destroy_add_app_layout(struct info *item)
+static void _destroy_add_apps_layout(struct info *item)
 {
        Evas_Object *eo = elm_object_part_content_unset(item->layout, "add_apps");
        DEL_EVAS_OBJECT(eo);
 }
 
-static int _update_all_slots(struct info *item)
+static void _set_main_layout_slot_count(struct info *item, int count)
+{
+       char tmp[BUFF_SMALL_SIZE] = { 0 };
+       snprintf(tmp, sizeof(tmp), "%d_slots", count);
+       elm_object_signal_emit(item->layout, tmp, "*");
+}
+
+static void _set_main_layout_add_apps_mode(struct info *item)
+{
+       elm_object_signal_emit(item->layout, "no_apps", "*");
+}
+
+static void _update_all_slots(struct info *item)
 {
        _ENTER;
 
        int app_list_index = 0;
        int cur_slot_index = 0;
 
-       retv_if(!item, WIDGET_ERROR_NOT_EXIST);
        _reset_all_slots_info(item);
 
        for (app_list_index = 0, cur_slot_index = 0 ; app_list_index < WIDGET_SLOTS_MAX_COUNT; app_list_index++) {
@@ -720,209 +678,230 @@ static int _update_all_slots(struct info *item)
        }
 
        if (cur_slot_index > 0) {
-               _destroy_add_app_layout(item);
-               char tmp[BUFF_SMALL_SIZE] = { 0 };
-               snprintf(tmp, sizeof(tmp), "%d_slots", cur_slot_index);
-               elm_object_signal_emit(item->layout, tmp, "*");
+               _destroy_add_apps_layout(item);
+               _set_main_layout_slot_count(item, cur_slot_index);
        } else {
-               elm_object_signal_emit(item->layout, "no_apps", "*");
+               _set_main_layout_add_apps_mode(item);
                _create_add_app_layout(item);
        }
+
        _EXIT;
-       return WIDGET_ERROR_DISABLED;
 }
 
-static Evas_Object *_create_win(widget_context_h context, int w, int h)
+static bool _create_win(struct info *info)
 {
-       _ENTER;
-       Evas_Object *win = NULL;
-
-       int ret = widget_app_get_elm_win(context, &win);
+       int ret = widget_app_get_elm_win(info->context, &info->win);
        if (ret != WIDGET_ERROR_NONE) {
-               _E("failed to get window. err = %d", ret);
-               return NULL;
+               _E("Get window failed. ret[%d]", ret);
+               return false;
        }
-       evas_object_resize(win, w, h);
-       evas_object_show(win);
+       evas_object_resize(info->win, info->w, info->h);
+       evas_object_show(info->win);
 
-       return win;
+       return true;
 }
 
-static int _widget_instance_resize(widget_context_h context, int w, int h, void *user_data)
+static bool _create_bg(struct info *info)
 {
-       _ENTER;
-
-       const char *id = widget_app_get_id(context);
-       _D("ID:%s",id);
-
-       struct info *item;
-       int ret;
-       Evas_Object *layout = NULL;
-       Evas_Object *bg = NULL;
-
-       item = _find_item((char*)id);
-       if (!item) {
-                _E("item was not found");
-               return WIDGET_ERROR_NOT_EXIST;
-       }
-
-       if( item->first_loaded && w == item->w && h == item->h)
-       {
-               _E("no need to update");
-               return WIDGET_ERROR_NONE;
-       }
-       item->first_loaded = 1;
+       char full_path[PATH_MAX] = { 0 };
 
-       _D("WIDGET is resized\n");
-       item->dbox_win = _create_win(context ,w ,h);
-       if (!item->dbox_win) {
-               _E("item dbox win is not found");
-               return WIDGET_ERROR_FAULT;
+       info->bg = elm_layout_add(info->win);
+       if (!info->bg) {
+               _E("Create background layout failed");
+               return false;
        }
+       apptray_wgt_utils_get_resource(EDJE_FILE, full_path, sizeof(full_path));
+       elm_layout_file_set(info->bg, full_path, "dbox_bg");
+       evas_object_size_hint_weight_set(info->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_resize(info->bg, info->w, info->h);
+       evas_object_show(info->bg);
 
-       _D("Layout set");
+       return true;
+}
 
-       bg = elm_layout_add(item->dbox_win);
+static bool _create_main_ly(struct info *info)
+{
        char full_path[PATH_MAX] = { 0 };
-       _get_resource(EDJE_FILE, full_path, sizeof(full_path));
-       _D("full_path:%s",full_path);
-       ret = elm_layout_file_set(bg, full_path, "dbox_bg");
-       if(ret == EINA_FALSE){
-               LOGE("failed to set layout");
-               return WIDGET_ERROR_FAULT;
+
+       info->layout = elm_layout_add(info->bg);
+       if (!info->layout) {
+               _E("Create main layout failed");
+               return false;
        }
+       apptray_wgt_utils_get_resource(EDJE_FILE, full_path, sizeof(full_path));
+       elm_layout_file_set(info->layout, full_path, "main_layout");
+       elm_object_signal_callback_add(info->layout, "mouse_clicked", "slot_1", _slot_clicked_cb, info);
+       elm_object_signal_callback_add(info->layout, "mouse_clicked", "slot_2", _slot_clicked_cb, info);
+       elm_object_signal_callback_add(info->layout, "mouse_clicked", "slot_3", _slot_clicked_cb, info);
+       elm_object_signal_callback_add(info->layout, "mouse_clicked", "slot_4", _slot_clicked_cb, info);
+       evas_object_size_hint_weight_set(info->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_show(info->layout);
 
-       _D("BG set");
-       evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_resize(bg, w, h);
-       evas_object_show(bg);
-       item->bg = bg;
+       elm_object_part_content_set(info->bg, "bg_swallow", info->layout);
 
-       layout = elm_layout_add(bg);
-       item->layout = layout;
-       _D("full_path:%s",full_path);
-       ret = elm_layout_file_set(layout, full_path, "main_layout");
-       _D("layout added");
-       if(ret == EINA_FALSE){
-               LOGE("failed to set layout");
-               return WIDGET_ERROR_FAULT;
-       }
+       return true;
+}
 
-       elm_object_signal_callback_add(layout, "mouse_clicked", "slot_1", _slot_clicked_cb, item);
-       elm_object_signal_callback_add(layout, "mouse_clicked", "slot_2", _slot_clicked_cb, item);
-       elm_object_signal_callback_add(layout, "mouse_clicked", "slot_3", _slot_clicked_cb, item);
-       elm_object_signal_callback_add(layout, "mouse_clicked", "slot_4", _slot_clicked_cb, item);
+static void _update_widget_content_app_list(struct info *info)
+{
+       char tmp[1024] = { 0 };
+       int ret = WIDGET_ERROR_NONE;
 
-       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_resize(layout, w, h);
-       evas_object_show(layout);
+       snprintf(tmp, sizeof(tmp), "%s %s %s %s",
+                       (info->obj[0].appid ? info->obj[0].appid : "empty"),
+                       (info->obj[1].appid ? info->obj[1].appid : "empty"),
+                       (info->obj[2].appid ? info->obj[2].appid : "empty"),
+                       (info->obj[3].appid ? info->obj[3].appid : "empty"));
 
-       elm_object_part_content_set(bg, "bg_swallow", layout);
+       bundle_del(info->content, BUNDLE_KEY_SHORTCUT_LIST);
+       bundle_add_str(info->content, BUNDLE_KEY_SHORTCUT_LIST, tmp);
 
-       evas_object_resize(item->dbox_win, w, h);
-       evas_object_show(item->dbox_win);
+       ret = widget_app_context_set_content_info(info->context, info->content);
+       if (ret != WIDGET_ERROR_NONE) {
+               _E("Set widget content failed. ret[%d]", ret);
+       }
+}
 
-       bool prefkey_exist = false;
-       ret = preference_is_existing(APP_WIDGET_CONTENT_KEY, &prefkey_exist);
+static struct info * _create_widget_instance_info(widget_context_h context, bundle *content, int w, int h)
+{
+       struct info *instance_info = NULL;
+       const char *instance_id = NULL;
+       int ret = 0;
 
-       if(ret !=PREFERENCE_ERROR_NONE) {
-               _E("preference_is_existing api failed ret:%d ",ret);
+       instance_info = calloc(1, sizeof(struct info));
+       if (!instance_info) {
+               return NULL;
+       }
 
-               _update_content_list(item, DEFAULT_APP_ORDER);
-               ret = preference_set_string(APP_WIDGET_CONTENT_KEY, DEFAULT_APP_ORDER);
-               if(ret != PREFERENCE_ERROR_NONE)
-               {
-                       _E("preference_set_string api failed ret:%d",ret);
+       instance_id = widget_app_get_id(context);
+       if (!instance_id) {
+               _E("Get widget instance id failed");
+               free(instance_info);
+               return NULL;
+       }
+       _D("Widget instance created with id [%s]", instance_info->id);
+
+       instance_info->context = context;
+       instance_info->id = strdup(instance_id);
+       instance_info->w = w;
+       instance_info->h = h;
+
+       if (content) {
+               _D("Widget instance content exists");
+               char *tmp = NULL;
+               instance_info->content = bundle_dup(content);
+               bundle_get_str(instance_info->content, BUNDLE_KEY_WIDGET_INSTANCE_ID, &tmp);
+               if (!tmp) {
+                       _D("Instance id not found in content. Set instance_id to content");
+                       bundle_add_str(instance_info->content, BUNDLE_KEY_WIDGET_INSTANCE_ID, instance_id);
                }
        } else {
-               _D("preference_is_existing api success");
-               if(prefkey_exist)
-               {
-                       char *content = NULL;
-                       _D("preference key is already exist");
-                       ret = preference_get_string(APP_WIDGET_CONTENT_KEY, &content);
-
-                       if(ret != PREFERENCE_ERROR_NONE) {
-                               _E("preference_get_string api failed, so load default app order ret:%d",ret);
-                               _update_content_list(item, DEFAULT_APP_ORDER);
-                       } else {
-                               _update_content_list(item, content);
-                       }
-                       free(content);
-               }
-               else
-               {
-                       _E("preference_key is not exist. might be first boot so load default app order and store in preference key");
-                       ret = preference_set_string(APP_WIDGET_CONTENT_KEY, DEFAULT_APP_ORDER);
-
-                       if(ret != PREFERENCE_ERROR_NONE)
-                       {
-                               _E("preference_set_string api failed ret:%d",ret);
-                       }
-                       _update_content_list(item, DEFAULT_APP_ORDER);
-               }
+               _D("Widget instance content not exists. Create new one");
+               instance_info->content = bundle_create();
+               bundle_add_str(instance_info->content, BUNDLE_KEY_WIDGET_INSTANCE_ID, instance_id);
        }
 
-       preference_unset_changed_cb(APP_WIDGET_CONTENT_KEY);
-       preference_set_changed_cb(APP_WIDGET_CONTENT_KEY, _preference_changed_cb, &item->id);
+       _D("Set widget instance content");
+       ret = widget_app_context_set_content_info(instance_info->context, instance_info->content);
+       if (ret != WIDGET_ERROR_NONE) {
+               _E("Set widget instance content failed. ret[%d]", ret);
+       }
 
-       _update_all_slots(item);
+       return instance_info;
+}
 
-       _D("widget resized to %dx%d\n", w, h);
-       item->w =w;
-       item->h = h;
+static bool _create_ui_content(struct info *info)
+{
+       if (!_create_win(info)) {
+               _E("Create window failed");
+               return false;
+       }
 
-       _EXIT;
+       if (!_create_bg(info)) {
+               _E("Create background failed");
+               return false;
+       }
 
-        return WIDGET_ERROR_NONE;
+       if (!_create_main_ly(info)) {
+               _E("Create background failed");
+               return false;
+       }
+       return true;
 }
 
-static int _widget_instance_create(widget_context_h context, bundle *content, int w, int h, void *user_data)
+static void _init_slots_data(struct info *info)
 {
-       _ENTER;
-
-       struct info *info = NULL;
-       const char *id = NULL;
-
-       info = calloc(1, sizeof(struct info));
-       if (!info) {
-               return WIDGET_ERROR_OUT_OF_MEMORY;
+       char *content_list = NULL;
+       bundle_get_str(info->content, BUNDLE_KEY_SHORTCUT_LIST, &content_list);
+       if (!content_list) {
+               _D("CONTENT DEFAULT");
+               _update_content_list(info, DEFAULT_APP_ORDER);
+       } else {
+               _D("CONTENT RESTORED");
+               _update_content_list(info, content_list);
        }
+       _update_all_slots(info);
+       _update_widget_content_app_list(info);
+}
 
-       id = widget_app_get_id(context);
-       if (!id) {
-               _E("Get widget instance id failed");
-               free(info);
-               return WIDGET_ERROR_OUT_OF_MEMORY;
+static void _update_slots_data(struct info *info, bundle *content)
+{
+       char *content_list = NULL;
+       bundle_get_str(content, BUNDLE_KEY_SHORTCUT_LIST, &content_list);
+       if (!content_list) {
+               _E("Application list is empty");
+               return;
        }
-       _D("Widget instance is created with id [%s]", info->id);
+       _update_content_list(info, content_list);
+       _update_all_slots(info);
+       _update_widget_content_app_list(info);
+}
 
-       info->id = strdup(id);
-       info->size_type = WIDGET_SIZE_TYPE_UNKNOWN;
-       info->first_loaded = 0;
+static int _widget_instance_create(widget_context_h context, bundle *content, int w, int h, void *user_data)
+{
+       _ENTER;
+
+       struct info *instance_info = _create_widget_instance_info(context, content, w, h);
+       retv_if(!instance_info, WIDGET_ERROR_FAULT);
+       s_list = eina_list_append(s_list, instance_info);
 
-       s_list = eina_list_append(s_list, info);
+       retv_if(!_create_ui_content(instance_info), WIDGET_ERROR_FAULT);
 
-       _widget_instance_resize(context, w, h, user_data);
+       _init_slots_data(instance_info);
 
        _EXIT;
 
        return WIDGET_ERROR_NONE;
 }
 
-static void _widget_app_lang_changed(app_event_info_h event_info, void *user_data)
+static int _widget_instance_destroy(widget_context_h context, widget_app_destroy_type_e reason, bundle *content, void *user_data)
 {
        _ENTER;
 
-       char *locale = NULL;
-       app_event_get_language(event_info, &locale);
-       elm_language_set(locale);
-       free(locale);
-}
+       struct info *instance_info;
+       const char *id = widget_app_get_id(context);
 
-static void _widget_app_region_changed(app_event_info_h event_info, void *user_data)
-{
-       _ENTER;
+       instance_info = _find_instance_info(id);
+       if (!instance_info) {
+                _E("id is invalid");
+               return WIDGET_ERROR_NOT_EXIST;
+       }
+
+       s_list = eina_list_remove(s_list, instance_info);
+
+       DEL_EVAS_OBJECT(instance_info->win);
+
+       free(instance_info->id);
+
+    _free_content_list(instance_info);
+
+    free(instance_info->id);
+
+       bundle_free(instance_info->content);
+
+       free(instance_info);
+
+       return WIDGET_ERROR_NONE;
 }
 
 static int _widget_instance_pause(widget_context_h context, void *user_data)
@@ -949,11 +928,47 @@ static int _widget_instance_update(widget_context_h context, bundle *content, in
 {
        _ENTER;
 
+       struct info *instance_info;
        const char *id = widget_app_get_id(context);
        _D("ID:%s",id);
 
+       if (!content) {
+               _E("Update content is NULL");
+               return WIDGET_ERROR_FAULT;
+       }
+
+       instance_info = _find_instance_info(id);
+       if (!instance_info) {
+                _E("id is invalid");
+               return WIDGET_ERROR_NOT_EXIST;
+       }
+
+       _update_slots_data(instance_info, content);
+
        return WIDGET_ERROR_NONE;
 }
+
+static int _widget_instance_resize(widget_context_h context, int w, int h, void *user_data)
+{
+       _ENTER;
+
+       const char *id = widget_app_get_id(context);
+       struct info *item = _find_instance_info(id);
+       if (!item) {
+                _E("item was not found");
+               return WIDGET_ERROR_NOT_EXIST;
+       }
+
+       evas_object_resize(item->win, w, h);
+       evas_object_resize(item->bg, w, h);
+       item->w = w;
+       item->h = h;
+
+       _EXIT;
+
+        return WIDGET_ERROR_NONE;
+}
+
 static widget_class_h _widget_app_create(void *user_data)
 {
        _ENTER;
@@ -991,6 +1006,21 @@ static void _widget_app_terminate(void *user_data)
        _unregister_badge_changed_callback();
 }
 
+static void _widget_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+       _ENTER;
+
+       char *locale = NULL;
+       app_event_get_language(event_info, &locale);
+       elm_language_set(locale);
+       free(locale);
+}
+
+static void _widget_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+       _ENTER;
+}
+
 int main(int argc, char *argv[])
 {
        _ENTER;
diff --git a/apptray-widget/src/apptray_widget_utils.c b/apptray-widget/src/apptray_widget_utils.c
new file mode 100755 (executable)
index 0000000..db6ec9f
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Samsung API
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apptray_widget_utils.h"
+
+#include <app_common.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <system_settings.h>
+#include <unicode/unum.h>
+#include <unicode/ustring.h>
+
+#include "apptray_widget_log.h"
+
+#define LOCALE_LEN 32
+
+void apptray_wgt_utils_get_resource(const char *file_in, char *file_path_out, int file_path_max)
+{
+       char *res_path = app_get_resource_path();
+       if (res_path) {
+               snprintf(file_path_out, file_path_max, "%s%s", res_path, file_in);
+               free(res_path);
+       }
+}
+
+char *apptray_wgt_utils_get_count_str_from_icu(int count)
+{
+       char *p = NULL;
+       char *locale = NULL;
+       char res[LOCALE_LEN] = { 0 };
+
+       UErrorCode status = U_ZERO_ERROR;
+       UNumberFormat *num_fmt = NULL;;
+       UChar result[LOCALE_LEN] = { 0 };
+
+       uint32_t number = count;
+       int32_t len = (int32_t) (sizeof(result) / sizeof((result)[0]));
+
+       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+       retv_if(!locale, NULL);
+
+       if (locale[0] != '\0') {
+               p = strstr(locale, ".UTF-8");
+               if (p) {
+                       *p = 0;
+               }
+       }
+
+       num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, locale, NULL, &status);
+       unum_format(num_fmt, number, result, len, NULL, &status);
+       u_austrcpy(res, result);
+       unum_close(num_fmt);
+
+       free(locale);
+
+       return strdup(res);
+}
index a074e3457571f0c98eee21309eb5f5c243b53d76..9cc652949e9183959308ae7c5af6e69de78c02f5 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.tizen.apptray-widget" version="1.0.0">
     <profile name="wearable"/>
-    <widget-application appid="org.tizen.apptray-widget" exec="apptray-widget" main="true" update-period="0">
+    <widget-application appid="org.tizen.apptray-widget" exec="apptray-widget" hw-acceleration="on" main="true" update-period="0">
         <label>apptray-widget</label>
         <icon>apps_widget_preview.png</icon>
         <support-size preview="apps_widget_preview.png">2x2</support-size>