diff options
author | Nilesh Trimbake <t.shripati@samsung.com> | 2018-03-23 16:10:49 +0530 |
---|---|---|
committer | Nilesh Trimbake <t.shripati@samsung.com> | 2018-03-23 16:11:05 +0530 |
commit | d2fc0983e7e471017ef092c8961dedfeb80214cc (patch) | |
tree | 357aad9a7d2279c17cc23e2c0c2f19e1f73dd606 | |
parent | 6b7b0706e849e5a6fefedf95879b824bf6c66edf (diff) | |
parent | 1fb65cc232ec980d265503a64b18d513a69617c9 (diff) | |
download | apptray-widget-d2fc0983e7e471017ef092c8961dedfeb80214cc.tar.gz apptray-widget-d2fc0983e7e471017ef092c8961dedfeb80214cc.tar.bz2 apptray-widget-d2fc0983e7e471017ef092c8961dedfeb80214cc.zip |
Merge branch 'tizen_4.0' into tizen
Change-Id: I38a40bf36b3efd1ad5b08ff0ad150cd6313baae3
24 files changed, 1507 insertions, 825 deletions
diff --git a/apptray-widget-app/Build/makefile b/apptray-widget-app/Build/makefile index f491b50..117b240 100644 --- a/apptray-widget-app/Build/makefile +++ b/apptray-widget-app/Build/makefile @@ -14,7 +14,7 @@ clean : app_clean version : build_version #PROJ_ROOT = . -BUILD_ROOT := $(PROJ_PATH)/Build# +#BUILD_ROOT := $(PROJ_PATH)/Build# ifeq ($(MAKE_NAME),mingw32-make) ifneq ($(SHELL),) diff --git a/apptray-widget-app/Build/makefile.mk b/apptray-widget-app/Build/makefile.mk index 205a3ad..53c0428 100644 --- a/apptray-widget-app/Build/makefile.mk +++ b/apptray-widget-app/Build/makefile.mk @@ -13,10 +13,18 @@ clean : app_clean version : build_version +_BLANK :=# +_SPACE := $(_BLANK) $(_BLANK)# +_SPACE_4MAKE := \$(_SPACE)# + +NULL_CHAR :=# +SPACE := $(NULL_CHAR) $(NULL_CHAR)# -#PROJ_ROOT := $(call BSLASH2SLASH,$(PROJ_PATH)) PROJ_ROOT := . -BUILD_ROOT := $(PROJ_ROOT)/Build +_PROJ_ROOT_4MAKE := $(subst $(_SPACE),$(_SPACE_4MAKE),$(PROJ_ROOT))# +PROJ_ROOT=$(_PROJ_ROOT_4MAKE) +_BUILD_ROOT_4MAKE := $(subst $(_SPACE),$(_SPACE_4MAKE),$(BUILD_ROOT))# +BUILD_ROOT=$(_BUILD_ROOT_4MAKE) include $(BUILD_ROOT)/basedef.mk @@ -109,7 +117,7 @@ $(APPFILE) : $(OBJS) $(UOBJS) @echo ' Building target: $@' @echo ' Invoking: C/C++ Linker' $(call MAKEDIRS,$(@D)) - $(CXX) -o $(APPFILE) $(OBJS) $(UOBJS) $(LIBPATHS) -Xlinker --as-needed $(LIBS) $(LINK_FLAGS) $(TC_LINKER_MISC) $(RS_LINKER_MISC) -pie -lpthread --sysroot="$(SYSROOT)" -Xlinker --version-script="$(PROJ_ROOT)/.exportMap" $(RS_LIB_PATHS) $(RS_LIBRARIES) -Xlinker -rpath="/opt/usr/apps/$(APPID)/lib" -Werror-implicit-function-declaration $(USER_LINK_OPTS) + $(CXX) -o $(APPFILE) $(OBJS) $(UOBJS) $(LIBPATHS) -Xlinker --as-needed $(LIBS) $(LINK_FLAGS) $(TC_LINKER_MISC) $(RS_LINKER_MISC) -pie -lpthread --sysroot="$(SYSROOT)" -Xlinker --version-script="$(PROJ_ROOT)/.exportMap" $(RS_LIB_PATHS) $(RS_LIBRARIES) -Xlinker -rpath='$$ORIGIN/../lib' -Werror-implicit-function-declaration $(USER_LINK_OPTS) @echo ' Finished building target: $@' endif ifeq ($(strip $(APPTYPE)),staticLib) @@ -137,19 +145,19 @@ $(OUTPUT_DIR) : $(call MAKEDIRS,$@) -ifneq ($(strip $(PLATFORM_INCS)),) -$(PLATFORM_INCS_FILE) : $(OBJ_OUTPUT) - @echo ' Building inc file: $@' -ifneq ($(findstring Windows,$(OS)),) -ifneq ($(findstring 3.82,$(MAKE_VERSION)),) - $(file > $@,$(PLATFORM_INCS)) -else - @echo $(PLATFORM_INCS) > $@ -endif -else - @echo $(PLATFORM_INCS) > $@ -endif -endif +#ifneq ($(strip $(PLATFORM_INCS)),) +#$(PLATFORM_INCS_FILE) : $(OBJ_OUTPUT) +# @echo ' Building inc file: $@' +#ifneq ($(findstring Windows,$(OS)),) +#ifneq ($(findstring 3.82,$(MAKE_VERSION)),) +# $(file > $@,$(PLATFORM_INCS)) +#else +# @echo $(PLATFORM_INCS) > $@ +#endif +#else +# @echo '$(PLATFORM_INCS)' > $@ +#endif +#endif include $(BUILD_ROOT)/build_edc.mk diff --git a/apptray-widget-app/Build/platform.mk b/apptray-widget-app/Build/platform.mk index 294a38a..3895d90 100644 --- a/apptray-widget-app/Build/platform.mk +++ b/apptray-widget-app/Build/platform.mk @@ -2,14 +2,17 @@ SYSROOT = $(SBI_SYSROOT) -USR_INCS := $(addprefix -I $(SYSROOT),$(PLATFORM_INCS_EX)) +#USR_INCS := $(addprefix -I "$(SYSROOT),$(PLATFORM_INCS_EX)) +USR_INCS1 := $(addsuffix ",$(PLATFORM_INCS_EX)) +USR_INCS := $(addprefix -I "$(SYSROOT),$(USR_INCS1)) ifeq ($(strip $(PLATFORM_LIB_PATHS)),) RS_LIB_PATHS := "$(SYSROOT)/usr/lib" else -RS_LIB_PATHS := $(addprefix -L$(SYSROOT),$(PLATFORM_LIB_PATHS)) +RS_LIB_PATHS1 := $(addsuffix ",$(PLATFORM_LIB_PATHS)) +RS_LIB_PATHS := $(addprefix -L "$(SYSROOT),$(RS_LIB_PATHS1)) endif RS_LIBRARIES := $(addprefix -l,$(RS_LIBRARIES_EX)) -PLATFORM_INCS = $(USR_INCS) -I"$(SDK_PATH)/library" +PLATFORM_INCS = $(USR_INCS) -I "$(SDK_PATH)/library" diff --git a/apptray-widget-app/inc/apptray_wgt_app_accessibility_utils.h b/apptray-widget-app/inc/apptray_wgt_app_accessibility_utils.h index 2183249..468f3db 100644 --- a/apptray-widget-app/inc/apptray_wgt_app_accessibility_utils.h +++ b/apptray-widget-app/inc/apptray_wgt_app_accessibility_utils.h @@ -14,90 +14,81 @@ * limitations under the License. */ -#ifndef __APPTRAY_WIDGET_ACCESSIBILITY_UTILS_H__ -#define __APPTRAY_WIDGET_ACCESSIBILITY_UTILS_H__ +#ifndef __APPTRAY_WIDGET_APP_ACCESSIBILITY_UTILS_H__ +#define __APPTRAY_WIDGET_APP_ACCESSIBILITY_UTILS_H__ #include <Elementary.h> #include <stdbool.h> /** * @brief Registers accessible object - * - * @param[in] parent Accessible object parent - * @param[in] ly Layout from which part for creation accessible object is taken - * @param[in] ly_part Part of layout for creation accessible object - * + * @param[in] parent Accessible object parent + * @param[in] ly Layout from which part for creation accessible object is taken + * @param[in] ly_part Part of layout for creation accessible object * @return Accessible object on success or NULL otherwise */ -Evas_Object *apptray_wgt_app_au_register_access_object(Evas_Object *parent, Evas_Object *ly, const char *ly_part); +Evas_Object *apptray_wgt_app_au_register_access_object(Evas_Object *parent, + Evas_Object *ly, const char *ly_part); /** * @brief Unregisters accessible object - * - * @param[in] obj Accessible object to unregister - * + * @param[in] ly Layout from which part for creation accessible object was taken + * @param[in] ly_part Part of layout for creation accessible object */ -void apptray_wgt_app_au_unregister_access_object(Evas_Object *obj); +void apptray_wgt_app_au_unregister_access_object(Evas_Object *ly, + const char *ly_part); /** * @brief Registers fake first accessible object - * - * @param[in] parent Accessible object parent - * @param[in] ly Layout from which part for creation accessible object is taken - * @param[in] ly_part Part of layout for creation accessible object - * + * @param[in] parent Accessible object parent + * @param[in] ly Layout from which part for creation accessible object is taken + * @param[in] ly_part Part of layout for creation accessible object * @return Accessible object on success or NULL otherwise */ -Evas_Object *apptray_wgt_app_au_register_fake_access_object(Evas_Object *parent, Evas_Object *ly, const char *ly_part); +Evas_Object *apptray_wgt_app_au_register_fake_access_object(Evas_Object *parent, + Evas_Object *ly, const char *ly_part); /** * @brief Symmetrically appends custom relationship between objects - * - * @param[in] from Highlight from object - * @param[in] to Highlight to object - * + * @param[in] from Highlight from object + * @param[in] to Highlight to object * @return true on success or false otherwise */ -bool apptray_wgt_app_au_append_symmetric_relationship(Evas_Object *from, Evas_Object *to); +bool apptray_wgt_app_au_append_symmetric_relationship(Evas_Object *from, + Evas_Object *to); /** * @brief Symmetrically removes custom relationship between objects - * - * @param[in] from Highlight from object - * @param[in] to Highlight to object + * @param[in] from Highlight from object + * @param[in] to Highlight to object */ -void apptray_wgt_app_au_remove_symmetric_relationship(Evas_Object *from, Evas_Object *to); +void apptray_wgt_app_au_remove_symmetric_relationship(Evas_Object *from, + Evas_Object *to); /** * @brief Appends end point to custom relationship - * - * @param[in] obj Evas object - * + * @param[in] obj Evas object * @return true on success or false otherwise */ bool apptray_wgt_app_au_append_relationship_end_point(Evas_Object *obj); /** * @brief Removes end point from custom relationship - * - * @param[in] obj Evas object + * @param[in] obj Evas object */ void apptray_wgt_app_au_remove_relationship_end_point(Evas_Object *obj); /** * @brief Appends start point to custom relationship - * - * @param[in] obj Evas object - * + * @param[in] obj Evas object * @return true on success or false otherwise */ bool apptray_wgt_app_au_append_relationship_start_point(Evas_Object *obj); /** * @brief Removes start point from custom relationship - * - * @param[in] obj Evas object + * @param[in] obj Evas object */ void apptray_wgt_app_au_remove_relationship_start_point(Evas_Object *obj); -#endif /* __APPTRAY_WIDGET_ACCESSIBILITY_UTILS_H__ */ +#endif /* __APPTRAY_WIDGET_APP_ACCESSIBILITY_UTILS_H__ */ diff --git a/apptray-widget-app/inc/apptray_wgt_app_common_def.h b/apptray-widget-app/inc/apptray_wgt_app_common_def.h index 2e2939c..93e3209 100644 --- a/apptray-widget-app/inc/apptray_wgt_app_common_def.h +++ b/apptray-widget-app/inc/apptray_wgt_app_common_def.h @@ -17,8 +17,6 @@ #ifndef __APPTRAY_WGT_APP_COMMON_DEF_H__ #define __APPTRAY_WGT_APP_COMMON_DEF_H__ -#include "apptray_wgt_app_common_def.h" - #define ATW_BUF_SIZE_SMALL 32 #define ATW_BUF_SIZE_NORMAL 128 #define ATW_BUF_SIZE_LARGE 512 diff --git a/apptray-widget-app/inc/apptray_wgt_app_item_info.h b/apptray-widget-app/inc/apptray_wgt_app_item_info.h index 578a0fe..dfb872b 100755 --- a/apptray-widget-app/inc/apptray_wgt_app_item_info.h +++ b/apptray-widget-app/inc/apptray_wgt_app_item_info.h @@ -18,24 +18,31 @@ #define __APPTRAY_WGT_APP_ITEM_INFO_H__ #include <Elementary.h> -#include <Evas.h> - -#include "apptray_wgt_app_common_def.h" -#include "apptray_wgt_app_utils.h" +/** + * @brief Item info structure + */ typedef struct { - char *pkgid; - char *appid; - char *name; - char *icon; - int open_app; - int removable; - Eina_Bool is_selected; - Elm_Object_Item *gl_item; + char *pkgid; /**< Application package id */ + char *appid; /**< Application id */ + char *name; /**< Name to display */ + char *icon; /**< Icon path */ + Eina_Bool is_selected; /**< Item selected status */ + Elm_Object_Item *gl_item; /**< Genlist item */ } apptray_wgt_app_item_info_s; -apptray_wgt_app_item_info_s *apptray_wgt_app_item_info_create(const char *appid); +/** + * @brief Creates item info instance + * @param[in] appid Application id in accordance to item + * @return New instance of item info on success, otherwise NULL on failure + */ +apptray_wgt_app_item_info_s *apptray_wgt_app_item_info_create( + const char *appid); +/** + * @brief Destroys item info instance + * @param[in] item_info Item info instance to destroy + */ void apptray_wgt_app_item_info_destroy(apptray_wgt_app_item_info_s *item_info); #endif /* __APPTRAY_WGT_APP_ITEM_INFO_H__*/ diff --git a/apptray-widget-app/inc/apptray_wgt_app_key.h b/apptray-widget-app/inc/apptray_wgt_app_key.h deleted file mode 100755 index eb9aba4..0000000 --- a/apptray-widget-app/inc/apptray_wgt_app_key.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2017 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_WGT_APP_KEY_H__ -#define __APPTRAY_WGT_APP_KEY_H__ - -#include <stdbool.h> - -typedef enum { - APPTRAY_WGT_APP_KEY_CB_RET_CONTINUE = 0, - APPTRAY_WGT_APP_KEY_CB_RET_STOP, -} apptray_wgt_app_key_cb_ret_e; - -typedef enum { - APPTRAY_WGT_APP_KEY_TYPE_BACK = 0, - APPTRAY_WGT_APP_KEY_TYPE_POWER, - APPTRAY_WGT_APP_KEY_TYPE_MAX, -} apptray_wgt_app_key_type_e; - -typedef apptray_wgt_app_key_cb_ret_e (*apptray_wgt_app_key_result_cb)(void *); - -void apptray_wgt_app_key_register(void); -void apptray_wgt_app_key_unregister(void); -bool apptray_wgt_app_key_register_cb(apptray_wgt_app_key_type_e type, - apptray_wgt_app_key_result_cb result_cb, void *result_data); -void apptray_wgt_app_key_unregister_cb(apptray_wgt_app_key_type_e type, - apptray_wgt_app_key_result_cb result_cb); -void apptray_wgt_app_key_cb_execute(int type); - -#endif /* __APPTRAY_WGT_APP_KEY_H__ */ diff --git a/apptray-widget-app/inc/apptray_wgt_app_key_event_provider.h b/apptray-widget-app/inc/apptray_wgt_app_key_event_provider.h new file mode 100755 index 0000000..d2c2441 --- /dev/null +++ b/apptray-widget-app/inc/apptray_wgt_app_key_event_provider.h @@ -0,0 +1,68 @@ +/* + * Copyright 2017 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_WGT_APP_KEY_EVENT_PROVIDER_H__ +#define __APPTRAY_WGT_APP_KEY_EVENT_PROVIDER_H__ + +#include <stdbool.h> + +/** + * Enumeration for key types that are available for handling + */ +typedef enum { + APPTRAY_WGT_APP_KEY_TYPE_BACK = 0, /**< Back key */ + APPTRAY_WGT_APP_KEY_TYPE_POWER, /**< Power key */ + + APPTRAY_WGT_APP_KEY_TYPE_MAX /**< Total keys count */ +} apptray_wgt_app_key_type_e; + +/** + * @brief Key event callback prototype + */ +typedef bool (*apptray_wgt_app_key_event_cb)(void *); + +/** + * @brief Initializes Key event provider + */ +void apptray_wgt_app_key_event_provider_init(void); + +/** + * @brief Deinitializes Key event provider + */ +void apptray_wgt_app_key_event_provider_deinit(void); + +/** + * @brief Adds key event handler + * @param[in] type Key type to handle + * @param[in] result_cb Result callback function + * @param[in] result_data Result callback data + * @return bool on success, false otherwise + */ +bool apptray_wgt_app_key_event_provider_add_handler( + apptray_wgt_app_key_type_e type, + apptray_wgt_app_key_event_cb result_cb, + void *result_data); + +/** + * @brief Deletes key event handler + * @param[in] type Key type that was handled + * @param[in] result_cb Result callback function that was set + */ +void apptray_wgt_app_key_event_provider_del_handler( + apptray_wgt_app_key_type_e type, + apptray_wgt_app_key_event_cb result_cb); + +#endif /* __APPTRAY_WGT_APP_KEY_EVENT_PROVIDER_H__ */ diff --git a/apptray-widget-app/inc/apptray_wgt_app_log.h b/apptray-widget-app/inc/apptray_wgt_app_log.h index a23c603..413a91a 100755 --- a/apptray-widget-app/inc/apptray_wgt_app_log.h +++ b/apptray-widget-app/inc/apptray_wgt_app_log.h @@ -100,7 +100,7 @@ } while (0) #define retvm_if(expr, val, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ _E(fmt, ##arg); \ _E("(%s) -> %s() return", #expr, __FUNCTION__); \ return val; \ @@ -108,14 +108,14 @@ } while (0) #define retv_if(expr, val) do { \ - if(expr) { \ + if (expr) { \ _E("(%s) -> %s() return", #expr, __FUNCTION__); \ return (val); \ } \ } while (0) #define retm_if(expr, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ _E(fmt, ##arg); \ _E("(%s) -> %s() return", #expr, __FUNCTION__); \ return; \ @@ -123,28 +123,28 @@ } while (0) #define ret_if(expr) do { \ - if(expr) { \ + if (expr) { \ _E("(%s) -> %s() return", #expr, __FUNCTION__); \ return; \ } \ } while (0) #define goto_if(expr, val) do { \ - if(expr) { \ + if (expr) { \ _E("(%s) -> goto", #expr); \ goto val; \ } \ } while (0) #define break_if(expr) { \ - if(expr) { \ + if (expr) { \ _E("(%s) -> break", #expr); \ break; \ } \ } #define continue_if(expr) { \ - if(expr) { \ + if (expr) { \ _E("(%s) -> continue", #expr); \ continue; \ } \ diff --git a/apptray-widget-app/inc/apptray_wgt_app_utils.h b/apptray-widget-app/inc/apptray_wgt_app_utils.h index 51bfd56..da17ea1 100755 --- a/apptray-widget-app/inc/apptray_wgt_app_utils.h +++ b/apptray-widget-app/inc/apptray_wgt_app_utils.h @@ -17,10 +17,22 @@ #ifndef __APPTRAY_WGT_APP_UTIL_H__ #define __APPTRAY_WGT_APP_UTIL_H__ +/** + * @brief Gets full path to edje files directory + * @return Path to edje files directory + */ const char *apptray_wgt_app_utils_get_edje_path(); +/** + * @brief Gets full path to locale files directory + * @return Path to locale files directory + */ const char *apptray_wgt_app_utils_get_locale_path(); +/** + * @brief Gets full path to default application icon resource + * @return Path to default application icon + */ const char *apptray_wgt_app_utils_get_default_app_icon_path(); #endif /* __APPTRAY_WGT_APP_UTIL_H__ */ diff --git a/apptray-widget-app/project_def.prop b/apptray-widget-app/project_def.prop index 361d86c..a10a925 100755 --- a/apptray-widget-app/project_def.prop +++ b/apptray-widget-app/project_def.prop @@ -9,7 +9,7 @@ type = app profile = wearable-4.0 # C/CPP Sources -USER_SRCS = src/apptray_wgt_app_accessibility_utils.c src/apptray_wgt_app_key.c src/apptray_wgt_app_item_info.c src/apptray_wgt_app.c src/apptray_wgt_app_utils.c +USER_SRCS = src/apptray_wgt_app_accessibility_utils.c src/apptray_wgt_app_item_info.c src/apptray_wgt_app.c src/apptray_wgt_app_key_event_provider.c src/apptray_wgt_app_utils.c # EDC Sources USER_EDCS = diff --git a/apptray-widget-app/src/apptray_wgt_app.c b/apptray-widget-app/src/apptray_wgt_app.c index 294564d..96b1033 100755 --- a/apptray-widget-app/src/apptray_wgt_app.c +++ b/apptray-widget-app/src/apptray_wgt_app.c @@ -18,7 +18,6 @@ #include <widget_service.h> #include <widget_errno.h> #include <feedback.h> -#include <bundle.h> #include <efl_extension.h> #include <system_settings.h> #include <app.h> @@ -26,18 +25,17 @@ #include <app_manager.h> #include "apptray_wgt_app_item_info.h" -#include "apptray_wgt_app_key.h" -#include "apptray_wgt_app_log.h" #include "apptray_wgt_app_utils.h" #include "apptray_wgt_app_common_def.h" #include "apptray_wgt_app_accessibility_utils.h" +#include "apptray_wgt_app_key_event_provider.h" +#include "apptray_wgt_app_log.h" #define ATW_DEFAULT_APP_ORDER "org.tizen.apptray-widget-app org.tizen.alarm org.tizen.w-phone org.tizen.watch-setting" #define ATW_APP_WIDGET_CONTENT_KEY "org.tizen.apptray-widget" #define ATW_BUNDLE_KEY_SHORTCUT_LIST "shortcut_list" -#define ATW_BUNDLE_KEY_WIDGET_INSTANCE_ID "instance_id" #define ATW_APP_SLOTS_MAX_COUNT 4 #define ATW_GENLIST_ITEM_ICON_DIMENSION 76 @@ -85,30 +83,30 @@ typedef struct { } _apptray_wgt_app_slot_convertor; static _apptray_wgt_app_slot_convertor _output_slot_conv[16] = { - {{ 0, 1, 2, 3 }}, - {{ 0, 1, 2, 3 }}, - {{ 1, 0, 2, 3 }}, - {{ 1, 0, 2, 3 }}, - {{ 2, 0, 1, 3 }}, - {{ 0, 2, 1, 3 }}, - {{ 1, 2, 0, 3 }}, - {{ 0, 1, 2, 3 }}, - {{ 3, 0, 1, 2 }}, - {{ 0, 3, 1, 2 }}, - {{ 1, 3, 0, 2 }}, - {{ 0, 1, 3, 2 }}, - {{ 3, 2, 0, 1 }}, - {{ 0, 3, 2, 1 }}, - {{ 1, 3, 2, 0 }}, - {{ 0, 1, 2, 3 }} + { { 0, 1, 2, 3 } }, + { { 0, 1, 2, 3 } }, + { { 1, 0, 2, 3 } }, + { { 1, 0, 2, 3 } }, + { { 2, 0, 1, 3 } }, + { { 0, 2, 1, 3 } }, + { { 1, 2, 0, 3 } }, + { { 0, 1, 2, 3 } }, + { { 3, 0, 1, 2 } }, + { { 0, 3, 1, 2 } }, + { { 1, 3, 0, 2 } }, + { { 0, 1, 3, 2 } }, + { { 3, 2, 0, 1 } }, + { { 0, 3, 2, 1 } }, + { { 1, 3, 2, 0 } }, + { { 0, 1, 2, 3 } } }; static _apptray_wgt_app_slot_convertor _input_slot_conv[5] = { - {{ 0, 1, 2, 3 }}, - {{ 0, 1, 2, 3 }}, - {{ 1, 2, 0, 3 }}, - {{ 0, 1, 2, 3 }}, - {{ 0, 1, 2, 3 }} + { { 0, 1, 2, 3 } }, + { { 0, 1, 2, 3 } }, + { { 1, 2, 0, 3 } }, + { { 0, 1, 2, 3 } }, + { { 0, 1, 2, 3 } } }; typedef struct { @@ -125,9 +123,9 @@ static _apptray_wgt_app_slot_coord _slot_coords[ATW_APP_SLOTS_MAX_COUNT] = { typedef struct appdata { Evas_Object *win; - Evas_Object *naviframe; - Evas_Object *conformant; - Eext_Circle_Surface *circle_surface; + Evas_Object *navi; + Evas_Object *conf; + Eext_Circle_Surface *circle_surf; Elm_Object_Item *edit_view_navi_item; Elm_Object_Item *select_view_navi_item; @@ -175,12 +173,16 @@ static appdata_s *g_info = NULL; static char *strdup_s(const char *val); static void _update_appid_list_with_selected_items(); static void _update_content(void); -static apptray_wgt_app_key_cb_ret_e _key_release_cb(void *data); +static bool _key_release_cb(void *data); static void _terminate_add_to_shortcut(void); static Eina_Bool _longpress_timer_cb(void *data); -static void _app_icon_clicked_cb(void *data, Evas_Object *obj, void *event_info); -static void _plus_clicked_cb(void *data, Evas_Object *obj, void *event_info); +static void _app_icon_clicked_cb(void *data, + Evas_Object *obj, + void *event_info); +static void _plus_clicked_cb(void *data, + Evas_Object *obj, + void *event_info); static void _transit_del_cb(void *data, Elm_Transit *transit); static void _anim_switch_item(Evas_Object *item, int src, int dst); @@ -190,25 +192,40 @@ static void _up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _del_btn_click_cb(void *data, Evas_Object *obj, void *event_info); -static char *_title_item_get_txt_cb(void *data, Evas_Object *obj, const char *part); +static char *_title_item_get_txt_cb(void *data, + Evas_Object *obj, + const char *part); static Elm_Genlist_Item_Class *_get_gl_itc_header(); -static char *_cont_item_get_txt_cb(void *data, Evas_Object *obj, const char *part); - -static void _toast_popup_hide_cb(void *data, Evas_Object *obj, void *event_info); -static void _toast_popup_dismiss_cb(void *data, Evas_Object *obj, void *event_info); +static char *_cont_item_get_txt_cb(void *data, + Evas_Object *obj, + const char *part); + +static void _toast_popup_hide_cb(void *data, + Evas_Object *obj, + void *event_info); +static void _toast_popup_dismiss_cb(void *data, + Evas_Object *obj, + void *event_info); static void _create_toast_popup(const char *text); -static void _gl_check_clicked_cb(void *data, Evas_Object *obj, void *event_info); -static void _cont_item_del_cb(void *data, Evas_Object *obj); +static void _gl_check_clicked_cb(void *data, + Evas_Object *obj, + void *event_info); +static void _cont_item_del_cb(void *data, + Evas_Object *obj); static Elm_Genlist_Item_Class *_get_gl_itc_content(); static Elm_Genlist_Item_Class *_get_gl_itc_empty(); static void _gl_add_header_item(Evas_Object *gl); static bool _check_already_added_apps(const char *appid); -static void _gl_item_clicked_cb(void *data, Evas_Object *obj, void *event_info); +static void _gl_item_clicked_cb(void *data, + Evas_Object *obj, + void *event_info); static void _gl_add_apps_items(Evas_Object *gl, Eina_List *app_list); static void _gl_add_empty_item(Evas_Object *gl); -static void _bottom_btn_click_cb(void *data, Evas_Object *obj, void *event_info); +static void _bottom_btn_click_cb(void *data, + Evas_Object *obj, + void *event_info); Evas_Object *_set_app_slot(const char *appid, int pos); static Eina_Bool _click_blocker_timer_cb(void *data); @@ -217,11 +234,17 @@ static bool _apps_all_cb(app_info_h handle, void *user_data); static Eina_List *_read_all_apps_on_device(Eina_List **list); /* Main UI components */ -static bool _create_main_ui_components(appdata_s *info, const char *name, const char *title); -static Evas_Object *_create_win(appdata_s *info, const char *name, const char *title); +static bool _create_main_ui_components(appdata_s *info, + const char *name, + const char *title); +static Evas_Object *_create_win(appdata_s *info, + const char *name, + const char *title); static Evas_Object *_create_conformant(Evas_Object *win); static Evas_Object *_create_naviframe(Evas_Object *parent, appdata_s *info); -static void _naviframe_transition_finished_cb(void *data, Evas_Object *obj, void *event_info); +static void _naviframe_transition_finished_cb(void *data, + Evas_Object *obj, + void *event_info); static void _process_navi_item_transition_finish(appdata_s *info); static bool _check_naviframe_is_empty(Evas_Object *naviframe); @@ -229,12 +252,18 @@ static bool _show_view(appdata_s *info, _apptray_wgt_view_type_e view_type); /* Select View */ static Evas_Object *_create_select_view(appdata_s *info); -static Evas_Object *_select_view_create_bottom_btn(Evas_Object *parent, appdata_s *info); -static Evas_Object *_select_view_create_genlist_ly(Evas_Object *parent, appdata_s *info); -static Evas_Object *_select_view_create_multi_pick_genlist(Evas_Object *parent, appdata_s *info); -static Evas_Object *_select_view_create_select_count_btn(Evas_Object *parent, appdata_s *info); -static Evas_Object *_select_view_create_simple_genlist(Evas_Object *parent, appdata_s *info); -static void _select_view_set_genlist_content(Evas_Object *genlist, appdata_s *info); +static Evas_Object *_select_view_create_bottom_btn(Evas_Object *parent, + appdata_s *info); +static Evas_Object *_select_view_create_genlist_ly(Evas_Object *parent, + appdata_s *info); +static Evas_Object *_select_view_create_multi_pick_genlist(Evas_Object *parent, + appdata_s *info); +static Evas_Object *_select_view_create_select_count_btn(Evas_Object *parent, + appdata_s *info); +static Evas_Object *_select_view_create_simple_genlist(Evas_Object *parent, + appdata_s *info); +static void _select_view_set_genlist_content(Evas_Object *genlist, + appdata_s *info); static Evas_Object *_select_view_create_main_ly(appdata_s *info); static void _select_view_update_apps_label(appdata_s *ad); @@ -245,19 +274,27 @@ static void _select_view_set_highlight_on_bottom_btn(appdata_s *app); static void _select_view_set_highlight_on_gl_first_item(appdata_s *app); static void _select_view_update_gl_item_highlight_on_next(appdata_s *app); static void _select_view_update_gl_item_highlight_on_prev(appdata_s *app); -static Eina_Bool _select_view_rotary_event_cb(void *data, Evas_Object *obj, Eext_Rotary_Event_Info *info); +static Eina_Bool _select_view_rotary_event_cb(void *data, + Evas_Object *obj, + Eext_Rotary_Event_Info *info); static void _select_view_gl_manual_scroll_next(appdata_s *app); static void _select_view_gl_manual_scroll_prev(appdata_s *app); static void _select_view_gl_manual_highlight_next(appdata_s *app); static void _select_view_gl_manual_highlight_prev(appdata_s *app); static void _select_view_process_rotary_clockwise_event(appdata_s *app); static void _select_view_process_rotary_counter_clockwise_event(appdata_s *app); -static void _select_view_gl_highlight_cb(void *data, Evas_Object *obj, void *event_info); -static void _select_view_gl_unhighlight_cb(void *data, Evas_Object *obj, void *event_info); +static void _select_view_gl_highlight_cb(void *data, + Evas_Object *obj, + void *event_info); +static void _select_view_gl_unhighlight_cb(void *data, + Evas_Object *obj, + void *event_info); static void _select_view_register_counter_ao(appdata_s *info); static void _select_view_register_custom_accessibility_rout(appdata_s *info); static void _select_view_update_counter_ao_name(appdata_s *info); -static Eina_Bool _ao_sv_counter_action_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info); +static Eina_Bool _ao_sv_counter_action_cb(void *data, + Evas_Object *obj, + Elm_Access_Action_Info *action_info); /* Edit View */ static Evas_Object *_create_edit_view(appdata_s *info); @@ -265,16 +302,25 @@ static Evas_Object *_edit_view_create_layout(appdata_s *info); static bool _edit_view_init_slots(const char *app_list); static Evas_Object *_edit_view_create_slot_ly(Evas_Object *parent); static Evas_Object *_edit_view_create_slot_app_btn(Evas_Object *parent); -static Evas_Object *_edit_view_create_slot_app_btn_icon(Evas_Object *parent, const char *image_path); +static Evas_Object *_edit_view_create_slot_app_btn_icon(Evas_Object *parent, + const char *image_path); static Evas_Object *_edit_view_create_slot_app_btn_del_ly(Evas_Object *parent); static Evas_Object *_edit_view_create_slot_empty_btn(Evas_Object *parent); static int _edit_view_get_slot_index_by_pointer(Evas_Object *slot); static void _edit_view_replace_slot_with_empty(Evas_Object *slot); -static Eina_Bool _edit_view_rotary_event_cb(void *data, Evas_Object *obj, Eext_Rotary_Event_Info *info); - -static Eina_Bool _ao_ev_ly_action_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info); -static void _edit_view_slot_btn_highlight_cb(void *data, Evas_Object *obj, void *event_info); -static void _edit_view_slot_btn_unhighlight_cb(void *data, Evas_Object *obj, void *event_info); +static Eina_Bool _edit_view_rotary_event_cb(void *data, + Evas_Object *obj, + Eext_Rotary_Event_Info *info); + +static Eina_Bool _ao_ev_ly_action_cb(void *data, + Evas_Object *obj, + Elm_Access_Action_Info *action_info); +static void _edit_view_slot_btn_highlight_cb(void *data, + Evas_Object *obj, + void *event_info); +static void _edit_view_slot_btn_unhighlight_cb(void *data, + Evas_Object *obj, + void *event_info); static void _edit_view_manual_highlight_next(); static void _edit_view_manual_highlight_prev(); @@ -296,10 +342,14 @@ static void _app_pause(void *data); static void _app_resume(void *data); static void _app_control(app_control_h service, void *data); static void _app_lang_changed(app_event_info_h event_info, void *user_data); -static bool _app_process_pick_operation(appdata_s *info); -static bool _app_process_main_operation(appdata_s *info, const char *app_list); -static void _activate_view_rotary_state(appdata_s *info, _apptray_wgt_view_type_e view_type); +static bool _init_widget_instance_id(appdata_s *info, app_control_h service); +static bool _init_widget_app_list(appdata_s *info, app_control_h service); +static bool _process_app_control_operation(appdata_s *info, + app_control_h service); + +static void _activate_view_rotary_state(appdata_s *info, + _apptray_wgt_view_type_e view_type); static char *strdup_s(const char *val) { @@ -311,19 +361,21 @@ static void _update_appid_list_with_selected_items() apptray_wgt_app_item_info_s *item_info = NULL; Eina_List *l = NULL; Eina_List *n = NULL; - int selected_app_count = 0; + int selected_count = 0; int i = 0; EINA_LIST_FOREACH_SAFE(g_info->all_app_list, l, n, item_info) { if (item_info->is_selected && item_info->appid) { - ++selected_app_count; + ++selected_count; } } EINA_LIST_FOREACH_SAFE(g_info->all_app_list, l, n, item_info) { if (item_info->is_selected && item_info->appid) { - free(g_info->appid_list[_input_slot_conv[selected_app_count].slot_seq_arr[i]]); - g_info->appid_list[_input_slot_conv[selected_app_count].slot_seq_arr[i]] = strdup(item_info->appid); + free(g_info->appid_list[_input_slot_conv[selected_count]. + slot_seq_arr[i]]); + g_info->appid_list[_input_slot_conv[selected_count]. + slot_seq_arr[i]] = strdup(item_info->appid); i++; } } @@ -342,6 +394,7 @@ static void _update_content(void) int res = 0; char content[ATW_BUF_SIZE_BIG] = { 0 }; int slot_mask = 0; + bundle *b_tmp = NULL; if (!g_info) { _E("g_info is NULL"); @@ -363,16 +416,18 @@ static void _update_content(void) g_info->appid_list[_output_slot_conv[slot_mask].slot_seq_arr[2]], g_info->appid_list[_output_slot_conv[slot_mask].slot_seq_arr[3]]); - bundle *b_tmp = bundle_create(); + b_tmp = bundle_create(); if (!b_tmp) { _E("bundle_create failed"); return; } bundle_add_str(b_tmp, ATW_BUNDLE_KEY_SHORTCUT_LIST, content); - res = widget_service_trigger_update(ATW_APP_WIDGET_CONTENT_KEY, g_info->widget_instance_id, b_tmp, 1); + res = widget_service_trigger_update(ATW_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, ATW_APP_WIDGET_CONTENT_KEY, res); + _E("Update widget instance [%s] of wgt app [%s] failed. res[%d]", + g_info->widget_instance_id, ATW_APP_WIDGET_CONTENT_KEY, res); } bundle_free(b_tmp); @@ -388,7 +443,9 @@ static void _terminate_add_to_shortcut(void) ui_app_exit(); } -static Evas_Object *_create_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; @@ -463,20 +520,25 @@ static int _edit_view_get_slot_index_by_pointer(Evas_Object *slot) return 0; } -static void _activate_view_rotary_state(appdata_s *info, _apptray_wgt_view_type_e view_type) +static void _activate_view_rotary_state(appdata_s *info, + _apptray_wgt_view_type_e view_type) { _ENTER; if (view_type == APPTRAY_WGT_APP_VIEW_EDIT) { if (info->select_view_circle_gl) { - eext_rotary_object_event_activated_set(info->select_layout, EINA_FALSE); + eext_rotary_object_event_activated_set(info->select_layout, + EINA_FALSE); } - eext_rotary_object_event_activated_set(info->edit_layout, EINA_TRUE); + eext_rotary_object_event_activated_set(info->edit_layout, + EINA_TRUE); } else { if (info->edit_layout) { - eext_rotary_object_event_activated_set(info->edit_layout, EINA_FALSE); + eext_rotary_object_event_activated_set(info->edit_layout, + EINA_FALSE); } - eext_rotary_object_event_activated_set(info->select_layout, EINA_TRUE); + eext_rotary_object_event_activated_set(info->select_layout, + EINA_TRUE); } } @@ -609,10 +671,14 @@ static void _move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) evas_object_move(data, eo_new_x, eo_new_y); for (i = 0; i < ATW_APP_SLOTS_MAX_COUNT; i++) { - if ((eo_new_x > _slot_coords[i].x - ATW_SLOT_ITEM_SET_POS_THRESHOLD - && eo_new_x < _slot_coords[i].x + ATW_SLOT_ITEM_SET_POS_THRESHOLD) - && (eo_new_y > _slot_coords[i].y - ATW_SLOT_ITEM_SET_POS_THRESHOLD - && eo_new_y < _slot_coords[i].y + ATW_SLOT_ITEM_SET_POS_THRESHOLD)) { + if ((eo_new_x > _slot_coords[i].x - + ATW_SLOT_ITEM_SET_POS_THRESHOLD + && eo_new_x < _slot_coords[i].x + + ATW_SLOT_ITEM_SET_POS_THRESHOLD) + && (eo_new_y > _slot_coords[i].y - + ATW_SLOT_ITEM_SET_POS_THRESHOLD + && eo_new_y < _slot_coords[i].y + + ATW_SLOT_ITEM_SET_POS_THRESHOLD)) { int slot_index = i + 1; if (pressed_index != slot_index && !transit_go) { char *tmp = NULL; @@ -622,11 +688,13 @@ static void _move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) _D("Slot %d area", slot_index); snprintf(buff, sizeof(buff), "index%d", slot_index); - item = elm_object_part_content_unset(g_info->edit_layout, buff); + item = elm_object_part_content_unset( + g_info->edit_layout, buff); _anim_switch_item(item, slot_index, pressed_index); tmp = strdup(g_info->appid_list[pressed_index - 1]); - g_info->appid_list[pressed_index - 1] = strdup(g_info->appid_list[i]); + g_info->appid_list[pressed_index - 1] = + strdup(g_info->appid_list[i]); g_info->appid_list[i] = strdup(tmp); FREE(tmp); @@ -669,7 +737,9 @@ static void _up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) elm_object_signal_emit(data, "show", "slot"); elm_object_signal_emit(data, "show_icon", "slot"); - elm_object_signal_emit(g_info->edit_layout, "hide_edit_stroke", "edit_layout"); + elm_object_signal_emit(g_info->edit_layout, + "hide_edit_stroke", + "edit_layout"); _update_content(); @@ -680,7 +750,8 @@ static void _up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) if (longpress_flag) { longpress_flag = EINA_FALSE; DEL_ECORE_TIMER(click_blocker_timer); - click_blocker_timer = ecore_timer_add(ATW_CLICK_BLOCKER_TIMER_DURATION, _click_blocker_timer_cb, NULL); + click_blocker_timer = ecore_timer_add(ATW_CLICK_BLOCKER_TIMER_DURATION, + _click_blocker_timer_cb, NULL); } } @@ -735,12 +806,14 @@ static void _edit_view_unset_access_rout() char buff[ATW_BUF_SIZE_SMALL] = { 0 }; if (g_info->ao_ev_first) { - apptray_wgt_app_au_remove_relationship_start_point(g_info->ao_ev_first); + apptray_wgt_app_au_remove_relationship_start_point( + g_info->ao_ev_first); cur_ao = g_info->ao_ev_first; } if (g_info->ao_ev_ly) { - apptray_wgt_app_au_remove_symmetric_relationship(cur_ao, g_info->ao_ev_ly); + apptray_wgt_app_au_remove_symmetric_relationship(cur_ao, + g_info->ao_ev_ly); cur_ao = g_info->ao_ev_ly; } @@ -766,12 +839,14 @@ static void _edit_view_set_access_rout() char buff[ATW_BUF_SIZE_SMALL] = { 0 }; if (g_info->ao_ev_first) { - apptray_wgt_app_au_append_relationship_start_point(g_info->ao_ev_first); + apptray_wgt_app_au_append_relationship_start_point( + g_info->ao_ev_first); cur_ao = g_info->ao_ev_first; } if (g_info->ao_ev_ly) { - apptray_wgt_app_au_append_symmetric_relationship(cur_ao, g_info->ao_ev_ly); + apptray_wgt_app_au_append_symmetric_relationship(cur_ao, + g_info->ao_ev_ly); cur_ao = g_info->ao_ev_ly; } @@ -802,25 +877,33 @@ static Evas_Object *_edit_view_create_slot_app_btn(Evas_Object *parent) Evas_Object *eo = elm_button_add(parent); retv_if(!eo, NULL); elm_object_style_set(eo, "apptray/icon_slot"); - evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_DOWN, _down_cb, parent); - evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_MOVE, _move_cb, parent); - evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_UP, _up_cb, parent); + evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_DOWN, + _down_cb, parent); + evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_MOVE, + _move_cb, parent); + evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_UP, + _up_cb, parent); evas_object_smart_callback_add(eo, "clicked", _app_icon_clicked_cb, parent); evas_object_show(eo); /* Accessibility */ elm_atspi_accessible_translation_domain_set(eo, ATW_DOMAIN); - elm_atspi_accessible_reading_info_type_set(eo, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME + elm_atspi_accessible_reading_info_type_set(eo, + ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION); - elm_atspi_accessible_description_set(eo, "WDS_ACCS_TBBODY_DOUBLE_TAP_TO_REMOVE"); + elm_atspi_accessible_description_set(eo, + "WDS_ACCS_TBBODY_DOUBLE_TAP_TO_REMOVE"); - evas_object_smart_callback_add(eo, "atspi,highlighted", _edit_view_slot_btn_highlight_cb, NULL); - evas_object_smart_callback_add(eo, "atspi,unhighlighted", _edit_view_slot_btn_unhighlight_cb, NULL); + evas_object_smart_callback_add(eo, "atspi,highlighted", + _edit_view_slot_btn_highlight_cb, NULL); + evas_object_smart_callback_add(eo, "atspi,unhighlighted", + _edit_view_slot_btn_unhighlight_cb, NULL); return eo; } -static Evas_Object *_edit_view_create_slot_app_btn_icon(Evas_Object *parent, const char *image_path) +static Evas_Object *_edit_view_create_slot_app_btn_icon(Evas_Object *parent, + const char *image_path) { Evas_Object *eo = evas_object_image_add(evas_object_evas_get(parent)); retv_if(!eo, NULL); @@ -922,13 +1005,17 @@ static void _edit_view_manual_highlight_prev() } } -static void _edit_view_slot_btn_highlight_cb(void *data, Evas_Object *obj, void *event_info) +static void _edit_view_slot_btn_highlight_cb(void *data, + Evas_Object *obj, + void *event_info) { _D("Slot btn [HIGHLIGHT]"); g_info->ev_cur_highlighted_obj = obj; } -static void _edit_view_slot_btn_unhighlight_cb(void *data, Evas_Object *obj, void *event_info) +static void _edit_view_slot_btn_unhighlight_cb(void *data, + Evas_Object *obj, + void *event_info) { _D("Slot btn [UNHIGHLIGHT]"); g_info->ev_cur_highlighted_obj = NULL; @@ -939,20 +1026,26 @@ static Evas_Object *_edit_view_create_slot_empty_btn(Evas_Object *parent) Evas_Object *eo = elm_button_add(parent); retv_if(!eo, NULL); elm_object_style_set(eo, "apptray/empty_slot"); - evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_DOWN, _down_cb, parent); - evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_MOVE, _move_cb, parent); - evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_UP, _up_cb, parent); + evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_DOWN, + _down_cb, parent); + evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_MOVE, + _move_cb, parent); + evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_UP, + _up_cb, parent); evas_object_smart_callback_add(eo, "clicked", _plus_clicked_cb, parent); evas_object_show(eo); /* Accessibility */ elm_atspi_accessible_translation_domain_set(eo, ATW_DOMAIN); - elm_atspi_accessible_reading_info_type_set(eo, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME + elm_atspi_accessible_reading_info_type_set(eo, + ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION); elm_atspi_accessible_description_set(eo, "IDS_KM_BODY_DOUBLE_TAP_TO_ADD"); - evas_object_smart_callback_add(eo, "atspi,highlighted", _edit_view_slot_btn_highlight_cb, NULL); - evas_object_smart_callback_add(eo, "atspi,unhighlighted", _edit_view_slot_btn_unhighlight_cb, NULL); + evas_object_smart_callback_add(eo, "atspi,highlighted", + _edit_view_slot_btn_highlight_cb, NULL); + evas_object_smart_callback_add(eo, "atspi,unhighlighted", + _edit_view_slot_btn_unhighlight_cb, NULL); return eo; } @@ -987,9 +1080,11 @@ Evas_Object *_set_app_slot(const char *appid, int pos) if (app_info_create(appid, &app_info) != APP_MANAGER_ERROR_NONE) { _E("app_info_create() failed"); - } else if (app_info_get_icon(app_info, &icon_path) != APP_MANAGER_ERROR_NONE) { + } else if (app_info_get_icon(app_info, &icon_path) != + APP_MANAGER_ERROR_NONE) { _E("app_info_get_icon() failed"); - } else if (app_info_get_label(app_info, &label) != APP_MANAGER_ERROR_NONE) { + } else if (app_info_get_label(app_info, &label) != + APP_MANAGER_ERROR_NONE) { _E("app_info_get_label() failed"); } @@ -1029,7 +1124,9 @@ Evas_Object *_set_app_slot(const char *appid, int pos) return slot; } -static Eina_Bool _ao_ev_ly_action_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info) +static Eina_Bool _ao_ev_ly_action_cb(void *data, + Evas_Object *obj, + Elm_Access_Action_Info *action_info) { retv_if(!data, EINA_FALSE); @@ -1049,18 +1146,25 @@ static void _edit_view_create_ly_access_obj(appdata_s *info) { _ENTER; - info->ao_ev_ly = (Evas_Object *)elm_access_object_register(info->edit_layout, info->win); + info->ao_ev_ly = (Evas_Object *)elm_access_object_register( + info->edit_layout, info->win); ret_if(!info->ao_ev_ly); elm_atspi_accessible_translation_domain_set(info->ao_ev_ly, ATW_DOMAIN); - elm_atspi_accessible_reading_info_type_set(info->ao_ev_ly, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME + elm_atspi_accessible_reading_info_type_set(info->ao_ev_ly, + ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION); - elm_atspi_accessible_description_set(info->ao_ev_ly, "WDS_ACCS_TBBODY_ROTATE_BEZEL_TO_EDIT_APP_SHORTCUTS"); + elm_atspi_accessible_description_set(info->ao_ev_ly, + "WDS_ACCS_TBBODY_ROTATE_BEZEL_TO_EDIT_APP_SHORTCUTS"); - elm_access_action_cb_set(info->ao_ev_ly, ELM_ACCESS_ACTION_HIGHLIGHT, _ao_ev_ly_action_cb, info); - elm_access_action_cb_set(info->ao_ev_ly, ELM_ACCESS_ACTION_UNHIGHLIGHT, _ao_ev_ly_action_cb, info); + elm_access_action_cb_set(info->ao_ev_ly, ELM_ACCESS_ACTION_HIGHLIGHT, + _ao_ev_ly_action_cb, info); + elm_access_action_cb_set(info->ao_ev_ly, ELM_ACCESS_ACTION_UNHIGHLIGHT, + _ao_ev_ly_action_cb, info); } -static Eina_Bool _edit_view_rotary_event_cb(void *data, Evas_Object *obj, Eext_Rotary_Event_Info *info) +static Eina_Bool _edit_view_rotary_event_cb(void *data, + Evas_Object *obj, + Eext_Rotary_Event_Info *info) { _ENTER; @@ -1085,14 +1189,17 @@ static Evas_Object *_edit_view_create_layout(appdata_s *info) elm_win_resize_object_add(info->win, eo); evas_object_show(eo); - if (!eext_rotary_object_event_callback_add(eo, _edit_view_rotary_event_cb, info)) { + if (!eext_rotary_object_event_callback_add(eo, + _edit_view_rotary_event_cb, info)) { _E("Rotaty object event callback add failed"); } return eo; } -static char *_title_item_get_txt_cb(void *data, Evas_Object *obj, const char *part) +static char *_title_item_get_txt_cb(void *data, + Evas_Object *obj, + const char *part) { return strdup(_("WDS_AWGT_HEADER_SELECT_APP_SHORTCUT")); } @@ -1112,7 +1219,9 @@ static Elm_Genlist_Item_Class *_get_gl_itc_header() return &header_itc; } -static char *_cont_item_get_txt_cb(void *data, Evas_Object *obj, const char *part) +static char *_cont_item_get_txt_cb(void *data, + Evas_Object *obj, + const char *part) { if (!strcmp(part, "elm.text")) { apptray_wgt_app_item_info_s *item_info = data; @@ -1123,13 +1232,17 @@ static char *_cont_item_get_txt_cb(void *data, Evas_Object *obj, const char *par return NULL; } -static void _toast_popup_hide_cb(void *data, Evas_Object *obj, void *event_info) +static void _toast_popup_hide_cb(void *data, + Evas_Object *obj, + void *event_info) { ret_if(!obj); elm_popup_dismiss(obj); } -static void _toast_popup_dismiss_cb(void *data, Evas_Object *obj, void *event_info) +static void _toast_popup_dismiss_cb(void *data, + Evas_Object *obj, + void *event_info) { ret_if(!obj); evas_object_del(obj); @@ -1148,12 +1261,16 @@ static void _create_toast_popup(const char *text) elm_object_style_set(popup, "toast/circle"); elm_popup_orient_set(popup, ELM_POPUP_ORIENT_BOTTOM); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _toast_popup_hide_cb, NULL); - evas_object_smart_callback_add(popup, "dismissed", _toast_popup_dismiss_cb, NULL); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, + _toast_popup_hide_cb, NULL); + evas_object_smart_callback_add(popup, "dismissed", + _toast_popup_dismiss_cb, NULL); elm_object_part_text_set(popup, "elm.text", text); - evas_object_smart_callback_add(popup, "block,clicked", _toast_popup_hide_cb, NULL); + evas_object_smart_callback_add(popup, "block,clicked", + _toast_popup_hide_cb, NULL); elm_popup_timeout_set(popup, 2.0); - evas_object_smart_callback_add(popup, "timeout", _toast_popup_hide_cb, NULL); + evas_object_smart_callback_add(popup, "timeout", + _toast_popup_hide_cb, NULL); evas_object_show(popup); @@ -1164,7 +1281,8 @@ static void _select_view_update_counter_ao_name(appdata_s *info) { if (info->ao_sv_counter) { char desc[ATW_BUF_SIZE_LARGE] = { 0 }; - snprintf(desc, sizeof(desc), _("IDS_KA_HEADER_PD_OF_PD"), info->select_count, ATW_APP_SLOTS_MAX_COUNT); + snprintf(desc, sizeof(desc), _("IDS_KA_HEADER_PD_OF_PD"), + info->select_count, ATW_APP_SLOTS_MAX_COUNT); elm_atspi_accessible_name_set(info->ao_sv_counter, desc); } } @@ -1178,19 +1296,23 @@ static void _gl_check_clicked_cb(void *data, Evas_Object *obj, void *event_info) if (item_info->is_selected) { item_info->is_selected = false; elm_check_state_set(obj, EINA_FALSE); - _create_toast_popup(_("WDS_HS_TPOP_YOU_CAN_ONLY_ADD_UP_TO_4_APPS_ABB")); + _create_toast_popup( + _("WDS_HS_TPOP_YOU_CAN_ONLY_ADD_UP_TO_4_APPS_ABB")); return; } } - g_info->select_count += (item_info->is_selected)? 1 : -1; - snprintf(buf, sizeof(buf), "%d/%d", g_info->select_count, ATW_APP_SLOTS_MAX_COUNT); + g_info->select_count += (item_info->is_selected) ? 1 : -1; + snprintf(buf, sizeof(buf), "%d/%d", g_info->select_count, + ATW_APP_SLOTS_MAX_COUNT); elm_object_text_set(g_info->select_count_btn, buf); _select_view_update_counter_ao_name(g_info); } -static Evas_Object *_cont_item_get_content_cb(void *data, Evas_Object *obj, const char *part) +static Evas_Object *_cont_item_get_content_cb(void *data, + Evas_Object *obj, + const char *part) { apptray_wgt_app_item_info_s *item_info = data; retv_if(!item_info, NULL); @@ -1207,20 +1329,25 @@ static Evas_Object *_cont_item_get_content_cb(void *data, Evas_Object *obj, cons ELM_SCALE_SIZE(ATW_GENLIST_ITEM_ICON_DIMENSION)); evas_object_show(image); return image; - } else if (g_info->launch_type == APPTRAY_WGT_APP_LAUNCH_TYPE_PICK && !strcmp(part, "elm.swallow.center_check")) { + } else if (g_info->launch_type == APPTRAY_WGT_APP_LAUNCH_TYPE_PICK && + !strcmp(part, "elm.swallow.center_check")) { Evas_Object *check = elm_check_add(obj); elm_object_style_set(check, "genlist/select_mode"); elm_check_state_set(check, EINA_FALSE); - evas_object_smart_callback_add(check, "changed", _gl_check_clicked_cb, data); + evas_object_smart_callback_add(check, "changed", + _gl_check_clicked_cb, data); elm_check_state_pointer_set(check, &item_info->is_selected); evas_object_repeat_events_set(check, EINA_FALSE); evas_object_propagate_events_set(check, EINA_FALSE); evas_object_show(check); /* Accessibility */ - elm_atspi_accessible_relationship_append(item_info->gl_item, ELM_ATSPI_RELATION_CONTROLLER_FOR, check); - elm_atspi_accessible_relationship_append(check, ELM_ATSPI_RELATION_CONTROLLED_BY, item_info->gl_item); - elm_atspi_accessible_relationship_append(item_info->gl_item, ELM_ATSPI_RELATION_DESCRIBED_BY, check); + elm_atspi_accessible_relationship_append(item_info->gl_item, + ELM_ATSPI_RELATION_CONTROLLER_FOR, check); + elm_atspi_accessible_relationship_append(check, + ELM_ATSPI_RELATION_CONTROLLED_BY, item_info->gl_item); + elm_atspi_accessible_relationship_append(item_info->gl_item, + ELM_ATSPI_RELATION_DESCRIBED_BY, check); elm_atspi_accessible_can_highlight_set(check, EINA_FALSE); return check; @@ -1265,7 +1392,8 @@ static Elm_Genlist_Item_Class *_get_gl_itc_empty() return &empty_itc; } -static void _select_view_set_genlist_content(Evas_Object *genlist, appdata_s *info) +static void _select_view_set_genlist_content(Evas_Object *genlist, + appdata_s *info) { if (info->launch_type == APPTRAY_WGT_APP_LAUNCH_TYPE_PICK) { _gl_add_empty_item(genlist); @@ -1276,7 +1404,9 @@ static void _select_view_set_genlist_content(Evas_Object *genlist, appdata_s *in _gl_add_empty_item(genlist); } -static void _select_view_gl_highlight_cb(void *data, Evas_Object *obj, void *event_info) +static void _select_view_gl_highlight_cb(void *data, + Evas_Object *obj, + void *event_info) { _ENTER; appdata_s *info = data; @@ -1285,7 +1415,9 @@ static void _select_view_gl_highlight_cb(void *data, Evas_Object *obj, void *eve info->sv_cur_highlighted_obj = event_info; } -static void _select_view_gl_unhighlight_cb(void *data, Evas_Object *obj, void *event_info) +static void _select_view_gl_unhighlight_cb(void *data, + Evas_Object *obj, + void *event_info) { _ENTER; appdata_s *info = data; @@ -1294,7 +1426,8 @@ static void _select_view_gl_unhighlight_cb(void *data, Evas_Object *obj, void *e info->sv_cur_highlighted_obj = NULL; } -static Evas_Object *_select_view_create_simple_genlist(Evas_Object *parent, appdata_s *info) +static Evas_Object *_select_view_create_simple_genlist(Evas_Object *parent, + appdata_s *info) { Evas_Object *eo = elm_genlist_add(parent); retv_if(!eo, NULL); @@ -1303,14 +1436,17 @@ static Evas_Object *_select_view_create_simple_genlist(Evas_Object *parent, appd elm_genlist_mode_set(eo, ELM_LIST_COMPRESS); elm_genlist_homogeneous_set(eo, EINA_TRUE); - info->select_view_circle_gl = eext_circle_object_genlist_add(eo, info->circle_surface); + info->select_view_circle_gl = eext_circle_object_genlist_add(eo, + info->circle_surf); eext_circle_object_genlist_scroller_policy_set(info->select_view_circle_gl, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); elm_layout_content_set(parent, "elm.swallow.content", eo); - evas_object_smart_callback_add(eo, "atspi,highlighted", _select_view_gl_highlight_cb, info); - evas_object_smart_callback_add(eo, "atspi,unhighlighted", _select_view_gl_unhighlight_cb, info); + evas_object_smart_callback_add(eo, "atspi,highlighted", + _select_view_gl_highlight_cb, info); + evas_object_smart_callback_add(eo, "atspi,unhighlighted", + _select_view_gl_unhighlight_cb, info); evas_object_show(eo); return eo; @@ -1318,7 +1454,8 @@ static Evas_Object *_select_view_create_simple_genlist(Evas_Object *parent, appd static void _gl_add_header_item(Evas_Object *gl) { - elm_genlist_item_append(gl, _get_gl_itc_header(), NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + elm_genlist_item_append(gl, _get_gl_itc_header(), NULL, NULL, + ELM_GENLIST_ITEM_NONE, NULL, NULL); } static bool _check_already_added_apps(const char *appid) @@ -1346,13 +1483,16 @@ static void _edit_view_update_slot_access_info(int pos) slot = elm_object_part_content_get(g_info->edit_layout, part_name); ret_if(!slot); - if (!IS_STRING_EMPTY(g_info->appid_list[pos]) && strcmp(g_info->appid_list[pos], "empty")) { + if (!IS_STRING_EMPTY(g_info->appid_list[pos]) && + strcmp(g_info->appid_list[pos], "empty")) { label = elm_object_part_text_get(slot, "name"); } else { label = _("WDS_ACCS_TBOPT_EMPTY"); } - snprintf(access_name, sizeof(access_name), "%s, %s.", _(_edit_view_get_slot_position_text(pos)), label); - elm_atspi_accessible_name_set(elm_object_part_content_get(slot, "icon"), access_name); + snprintf(access_name, sizeof(access_name), "%s, %s.", + _(_edit_view_get_slot_position_text(pos)), label); + elm_atspi_accessible_name_set( + elm_object_part_content_get(slot, "icon"), access_name); } static void _edit_view_update_app_slot(const char *app_id, int slot_id) @@ -1397,7 +1537,8 @@ static void _gl_add_apps_items(Evas_Object *gl, Eina_List *app_list) Eina_List *n = NULL; EINA_LIST_FOREACH_SAFE(item_info_list, l, n, item_info) { - item_info->gl_item = elm_genlist_item_append(gl, _get_gl_itc_content(), item_info, NULL, + item_info->gl_item = elm_genlist_item_append(gl, _get_gl_itc_content(), + item_info, NULL, ELM_GENLIST_ITEM_NONE, _gl_item_clicked_cb, item_info); if (!item_info->gl_item) { _E("Failed to append genlist item"); @@ -1407,7 +1548,8 @@ static void _gl_add_apps_items(Evas_Object *gl, Eina_List *app_list) static void _gl_add_empty_item(Evas_Object *gl) { - Elm_Object_Item *item = elm_genlist_item_append(gl, _get_gl_itc_empty(), NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + Elm_Object_Item *item = elm_genlist_item_append(gl, _get_gl_itc_empty(), + NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); /* Accessibility */ elm_atspi_accessible_can_highlight_set(item, EINA_FALSE); } @@ -1591,7 +1733,8 @@ static void _select_view_process_rotary_counter_clockwise_event(appdata_s *app) } } -static Eina_Bool _select_view_rotary_event_cb(void *data, Evas_Object *obj, Eext_Rotary_Event_Info *info) +static Eina_Bool _select_view_rotary_event_cb(void *data, Evas_Object *obj, + Eext_Rotary_Event_Info *info) { _ENTER; retv_if(!data, EINA_FALSE); @@ -1607,13 +1750,14 @@ static Eina_Bool _select_view_rotary_event_cb(void *data, Evas_Object *obj, Eext static Evas_Object *_select_view_create_main_ly(appdata_s *info) { - Evas_Object *eo = elm_layout_add(info->naviframe); + Evas_Object *eo = elm_layout_add(info->navi); retv_if(!eo, NULL); elm_layout_theme_set(eo, "layout", "bottom_button", "default"); evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(eo); - if (!eext_rotary_object_event_callback_add(eo, _select_view_rotary_event_cb, info)) { + if (!eext_rotary_object_event_callback_add(eo, + _select_view_rotary_event_cb, info)) { _E("Rotaty object event callback add failed"); } @@ -1626,7 +1770,8 @@ static void _bottom_btn_click_cb(void *data, Evas_Object *obj, void *event_info) _terminate_add_to_shortcut(); } -static void _select_view_bottom_btn_highlight_cb(void *data, Evas_Object *obj, void *event_info) +static void _select_view_bottom_btn_highlight_cb(void *data, + Evas_Object *obj, void *event_info) { _ENTER; appdata_s *info = data; @@ -1635,7 +1780,8 @@ static void _select_view_bottom_btn_highlight_cb(void *data, Evas_Object *obj, v info->sv_cur_highlighted_obj = obj; } -static void _select_view_bottom_btn_unhighlight_cb(void *data, Evas_Object *obj, void *event_info) +static void _select_view_bottom_btn_unhighlight_cb(void *data, + Evas_Object *obj, void *event_info) { _ENTER; appdata_s *info = data; @@ -1644,7 +1790,8 @@ static void _select_view_bottom_btn_unhighlight_cb(void *data, Evas_Object *obj, info->sv_cur_highlighted_obj = NULL; } -static Evas_Object *_select_view_create_bottom_btn(Evas_Object *parent, appdata_s *info) +static Evas_Object *_select_view_create_bottom_btn(Evas_Object *parent, + appdata_s *info) { Evas_Object *eo = elm_button_add(parent); retv_if(!eo, NULL); @@ -1661,7 +1808,8 @@ static Evas_Object *_select_view_create_bottom_btn(Evas_Object *parent, appdata_ return eo; } -static Evas_Object *_select_view_create_genlist_ly(Evas_Object *parent, appdata_s *info) +static Evas_Object *_select_view_create_genlist_ly(Evas_Object *parent, + appdata_s *info) { Evas_Object *eo = elm_layout_add(parent); retv_if(!eo, NULL); @@ -1674,7 +1822,8 @@ static Evas_Object *_select_view_create_genlist_ly(Evas_Object *parent, appdata_ return eo; } -static Evas_Object *_select_view_create_multi_pick_genlist(Evas_Object *parent, appdata_s *info) +static Evas_Object *_select_view_create_multi_pick_genlist(Evas_Object *parent, + appdata_s *info) { Evas_Object *eo = _select_view_create_simple_genlist(parent, info); retv_if(!eo, NULL); @@ -1683,7 +1832,8 @@ static Evas_Object *_select_view_create_multi_pick_genlist(Evas_Object *parent, return eo; } -static Evas_Object *_select_view_create_select_count_btn(Evas_Object *parent, appdata_s *info) +static Evas_Object *_select_view_create_select_count_btn(Evas_Object *parent, + appdata_s *info) { char buf[ATW_BUF_SIZE_SMALL] = { 0 }; @@ -1698,7 +1848,9 @@ static Evas_Object *_select_view_create_select_count_btn(Evas_Object *parent, ap return eo; } -static Eina_Bool _ao_sv_counter_action_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info) +static Eina_Bool _ao_sv_counter_action_cb(void *data, + Evas_Object *obj, + Elm_Access_Action_Info *action_info) { retv_if(!data, EINA_FALSE); @@ -1721,10 +1873,13 @@ static void _select_view_register_counter_ao(appdata_s *info) elm_atspi_accessible_translation_domain_set(ao, ATW_DOMAIN); elm_atspi_accessible_role_set(ao, ELM_ATSPI_ROLE_TEXT); - elm_atspi_accessible_reading_info_type_set(ao, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME); + elm_atspi_accessible_reading_info_type_set(ao, + ELM_ACCESSIBLE_READING_INFO_TYPE_NAME); - elm_access_action_cb_set(ao, ELM_ACCESS_ACTION_HIGHLIGHT, _ao_sv_counter_action_cb, info); - elm_access_action_cb_set(ao, ELM_ACCESS_ACTION_UNHIGHLIGHT, _ao_sv_counter_action_cb, info); + elm_access_action_cb_set(ao, ELM_ACCESS_ACTION_HIGHLIGHT, + _ao_sv_counter_action_cb, info); + elm_access_action_cb_set(ao, ELM_ACCESS_ACTION_UNHIGHLIGHT, + _ao_sv_counter_action_cb, info); info->ao_sv_counter = ao; @@ -1742,12 +1897,14 @@ static void _select_view_register_custom_accessibility_rout(appdata_s *info) } if (info->ao_sv_counter) { - apptray_wgt_app_au_append_symmetric_relationship(cur_ao, info->ao_sv_counter); + apptray_wgt_app_au_append_symmetric_relationship(cur_ao, + info->ao_sv_counter); cur_ao = info->ao_sv_counter; } if (info->select_bottom_btn) { - apptray_wgt_app_au_append_symmetric_relationship(cur_ao, info->select_bottom_btn); + apptray_wgt_app_au_append_symmetric_relationship(cur_ao, + info->select_bottom_btn); cur_ao = info->select_bottom_btn; } @@ -1777,32 +1934,37 @@ static Evas_Object *_create_select_view(appdata_s *info) if (info->launch_type == APPTRAY_WGT_APP_LAUNCH_TYPE_PICK) { Evas_Object *genlist_layout = NULL; - info->select_bottom_btn = _select_view_create_bottom_btn(info->select_layout, info); + info->select_bottom_btn = _select_view_create_bottom_btn( + info->select_layout, info); if (!info->select_bottom_btn) { DEL_EVAS_OBJECT(info->select_layout); return NULL; } - genlist_layout = _select_view_create_genlist_ly(info->select_layout, info); + genlist_layout = _select_view_create_genlist_ly( + info->select_layout, info); if (!genlist_layout) { DEL_EVAS_OBJECT(info->select_layout); return NULL; } - info->select_gl = _select_view_create_multi_pick_genlist(genlist_layout, info); + info->select_gl = _select_view_create_multi_pick_genlist( + genlist_layout, info); if (!info->select_gl) { DEL_EVAS_OBJECT(info->select_layout); return NULL; } - info->select_count_btn = _select_view_create_select_count_btn(genlist_layout, info); + info->select_count_btn = _select_view_create_select_count_btn( + genlist_layout, info); if (!info->select_count_btn) { DEL_EVAS_OBJECT(info->select_layout); return NULL; } } else { - info->select_gl = _select_view_create_simple_genlist(info->select_layout, info); + info->select_gl = _select_view_create_simple_genlist( + info->select_layout, info); retv_if(!info->select_gl, NULL); } _select_view_set_genlist_content(info->select_gl, info); @@ -1865,10 +2027,14 @@ static Eina_List *_read_all_apps_on_device(Eina_List **list) app_info_filter_h filter = NULL; retv_if(app_info_filter_create(&filter) != APP_MANAGER_ERROR_NONE, NULL); - goto_if(app_info_filter_add_bool(filter, PACKAGE_INFO_PROP_APP_NODISPLAY, false) != APP_MANAGER_ERROR_NONE, ERROR); - goto_if(app_info_filter_foreach_appinfo(filter, _apps_all_cb, list) != APP_MANAGER_ERROR_NONE, ERROR); + goto_if(app_info_filter_add_bool(filter, + PACKAGE_INFO_PROP_APP_NODISPLAY, false) != + APP_MANAGER_ERROR_NONE, ERROR); + goto_if(app_info_filter_foreach_appinfo(filter, _apps_all_cb, list) != + APP_MANAGER_ERROR_NONE, ERROR); *list = eina_list_sort(*list, eina_list_count(*list), _apps_sort_cb); - *list = eina_list_prepend(*list, apptray_wgt_app_item_info_create(ATW_APPS_PKG)); + *list = eina_list_prepend(*list, + apptray_wgt_app_item_info_create(ATW_APPS_PKG)); ERROR: if (filter) app_info_filter_destroy(filter); @@ -1927,7 +2093,8 @@ static bool _edit_view_init_slots(const char *app_list) } for (i = 0 ; i < ATW_APP_SLOTS_MAX_COUNT ; i++) { - _set_app_slot(app_list_array[i], _input_slot_conv[app_count].slot_seq_arr[i]); + _set_app_slot(app_list_array[i], + _input_slot_conv[app_count].slot_seq_arr[i]); free(app_list_array[i]); } free(content); @@ -1964,15 +2131,17 @@ static bool _show_view(appdata_s *info, _apptray_wgt_view_type_e view_type) switch (view_type) { case APPTRAY_WGT_APP_VIEW_EDIT: if (info->edit_view_navi_item) { - elm_naviframe_content_preserve_on_pop_set(info->naviframe, EINA_TRUE); + elm_naviframe_content_preserve_on_pop_set(info->navi, + EINA_TRUE); elm_naviframe_item_pop_to(info->edit_view_navi_item); info->select_view_navi_item = NULL; } else { view_content = _create_edit_view(info); retv_if(!view_content, false); - push_without_transition = _check_naviframe_is_empty(info->naviframe); - info->edit_view_navi_item = elm_naviframe_item_push(info->naviframe, + push_without_transition = _check_naviframe_is_empty( + info->navi); + info->edit_view_navi_item = elm_naviframe_item_push(info->navi, NULL, NULL, NULL, view_content, "empty"); retv_if(!info->edit_view_navi_item, false); } @@ -1981,8 +2150,8 @@ static bool _show_view(appdata_s *info, _apptray_wgt_view_type_e view_type) view_content = _create_select_view(info); retv_if(!view_content, false); - push_without_transition = _check_naviframe_is_empty(info->naviframe); - info->select_view_navi_item = elm_naviframe_item_push(info->naviframe, + push_without_transition = _check_naviframe_is_empty(info->navi); + info->select_view_navi_item = elm_naviframe_item_push(info->navi, NULL, NULL, NULL, view_content, "empty"); retv_if(!info->select_view_navi_item, false); break; @@ -1996,28 +2165,6 @@ static bool _show_view(appdata_s *info, _apptray_wgt_view_type_e view_type) return true; } -static bool _app_process_main_operation(appdata_s *info, const char *app_list) -{ - _ENTER; - - retv_if(!info, false); - retv_if(!app_list, false); - - info->init_app_list = strdup(app_list); - retv_if(!info->init_app_list, false); - - return _show_view(info, APPTRAY_WGT_APP_VIEW_EDIT); -} - -static bool _app_process_pick_operation(appdata_s *info) -{ - _ENTER; - - retv_if(!info, false); - - return _show_view(g_info, APPTRAY_WGT_APP_VIEW_SELECT); -} - static Evas_Object *_create_conformant(Evas_Object *win) { Evas_Object *eo = NULL; @@ -2036,16 +2183,17 @@ static void _process_navi_item_transition_finish(appdata_s *info) { _ENTER; - Elm_Object_Item *top_item = elm_naviframe_top_item_get(info->naviframe); + Elm_Object_Item *top_item = elm_naviframe_top_item_get(info->navi); if (top_item == info->edit_view_navi_item) { _activate_view_rotary_state(info, APPTRAY_WGT_APP_VIEW_EDIT); } else if (top_item == info->select_view_navi_item) { _activate_view_rotary_state(info, APPTRAY_WGT_APP_VIEW_SELECT); } - elm_naviframe_content_preserve_on_pop_set(info->naviframe, EINA_FALSE); + elm_naviframe_content_preserve_on_pop_set(info->navi, EINA_FALSE); } -static void _naviframe_transition_finished_cb(void *data, Evas_Object *obj, void *event_info) +static void _naviframe_transition_finished_cb(void *data, Evas_Object *obj, + void *event_info) { _ENTER; @@ -2070,36 +2218,39 @@ static Evas_Object *_create_naviframe(Evas_Object *parent, appdata_s *info) } -static bool _create_main_ui_components(appdata_s *info, const char *name, const char *title) +static bool _create_main_ui_components(appdata_s *info, + const char *name, + const char *title) { info->win = _create_win(info, name, title); retv_if(!info->win, false); - info->conformant = _create_conformant(info->win); - retv_if(!info->conformant, false); + info->conf = _create_conformant(info->win); + retv_if(!info->conf, false); - info->circle_surface = eext_circle_surface_conformant_add(info->conformant); - retv_if(!info->circle_surface, false); + info->circle_surf = eext_circle_surface_conformant_add(info->conf); + retv_if(!info->circle_surf, false); - info->naviframe = _create_naviframe(info->win, info); - retv_if(!info->naviframe, false); + info->navi = _create_naviframe(info->win, info); + retv_if(!info->navi, false); - elm_object_content_set(info->conformant, info->naviframe); + elm_object_content_set(info->conf, info->navi); return true; } -static apptray_wgt_app_key_cb_ret_e _key_release_cb(void *data) +static bool _key_release_cb(void *data) { appdata_s *info = data; retv_if(!info, false); if (info->toast_popup) { - return APPTRAY_WGT_APP_KEY_CB_RET_STOP; + return true; } - if (elm_naviframe_top_item_get(info->naviframe) == info->select_view_navi_item - && info->launch_type != APPTRAY_WGT_APP_LAUNCH_TYPE_PICK) { + if (elm_naviframe_top_item_get(info->navi) == + info->select_view_navi_item && + info->launch_type != APPTRAY_WGT_APP_LAUNCH_TYPE_PICK) { _show_view(g_info, APPTRAY_WGT_APP_VIEW_EDIT); } else { if (info->launch_type == APPTRAY_WGT_APP_LAUNCH_TYPE_PICK) { @@ -2108,7 +2259,7 @@ static apptray_wgt_app_key_cb_ret_e _key_release_cb(void *data) _terminate_add_to_shortcut(); } - return APPTRAY_WGT_APP_KEY_CB_RET_STOP; + return true; } static void _update_win_title(Evas_Object *win, const char *title) @@ -2136,9 +2287,11 @@ static bool _app_create(void *data) feedback_initialize(); - apptray_wgt_app_key_register(); - apptray_wgt_app_key_register_cb(APPTRAY_WGT_APP_KEY_TYPE_BACK, _key_release_cb, info); - apptray_wgt_app_key_register_cb(APPTRAY_WGT_APP_KEY_TYPE_POWER, _key_release_cb, info); + apptray_wgt_app_key_event_provider_init(); + apptray_wgt_app_key_event_provider_add_handler( + APPTRAY_WGT_APP_KEY_TYPE_BACK, _key_release_cb, info); + apptray_wgt_app_key_event_provider_add_handler( + APPTRAY_WGT_APP_KEY_TYPE_POWER, _key_release_cb, info); elm_theme_extension_add(NULL, ATW_EDJE_PATH); @@ -2151,9 +2304,11 @@ static void _app_terminate(void *data) int i; - apptray_wgt_app_key_unregister_cb(APPTRAY_WGT_APP_KEY_TYPE_BACK, _key_release_cb); - apptray_wgt_app_key_unregister_cb(APPTRAY_WGT_APP_KEY_TYPE_POWER, _key_release_cb); - apptray_wgt_app_key_unregister(); + apptray_wgt_app_key_event_provider_del_handler( + APPTRAY_WGT_APP_KEY_TYPE_BACK, _key_release_cb); + apptray_wgt_app_key_event_provider_del_handler( + APPTRAY_WGT_APP_KEY_TYPE_POWER, _key_release_cb); + apptray_wgt_app_key_event_provider_deinit(); DEL_ECORE_TIMER(longpress_timer); DEL_ECORE_TIMER(click_blocker_timer); @@ -2187,44 +2342,83 @@ static void _app_resume(void *data) _ENTER; } -static void _app_control(app_control_h service, void *data) +static bool _init_widget_instance_id(appdata_s *info, app_control_h service) { - _ENTER; + int ret = app_control_get_extra_data(service, + APP_CONTROL_DATA_WIDGET_INSTANCE_ID, &info->widget_instance_id); + if (ret != APP_CONTROL_ERROR_NONE) { + _E("app_control_get_extra_data() failed. ret[%d]", ret); + return false; + } - appdata_s *info = data; + return true; +} + +static bool _init_widget_app_list(appdata_s *info, app_control_h service) +{ + char *content_info = NULL; + + int ret = app_control_get_extra_data(service, + APP_CONTROL_DATA_WIDGET_CONTENT, &content_info); + if (ret != APP_CONTROL_ERROR_NONE) { + _E("app_control_get_extra_data() failed. ret[%d]", ret); + return false; + } + + bundle *tmp = bundle_decode((const bundle_raw *)content_info, + strlen(content_info)); + if (!tmp) { + _E("bundle_decode() failed"); + free(content_info); + return false; + } + + ret = bundle_get_str(tmp, ATW_BUNDLE_KEY_SHORTCUT_LIST, + &info->init_app_list); + if (ret != BUNDLE_ERROR_NONE) { + _E("bundle_get_str() failed"); + free(content_info); + return false; + } + + return true; +} + +static bool _process_app_control_operation(appdata_s *info, + app_control_h service) +{ char *operation = NULL; - char *content_val = NULL; - char *tmp = NULL; - char *app_list = NULL; - bool res = false; - - 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, ATW_BUNDLE_KEY_WIDGET_INSTANCE_ID, &tmp); - _D("Widget instance id [%s]", tmp); - info->widget_instance_id = strdup_s(tmp); - bundle_get_str(tmp_b, ATW_BUNDLE_KEY_SHORTCUT_LIST, &tmp); - _D("App shortcuts [%s]", tmp); - app_list = strdup_s(tmp); - } - bundle_free(tmp_b); + + int ret = app_control_get_operation(service, &operation); + if (ret != APP_CONTROL_ERROR_NONE) { + _E("app_control_get_operation() failed. ret[%d]", ret); + return false; } - app_control_get_operation(service, &operation); _D("Operation [%s]", operation); + if (!operation || !strcmp(operation, APP_CONTROL_OPERATION_MAIN)) { + if (!_init_widget_app_list(info, service)) { + _E("_init_widget_app_list() failed"); + free(operation); + return false; + } info->launch_type = APPTRAY_WGT_APP_LAUNCH_TYPE_MAIN; - res = _app_process_main_operation(info, app_list); + return _show_view(info, APPTRAY_WGT_APP_VIEW_EDIT); } else if (!strcmp(operation, APP_CONTROL_OPERATION_PICK)) { info->launch_type = APPTRAY_WGT_APP_LAUNCH_TYPE_PICK; - res = _app_process_pick_operation(info); + return _show_view(info, APPTRAY_WGT_APP_VIEW_SELECT); } - free(app_list); + return false; +} + +static void _app_control(app_control_h service, void *data) +{ + _ENTER; - if (!res) { + if (!_init_widget_instance_id(data, service) || + !_process_app_control_operation(data, service)) { ui_app_exit(); } } @@ -2280,7 +2474,8 @@ static void _edit_view_update_slots_apps_label(appdata_s *ad) int i; for (i = 0; i < ATW_APP_SLOTS_MAX_COUNT; i++) { - if (!IS_STRING_EMPTY(ad->appid_list[i]) && strcmp(ad->appid_list[i], "empty")) { + if (!IS_STRING_EMPTY(ad->appid_list[i]) && strcmp(ad->appid_list[i], + "empty")) { ret = 0; app_info = NULL; label = NULL; @@ -2297,7 +2492,8 @@ static void _edit_view_update_slots_apps_label(appdata_s *ad) } else { char buff[ATW_BUF_SIZE_SMALL] = { 0 }; snprintf(buff, sizeof(buff), "index%d", i+1); - Evas_Object *eo = elm_object_part_content_get(ad->edit_layout, buff); + Evas_Object *eo = elm_object_part_content_get(ad->edit_layout, + buff); if (eo) { elm_object_part_text_set(eo, "name", label); } @@ -2314,7 +2510,8 @@ static void _app_lang_changed(app_event_info_h event_info, void *user_data) appdata_s *info = user_data; char *locale = NULL; - system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale); + system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, + &locale); elm_language_set(locale); free(locale); @@ -2333,8 +2530,6 @@ static void _app_lang_changed(app_event_info_h event_info, void *user_data) int main(int argc, char *argv[]) { - _ENTER; - appdata_s ad = { 0 }; int ret = 0; @@ -2347,7 +2542,8 @@ int main(int argc, char *argv[]) lcc.resume = _app_resume; lcc.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[0], APP_EVENT_LANGUAGE_CHANGED, + _app_lang_changed, &ad); ret = ui_app_main(argc, argv, &lcc, &ad); if (ret != APP_ERROR_NONE) { diff --git a/apptray-widget-app/src/apptray_wgt_app_accessibility_utils.c b/apptray-widget-app/src/apptray_wgt_app_accessibility_utils.c index 8e8fd7b..4929c0d 100644 --- a/apptray-widget-app/src/apptray_wgt_app_accessibility_utils.c +++ b/apptray-widget-app/src/apptray_wgt_app_accessibility_utils.c @@ -18,13 +18,18 @@ #include "apptray_wgt_app_log.h" -static bool _append_symmetric_relationship(Evas_Object *from, Evas_Object *to); -static void _remove_symmetric_relationship(Evas_Object *from, Evas_Object *to); -static Evas_Object *_register_access_object(Evas_Object *parent, Evas_Object *ly, const char *ly_part); - -static Evas_Object *_register_access_object(Evas_Object *parent, Evas_Object *ly, const char *ly_part) +static bool _append_symmetric_relationship(Evas_Object *from, + Evas_Object *to); +static void _remove_symmetric_relationship(Evas_Object *from, + Evas_Object *to); +static Evas_Object *_register_access_object(Evas_Object *parent, + Evas_Object *ly, const char *ly_part); + +static Evas_Object *_register_access_object(Evas_Object *parent, + Evas_Object *ly, const char *ly_part) { - Evas_Object *po = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(ly), ly_part); + Evas_Object *po = (Evas_Object *)edje_object_part_object_get( + elm_layout_edje_get(ly), ly_part); retv_if(!po, NULL); Evas_Object *ao = elm_access_object_register(po, parent); retv_if(!ao, NULL); @@ -32,7 +37,16 @@ static Evas_Object *_register_access_object(Evas_Object *parent, Evas_Object *ly return ao; } -Evas_Object *apptray_wgt_app_au_register_access_object(Evas_Object *parent, Evas_Object *ly, const char *ly_part) +static void _unregister_access_object(Evas_Object *ly, + const char *ly_part) +{ + Evas_Object *po = (Evas_Object *)edje_object_part_object_get( + elm_layout_edje_get(ly), ly_part); + elm_access_object_unregister(po); +} + +Evas_Object *apptray_wgt_app_au_register_access_object(Evas_Object *parent, + Evas_Object *ly, const char *ly_part) { retv_if(!parent, NULL); retv_if(!ly, NULL); @@ -41,14 +55,17 @@ Evas_Object *apptray_wgt_app_au_register_access_object(Evas_Object *parent, Evas return _register_access_object(parent, ly, ly_part); } -void apptray_wgt_app_au_unregister_access_object(Evas_Object *obj) +void apptray_wgt_app_au_unregister_access_object(Evas_Object *ly, + const char *ly_part) { - ret_if(!obj); + ret_if(!ly); + ret_if(!ly_part); - elm_access_object_unregister(obj); + _unregister_access_object(ly, ly_part); } -Evas_Object *apptray_wgt_app_au_register_fake_access_object(Evas_Object *parent, Evas_Object *ly, const char *ly_part) +Evas_Object *apptray_wgt_app_au_register_fake_access_object( + Evas_Object *parent, Evas_Object *ly, const char *ly_part) { retv_if(!parent, NULL); retv_if(!ly, NULL); @@ -58,7 +75,8 @@ Evas_Object *apptray_wgt_app_au_register_fake_access_object(Evas_Object *parent, retv_if(!ao, NULL); elm_atspi_accessible_can_highlight_set(ao, EINA_FALSE); elm_atspi_accessible_role_set(ao, ELM_ATSPI_ROLE_TEXT); - elm_atspi_accessible_reading_info_type_set(ao, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME); + elm_atspi_accessible_reading_info_type_set(ao, + ELM_ACCESSIBLE_READING_INFO_TYPE_NAME); elm_atspi_accessible_name_set(ao, ""); return ao; @@ -66,17 +84,21 @@ Evas_Object *apptray_wgt_app_au_register_fake_access_object(Evas_Object *parent, static bool _append_symmetric_relationship(Evas_Object *from, Evas_Object *to) { - Eina_Bool res = elm_atspi_accessible_relationship_append(from, ELM_ATSPI_RELATION_FLOWS_TO, to); + Eina_Bool res = elm_atspi_accessible_relationship_append(from, + ELM_ATSPI_RELATION_FLOWS_TO, to); retv_if(!res, false); - res = elm_atspi_accessible_relationship_append(to, ELM_ATSPI_RELATION_FLOWS_FROM, from); + res = elm_atspi_accessible_relationship_append(to, + ELM_ATSPI_RELATION_FLOWS_FROM, from); if (!res) { - elm_atspi_accessible_relationship_remove(from, ELM_ATSPI_RELATION_FLOWS_TO, to); + elm_atspi_accessible_relationship_remove(from, + ELM_ATSPI_RELATION_FLOWS_TO, to); return false; } return true; } -bool apptray_wgt_app_au_append_symmetric_relationship(Evas_Object *from, Evas_Object *to) +bool apptray_wgt_app_au_append_symmetric_relationship(Evas_Object *from, + Evas_Object *to) { retv_if(!from, false); retv_if(!to, false); @@ -86,11 +108,14 @@ bool apptray_wgt_app_au_append_symmetric_relationship(Evas_Object *from, Evas_Ob static void _remove_symmetric_relationship(Evas_Object *from, Evas_Object *to) { - elm_atspi_accessible_relationship_remove(from, ELM_ATSPI_RELATION_FLOWS_TO, to); - elm_atspi_accessible_relationship_remove(to, ELM_ATSPI_RELATION_FLOWS_FROM, from); + elm_atspi_accessible_relationship_remove(from, + ELM_ATSPI_RELATION_FLOWS_TO, to); + elm_atspi_accessible_relationship_remove(to, + ELM_ATSPI_RELATION_FLOWS_FROM, from); } -void apptray_wgt_app_au_remove_symmetric_relationship(Evas_Object *from, Evas_Object *to) +void apptray_wgt_app_au_remove_symmetric_relationship(Evas_Object *from, + Evas_Object *to) { ret_if(!from); ret_if(!to); @@ -102,7 +127,8 @@ bool apptray_wgt_app_au_append_relationship_end_point(Evas_Object *obj) { retv_if(!obj, false); - retv_if(!elm_atspi_accessible_relationship_append(obj, ELM_ATSPI_RELATION_FLOWS_TO, obj), false); + retv_if(!elm_atspi_accessible_relationship_append(obj, + ELM_ATSPI_RELATION_FLOWS_TO, obj), false); return true; } @@ -110,14 +136,16 @@ void apptray_wgt_app_au_remove_relationship_end_point(Evas_Object *obj) { ret_if(!obj); - elm_atspi_accessible_relationship_remove(obj, ELM_ATSPI_RELATION_FLOWS_TO, obj); + elm_atspi_accessible_relationship_remove(obj, + ELM_ATSPI_RELATION_FLOWS_TO, obj); } bool apptray_wgt_app_au_append_relationship_start_point(Evas_Object *obj) { retv_if(!obj, false); - retv_if(!elm_atspi_accessible_relationship_append(obj, ELM_ATSPI_RELATION_FLOWS_FROM, obj), false); + retv_if(!elm_atspi_accessible_relationship_append(obj, + ELM_ATSPI_RELATION_FLOWS_FROM, obj), false); return true; } @@ -125,6 +153,7 @@ void apptray_wgt_app_au_remove_relationship_start_point(Evas_Object *obj) { ret_if(!obj); - elm_atspi_accessible_relationship_remove(obj, ELM_ATSPI_RELATION_FLOWS_FROM, obj); + elm_atspi_accessible_relationship_remove(obj, + ELM_ATSPI_RELATION_FLOWS_FROM, obj); } diff --git a/apptray-widget-app/src/apptray_wgt_app_item_info.c b/apptray-widget-app/src/apptray_wgt_app_item_info.c index 377c9a4..84b053a 100644 --- a/apptray-widget-app/src/apptray_wgt_app_item_info.c +++ b/apptray-widget-app/src/apptray_wgt_app_item_info.c @@ -16,12 +16,12 @@ #include "apptray_wgt_app_item_info.h" -#include <stdlib.h> #include <app.h> #include <app_info.h> #include <app_manager.h> #include "apptray_wgt_app_common_def.h" +#include "apptray_wgt_app_utils.h" #include "apptray_wgt_app_log.h" apptray_wgt_app_item_info_s *apptray_wgt_app_item_info_create(const char *appid) @@ -35,30 +35,32 @@ apptray_wgt_app_item_info_s *apptray_wgt_app_item_info_create(const char *appid) char *icon = NULL; bool nodisplay = false; bool enabled = false; - bool removable = false; retv_if(!appid, NULL); item_info = calloc(1, sizeof(apptray_wgt_app_item_info_s)); - if (NULL == item_info) { - return NULL; - } + retv_if(!item_info, NULL); int error = app_info_create(appid, &appinfo_h); _D("AppTrayError Error = %d, AppID=%s", error, appid); goto_if(error != APP_MANAGER_ERROR_NONE, ERROR); - goto_if(app_info_get_package(appinfo_h, &pkgid) != APP_MANAGER_ERROR_NONE, ERROR); - goto_if(app_info_get_label(appinfo_h, &name) != APP_MANAGER_ERROR_NONE, ERROR); - goto_if(app_info_get_icon(appinfo_h, &icon) != APP_MANAGER_ERROR_NONE, ERROR); + goto_if(app_info_get_package(appinfo_h, &pkgid) != + APP_MANAGER_ERROR_NONE, ERROR); + goto_if(app_info_get_label(appinfo_h, &name) != + APP_MANAGER_ERROR_NONE, ERROR); + goto_if(app_info_get_icon(appinfo_h, &icon) != + APP_MANAGER_ERROR_NONE, ERROR); _D("name:%s, icon:%s", name, icon); if (strncmp(appid, ATW_APPS_PKG, strlen(ATW_APPS_PKG))) { - goto_if(app_info_is_nodisplay(appinfo_h, &nodisplay) != APP_MANAGER_ERROR_NONE, ERROR); + goto_if(app_info_is_nodisplay(appinfo_h, &nodisplay) != + APP_MANAGER_ERROR_NONE, ERROR); if (nodisplay) { goto ERROR; } - goto_if(app_info_is_enabled(appinfo_h, &enabled) != APP_MANAGER_ERROR_NONE, ERROR); + goto_if(app_info_is_enabled(appinfo_h, &enabled) != + APP_MANAGER_ERROR_NONE, ERROR); if (!enabled) { goto ERROR; } @@ -74,10 +76,8 @@ apptray_wgt_app_item_info_s *apptray_wgt_app_item_info_create(const char *appid) if (name) { if (!strncmp(appid, ATW_APPS_PKG, strlen(ATW_APPS_PKG))) { - /* TODO: Need translation */ item_info->name = strdup(_("WDS_WNOTI_HEADER_APPS")); - } - else{ + } else { item_info->name = strdup(name); } goto_if(NULL == item_info->name, ERROR); @@ -94,9 +94,6 @@ apptray_wgt_app_item_info_s *apptray_wgt_app_item_info_create(const char *appid) } goto_if(NULL == item_info->icon, ERROR); - - item_info->removable = removable; - free(pkgid); free(name); free(icon); @@ -129,5 +126,6 @@ void apptray_wgt_app_item_info_destroy(apptray_wgt_app_item_info_s *item_info) free(item_info->appid); free(item_info->name); free(item_info->icon); + free(item_info); } diff --git a/apptray-widget-app/src/apptray_wgt_app_key.c b/apptray-widget-app/src/apptray_wgt_app_key_event_provider.c index 90ee709..09ce154 100755 --- a/apptray-widget-app/src/apptray_wgt_app_key.c +++ b/apptray-widget-app/src/apptray_wgt_app_key_event_provider.c @@ -14,15 +14,14 @@ * limitations under the License. */ -#include "apptray_wgt_app_key.h" +#include "apptray_wgt_app_key_event_provider.h" #include <Elementary.h> -#include <stdbool.h> #include <stdlib.h> #include <bundle.h> -#include "apptray_wgt_app_log.h" #include "apptray_wgt_app_utils.h" +#include "apptray_wgt_app_log.h" #define ATW_HOME_KEY_ESC "XF86PowerOff" #define ATW_CALLBACK_LIST_MAX 2 @@ -46,11 +45,14 @@ static struct { }; typedef struct { - apptray_wgt_app_key_cb_ret_e (*result_cb)(void *); + bool (*result_cb)(void *); void *result_data; } key_cb_s; -bool apptray_wgt_app_key_register_cb(apptray_wgt_app_key_type_e type, apptray_wgt_app_key_result_cb result_cb, void *result_data) +bool apptray_wgt_app_key_event_provider_add_handler( + apptray_wgt_app_key_type_e type, + apptray_wgt_app_key_event_cb result_cb, + void *result_data) { key_cb_s *cb = NULL; @@ -71,7 +73,9 @@ bool apptray_wgt_app_key_register_cb(apptray_wgt_app_key_type_e type, apptray_wg return true; } -void apptray_wgt_app_key_unregister_cb(apptray_wgt_app_key_type_e type, apptray_wgt_app_key_result_cb result_cb) +void apptray_wgt_app_key_event_provider_del_handler( + apptray_wgt_app_key_type_e type, + apptray_wgt_app_key_event_cb result_cb) { const Eina_List *l; const Eina_List *n; @@ -93,7 +97,7 @@ static void _execute_cbs(int type) EINA_LIST_FOREACH_SAFE(key_info.cbs_list[type], l, n, cb) { continue_if(NULL == cb); continue_if(NULL == cb->result_cb); - if (APPTRAY_WGT_APP_KEY_CB_RET_STOP == cb->result_cb(cb->result_data)) { + if (cb->result_cb(cb->result_data)) { _W("back key execution has been stopped"); break; } @@ -113,11 +117,11 @@ static Eina_Bool _key_release_cb(void *data, int type, void *event) return ECORE_CALLBACK_PASS_ON; } - if (!strcmp(ev->keyname, "XF86Back" )) { + if (!strcmp(ev->keyname, "XF86Back")) { _execute_cbs(APPTRAY_WGT_APP_KEY_TYPE_BACK); } - if (!strcmp(ev->keyname, "XF86PowerOff" )) { + if (!strcmp(ev->keyname, "XF86PowerOff")) { _execute_cbs(APPTRAY_WGT_APP_KEY_TYPE_POWER); } @@ -139,17 +143,19 @@ static Eina_Bool _key_press_cb(void *data, int type, void *event) return ECORE_CALLBACK_PASS_ON; } -void apptray_wgt_app_key_register(void) +void apptray_wgt_app_key_event_provider_init(void) { if (!key_info.release_handler) { - key_info.release_handler = ecore_event_handler_add(ECORE_EVENT_KEY_UP, _key_release_cb, NULL); + key_info.release_handler = ecore_event_handler_add(ECORE_EVENT_KEY_UP, + _key_release_cb, NULL); if (!key_info.release_handler) { _E("Failed to register a key up event handler"); } } if (!key_info.press_handler) { - key_info.press_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _key_press_cb, NULL); + key_info.press_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, + _key_press_cb, NULL); if (!key_info.press_handler) { _E("Failed to register a key down event handler"); } @@ -159,7 +165,7 @@ void apptray_wgt_app_key_register(void) key_info.register_handler = EINA_TRUE; } -void apptray_wgt_app_key_unregister(void) +void apptray_wgt_app_key_event_provider_deinit(void) { if (key_info.release_handler) { ecore_event_handler_del(key_info.release_handler); @@ -173,10 +179,3 @@ void apptray_wgt_app_key_unregister(void) key_info.register_handler = EINA_FALSE; } - -void apptray_wgt_app_key_cb_execute(int type) -{ - _execute_cbs(type); -} - -// End of a file diff --git a/apptray-widget/Build/makefile b/apptray-widget/Build/makefile index f491b50..117b240 100644 --- a/apptray-widget/Build/makefile +++ b/apptray-widget/Build/makefile @@ -14,7 +14,7 @@ clean : app_clean version : build_version #PROJ_ROOT = . -BUILD_ROOT := $(PROJ_PATH)/Build# +#BUILD_ROOT := $(PROJ_PATH)/Build# ifeq ($(MAKE_NAME),mingw32-make) ifneq ($(SHELL),) diff --git a/apptray-widget/Build/makefile.mk b/apptray-widget/Build/makefile.mk index 205a3ad..53c0428 100644 --- a/apptray-widget/Build/makefile.mk +++ b/apptray-widget/Build/makefile.mk @@ -13,10 +13,18 @@ clean : app_clean version : build_version +_BLANK :=# +_SPACE := $(_BLANK) $(_BLANK)# +_SPACE_4MAKE := \$(_SPACE)# + +NULL_CHAR :=# +SPACE := $(NULL_CHAR) $(NULL_CHAR)# -#PROJ_ROOT := $(call BSLASH2SLASH,$(PROJ_PATH)) PROJ_ROOT := . -BUILD_ROOT := $(PROJ_ROOT)/Build +_PROJ_ROOT_4MAKE := $(subst $(_SPACE),$(_SPACE_4MAKE),$(PROJ_ROOT))# +PROJ_ROOT=$(_PROJ_ROOT_4MAKE) +_BUILD_ROOT_4MAKE := $(subst $(_SPACE),$(_SPACE_4MAKE),$(BUILD_ROOT))# +BUILD_ROOT=$(_BUILD_ROOT_4MAKE) include $(BUILD_ROOT)/basedef.mk @@ -109,7 +117,7 @@ $(APPFILE) : $(OBJS) $(UOBJS) @echo ' Building target: $@' @echo ' Invoking: C/C++ Linker' $(call MAKEDIRS,$(@D)) - $(CXX) -o $(APPFILE) $(OBJS) $(UOBJS) $(LIBPATHS) -Xlinker --as-needed $(LIBS) $(LINK_FLAGS) $(TC_LINKER_MISC) $(RS_LINKER_MISC) -pie -lpthread --sysroot="$(SYSROOT)" -Xlinker --version-script="$(PROJ_ROOT)/.exportMap" $(RS_LIB_PATHS) $(RS_LIBRARIES) -Xlinker -rpath="/opt/usr/apps/$(APPID)/lib" -Werror-implicit-function-declaration $(USER_LINK_OPTS) + $(CXX) -o $(APPFILE) $(OBJS) $(UOBJS) $(LIBPATHS) -Xlinker --as-needed $(LIBS) $(LINK_FLAGS) $(TC_LINKER_MISC) $(RS_LINKER_MISC) -pie -lpthread --sysroot="$(SYSROOT)" -Xlinker --version-script="$(PROJ_ROOT)/.exportMap" $(RS_LIB_PATHS) $(RS_LIBRARIES) -Xlinker -rpath='$$ORIGIN/../lib' -Werror-implicit-function-declaration $(USER_LINK_OPTS) @echo ' Finished building target: $@' endif ifeq ($(strip $(APPTYPE)),staticLib) @@ -137,19 +145,19 @@ $(OUTPUT_DIR) : $(call MAKEDIRS,$@) -ifneq ($(strip $(PLATFORM_INCS)),) -$(PLATFORM_INCS_FILE) : $(OBJ_OUTPUT) - @echo ' Building inc file: $@' -ifneq ($(findstring Windows,$(OS)),) -ifneq ($(findstring 3.82,$(MAKE_VERSION)),) - $(file > $@,$(PLATFORM_INCS)) -else - @echo $(PLATFORM_INCS) > $@ -endif -else - @echo $(PLATFORM_INCS) > $@ -endif -endif +#ifneq ($(strip $(PLATFORM_INCS)),) +#$(PLATFORM_INCS_FILE) : $(OBJ_OUTPUT) +# @echo ' Building inc file: $@' +#ifneq ($(findstring Windows,$(OS)),) +#ifneq ($(findstring 3.82,$(MAKE_VERSION)),) +# $(file > $@,$(PLATFORM_INCS)) +#else +# @echo $(PLATFORM_INCS) > $@ +#endif +#else +# @echo '$(PLATFORM_INCS)' > $@ +#endif +#endif include $(BUILD_ROOT)/build_edc.mk diff --git a/apptray-widget/Build/platform.mk b/apptray-widget/Build/platform.mk index 294a38a..3895d90 100644 --- a/apptray-widget/Build/platform.mk +++ b/apptray-widget/Build/platform.mk @@ -2,14 +2,17 @@ SYSROOT = $(SBI_SYSROOT) -USR_INCS := $(addprefix -I $(SYSROOT),$(PLATFORM_INCS_EX)) +#USR_INCS := $(addprefix -I "$(SYSROOT),$(PLATFORM_INCS_EX)) +USR_INCS1 := $(addsuffix ",$(PLATFORM_INCS_EX)) +USR_INCS := $(addprefix -I "$(SYSROOT),$(USR_INCS1)) ifeq ($(strip $(PLATFORM_LIB_PATHS)),) RS_LIB_PATHS := "$(SYSROOT)/usr/lib" else -RS_LIB_PATHS := $(addprefix -L$(SYSROOT),$(PLATFORM_LIB_PATHS)) +RS_LIB_PATHS1 := $(addsuffix ",$(PLATFORM_LIB_PATHS)) +RS_LIB_PATHS := $(addprefix -L "$(SYSROOT),$(RS_LIB_PATHS1)) endif RS_LIBRARIES := $(addprefix -l,$(RS_LIBRARIES_EX)) -PLATFORM_INCS = $(USR_INCS) -I"$(SDK_PATH)/library" +PLATFORM_INCS = $(USR_INCS) -I "$(SDK_PATH)/library" diff --git a/apptray-widget/inc/apptray_widget_accessibility_utils.h b/apptray-widget/inc/apptray_widget_accessibility_utils.h index 9eb2738..a31d30d 100644 --- a/apptray-widget/inc/apptray_widget_accessibility_utils.h +++ b/apptray-widget/inc/apptray_widget_accessibility_utils.h @@ -21,21 +21,20 @@ /** * @brief Registers accessible object - * - * @param[in] parent Accessible object parent - * @param[in] ly Layout from which part for creation accessible object is taken - * @param[in] ly_part Part of layout for creation accessible object - * + * @param[in] parent Accessible object parent + * @param[in] ly Layout from which part for creation accessible object is taken + * @param[in] ly_part Part of layout for creation accessible object * @return Accessible object on success or NULL otherwise */ -Evas_Object *apptray_wgt_au_register_access_object(Evas_Object *parent, Evas_Object *ly, const char *ly_part); +Evas_Object *apptray_wgt_au_register_access_object(Evas_Object *parent, + Evas_Object *ly, const char *ly_part); /** * @brief Unregisters accessible object - * - * @param[in] obj Accessible object to unregister - * + * @param[in] ly Layout from which part for creation accessible object was taken + * @param[in] ly_part Part of layout for creation accessible object */ -void apptray_wgt_au_unregister_access_object(Evas_Object *obj); +void apptray_wgt_au_unregister_access_object(Evas_Object *ly, + const char *ly_part); #endif /* __APPTRAY_WIDGET_ACCESSIBILITY_UTILS_H__ */ diff --git a/apptray-widget/inc/apptray_widget_log.h b/apptray-widget/inc/apptray_widget_log.h index 16614ca..e64bac3 100755 --- a/apptray-widget/inc/apptray_widget_log.h +++ b/apptray-widget/inc/apptray_widget_log.h @@ -101,7 +101,7 @@ } while (0) #define retvm_if(expr, val, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ _E(fmt, ##arg); \ _E("(%s) -> %s() return", #expr, __FUNCTION__); \ return val; \ @@ -109,14 +109,14 @@ } while (0) #define retv_if(expr, val) do { \ - if(expr) { \ + if (expr) { \ _E("(%s) -> %s() return", #expr, __FUNCTION__); \ return (val); \ } \ } while (0) #define retm_if(expr, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ _E(fmt, ##arg); \ _E("(%s) -> %s() return", #expr, __FUNCTION__); \ return; \ @@ -124,28 +124,28 @@ } while (0) #define ret_if(expr) do { \ - if(expr) { \ + if (expr) { \ _E("(%s) -> %s() return", #expr, __FUNCTION__); \ return; \ } \ } while (0) #define goto_if(expr, val) do { \ - if(expr) { \ + if (expr) { \ _E("(%s) -> goto", #expr); \ goto val; \ } \ } while (0) #define break_if(expr) { \ - if(expr) { \ + if (expr) { \ _E("(%s) -> break", #expr); \ break; \ } \ } #define continue_if(expr) { \ - if(expr) { \ + if (expr) { \ _E("(%s) -> continue", #expr); \ continue; \ } \ diff --git a/apptray-widget/inc/apptray_widget_utils.h b/apptray-widget/inc/apptray_widget_utils.h index 12e4e1f..3666a9f 100755 --- a/apptray-widget/inc/apptray_widget_utils.h +++ b/apptray-widget/inc/apptray_widget_utils.h @@ -17,12 +17,31 @@ #ifndef __APPTRAY_WIDGET_UTILS_H__ #define __APPTRAY_WIDGET_UTILS_H__ +/** + * @brief Gets get full path to resources + * @param[in] file_in Short path to resource file + * @param[out] file_path_out Output buffer for getting full path to resource + * @param[out] file_path_max Size of @file_path_max buffer + */ void apptray_wgt_utils_get_resource(const char *file_in, char *file_path_out, int file_path_max); +/** + * @brief Gets full path to local file directory + * @return Path to local file directory + */ const char *apptray_wgt_utils_get_locale_path(); +/** + * @brief Gets full path to default application icon resource + * @return Path to default application icon + */ const char *apptray_wgt_utils_get_default_app_icon_path(); -char *apptray_wgt_utils_get_count_str_from_icu(int count); +/** + * @brief Converts integer value into string according to current local + * @param[in] value Value to convert + * @return String interpretation of the @value + */ +const char *apptray_wgt_utils_convert_int_to_icu_str(int value); #endif /* __APPTRAY_WIDGET_UTILS_H__ */ diff --git a/apptray-widget/src/apptray_widget.c b/apptray-widget/src/apptray_widget.c index 55eaaa5..f6ad857 100755 --- a/apptray-widget/src/apptray_widget.c +++ b/apptray-widget/src/apptray_widget.c @@ -30,14 +30,15 @@ #define ATW_SLOT_INDEX_BUFF_SIZE 10 -#define ATW_BUNDLE_KEY_SHORTCUT_LIST "shortcut_list" -#define ATW_BUNDLE_KEY_WIDGET_INSTANCE_ID "instance_id" -#define ATW_BUNDLE_KEY_CONTENT_INFO "content_info" +#define ATW_BUNDLE_KEY_SHORTCUT_LIST "shortcut_list" -static Eina_List *s_list = NULL; +static Eina_List *s_instance_list = NULL; package_manager_h s_pkg_manager = NULL; -struct slot_info { +/** + * @brief Widget instance slot info structure + */ +struct _slot { char *appid; char *icon; char *label; @@ -47,7 +48,15 @@ struct slot_info { Evas_Object *ao; }; -struct info { +/** + * Slot info handle definition + */ +typedef struct _slot *_slot_h; + +/** + * @brief Widget instance info structure + */ +struct _instance { widget_context_h context; char* id; int w; @@ -55,8 +64,8 @@ struct info { Evas_Object *win; Evas_Object *bg; Evas_Object *layout; - struct slot_info slot[ATW_SLOTS_MAX_COUNT]; - int first_loaded; + Evas_Object *add_apps_ly; + struct _slot slot[ATW_SLOTS_MAX_COUNT]; char *content_app_list[ATW_SLOTS_MAX_COUNT]; bundle *content; @@ -64,126 +73,163 @@ struct info { Evas_Object *ao_add_app; }; -static struct info *_find_instance_info(const char* id); +/** + * Instance handle definition + */ +typedef struct _instance *_instance_h; + +static _instance_h _find_instance(const char* id); -static void _check_slots_on_package_remove_callback(const char *package); +static void _try_update_slots_on_package_remove_callback(const char *package); -static void _update_slot_ly_badge(struct slot_info *item); +static void _update_slot_ly_badge(_slot_h slot); static int _get_app_badge_count(const char *appid); static void _register_badge_changed_callback(void); static void _unregister_badge_changed_callback(void); -static void _badge_changed_cb(unsigned int action, const char *appid, unsigned int count, void *data); - -static void _slot_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _process_slot_click_event(struct slot_info *slot); - -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); -static void _log_content_list(struct info *item); -static void _free_content_list(struct info *item); -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 _process_add_apps_click_event(struct info *item); - -static void _process_widget_instance_lang_change_event(struct info *item); - -static void _create_add_apps_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 void _update_widget_content_app_list(struct info *info); - -static struct info * _create_widget_instance_info(widget_context_h context, bundle *content, int w, int h); -static void _destroy_widget_instance_info(struct info **instance_info); - -static widget_class_h _widget_app_create(void *user_data); -static void _widget_app_terminate(void *user_data); -static void _widget_app_lang_changed(app_event_info_h event_info, void *user_data); - -static int _widget_instance_create(widget_context_h context, bundle *content, int w, int h, void *user_data); -static int _widget_instance_destroy(widget_context_h context, widget_app_destroy_type_e reason, bundle *content, void *user_data); -static int _widget_instance_pause(widget_context_h context, void *user_data); -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 _init_slots_data(struct info *info); -static void _update_slots_data(struct info *info, bundle *content); +static void _badge_changed_cb(unsigned int action, + const char *appid, unsigned int count, void *data); + +static void _slot_clicked_cb(void *data, + Evas_Object *obj, const char *emission, const char *source); +static void _process_slot_click_event(_slot_h slot); + +static void _update_all_slots(_instance_h instance); +static bool _set_slot(_instance_h instance, const char *appid, int pos); +static void _reset_slot(_instance_h instance, int index); +static void _reset_all_slots_info(_instance_h instance); +static void _log_content_list(_instance_h instance); +static void _free_content_list(_instance_h instance); +static void _update_content_list(_instance_h instance, + const char *content); + +static void _add_apps_clicked_cb(void *data, + Evas_Object *obj, const char *emission, const char *source); +static void _process_add_apps_request(_instance_h instance); + +static void _process_widget_instance_lang_change_event( + _instance_h instance); + +static void _create_add_apps_layout(_instance_h instance); +static void _destroy_add_apps_layout(_instance_h instance); +static void _set_main_layout_slot_count(_instance_h instance, int count); +static void _set_main_layout_add_apps_mode(_instance_h instance); + +static bool _create_win(_instance_h instance); + +static void _update_widget_content_app_list(_instance_h instance); + +static _instance_h _create_widget_instance(widget_context_h context, + bundle *content, int w, int h); +static void _destroy_widget_instance(_instance_h *instance); + +static widget_class_h _widget_app_create_cb(void *user_data); +static void _widget_app_terminate_cb(void *user_data); +static void _widget_app_lang_changed(app_event_info_h event_info, + void *user_data); + +static int _widget_instance_create_cb(widget_context_h context, + bundle *content, int w, int h, void *user_data); +static int _widget_instance_destroy_cb(widget_context_h context, + widget_app_destroy_type_e reason, bundle *content, + void *user_data); +static int _widget_instance_pause_cb(widget_context_h context, + void *user_data); +static int _widget_instance_resume_cb(widget_context_h context, + void *user_data); +static int _widget_instance_update_cb(widget_context_h context, + bundle *content, int force, void *user_data); +static int _widget_instance_resize_cb(widget_context_h context, + int w, int h, void *user_data); + +static void _init_slots_data(_instance_h instance); +static void _update_slots_data(_instance_h instance, bundle *content); static void _init_package_manager(); static void _deinit_package_manager(); -void _package_manager_event_cb(const char *type, const char *package, package_manager_event_type_e event_type, - package_manager_event_state_e event_state, int progress, - package_manager_error_e error, void *user_data); +void _package_manager_event_cb(const char *type, + const char *package, package_manager_event_type_e event_type, + package_manager_event_state_e event_state, int progress, + package_manager_error_e error, void *user_data); /* Accessibility */ -static Evas_Object *_create_slot_access_object(struct slot_info *slot, Evas_Object *parent); -static void _update_slot_access_object_info(struct slot_info *slot); -static Eina_Bool _slot_access_object_activate_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info); - -static void _create_add_apps_layout_access_object(struct info *item, Evas_Object *layout); -static void _destroy_add_apps_layout_access_object(struct info *item); -static Eina_Bool _add_apps_access_object_activate_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info); -static void _update_add_apps_access_object_info(struct info *item); - -static inline struct info *_find_instance_info(const char* id) +static Evas_Object *_create_slot_access_object(_slot_h slot, + Evas_Object *parent); +static void _update_slot_access_object_info(_slot_h slot); +static Eina_Bool _slot_access_object_activate_cb(void *data, Evas_Object *obj, + Elm_Access_Action_Info *action_info); + +static void _create_add_apps_layout_access_object(_instance_h instance); +static void _destroy_add_apps_layout_access_object(_instance_h instance); +static Eina_Bool _add_apps_access_object_activate_cb(void *data, + Evas_Object *obj, Elm_Access_Action_Info *action_info); +static void _update_add_apps_access_object_info(_instance_h instance); + +/** + * @brief Finds instance in the instance list by id + * @param[in] id Instance info id + * @return Instance info on success, otherwise NULL + */ +static inline _instance_h _find_instance(const char* id) { _ENTER; - struct info *item = NULL; + _instance_h instance = NULL; + Eina_List *l = NULL; _D("Need to find [%s]", id); - EINA_LIST_FOREACH(s_list, l, item) { - _D("item->id:%s,id:%s",item->id, id); - if (!strncmp(item->id, id, strlen(id))) { - _D("Item found"); - return item; + EINA_LIST_FOREACH(s_instance_list, l, instance) { + if (!strncmp(instance->id, id, strlen(id))) { + _D("Instance found"); + return instance; } } - _D("Item not found"); + _D("Instance not found"); - return item; + return instance; } -static void _check_slots_on_package_remove_callback(const char *package) +/** + * @brief Tries update slots on package remove notification + * @param[in] package Package name + */ +static void _try_update_slots_on_package_remove_callback(const char *package) { _ENTER; _D("Need check and remove pkgid [%s]", package); Eina_List *l = NULL; - struct info *item= NULL; + _instance_h instance = NULL; bool need_update = false; int i = 0; - EINA_LIST_FOREACH(s_list, l, item) { - for (i = 0 ; i < ATW_SLOTS_MAX_COUNT ; i++) { - if (IS_STRING_EMPTY(item->slot[i].appid) - || !strcmp(item->slot[i].appid, "empty")) { + EINA_LIST_FOREACH(s_instance_list, l, instance) { + for (i = 0; i < ATW_SLOTS_MAX_COUNT; i++) { + if (IS_STRING_EMPTY(instance->slot[i].appid) + || !strcmp(instance->slot[i].appid, "empty")) { continue; } - if (!strcmp(item->slot[i].pkgid, package)) { - free(item->content_app_list[i]); - item->content_app_list[i] = strdup("empty"); + if (!strcmp(instance->slot[i].pkgid, package)) { + free(instance->content_app_list[i]); + instance->content_app_list[i] = strdup("empty"); need_update = true; } } if (need_update) { need_update = false; - _update_all_slots(item); - _update_widget_content_app_list(item); + _update_all_slots(instance); + _update_widget_content_app_list(instance); } } } +/** + * @brief Gets number of application notification to display in badge + * @param[in] appid Application id to check number of notification + * @return Value of notification to display in badge + */ static int _get_app_badge_count(const char *appid) { _ENTER; @@ -194,7 +240,7 @@ static int _get_app_badge_count(const char *appid) retv_if(!appid, 0); err = badge_get_display(appid, &is_display); - _D("badge_get_display err:%d",err); + _D("badge_get_display err:%d", err); if (BADGE_ERROR_NOT_EXIST == err) { _D("Badge does not exist"); @@ -215,42 +261,55 @@ static int _get_app_badge_count(const char *appid) return (int)count; } -static void _update_slot_ly_badge(struct slot_info *item) +/** + * @brief Updated slot's badge layout + * @param[in] slot Slot info handle + */ +static void _update_slot_ly_badge(_slot_h slot) { _ENTER; char badge_signal[16]; - ret_if(!item); + ret_if(!slot); - if (item->badge_count > ATW_MAX_BADGE_COUNT) { - item->badge_count = ATW_MAX_BADGE_COUNT; + if (slot->badge_count > ATW_MAX_BADGE_COUNT) { + slot->badge_count = ATW_MAX_BADGE_COUNT; } - elm_object_part_text_set(item->eo, "badge_txt", - apptray_wgt_utils_get_count_str_from_icu(item->badge_count)); + elm_object_part_text_set(slot->eo, "badge_txt", + apptray_wgt_utils_convert_int_to_icu_str(slot->badge_count)); - if (item->badge_count <= 0) { + if (slot->badge_count <= 0) { snprintf(badge_signal, sizeof(badge_signal), "badge,off"); - } else if (item->badge_count < 10) { + } else if (slot->badge_count < 10) { snprintf(badge_signal, sizeof(badge_signal), "badge,on,1"); - } else if (item->badge_count < 100) { + } else if (slot->badge_count < 100) { snprintf(badge_signal, sizeof(badge_signal), "badge,on,2"); } else { snprintf(badge_signal, sizeof(badge_signal), "badge,on,3"); } - elm_object_signal_emit(item->eo, badge_signal, "slot"); + elm_object_signal_emit(slot->eo, badge_signal, "slot"); } -static void _badge_changed_cb(unsigned int action, const char *appid, unsigned int count, void *data) +/** + * @brief Called when badge change callback happens + * @param[in] action The type of the change. Refer #badge_action + * @param[in] app_id The name of the application + * @param[in] count The count of the badge + * @param[in] data The user data passed from the callback register function + */ +static void _badge_changed_cb(unsigned int action, + const char *appid, unsigned int count, void *data) { _ENTER; - Eina_List *l; - struct info *item; + Eina_List *l = NULL; + _instance_h instance = NULL; unsigned int is_display = 0; badge_error_e err = BADGE_ERROR_NONE; int i = 0; - _D("Badge changed, action : %u, appid : %s, count : %u", action, appid, count); + _D("Badge changed, action : %u, appid : %s, count : %u", + action, appid, count); ret_if(!appid); @@ -269,18 +328,21 @@ static void _badge_changed_cb(unsigned int action, const char *appid, unsigned i count = 0; } - EINA_LIST_FOREACH(s_list, l, item) { - for(i = 0 ; i < ATW_SLOTS_MAX_COUNT ; i++) { - if (!IS_STRING_EMPTY(item->slot[i].appid) - && !strcmp(item->slot[i].appid, appid)) { - item->slot[i].badge_count = count; - _update_slot_ly_badge(&item->slot[i]); - _update_slot_access_object_info(&item->slot[i]); + EINA_LIST_FOREACH(s_instance_list, l, instance) { + for (i = 0; i < ATW_SLOTS_MAX_COUNT; i++) { + if (!IS_STRING_EMPTY(instance->slot[i].appid) + && !strcmp(instance->slot[i].appid, appid)) { + instance->slot[i].badge_count = count; + _update_slot_ly_badge(&instance->slot[i]); + _update_slot_access_object_info(&instance->slot[i]); } } } } +/** + * @brief Registers badge change callback + */ static void _register_badge_changed_callback(void) { _ENTER; @@ -288,6 +350,9 @@ static void _register_badge_changed_callback(void) ret_if(BADGE_ERROR_NONE != err); } +/** + * @brief Unregisters badge change callback + */ static void _unregister_badge_changed_callback(void) { _ENTER; @@ -295,7 +360,11 @@ static void _unregister_badge_changed_callback(void) ret_if(BADGE_ERROR_NONE != err); } -static void _process_slot_click_event(struct slot_info *slot) +/** + * @brief Processes click event on slot + * @param[in] slot Slot info handle + */ +static void _process_slot_click_event(_slot_h slot) { app_control_h service = NULL; int ret = app_control_create(&service); @@ -307,7 +376,8 @@ static void _process_slot_click_event(struct slot_info *slot) if (!strcmp(slot->appid, ATW_APPS_PKG)) { app_control_set_operation(service, APP_CONTROL_OPERATION_DEFAULT); app_control_set_app_id(service, ATW_WHOME_PKG); - app_control_add_extra_data(service, ATW_WHOME_APP_CONTROL, ATW_APP_LAUNCH_KEY); + app_control_add_extra_data(service, ATW_WHOME_APP_CONTROL, + ATW_APP_LAUNCH_KEY); } else { app_control_set_operation(service, APP_CONTROL_OPERATION_MAIN); app_control_set_app_id(service, slot->appid); @@ -320,20 +390,34 @@ static void _process_slot_click_event(struct slot_info *slot) app_control_destroy(service); } -static void _slot_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +/** + * @brief Called on slot click event + * @param[in] data Instance info + * @param[in] obj Evas object which initiate click event + * @param[in] emission Signal value form edje + * @param[in] source Source value form edje + */ +static void _slot_clicked_cb(void *data, Evas_Object *obj, + const char *emission, const char *source) { _ENTER; - struct info *item = (struct info *)data; + _instance_h instance = data; int index = -1; sscanf(source, "slot_%d", &index); ret_if(index <= 0); - _process_slot_click_event(&item->slot[index - 1]); + _process_slot_click_event(&instance->slot[index - 1]); } -static Evas_Object *_create_slot_layout(struct info *item, int pos) +/** + * @brief Creates slot layout + * @param[in] instance Instance handle + * @param[in] pos Slot position for which layout is created + * @return Layout object on success, otherwise NULL + */ +static Evas_Object *_create_slot_layout(_instance_h instance, int pos) { char full_path[ATW_PATH_MAX] = { 0 }; char index[ATW_SLOT_INDEX_BUFF_SIZE] = { 0 }; @@ -341,58 +425,88 @@ static Evas_Object *_create_slot_layout(struct info *item, int pos) snprintf(index, sizeof(index), "slot_%d", pos + 1); - slot = elm_layout_add(item->layout); + slot = elm_layout_add(instance->layout); retv_if(!slot, NULL); apptray_wgt_utils_get_resource(ATW_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); - elm_object_part_content_set(item->layout, index, slot); + elm_object_part_content_set(instance->layout, index, slot); evas_object_show(slot); return slot; } -static Evas_Object *_create_slot_app_icon(struct info *item, int pos) +/** + * @brief Creates slot application icon + * @param[in] instance Instance handle + * @param[in] pos Slot position + * @return Icon object on success, otherwise NULL + */ +static Evas_Object *_create_slot_app_icon(_instance_h instance, int pos) { Evas_Object *icon = evas_object_image_add( - evas_object_evas_get(item->slot[pos].eo)); + evas_object_evas_get(instance->slot[pos].eo)); retv_if(!icon, NULL); evas_object_repeat_events_set(icon, EINA_TRUE); - evas_object_image_file_set(icon, item->slot[pos].icon, NULL); + evas_object_image_file_set(icon, instance->slot[pos].icon, NULL); evas_object_image_filled_set(icon, EINA_TRUE); - elm_object_part_content_set(item->slot[pos].eo, "icon", icon); + elm_object_part_content_set(instance->slot[pos].eo, "icon", icon); evas_object_show(icon); return icon; } -static Eina_Bool _slot_access_object_activate_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info) +/** + * @brief Called when Screen Reader activates slot access object + * @param[in] data Slot info handle + * @param[in] obj Access object that get activation + * @param[in] action_info Action info + * @return EINA_TRUE to stop propagation event, + * EINA_FALSE otherwise + */ +static Eina_Bool _slot_access_object_activate_cb(void *data, + Evas_Object *obj, + Elm_Access_Action_Info *action_info) { retv_if(!data, EINA_FALSE); - _process_slot_click_event((struct slot_info *)data); + _process_slot_click_event(data); return EINA_TRUE; } -static Evas_Object *_create_slot_access_object(struct slot_info *slot, Evas_Object *parent) +/** + * @brief Creates access object for slot layout for Screen Reader feature + * @param[in] data Slot info handle + * @param[in] parent Parent object for access object + * @return Access object on success, otherwise NULL + */ +static Evas_Object *_create_slot_access_object(_slot_h slot, + Evas_Object *parent) { _ENTER; - Evas_Object *ao = apptray_wgt_au_register_access_object(parent, slot->eo, "ao_icon"); + Evas_Object *ao = apptray_wgt_au_register_access_object(parent, + slot->eo, "ao_icon"); retv_if(!ao, NULL); elm_atspi_accessible_translation_domain_set(ao, ATW_DOMAIN); elm_atspi_accessible_role_set(ao, ELM_ATSPI_ROLE_TEXT); - elm_atspi_accessible_reading_info_type_set(ao, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME + elm_atspi_accessible_reading_info_type_set(ao, + ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION); - elm_access_action_cb_set(ao, ELM_ACCESS_ACTION_ACTIVATE, _slot_access_object_activate_cb, slot); + elm_access_action_cb_set(ao, ELM_ACCESS_ACTION_ACTIVATE, + _slot_access_object_activate_cb, slot); return ao; } -static void _update_slot_access_object_info(struct slot_info *slot) +/** + * @brief Updates slot Screen Reader info + * @param[in] slot Slot info handle + */ +static void _update_slot_access_object_info(_slot_h slot) { _ENTER; @@ -403,14 +517,24 @@ static void _update_slot_access_object_info(struct slot_info *slot) if (slot->badge_count) { char buff[ATW_BUFF_SIZE_BIG] = { 0 }; - snprintf(buff, sizeof(buff), _("IDS_TTS_BODY_PD_NEW_ITEMS"), slot->badge_count); + snprintf(buff, + sizeof(buff), + _("IDS_TTS_BODY_PD_NEW_ITEMS"), + slot->badge_count); elm_atspi_accessible_description_set(slot->ao, buff); } else { elm_atspi_accessible_description_set(slot->ao, ""); } } -static bool _set_slot(struct info *item, const char *appid, int pos) +/** + * @brief Sets slot to main layout + * @param[in] instance Instance handle + * @param[in] appid Application id to display slot + * @param[in] index Slot index + * @return true on success, otherwise false + */ +static bool _set_slot(_instance_h instance, const char *appid, int pos) { _ENTER; @@ -420,17 +544,17 @@ static bool _set_slot(struct info *item, const char *appid, int pos) char *label = NULL; char *icon_path_tmp = NULL; - _D("Try update slot [%d]", pos + 1); + _D("Try update slot [%d]", index + 1); if (!appid || !strcmp(appid, "empty")) { _D("appid to set is empty"); return false; } - item->slot[pos].appid = strdup(appid); + instance->slot[pos].appid = strdup(appid); - item->slot[pos].eo = _create_slot_layout(item, pos); - if (!item->slot[pos].eo) { + instance->slot[pos].eo = _create_slot_layout(instance, pos); + if (!instance->slot[pos].eo) { _E("Create slot layout failed"); goto fail_return; } @@ -446,16 +570,18 @@ static bool _set_slot(struct info *item, const char *appid, int pos) _E("get appinfo failed. ret[%d]", ret); goto fail_return; } - item->slot[pos].pkgid = pkgid; + instance->slot[pos].pkgid = pkgid; ret = app_info_get_label(app_info, &label); if (ret != APP_MANAGER_ERROR_NONE) { _E("get label failed. ret[%d]", ret); - item->slot[pos].label = strdup(""); + instance->slot[pos].label = strdup(""); } else { - item->slot[pos].label = strdup(label); + instance->slot[pos].label = strdup(label); } - elm_object_part_text_set(item->slot[pos].eo, "name", item->slot[pos].label); + elm_object_part_text_set(instance->slot[pos].eo, + "name", + instance->slot[pos].label); ret = app_info_get_icon(app_info, &icon_path_tmp); if (ret != APP_MANAGER_ERROR_NONE) { @@ -463,27 +589,29 @@ static bool _set_slot(struct info *item, const char *appid, int pos) } if (icon_path_tmp) { if (strlen(icon_path_tmp) > 0) { - item->slot[pos].icon = strdup(icon_path_tmp); + instance->slot[pos].icon = strdup(icon_path_tmp); } else { - item->slot[pos].icon = strdup(ATW_DEFAULT_ICON); + instance->slot[pos].icon = strdup(ATW_DEFAULT_ICON); } } else { - item->slot[pos].icon = strdup(ATW_DEFAULT_ICON); + instance->slot[pos].icon = strdup(ATW_DEFAULT_ICON); } - if (!_create_slot_app_icon(item, pos)) { + if (!_create_slot_app_icon(instance, pos)) { _E("Create slot icon failed"); goto fail_return; } - item->slot[pos].badge_count = _get_app_badge_count(item->slot[pos].appid); - _update_slot_ly_badge(&item->slot[pos]); + instance->slot[pos].badge_count = _get_app_badge_count( + instance->slot[pos].appid); + _update_slot_ly_badge(&instance->slot[pos]); - item->slot[pos].ao = _create_slot_access_object(&item->slot[pos], item->layout); - if (!item->slot[pos].ao) { + instance->slot[pos].ao = _create_slot_access_object(&instance->slot[pos], + instance->layout); + if (!instance->slot[pos].ao) { _E("Register accessible object for slot [%d] failed", pos); } else { - _update_slot_access_object_info(&item->slot[pos]); + _update_slot_access_object_info(&instance->slot[pos]); } free(label); @@ -492,13 +620,13 @@ static bool _set_slot(struct info *item, const char *appid, int pos) if (app_info) app_info_destroy(app_info); - _D("Slot [%d] was added", pos + 1); + _D("Slot [%d] was added", index + 1); return true; fail_return: - _reset_slot_info(item, pos); + _reset_slot(instance, pos); free(label); free(icon_path_tmp); @@ -506,59 +634,84 @@ fail_return: if (app_info) app_info_destroy(app_info); - _D("Slot [%d] was not added", pos + 1); + _D("Slot [%d] was not added", index + 1); return false; } -static void _reset_slot_info(struct info *item, int index) +/** + * @brief Resets slot + * @param[in] instance Instance handle + * @param[in] index Slot index + */ +static void _reset_slot(_instance_h instance, int index) { _ENTER; - FREE(item->slot[index].appid); - FREE(item->slot[index].icon); - FREE(item->slot[index].label); - FREE(item->slot[index].pkgid); + FREE(instance->slot[index].appid); + FREE(instance->slot[index].icon); + FREE(instance->slot[index].label); + FREE(instance->slot[index].pkgid); char index_str[10] = { 0 }; snprintf(index_str, sizeof(index_str), "slot_%d", index + 1); - elm_object_part_content_unset(item->layout, index_str); + elm_object_part_content_unset(instance->layout, index_str); - if (item->slot[index].ao) { - apptray_wgt_au_unregister_access_object(item->slot[index].ao); - item->slot[index].ao = NULL; - } - DEL_EVAS_OBJECT(item->slot[index].eo); + apptray_wgt_au_unregister_access_object(instance->slot[index].eo, "ao_icon"); + instance->slot[index].ao = NULL; + DEL_EVAS_OBJECT(instance->slot[index].eo); _EXIT; } -static void _reset_all_slots_info(struct info *item) +/** + * @brief Resets all slots info + * @param[in] instance Instance handle + * @param[in] index Slot index + */ +static void _reset_all_slots_info(_instance_h instance) { _ENTER; int i = 0; for (; i < ATW_SLOTS_MAX_COUNT; i++) { - _reset_slot_info(item, i); + _reset_slot(instance, i); } _EXIT; } -static void _log_content_list(struct info *item) +/** + * @brief Logs instance content list + * @param[in] instance Instance handle + */ +static void _log_content_list(_instance_h instance) { - _D("%s %s %s %s", item->content_app_list[0], item->content_app_list[1], item->content_app_list[2], item->content_app_list[3]); + _D("%s %s %s %s", + instance->content_app_list[0], + instance->content_app_list[1], + instance->content_app_list[2], + instance->content_app_list[3]); } -static void _free_content_list(struct info *item) +/** + * @brief Deletes instance content list + * @param[in] instance Instance handle + */ +static void _free_content_list(_instance_h instance) { int i = 0; for (; i < ATW_SLOTS_MAX_COUNT; i++) { - FREE(item->content_app_list[i]); + FREE(instance->content_app_list[i]); } } -static void _update_content_list(struct info *item, const char *content) +/** + * @brief Updates instance content list + * @param[in] instance Instance handle + * @param[in] content Content to update + */ +static void _update_content_list(_instance_h instance, const char *content) { _ENTER; @@ -569,7 +722,7 @@ static void _update_content_list(struct info *item, const char *content) int j = 0; ret_if(!content); - ret_if(!item); + ret_if(!instance); _D("content to set [%s]", content); @@ -577,7 +730,7 @@ static void _update_content_list(struct info *item, const char *content) ret_if(!tmp); for (; i < ATW_SLOTS_MAX_COUNT; i++) { - FREE(item->content_app_list[i]); + FREE(instance->content_app_list[i]); } for (i = 0, j = 0; i < ATW_SLOTS_MAX_COUNT; i++) { @@ -589,21 +742,27 @@ static void _update_content_list(struct info *item, const char *content) } if (strcmp(tmp_app_id, "empty")) { - item->content_app_list[j] = strdup(tmp_app_id); + instance->content_app_list[j] = strdup(tmp_app_id); j++; } } + free(tmp); for (; j < ATW_SLOTS_MAX_COUNT; j++) { - item->content_app_list[j] = strdup("empty"); + instance->content_app_list[j] = strdup("empty"); } - _log_content_list(item); + _log_content_list(instance); _EXIT; } -static void _process_add_apps_click_event(struct info *item) +/** + * @brief Processes add application request + * @param[in] instance Instance handle + * @param[in] content Content to update + */ +static void _process_add_apps_request(_instance_h instance) { _ENTER; @@ -617,11 +776,15 @@ static void _process_add_apps_click_event(struct info *item) bundle_raw *bndl_raw = NULL; int bndl_raw_len = 0; - bundle_encode(item->content, &bndl_raw, &bndl_raw_len); - app_control_add_extra_data(service, ATW_BUNDLE_KEY_CONTENT_INFO, (const char *)bndl_raw); + bundle_encode(instance->content, &bndl_raw, &bndl_raw_len); + app_control_add_extra_data(service, + APP_CONTROL_DATA_WIDGET_CONTENT, + (const char *)bndl_raw); free(bndl_raw); - app_control_add_extra_data(service, ATW_BUNDLE_KEY_WIDGET_INSTANCE_ID, item->id); + app_control_add_extra_data(service, + APP_CONTROL_DATA_WIDGET_INSTANCE_ID, + instance->id); int ret = app_control_send_launch_request(service, NULL, NULL); if (ret != APP_CONTROL_ERROR_NONE) { @@ -630,273 +793,388 @@ static void _process_add_apps_click_event(struct info *item) app_control_destroy(service); } -static void _add_application_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +/** + * @brief Called on Add application button event + * @param[in] data Instance handle + * @param[in] obj Object that initiate event + * @param[in] emission Signal value form edje + * @param[in] source Source value form edje + */ +static void _add_apps_clicked_cb(void *data, + Evas_Object *obj, const char *emission, const char *source) { _ENTER; ret_if(!data); - _process_add_apps_click_event((struct info *)data); + _process_add_apps_request(data); } -static Eina_Bool _add_apps_access_object_activate_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info) +/** + * @brief Called when Screen Reader activates Add application access object + * @param[in] data Instance handle + * @param[in] obj Access object that get activation + * @param[in] action_info Action info + * @return EINA_TRUE to stop propagation event, + * EINA_FALSE otherwise + */ +static Eina_Bool _add_apps_access_object_activate_cb(void *data, + Evas_Object *obj, Elm_Access_Action_Info *action_info) { _ENTER; retv_if(!data, EINA_FALSE); - _process_add_apps_click_event((struct info *)data); + _process_add_apps_request(data); return EINA_TRUE; } -static void _create_add_apps_layout_access_object(struct info *item, Evas_Object *layout) +/** + * @brief Creates Add application access object + * @param[in] instance Instance handle + */ +static void _create_add_apps_layout_access_object(_instance_h instance) { - Evas_Object *ao = apptray_wgt_au_register_access_object(item->layout, layout, "ao_icon"); + Evas_Object *ao = apptray_wgt_au_register_access_object(instance->layout, + instance->add_apps_ly, "ao_icon"); ret_if(!ao); elm_atspi_accessible_translation_domain_set(ao, ATW_DOMAIN); elm_atspi_accessible_role_set(ao, ELM_ATSPI_ROLE_PUSH_BUTTON); - elm_access_action_cb_set(ao, ELM_ACCESS_ACTION_ACTIVATE, _add_apps_access_object_activate_cb, item); - item->ao_add_app = ao; + elm_access_action_cb_set(ao, + ELM_ACCESS_ACTION_ACTIVATE, + _add_apps_access_object_activate_cb, + instance); + instance->ao_add_app = ao; } -static void _destroy_add_apps_layout_access_object(struct info *item) +/** + * @brief Destroys Add application access object + * @param[in] instance Instance handle + * @param[in] layout Access object parent + */ +static void _destroy_add_apps_layout_access_object(_instance_h instance) { - if (!item->ao_add_app) { + if (!instance->add_apps_ly) { return; } - apptray_wgt_au_unregister_access_object(item->ao_add_app); - item->ao_add_app = NULL; + apptray_wgt_au_unregister_access_object(instance->add_apps_ly, "ao_icon"); + instance->ao_add_app = NULL; } -static void _update_add_apps_access_object_info(struct info *item) +/** + * @brief Updates Add application access object info + * @param[in] instance Instance handle + */ +static void _update_add_apps_access_object_info(_instance_h instance) { - ret_if(!item->ao_add_app); + ret_if(!instance->ao_add_app); - elm_atspi_accessible_name_set(item->ao_add_app, "WDS_AWGT_MBODY_ADD_APP_SHORTCUTS_ABB"); - elm_atspi_accessible_description_set(item->ao_add_app, "WDS_ACCS_TBBODY_DOUBLE_TAP_TO_ADD_APP_SHORTCUTS"); + elm_atspi_accessible_name_set(instance->ao_add_app, + "WDS_AWGT_MBODY_ADD_APP_SHORTCUTS_ABB"); + elm_atspi_accessible_description_set(instance->ao_add_app, + "WDS_ACCS_TBBODY_DOUBLE_TAP_TO_ADD_APP_SHORTCUTS"); } -static void _create_add_apps_layout(struct info *item) +/** + * @brief Creates Add application layout + * @param[in] instance Instance handle + */ +static void _create_add_apps_layout(_instance_h instance) { - Evas_Object *eo = elm_layout_add(item->layout); + Evas_Object *eo = elm_layout_add(instance->layout); char full_path[ATW_PATH_MAX] = { 0 }; apptray_wgt_utils_get_resource(ATW_EDJE_FILE, full_path, sizeof(full_path)); elm_layout_file_set(eo, full_path, "add_app_shorcuts"); - elm_object_translatable_part_text_set(eo, "txt", "WDS_AWGT_MBODY_ADD_APP_SHORTCUTS_ABB"); + elm_object_translatable_part_text_set(eo, "txt", + "WDS_AWGT_MBODY_ADD_APP_SHORTCUTS_ABB"); evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_signal_callback_add(eo, "mouse_clicked", "touch_rect", _add_application_clicked_cb, item); - elm_object_part_content_set(item->layout, "add_apps", eo); + elm_object_signal_callback_add(eo, "mouse_clicked", "touch_rect", + _add_apps_clicked_cb, instance); + elm_object_part_content_set(instance->layout, "add_apps", eo); evas_object_show(eo); - _create_add_apps_layout_access_object(item, eo); - _update_add_apps_access_object_info(item); + instance->add_apps_ly = eo; + + _create_add_apps_layout_access_object(instance); + _update_add_apps_access_object_info(instance); } -static void _destroy_add_apps_layout(struct info *item) +/** + * @brief Destroys Add application layout + * @param[in] instance Instance handle + */ +static void _destroy_add_apps_layout(_instance_h instance) { - Evas_Object *eo = NULL; + _destroy_add_apps_layout_access_object(instance); - _destroy_add_apps_layout_access_object(item); - - eo = elm_object_part_content_unset(item->layout, "add_apps"); - DEL_EVAS_OBJECT(eo); + DEL_EVAS_OBJECT(instance->add_apps_ly); } -static void _set_main_layout_slot_count(struct info *item, int count) +/** + * @brief Sets slot count to main layout + * @param[in] instance Instance handle + */ +static void _set_main_layout_slot_count(_instance_h instance, int count) { char tmp[ATW_BUFF_SIZE_NORMAL] = { 0 }; snprintf(tmp, sizeof(tmp), "%d_slots", count); - elm_object_signal_emit(item->layout, tmp, "*"); + elm_object_signal_emit(instance->layout, tmp, "*"); } -static void _set_main_layout_add_apps_mode(struct info *item) +/** + * @brief Sets Add application mode to main layout + * @param[in] instance Instance handle + */ +static void _set_main_layout_add_apps_mode(_instance_h instance) { - elm_object_signal_emit(item->layout, "no_apps", "*"); + elm_object_signal_emit(instance->layout, "no_apps", "*"); } -static void _update_all_slots(struct info *item) +/** + * @brief Updates all slots + * @param[in] instance Instance handle + */ +static void _update_all_slots(_instance_h instance) { _ENTER; int app_list_index = 0; int cur_slot_index = 0; - _reset_all_slots_info(item); + _reset_all_slots_info(instance); - for (app_list_index = 0, cur_slot_index = 0 ; app_list_index < ATW_SLOTS_MAX_COUNT; app_list_index++) { - if (_set_slot(item, item->content_app_list[app_list_index], cur_slot_index)) + for (app_list_index = 0, cur_slot_index = 0; + app_list_index < ATW_SLOTS_MAX_COUNT; + app_list_index++) { + if (_set_slot(instance, + instance->content_app_list[app_list_index], + cur_slot_index)) ++cur_slot_index; } if (cur_slot_index > 0) { - _destroy_add_apps_layout(item); - _set_main_layout_slot_count(item, cur_slot_index); + _destroy_add_apps_layout(instance); + _set_main_layout_slot_count(instance, cur_slot_index); } else { - _set_main_layout_add_apps_mode(item); - _create_add_apps_layout(item); + _set_main_layout_add_apps_mode(instance); + _create_add_apps_layout(instance); } _EXIT; } -static bool _create_win(struct info *info) +/** + * @brief Create instance window + * @param[in] instance Instance handle + * @return true on success, otherwise false + */ +static bool _create_win(_instance_h instance) { - int ret = widget_app_get_elm_win(info->context, &info->win); + int ret = widget_app_get_elm_win(instance->context, &instance->win); if (ret != WIDGET_ERROR_NONE) { _E("Get window failed. ret[%d]", ret); return false; } - evas_object_resize(info->win, info->w, info->h); - evas_object_show(info->win); + evas_object_resize(instance->win, instance->w, instance->h); + evas_object_show(instance->win); return true; } -static bool _create_bg(struct info *info) +/** + * @brief Create instance background + * @param[in] instance Instance handle + * @return true on success, otherwise false + */ +static bool _create_bg(_instance_h instance) { char full_path[ATW_PATH_MAX] = { 0 }; - info->bg = elm_layout_add(info->win); - if (!info->bg) { + instance->bg = elm_layout_add(instance->win); + if (!instance->bg) { _E("Create background layout failed"); return false; } apptray_wgt_utils_get_resource(ATW_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); + elm_layout_file_set(instance->bg, full_path, "dbox_bg"); + evas_object_size_hint_weight_set(instance->bg, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_resize(instance->bg, instance->w, instance->h); + evas_object_show(instance->bg); return true; } -static bool _create_main_ly(struct info *info) +/** + * @brief Create instance main layout + * @param[in] instance Instance handle + * @return true on success, otherwise false + */ +static bool _create_main_ly(_instance_h instance) { char full_path[ATW_PATH_MAX] = { 0 }; - info->layout = elm_layout_add(info->bg); - if (!info->layout) { + instance->layout = elm_layout_add(instance->bg); + if (!instance->layout) { _E("Create main layout failed"); return false; } apptray_wgt_utils_get_resource(ATW_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); - - elm_object_part_content_set(info->bg, "bg_swallow", info->layout); + elm_layout_file_set(instance->layout, full_path, "main_layout"); + elm_object_signal_callback_add(instance->layout, + "mouse_clicked", "slot_1", _slot_clicked_cb, instance); + elm_object_signal_callback_add(instance->layout, + "mouse_clicked", "slot_2", _slot_clicked_cb, instance); + elm_object_signal_callback_add(instance->layout, + "mouse_clicked", "slot_3", _slot_clicked_cb, instance); + elm_object_signal_callback_add(instance->layout, + "mouse_clicked", "slot_4", _slot_clicked_cb, instance); + evas_object_size_hint_weight_set(instance->layout, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(instance->layout); + + elm_object_part_content_set(instance->bg, "bg_swallow", instance->layout); return true; } -static void _update_widget_content_app_list(struct info *info) +/** + * @brief Updates widget content application list + * @param[in] instance Instance handle + */ +static void _update_widget_content_app_list(_instance_h instance) { char tmp[ATW_BUFF_SIZE_BIG] = { 0 }; int ret = WIDGET_ERROR_NONE; snprintf(tmp, sizeof(tmp), "%s %s %s %s", - (info->slot[0].appid ? info->slot[0].appid : "empty"), - (info->slot[1].appid ? info->slot[1].appid : "empty"), - (info->slot[2].appid ? info->slot[2].appid : "empty"), - (info->slot[3].appid ? info->slot[3].appid : "empty")); + (instance->slot[0].appid ? instance->slot[0].appid : "empty"), + (instance->slot[1].appid ? instance->slot[1].appid : "empty"), + (instance->slot[2].appid ? instance->slot[2].appid : "empty"), + (instance->slot[3].appid ? instance->slot[3].appid : "empty")); - bundle_del(info->content, ATW_BUNDLE_KEY_SHORTCUT_LIST); - bundle_add_str(info->content, ATW_BUNDLE_KEY_SHORTCUT_LIST, tmp); + bundle_del(instance->content, ATW_BUNDLE_KEY_SHORTCUT_LIST); + bundle_add_str(instance->content, ATW_BUNDLE_KEY_SHORTCUT_LIST, tmp); - ret = widget_app_context_set_content_info(info->context, info->content); + ret = widget_app_context_set_content_info(instance->context, + instance->content); if (ret != WIDGET_ERROR_NONE) { _E("Set widget content failed. ret[%d]", ret); } } -static struct info * _create_widget_instance_info(widget_context_h context, bundle *content, int w, int h) +/** + * @brief Creates new widget instance + * @param[in] context Widget context handle + * @param[in] content The data set for the previous status + * @param[in] w The pixel value for widget width + * @param[in] h The pixel value for widget height + * @return Instance handle on success, otherwise NULL + */ +static _instance_h _create_widget_instance(widget_context_h context, + bundle *content, int w, int h) { - struct info *instance_info = NULL; + _instance_h instance = NULL; const char *instance_id = NULL; int ret = 0; - instance_info = calloc(1, sizeof(struct info)); - if (!instance_info) { + instance = calloc(1, sizeof(struct _instance)); + if (!instance) { return NULL; } instance_id = widget_app_get_id(context); if (!instance_id) { _E("Get widget instance id failed"); - free(instance_info); + free(instance); return NULL; } - _D("Widget instance created with id [%s]", instance_info->id); + _D("Widget instance created with id [%s]", instance->id); - instance_info->context = context; - instance_info->id = strdup(instance_id); - instance_info->w = w; - instance_info->h = h; + instance->context = context; + instance->id = strdup(instance_id); + instance->w = w; + instance->h = h; if (content) { _D("Widget instance content exists"); - instance_info->content = bundle_dup(content); - bundle_del(instance_info->content, ATW_BUNDLE_KEY_WIDGET_INSTANCE_ID); + instance->content = bundle_dup(content); } else { _D("Widget instance content not exists. Create new one"); - instance_info->content = bundle_create(); + instance->content = bundle_create(); } - bundle_add_str(instance_info->content, ATW_BUNDLE_KEY_WIDGET_INSTANCE_ID, instance_id); _D("Set widget instance content"); - ret = widget_app_context_set_content_info(instance_info->context, instance_info->content); + ret = widget_app_context_set_content_info(instance->context, + instance->content); if (ret != WIDGET_ERROR_NONE) { _E("Set widget instance content failed. ret[%d]", ret); } - return instance_info; + return instance; } -static void _destroy_widget_instance_info(struct info **instance_info) +/** + * @brief Destroys new widget instance + * @param[in] instance Instance handle + */ +static void _destroy_widget_instance(_instance_h *instance) { - DEL_EVAS_OBJECT((*instance_info)->win); - free((*instance_info)->id); - _free_content_list((*instance_info)); - bundle_free((*instance_info)->content); + DEL_EVAS_OBJECT((*instance)->win); + free((*instance)->id); + _free_content_list((*instance)); + bundle_free((*instance)->content); - FREE((*instance_info)); + FREE((*instance)); } -static bool _create_ui_content(struct info *info) +/** + * @brief Creates widget instance UI content + * @param[in] instance Instance handle + * @return true on success, otherwise false + */ +static bool _create_ui_content(_instance_h instance) { - retv_if(!_create_win(info), false); - retv_if(!_create_bg(info), false); - retv_if(!_create_main_ly(info), false); + retv_if(!_create_win(instance), false); + retv_if(!_create_bg(instance), false); + retv_if(!_create_main_ly(instance), false); return true; } -static void _init_slots_data(struct info *info) +/** + * @brief Initialises instance slots + * @param[in] instance Instance handle + */ +static void _init_slots_data(_instance_h instance) { char *content_list = NULL; - bundle_get_str(info->content, ATW_BUNDLE_KEY_SHORTCUT_LIST, &content_list); + bundle_get_str(instance->content, + ATW_BUNDLE_KEY_SHORTCUT_LIST, + &content_list); if (!content_list) { _D("Default content"); - _update_content_list(info, ATW_DEFAULT_APP_ORDER); + _update_content_list(instance, ATW_DEFAULT_APP_ORDER); } else { _D("Content restored"); - _update_content_list(info, content_list); + _update_content_list(instance, content_list); } - _update_all_slots(info); - _update_widget_content_app_list(info); + _update_all_slots(instance); + _update_widget_content_app_list(instance); } -static void _update_slots_data(struct info *info, bundle *content) +/** + * @brief Updates instance slots with content + * @param[in] instance Instance handle + * @param[in] content Content + */ +static void _update_slots_data(_instance_h instance, bundle *content) { char *content_list = NULL; bundle_get_str(content, ATW_BUNDLE_KEY_SHORTCUT_LIST, &content_list); @@ -904,127 +1182,193 @@ static void _update_slots_data(struct info *info, bundle *content) _E("Application list is empty"); return; } - _update_content_list(info, content_list); - _update_all_slots(info); - _update_widget_content_app_list(info); + _update_content_list(instance, content_list); + _update_all_slots(instance); + _update_widget_content_app_list(instance); } -static int _widget_instance_create(widget_context_h context, bundle *content, int w, int h, void *user_data) +/** + * @brief Called when the native widget instance starts + * @param[in] context Widget context handle + * @param[in] content The data set for the previous status + * @param[in] w The pixel value for widget width + * @param[in] h The pixel value for widget height + * @param[in] user_data The user data passed from widget_app_class_create function (not used) + * @return #WIDGET_ERROR_NONE on success, otherwise an error code + */ +static int _widget_instance_create_cb(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); + _instance_h instance = _create_widget_instance(context, + content, w, h); + retv_if(!instance, WIDGET_ERROR_FAULT); - if (!_create_ui_content(instance_info)) { + if (!_create_ui_content(instance)) { _E("_create_ui_content() failed!"); - _destroy_widget_instance_info(&instance_info); + _destroy_widget_instance(&instance); return WIDGET_ERROR_FAULT; } - s_list = eina_list_append(s_list, instance_info); + s_instance_list = eina_list_append(s_instance_list, instance); - _init_slots_data(instance_info); + _init_slots_data(instance); _EXIT; return WIDGET_ERROR_NONE; } -static int _widget_instance_destroy(widget_context_h context, widget_app_destroy_type_e reason, bundle *content, void *user_data) +/** + * @brief Called before the native widget instance is destroyed + * @param[in] context The context of widget instance + * @param[in] reason The reason for destruction + * @param[in,out] content The data set to save + * @param[in] user_data The user data passed from widget_app_class_create function (not used) + * @return #WIDGET_ERROR_NONE on success, otherwise an error code on failure + */ +static int _widget_instance_destroy_cb(widget_context_h context, + widget_app_destroy_type_e reason, bundle *content, void *user_data) { _ENTER; - struct info *instance_info; + _instance_h instance; const char *id = widget_app_get_id(context); - instance_info = _find_instance_info(id); - if (!instance_info) { + instance = _find_instance(id); + if (!instance) { _E("id is invalid"); return WIDGET_ERROR_NOT_EXIST; } - s_list = eina_list_remove(s_list, instance_info); + s_instance_list = eina_list_remove(s_instance_list, instance); - _destroy_widget_instance_info(&instance_info); + _destroy_widget_instance(&instance); return WIDGET_ERROR_NONE; } -static int _widget_instance_pause(widget_context_h context, void *user_data) + +/** + * @brief Called when the native widget is invisible + * @param[in] context The context of widget instance + * @param[in] user_data The user data passed from widget_app_class_create function (not used) + * @return #WIDGET_ERROR_NONE on success, otherwise an error code on failure + */ +static int _widget_instance_pause_cb(widget_context_h context, void *user_data) { _ENTER; const char *id = widget_app_get_id(context); - _D("ID:%s",id); + _D("ID:%s", id); return WIDGET_ERROR_NONE; } -static int _widget_instance_resume(widget_context_h context, void *user_data) +/** + * @brief Called when the widget is visible + * @param[in] context The context of widget instance + * @param[in] user_data The user data passed from widget_app_class_create function (not used) + * @return #WIDGET_ERROR_NONE on success, otherwise an error code on failure + */ +static int _widget_instance_resume_cb(widget_context_h context, void *user_data) { _ENTER; const char *id = widget_app_get_id(context); - _D("ID:%s",id); + _D("ID:%s", id); return WIDGET_ERROR_NONE; } -static int _widget_instance_update(widget_context_h context, bundle *content, int force, void *user_data) +/** + * @brief Called when the event for updating native widget is received + * @param[in] context The context of widget instance + * @param[in] content The data set for updating this widget. + * @param[in] force Although the widget is paused, if it is TRUE, the widget can be updated + * @param[in] user_data The user data passed from widget_app_class_create function (not used) + * @return #WIDGET_ERROR_NONE on success, otherwise an error code on failure + */ +static int _widget_instance_update_cb(widget_context_h context, + bundle *content, int force, void *user_data) { _ENTER; - struct info *instance_info; + _instance_h instance; const char *id = widget_app_get_id(context); - _D("ID:%s",id); + _D("ID:%s", id); if (!content) { _E("Update content is NULL"); return WIDGET_ERROR_FAULT; } - instance_info = _find_instance_info(id); - if (!instance_info) { + instance = _find_instance(id); + if (!instance) { _E("id is invalid"); return WIDGET_ERROR_NOT_EXIST; } - _update_slots_data(instance_info, content); + _update_slots_data(instance, content); return WIDGET_ERROR_NONE; } -static int _widget_instance_resize(widget_context_h context, int w, int h, void *user_data) +/** + * @brief Called before the widget size is changed. + * @param[in] context The context of widget instance + * @param[in] w The pixel value for widget width + * @param[in] h The pixel value for widget height + * @param[in] user_data The user data passed from widget_app_class_create function (not used) + * @return #WIDGET_ERROR_NONE on success, otherwise an error code on failure + */ +static int _widget_instance_resize_cb(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"); + _instance_h instance = _find_instance(id); + if (!instance) { + _E("Instance 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; + evas_object_resize(instance->win, w, h); + evas_object_resize(instance->bg, w, h); + instance->w = w; + instance->h = h; _EXIT; return WIDGET_ERROR_NONE; } -void _package_manager_event_cb(const char *type, const char *package, package_manager_event_type_e event_type, - package_manager_event_state_e event_state, int progress, - package_manager_error_e error, void *user_data) +/** + * @brief Called when the package is installed, uninstalled, or updated, + * and the progress of the request to the package manager changes + * @param[in] type The type of the package to be installed, uninstalled, or updated + * @param[in] package The name of the package to be installed, uninstalled, or updated + * @param[in] event_type The type of the request to the package manager + * @param[in] event_state The current state of the request to the package manager + * @param[in] progress The progress for the request that is being processed by the package manager + * @param[in] error The error code when the package manager failed to process the request + * @param[in] user_data The user data passed from package_manager_set_event_cb() + */ +void _package_manager_event_cb(const char *type, const char *package, + package_manager_event_type_e event_type, + package_manager_event_state_e event_state, int progress, + package_manager_error_e error, void *user_data) { if (event_type == PACKAGE_MANAGER_EVENT_TYPE_UNINSTALL && event_state == PACKAGE_MANAGER_EVENT_STATE_STARTED) { - _check_slots_on_package_remove_callback(package); + _try_update_slots_on_package_remove_callback(package); } } +/** + * @brief Initializes package manager + */ static void _init_package_manager() { _deinit_package_manager(); @@ -1035,14 +1379,16 @@ static void _init_package_manager() return; } - ret = package_manager_set_event_status(s_pkg_manager, PACKAGE_MANAGER_STATUS_TYPE_UNINSTALL); + ret = package_manager_set_event_status(s_pkg_manager, + PACKAGE_MANAGER_STATUS_TYPE_UNINSTALL); if (ret != PACKAGE_MANAGER_ERROR_NONE) { _E("Package manager set event status failed. ret [%d]", ret); _deinit_package_manager(); return; } - ret = package_manager_set_event_cb(s_pkg_manager, _package_manager_event_cb, NULL); + ret = package_manager_set_event_cb(s_pkg_manager, + _package_manager_event_cb, NULL); if (ret != PACKAGE_MANAGER_ERROR_NONE) { _E("Package manager set event callback failed. ret [%d]", ret); _deinit_package_manager(); @@ -1050,6 +1396,9 @@ static void _init_package_manager() } } +/** + * @brief Deinitializes package manager + */ static void _deinit_package_manager() { if (s_pkg_manager) { @@ -1059,7 +1408,12 @@ static void _deinit_package_manager() } } -static widget_class_h _widget_app_create(void *user_data) +/** + * @brief Called when the widget application starts + * @param[in] user_data The user data passed from the callback registration function + * @return The object of widget class + */ +static widget_class_h _widget_app_create_cb(void *user_data) { _ENTER; @@ -1075,12 +1429,12 @@ static widget_class_h _widget_app_create(void *user_data) APP_EVENT_LANGUAGE_CHANGED, _widget_app_lang_changed, user_data); widget_instance_lifecycle_callback_s ops = { - .create = _widget_instance_create, - .destroy = _widget_instance_destroy, - .pause = _widget_instance_pause, - .resume = _widget_instance_resume, - .update = _widget_instance_update, - .resize = _widget_instance_resize, + .create = _widget_instance_create_cb, + .destroy = _widget_instance_destroy_cb, + .pause = _widget_instance_pause_cb, + .resume = _widget_instance_resume_cb, + .update = _widget_instance_update_cb, + .resize = _widget_instance_resize_cb, }; widget_class_h w_class = widget_app_class_create(ops, user_data); @@ -1091,7 +1445,11 @@ static widget_class_h _widget_app_create(void *user_data) return w_class; } -static void _widget_app_terminate(void *user_data) +/** + * @brief Called when the application's main loop exits + * @param[in] user_data The user data passed from the callback registration function + */ +static void _widget_app_terminate_cb(void *user_data) { _ENTER; @@ -1099,7 +1457,11 @@ static void _widget_app_terminate(void *user_data) _unregister_badge_changed_callback(); } -static void _process_widget_instance_lang_change_event(struct info *item) +/** + * @brief Processes widget instance language change callback + * @param[in] instance Instance handle + */ +static void _process_widget_instance_lang_change_event(_instance_h instance) { _ENTER; @@ -1109,13 +1471,13 @@ static void _process_widget_instance_lang_change_event(struct info *item) int i; for (i = 0; i < ATW_SLOTS_MAX_COUNT; i++) { - if (!IS_STRING_EMPTY(item->slot[i].appid) - && strcmp(item->slot[i].appid, "empty")) { + if (!IS_STRING_EMPTY(instance->slot[i].appid) + && strcmp(instance->slot[i].appid, "empty")) { ret = 0; app_info = NULL; label = NULL; - ret = app_info_create(item->slot[i].appid, &app_info); + ret = app_info_create(instance->slot[i].appid, &app_info); if (ret != APP_MANAGER_ERROR_NONE) { _E("get appinfo failed. ret[%d]", ret); continue; @@ -1123,29 +1485,36 @@ static void _process_widget_instance_lang_change_event(struct info *item) ret = app_info_get_label(app_info, &label); if (ret == APP_MANAGER_ERROR_NONE) { - free(item->slot[i].label); + free(instance->slot[i].label); if (label) { - item->slot[i].label = strdup(label); + instance->slot[i].label = strdup(label); } else { - item->slot[i].label = strdup(""); + instance->slot[i].label = strdup(""); } } - elm_object_part_text_set(item->slot[i].eo, "name", item->slot[i].label); + elm_object_part_text_set(instance->slot[i].eo, "name", + instance->slot[i].label); - _update_slot_access_object_info(&item->slot[i]); + _update_slot_access_object_info(&instance->slot[i]); free(label); app_info_destroy(app_info); } } - _update_add_apps_access_object_info(item); + _update_add_apps_access_object_info(instance); } -static void _widget_app_lang_changed(app_event_info_h event_info, void *user_data) +/** + * @brief Called when application got notification from system about language changed + * @param[in] event_info Event info + * @param[in] user_data User data (not used) + */ +static void _widget_app_lang_changed(app_event_info_h event_info, + void *user_data) { _ENTER; - struct info *item = NULL; + _instance_h instance = NULL; Eina_List *l = NULL; char *locale = NULL; @@ -1153,11 +1522,14 @@ static void _widget_app_lang_changed(app_event_info_h event_info, void *user_dat elm_language_set(locale); free(locale); - EINA_LIST_FOREACH(s_list, l, item) { - _process_widget_instance_lang_change_event(item); + EINA_LIST_FOREACH(s_instance_list, l, instance) { + _process_widget_instance_lang_change_event(instance); } } +/** + * @brief Application enter point + */ int main(int argc, char *argv[]) { _ENTER; @@ -1165,12 +1537,13 @@ int main(int argc, char *argv[]) widget_app_lifecycle_callback_s ops = { NULL }; int ret; - ops.create = _widget_app_create; - ops.terminate = _widget_app_terminate; + ops.create = _widget_app_create_cb; + ops.terminate = _widget_app_terminate_cb; ret = widget_app_main(argc, argv, &ops, NULL); if (ret != WIDGET_ERROR_NONE) { - dlog_print(DLOG_ERROR, LOG_TAG, "widget_app_main() is failed. err = %d", ret); + _E("widget_app_main() is failed. err = %d", ret); } + return ret; } diff --git a/apptray-widget/src/apptray_widget_accessibility_utils.c b/apptray-widget/src/apptray_widget_accessibility_utils.c index 092728d..a5c2ca9 100644 --- a/apptray-widget/src/apptray_widget_accessibility_utils.c +++ b/apptray-widget/src/apptray_widget_accessibility_utils.c @@ -18,11 +18,14 @@ #include "apptray_widget_log.h" -static Evas_Object *_register_access_object(Evas_Object *parent, Evas_Object *ly, const char *ly_part); +static Evas_Object *_register_access_object(Evas_Object *parent, + Evas_Object *ly, const char *ly_part); -static Evas_Object *_register_access_object(Evas_Object *parent, Evas_Object *ly, const char *ly_part) +static Evas_Object *_register_access_object(Evas_Object *parent, + Evas_Object *ly, const char *ly_part) { - Evas_Object *po = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(ly), ly_part); + Evas_Object *po = (Evas_Object *)edje_object_part_object_get( + elm_layout_edje_get(ly), ly_part); retv_if(!po, NULL); Evas_Object *ao = elm_access_object_register(po, parent); retv_if(!ao, NULL); @@ -30,7 +33,16 @@ static Evas_Object *_register_access_object(Evas_Object *parent, Evas_Object *ly return ao; } -Evas_Object *apptray_wgt_au_register_access_object(Evas_Object *parent, Evas_Object *ly, const char *ly_part) +static void _unregister_access_object(Evas_Object *ly, + const char *ly_part) +{ + Evas_Object *po = (Evas_Object *)edje_object_part_object_get( + elm_layout_edje_get(ly), ly_part); + elm_access_object_unregister(po); +} + +Evas_Object *apptray_wgt_au_register_access_object(Evas_Object *parent, + Evas_Object *ly, const char *ly_part) { retv_if(!parent, NULL); retv_if(!ly, NULL); @@ -39,9 +51,11 @@ Evas_Object *apptray_wgt_au_register_access_object(Evas_Object *parent, Evas_Obj return _register_access_object(parent, ly, ly_part); } -void apptray_wgt_au_unregister_access_object(Evas_Object *obj) +void apptray_wgt_au_unregister_access_object(Evas_Object *ly, + const char *ly_part) { - ret_if(!obj); + ret_if(!ly); + ret_if(!ly_part); - elm_access_object_unregister(obj); + _unregister_access_object(ly, ly_part); } diff --git a/apptray-widget/src/apptray_widget_utils.c b/apptray-widget/src/apptray_widget_utils.c index fdb3fbe..ba4e0c0 100755 --- a/apptray-widget/src/apptray_widget_utils.c +++ b/apptray-widget/src/apptray_widget_utils.c @@ -75,7 +75,7 @@ const char *apptray_wgt_utils_get_default_app_icon_path() return res_path; } -char *apptray_wgt_utils_get_count_str_from_icu(int num) +const char *apptray_wgt_utils_convert_int_to_icu_str(int value) { static char buff[ATW_BUFF_SIZE_MIDDLE] = { 0 }; char *locale = NULL; @@ -102,7 +102,7 @@ char *apptray_wgt_utils_get_count_str_from_icu(int num) } len = (int32_t) (sizeof(u_buff) / sizeof(u_buff[0])); - i18n_unumber_format(num_format, num, u_buff, len, NULL, &status); + i18n_unumber_format(num_format, value, u_buff, len, NULL, &status); i18n_ustring_copy_au(buff, u_buff); i18n_unumber_destroy(num_format); @@ -111,7 +111,7 @@ char *apptray_wgt_utils_get_count_str_from_icu(int num) return buff; fail: - snprintf(buff, sizeof(buff), "%d", num); + snprintf(buff, sizeof(buff), "%d", value); free(locale); |