#include "apps_data.h"
bool apps_db_create(void);
-bool apps_db_close();
bool apps_db_update(app_data_t *item);
bool apps_db_insert(app_data_t *item);
bool apps_db_delete(app_data_t *item);
#include "view.h"
#include "apps_data.h"
-#include "homescreen-efl.h"
+#include "homescreen-manager.h"
Evas_Object *apps_view_create(Evas_Object *parent);
void apps_view_init(void);
#include "cluster_data.h"
#include "cluster_page.h"
#include "view.h"
-#include "homescreen-efl.h"
+#include "homescreen-manager.h"
Evas_Object *cluster_view_create(Evas_Object *parent);
void cluster_view_init(void);
+++ /dev/null
-/*
- * Copyright 2012 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 __HOMESCREEN_EFL_H__
-#define __HOMESCREEN_EFL_H__
-
-#include <app.h>
-#include <Elementary.h>
-
-#if !defined(PACKAGE)
-#define PACKAGE "org.tizen.homescreen-efl"
-#endif
-
-typedef enum {
- HOMESCREEN_VIEW_HOME = 0,
- HOMESCREEN_VIEW_APPS,
- HOMESCREEN_VIEW_UNKNOWN,
-} homescreen_view_t;
-Evas_Object *homescreen_efl_get_win(void);
-Evas_Object *homescreen_efl_get_conformant(void);
-
-void homescreen_efl_hw_menu_key_release(void);
-void homescreen_efl_hw_home_key_release(void);
-void homescreen_efl_hw_back_key_release(void);
-
-void homescreen_efl_btn_show(homescreen_view_t view_t);
-void homescreen_efl_btn_hide(homescreen_view_t view_t);
-
-void homescreen_efl_get_access_menu_btn(Eina_List **list);
-void homescreen_efl_get_access_apps_btn(Eina_List **list);
-void homescreen_efl_get_access_home_btn(Eina_List **list);
-
-#endif
-
--- /dev/null
+/*
+ * Copyright 2012 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 __HOMESCREEN_EFL_H__
+#define __HOMESCREEN_EFL_H__
+
+#include <app.h>
+#include <Elementary.h>
+
+#if !defined(PACKAGE)
+#define PACKAGE "org.tizen.homescreen-efl"
+#endif
+
+typedef enum {
+ HOMESCREEN_VIEW_HOME = 0,
+ HOMESCREEN_VIEW_APPS,
+ HOMESCREEN_VIEW_UNKNOWN,
+} homescreen_view_t;
+
+bool app_create(void *data);
+void app_control(app_control_h app_control, void*data);
+void app_resume(void *data);
+void app_pause(void *data);
+void app_terminate(void *data);
+
+void app_lang_changed(app_event_info_h event_info, void *user_data);
+void app_orient_changed(app_event_info_h event_info, void *user_data);
+void app_region_changed(app_event_info_h event_info, void *user_data);
+void app_low_battery(app_event_info_h event_info, void *user_data);
+void app_low_memory(app_event_info_h event_info, void *user_data);
+
+Evas_Object *app_get_win(void);
+Evas_Object *app_get_conformant(void);
+
+void app_hw_menu_key_release(void);
+void app_hw_home_key_release(void);
+void app_hw_back_key_release(void);
+
+void app_btn_show(homescreen_view_t view_t);
+void app_btn_hide(homescreen_view_t view_t);
+
+void app_get_access_menu_btn(Eina_List **list);
+void app_get_access_apps_btn(Eina_List **list);
+void app_get_access_home_btn(Eina_List **list);
+
+#endif
+
profile = mobile-4.0
# C/CPP Sources
-USER_SRCS = src/apps_data.c test/unit/unit_test/unit_test_group_test/unit_test_group_result.c test/unit/unit_test/unit_test_main.c src/homescreen-efl.c src/popup.c test/unit/unit_test/unit_test_function_test/unit_test_unit_function.c test/unit/unit_group.c test/unit/unit_test/unit_test_group_test/unit_test_group.c src/cluster_page.c src/cluster_db.c test/feature_test/group_feature_all_page_back.c src/cluster_view.c test/feature_test/feature_test.c src/widget_viewer.c test/unit/unit_test/unit_test_function_test/unit_test_group_function.c test/unit/unit_test/unit_test_assert_test/unit_test_assert.c test/unit/unit_test/unit_test_function_test/unit_test_log_buf_function.c src/page_indicator.c src/cluster_data.c src/add_widget_viewer/add_widget_data.c src/conf.c test/unit/unit_assert.c test/feature_test/group_feature_scroll_page_after_adding_widget.c test/unit/unit_test/unit_test_append_log/unit_test_append_log.c src/apps_view.c src/menu.c test/unit/unit_log_buf.c test/unit/unit_result.c src/hw_key.c src/screen_reader_handler.c test/unit/unit_test/unit_test_function_test/unit_test_function.c test/feature_test/group_feature_scroll_to_page.c src/add_widget_viewer/add_widget_viewer.c src/apps_db.c src/apps_package_manager.c test/test_main.c src/util.c test/unit/unit.c
+USER_SRCS = test/function_test/group_function_apps_db.c test/function_test/function_test.c src/apps_data.c test/unit/unit_test/unit_test_group_test/unit_test_group_result.c test/unit/unit_test/unit_test_main.c src/popup.c test/unit/unit_test/unit_test_function_test/unit_test_unit_function.c test/unit/unit_group.c test/unit/unit_test/unit_test_group_test/unit_test_group.c src/cluster_page.c src/cluster_db.c test/feature_test/group_feature_all_page_back.c src/cluster_view.c test/feature_test/feature_test.c src/widget_viewer.c test/unit/unit_test/unit_test_function_test/unit_test_group_function.c src/main.c test/unit/unit_test/unit_test_assert_test/unit_test_assert.c test/unit/unit_test/unit_test_function_test/unit_test_log_buf_function.c src/page_indicator.c src/cluster_data.c src/add_widget_viewer/add_widget_data.c src/conf.c test/unit/unit_assert.c test/feature_test/group_feature_scroll_page_after_adding_widget.c test/unit/unit_test/unit_test_append_log/unit_test_append_log.c src/apps_view.c src/homescreen-manager.c src/menu.c test/unit/unit_log_buf.c test/unit/unit_result.c src/hw_key.c src/screen_reader_handler.c test/unit/unit_test/unit_test_function_test/unit_test_function.c test/feature_test/group_feature_scroll_to_page.c src/add_widget_viewer/add_widget_viewer.c src/apps_db.c src/apps_package_manager.c test/test_main.c src/util.c test/unit/unit.c
# EDC Sources
USER_EDCS =
return storage_type;
}
+
+#include "test.h"
+#if TEST_MODE
+void __t__apps_data_item_free(void *item)
+{
+ __apps_data_item_free((app_data_t*)item);
+}
+#endif
+
#include "apps_data.h"
#include "util.h"
-
#define APPS_DB_NAME ".apps-data.db"
#define QUERY_MAXLEN 4096
#define SELECT_APP_ITEM "SELECT * FROM apps WHERE type=0 AND isFolder=0;"
static bool __apps_db_open(void);
+static bool __apps_db_close(void);
bool apps_db_create(void)
{
return true;
}
-bool apps_db_close()
-{
- if (apps_db) {
- sqlite3_exec(apps_db, "COMMIT TRANSACTION", NULL, NULL, NULL);
- sqlite3_close(apps_db);
- apps_db = NULL;
- }
- return true;
-}
-
bool apps_db_get_list(Eina_List **apps)
{
sqlite3_stmt *stmt;
}
sqlite3_step(stmt);
sqlite3_finalize(stmt);
- apps_db_close();
+ __apps_db_close();
return true;
}
sqlite3_finalize(stmt);
item->db_id = (int)sqlite3_last_insert_rowid(apps_db);
- apps_db_close();
+ __apps_db_close();
return true;
}
sqlite3_step(stmt);
sqlite3_finalize(stmt);
- apps_db_close();
+ __apps_db_close();
return true;
}
sqlite3_step(stmt);
sqlite3_finalize(stmt);
- apps_db_close();
+ __apps_db_close();
return true;
}
sqlite3_step(stmt);
sqlite3_finalize(stmt);
- apps_db_close();
+ __apps_db_close();
return true;
}
-bool __apps_db_open()
+static bool __apps_db_open(void)
{
if (!apps_db) {
int ret;
}
return true;
}
+
+static bool __apps_db_close(void)
+{
+ if (apps_db) {
+ sqlite3_exec(apps_db, "COMMIT TRANSACTION", NULL, NULL, NULL);
+ sqlite3_close(apps_db);
+ apps_db = NULL;
+ }
+ return true;
+}
+
+#include "test.h"
+#if TEST_MODE
+bool __t__apps_db_open(void)
+{
+ return __apps_db_open();
+}
+
+bool __t__apps_db_close(void)
+{
+ return __apps_db_close();
+}
+#endif
+
#include "edc_conf.h"
#include "util.h"
#include "page_indicator.h"
-#include "homescreen-efl.h"
+#include "homescreen-manager.h"
#include "apps_data.h"
#include "apps_db.h"
#include "menu.h"
__apps_view_get_access_page_icon_delete_button(list);
if (apps_view_s.view_state == VIEW_STATE_NORMAL) {
- homescreen_efl_get_access_menu_btn(list);
- homescreen_efl_get_access_home_btn(list);
+ app_get_access_menu_btn(list);
+ app_get_access_home_btn(list);
}
}
elm_win_resize_object_add(win, apps_view_s.bg);
evas_object_show(apps_view_s.bg);
- Evas_Object *rect = evas_object_rectangle_add(homescreen_efl_get_win());
+ Evas_Object *rect = evas_object_rectangle_add(app_get_win());
evas_object_color_set(rect, 0, 0, 0, 0);
evas_object_size_hint_min_set(rect, apps_view_s.width, apps_view_s.height);
evas_object_size_hint_max_set(rect, apps_view_s.width, apps_view_s.height);
elm_object_part_content_set(apps_view_s.bg, SIZE_SETTER, rect);
evas_object_show(rect);
- apps_view_s.event_block_bg = evas_object_rectangle_add(homescreen_efl_get_win());
+ apps_view_s.event_block_bg = evas_object_rectangle_add(app_get_win());
evas_object_color_set(apps_view_s.event_block_bg, 0, 0, 0, 0);
evas_object_resize(apps_view_s.event_block_bg, apps_view_s.width, CLUSTER_VIEW_H + INDICATOR_H);
evas_object_move(apps_view_s.event_block_bg, 0, 0);
evas_object_size_hint_weight_set(page_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_resize(page_ly, APPS_VIEW_W, APPS_VIEW_H);
- Evas_Object *rect = evas_object_rectangle_add(homescreen_efl_get_win());
+ Evas_Object *rect = evas_object_rectangle_add(app_get_win());
evas_object_color_set(rect, 255, 255, 255, 0);
evas_object_size_hint_min_set(rect, APPS_VIEW_W, APPS_VIEW_H);
evas_object_size_hint_max_set(rect, APPS_VIEW_W, APPS_VIEW_H);
void apps_view_set_state(view_state_t state)
{
if (state == VIEW_STATE_EDIT) {
- homescreen_efl_btn_hide(HOMESCREEN_VIEW_APPS);
+ app_btn_hide(HOMESCREEN_VIEW_APPS);
if (apps_view_s.view_state != VIEW_STATE_CHOOSER)
elm_object_signal_emit(apps_view_s.bg, SIGNAL_EDIT_MODE_ON_ANI, SIGNAL_SOURCE);
elm_object_signal_emit(apps_view_s.chooser_btn, SIGNAL_CHOOSER_BUTTON_HIDE, SIGNAL_SOURCE);
} else if (state == VIEW_STATE_CHOOSER) {
- homescreen_efl_btn_hide(HOMESCREEN_VIEW_APPS);
- elm_win_indicator_mode_set(homescreen_efl_get_win(), ELM_WIN_INDICATOR_HIDE);
+ app_btn_hide(HOMESCREEN_VIEW_APPS);
+ elm_win_indicator_mode_set(app_get_win(), ELM_WIN_INDICATOR_HIDE);
if (apps_view_s.view_state != VIEW_STATE_EDIT)
elm_object_signal_emit(apps_view_s.bg, SIGNAL_EDIT_MODE_ON_ANI, SIGNAL_SOURCE);
elm_object_signal_emit(apps_view_s.chooser_btn, SIGNAL_CHOOSER_BUTTON_SHOW, SIGNAL_SOURCE);
} else if (state == VIEW_STATE_NORMAL) {
- homescreen_efl_btn_show(HOMESCREEN_VIEW_APPS);
- elm_win_indicator_mode_set(homescreen_efl_get_win(), ELM_WIN_INDICATOR_SHOW);
+ app_btn_show(HOMESCREEN_VIEW_APPS);
+ elm_win_indicator_mode_set(app_get_win(), ELM_WIN_INDICATOR_SHOW);
Evas_Object *edje = NULL;
edje = elm_layout_edje_get(apps_view_s.bg);
apps_view_s.opened_folder = item;
- apps_view_s.folder_popup_ly = elm_layout_add(homescreen_efl_get_conformant());
+ apps_view_s.folder_popup_ly = elm_layout_add(app_get_conformant());
elm_layout_file_set(apps_view_s.folder_popup_ly , edj_path, GROUP_APPS_FOLDER_POPUP_LY);
evas_object_size_hint_weight_set(apps_view_s.folder_popup_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_resize(apps_view_s.folder_popup_ly, apps_view_s.width, apps_view_s.height);
snprintf(edj_path, sizeof(edj_path), "%s", util_get_res_file_path(EDJE_DIR"/apps_chooser_btn.edj"));
- apps_view_s.chooser_btn = elm_layout_add(homescreen_efl_get_win());
+ apps_view_s.chooser_btn = elm_layout_add(app_get_win());
elm_layout_file_set(apps_view_s.chooser_btn, edj_path, GROUP_APPS_CHOOSER_BTN_LY);
evas_object_size_hint_weight_set(apps_view_s.chooser_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_resize(apps_view_s.chooser_btn, apps_view_s.width, apps_view_s.height);
#include <efl_extension.h>
-#include "homescreen-efl.h"
+#include "homescreen-manager.h"
#include "cluster_view.h"
#include "conf.h"
#include "edc_conf.h"
}
if (state == VIEW_STATE_EDIT) {
- homescreen_efl_btn_hide(HOMESCREEN_VIEW_HOME);
+ app_btn_hide(HOMESCREEN_VIEW_HOME);
Eina_List *data_list = cluster_data_get_widget_list();
Eina_List *find_list = NULL;
}
} else if (state == VIEW_STATE_NORMAL) {
if (cluster_view_s.view_state == VIEW_STATE_EDIT) {
- homescreen_efl_btn_show(HOMESCREEN_VIEW_HOME);
+ app_btn_show(HOMESCREEN_VIEW_HOME);
if (cluster_view_s.picked_widget) {
cluster_page_t *page = (cluster_page_t *)eina_list_nth(cluster_view_s.page_list, cluster_view_s.picked_widget->page_idx);
} else if (cluster_view_s.view_state == VIEW_STATE_ADD_VIEWER) {
add_widget_viewer_win_destroy();
} else if (cluster_view_s.view_state == VIEW_STATE_ALL_PAGE) {
- elm_win_indicator_mode_set(homescreen_efl_get_win(), ELM_WIN_INDICATOR_SHOW);
- homescreen_efl_btn_show(HOMESCREEN_VIEW_HOME);
+ elm_win_indicator_mode_set(app_get_win(), ELM_WIN_INDICATOR_SHOW);
+ app_btn_show(HOMESCREEN_VIEW_HOME);
page_indicator_show(cluster_view_s.indicator);
evas_object_hide(cluster_view_s.scroller);
} else if (state == VIEW_STATE_ADD_VIEWER) {
add_widget_viewer_win_create();
} else if (state == VIEW_STATE_ALL_PAGE) {
- elm_win_indicator_mode_set(homescreen_efl_get_win(), ELM_WIN_INDICATOR_HIDE);
- homescreen_efl_btn_hide(HOMESCREEN_VIEW_HOME);
+ elm_win_indicator_mode_set(app_get_win(), ELM_WIN_INDICATOR_HIDE);
+ app_btn_hide(HOMESCREEN_VIEW_HOME);
page_indicator_hide(cluster_view_s.indicator);
__cluster_view_create_all_page();
cluster_page_t *page = (cluster_page_t *)eina_list_nth(cluster_view_s.page_list, cluster_view_s.current_page);
if (page) cluster_page_get_access_widget_list(page, list, EINA_FALSE);
- homescreen_efl_get_access_menu_btn(list);
- homescreen_efl_get_access_apps_btn(list);
+ app_get_access_menu_btn(list);
+ app_get_access_apps_btn(list);
} else if (cluster_view_s.view_state == VIEW_STATE_EDIT) {
cluster_page_t *page = (cluster_page_t *)eina_list_nth(cluster_view_s.page_list, cluster_view_s.current_page);
if (page) cluster_page_get_access_widget_list(page, list, EINA_TRUE);
static void __cluster_view_create_all_page(void)
{
- cluster_view_s.allpage = elm_layout_add(homescreen_efl_get_win());
+ cluster_view_s.allpage = elm_layout_add(app_get_win());
elm_layout_file_set(cluster_view_s.allpage, util_get_res_file_path(EDJE_DIR"/cluster_allpage.edj"), GROUP_CLUSTER_ALLPAGE_LY);
evas_object_size_hint_align_set(cluster_view_s.allpage, EVAS_HINT_FILL, EVAS_HINT_FILL);
#include "conf.h"
#include "edc_conf.h"
#include "util.h"
-#include "homescreen-efl.h"
+#include "homescreen-manager.h"
#include "apps_view.h"
#include "cluster_view.h"
#include "hw_key.h"
.animator = NULL,
};
-static void __homescreen_efl_get_window_size(Evas_Object *win);
-static void __homescreen_efl_set_wallpaper(void);
-static void __homescreen_efl_set_conformant(void);
-static void __homescreen_efl_create_home_btn(void);
+static void __get_window_size(Evas_Object *win);
+static void __set_wallpaper(void);
+static bool __create_view(void);
+static void __set_conformant(void);
+static void __create_home_btn(void);
+static Eina_Bool __init_view(void *data);
-static void __homescreen_efl_home_bg_changed_cb(system_settings_key_e key, void *data);
-static void __homescreen_efl_menu_btn_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
-static void __homescreen_efl_home_btn_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
+bool app_create(void *data)
+{
+ elm_config_accel_preference_set("3d");
+ ecore_animator_frametime_set(FRAMES_PER_SECOND);
+
+ feedback_initialize();
+
+ hw_key_register();
+
+ main_info.win = elm_win_util_standard_add(PACKAGE, PACKAGE);
+ __get_window_size(main_info.win);
+
+ __set_wallpaper();
+ evas_object_show(main_info.win);
+
+ __create_view();
+
+ __set_conformant();
+ __create_home_btn();
+
+ main_info.view_type = HOMESCREEN_VIEW_HOME;
-static void __homescreen_efl_change_view(void);
-static Eina_Bool __homescreen_efl_show_apps_anim(void *data, double pos);
-static Eina_Bool __homescreen_efl_show_cluster_anim(void *data, double pos);
+ ecore_timer_add(HOME_LOADING_TIME, __init_view, NULL);
-static bool __homescreen_efl_create_view(void);
-static Eina_Bool __homescreen_efl_init_view(void *data);
+ return true;
+}
-void __homescreen_efl_lang_changed_cb(app_event_info_h event_info, void *user_data)
+#define APP_CONTROL_HOME_OP_KEY "__HOME_OP__"
+#define APP_CONTROL_HOME_OP_VAL_LAUNCH_BY_HOME_KEY "__LAUNCH_BY_HOME_KEY__"
+static void _print_app_control_err_to_str(app_control_error_e err);
+
+void app_control(app_control_h app_control, void*data)
+{
+ app_control_error_e ret = 0;
+ char *operation = NULL;
+
+ if (!app_control) {
+ LOGE("app_control is NULL");
+ return;
+ }
+
+ ret = app_control_get_operation(app_control, &operation);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ _print_app_control_err_to_str(ret);
+ return;
+ }
+
+ if (!strncmp(operation, APP_CONTROL_OPERATION_DEFAULT, strlen(operation))) {
+ char *value = NULL;
+ ret = app_control_get_extra_data(app_control, APP_CONTROL_HOME_OP_KEY, &value);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ _print_app_control_err_to_str(ret);
+ free(operation);
+ return;
+ }
+
+ if (value && !strncmp(value, APP_CONTROL_HOME_OP_VAL_LAUNCH_BY_HOME_KEY, strlen(value))) {
+ /*
+ * If the homescreen is launched by home key,
+ * show the first view of the homescreen.
+ */
+ LOGD("launched by home key");
+ if (menu_is_show()) {
+ menu_hide();
+ } else if (popup_is_show()) {
+ popup_hide();
+ }
+ app_hw_home_key_release();
+ }
+
+ free(value);
+ }
+
+ free(operation);
+}
+
+void app_resume(void *data)
+{
+}
+
+void app_pause(void *data)
+{
+
+}
+
+void app_terminate(void *data)
+{
+ apps_view_app_terminate();
+ cluster_view_app_terminate();
+ hw_key_unregister();
+ feedback_deinitialize();
+}
+
+void app_lang_changed(app_event_info_h event_info, void *user_data)
{
menu_hide();
cluster_view_lang_changed(main_info.view_type);
}
}
-void __homescreen_efl_orient_changed_cb(app_event_info_h event_info, void *user_data)
+void app_orient_changed(app_event_info_h event_info, void *user_data)
{
LOGD("called");
}
-void __homescreen_efl_region_changed_cb(app_event_info_h event_info, void *user_data)
+void app_region_changed(app_event_info_h event_info, void *user_data)
{
LOGD("called");
}
-void __homescreen_efl_low_battery_cb(app_event_info_h event_info, void *user_data)
+void app_low_battery(app_event_info_h event_info, void *user_data)
{
LOGD("called");
}
-void __homescreen_efl_low_memory_cb(app_event_info_h event_info, void *user_data)
+void app_low_memory(app_event_info_h event_info, void *user_data)
{
LOGD("called");
}
-bool __homescreen_efl_app_create_cb(void *data)
+Evas_Object * app_get_win(void)
{
- elm_config_accel_preference_set("3d");
- ecore_animator_frametime_set(FRAMES_PER_SECOND);
+ return main_info.win;
+}
- feedback_initialize();
+Evas_Object * app_get_conformant(void)
+{
+ return main_info.conformant;
+}
- hw_key_register();
+static void __app_change_view(void);
- main_info.win = elm_win_util_standard_add(PACKAGE, PACKAGE);
- __homescreen_efl_get_window_size(main_info.win);
+void app_hw_menu_key_release(void)
+{
+ if (main_info.view_type == HOMESCREEN_VIEW_HOME) {
+ cluster_view_hw_menu_key();
+ } else if (main_info.view_type == HOMESCREEN_VIEW_APPS) {
+ apps_view_hw_menu_key();
+ }
+}
- __homescreen_efl_set_wallpaper();
- evas_object_show(main_info.win);
+void app_hw_home_key_release(void)
+{
+ if (main_info.view_type == HOMESCREEN_VIEW_APPS) {
+ if (apps_view_hw_home_key() == false)
+ __app_change_view();
+ }
+
+ cluster_view_hw_home_key();
+}
+
+void app_hw_back_key_release(void)
+{
+ if (main_info.view_type == HOMESCREEN_VIEW_HOME) {
+ if (cluster_view_hw_back_key() == false) {
+ __app_change_view();
+ }
+ } else if (main_info.view_type == HOMESCREEN_VIEW_APPS) {
+ if (apps_view_hw_back_key() == false) {
+ __app_change_view();
+ }
+ }
+}
- __homescreen_efl_create_view();
+void app_btn_show(homescreen_view_t view_t)
+{
+ LOGD("state %d", view_t);
+ switch (view_t) {
+ case HOMESCREEN_VIEW_HOME:
+ elm_object_signal_emit(main_info.btn_layout, SIGNAL_BTN_SHOW_HOME_STATE, SIGNAL_SOURCE);
+ break;
+ case HOMESCREEN_VIEW_APPS:
+ elm_object_signal_emit(main_info.btn_layout, SIGNAL_BTN_SHOW_APPS_STATE, SIGNAL_SOURCE);
+ break;
+ default:
+ break;
+ }
+}
- __homescreen_efl_set_conformant();
- __homescreen_efl_create_home_btn();
+void app_btn_hide(homescreen_view_t view_t)
+{
+ LOGD("state %d", view_t);
+ switch (view_t) {
+ case HOMESCREEN_VIEW_HOME:
+ elm_object_signal_emit(main_info.btn_layout, SIGNAL_BTN_HIDE_HOME_STATE, SIGNAL_SOURCE);
+ break;
+ case HOMESCREEN_VIEW_APPS:
+ elm_object_signal_emit(main_info.btn_layout, SIGNAL_BTN_HIDE_APPS_STATE, SIGNAL_SOURCE);
+ break;
+ default:
+ break;
+ }
+}
- ecore_timer_add(HOME_LOADING_TIME, __homescreen_efl_init_view, NULL);
+static void __app_menu_btn_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void __app_home_btn_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
- return true;
+void app_get_access_menu_btn(Eina_List **list)
+{
+ Evas_Object *menu_btn = NULL;
+ access_info_t *btn_info = NULL;
+ char buf[STR_MAX] = { 0, };
+
+ menu_btn = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(main_info.btn_layout), MENU_BUTTON);
+ btn_info = (access_info_t *)malloc(sizeof(access_info_t));
+ btn_info->is_access_obj = EINA_FALSE;
+ btn_info->target = menu_btn;
+ btn_info->parent = main_info.btn_layout;
+ btn_info->name = strdup(_("IDS_HS_BODY_MENU"));
+ snprintf(buf, sizeof(buf), "%s, %s", _("IDS_ACCS_BODY_BUTTON_TTS"), _("IDS_ST_BODY_DOUBLE_TAP_TO_OPEN_THE_MENU_T_TTS"));
+ btn_info->description = strdup(buf);
+ btn_info->role = ELM_ATSPI_ROLE_UNKNOWN;
+ btn_info->clicked_cb = __app_menu_btn_clicked;
+ btn_info->cb_data = NULL;
+ btn_info->priority = ACCESS_PRIORITY_MENUBUTTON;
+
+ *list = eina_list_append(*list, btn_info);
+}
+
+void app_get_access_apps_btn(Eina_List **list)
+{
+ Evas_Object *apps_btn = NULL;
+ access_info_t *btn_info = NULL;
+ char buf[STR_MAX] = { 0, };
+
+ apps_btn = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(main_info.btn_layout), HOME_BUTTON);
+ btn_info = (access_info_t *)malloc(sizeof(access_info_t));
+ btn_info->is_access_obj = EINA_FALSE;
+ btn_info->target = apps_btn;
+ btn_info->parent = main_info.btn_layout;
+ btn_info->name = strdup(_("IDS_AT_TAB4_ALL_APPS"));
+ snprintf(buf, sizeof(buf), "%s, %s", _("IDS_ACCS_BODY_BUTTON_TTS"), _("IDS_HS_TBBODY_DOUBLE_TAP_TO_GO_TO_APPS_SCREEN"));
+ btn_info->description = strdup(buf);
+ btn_info->role = ELM_ATSPI_ROLE_UNKNOWN;
+ btn_info->clicked_cb = __app_home_btn_clicked;
+ btn_info->cb_data = NULL;
+ btn_info->priority = ACCESS_PRIORITY_APPSBUTTON;
+
+ *list = eina_list_append(*list, btn_info);
+}
+
+void app_get_access_home_btn(Eina_List **list)
+{
+ Evas_Object *home_btn = NULL;
+ access_info_t *btn_info = NULL;
+ char buf[STR_MAX] = { 0, };
+
+ home_btn = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(main_info.btn_layout), HOME_BUTTON);
+ btn_info = (access_info_t *)malloc(sizeof(access_info_t));
+ btn_info->is_access_obj = EINA_FALSE;
+ btn_info->target = home_btn;
+ btn_info->parent = main_info.btn_layout;
+ btn_info->name = strdup(_("IDS_HS_TBOPT_HOME_M_HOMESCREEN"));
+ snprintf(buf, sizeof(buf), "%s, %s", _("IDS_ACCS_BODY_BUTTON_TTS"), _("IDS_HS_TBBODY_DOUBLE_TAP_TO_GO_TO_HOME_SCREEN"));
+ btn_info->description = strdup(buf);
+ btn_info->role = ELM_ATSPI_ROLE_UNKNOWN;
+ btn_info->clicked_cb = __app_home_btn_clicked;
+ btn_info->cb_data = NULL;
+ btn_info->priority = ACCESS_PRIORITY_HOMEBUTTON;
+
+ *list = eina_list_append(*list, btn_info);
}
static void _print_app_control_err_to_str(app_control_error_e err)
LOGE("app_control error(%d) : %s", err, err_str);
}
-#define APP_CONTROL_HOME_OP_KEY "__HOME_OP__"
-#define APP_CONTROL_HOME_OP_VAL_LAUNCH_BY_HOME_KEY "__LAUNCH_BY_HOME_KEY__"
-void __homescreen_efl_app_control_cb(app_control_h app_control, void*data)
-{
- app_control_error_e ret = 0;
- char *operation = NULL;
-
- if (!app_control) {
- LOGE("app_control is NULL");
- return;
- }
-
- ret = app_control_get_operation(app_control, &operation);
- if (ret != APP_CONTROL_ERROR_NONE) {
- _print_app_control_err_to_str(ret);
- return;
- }
-
- if (!strncmp(operation, APP_CONTROL_OPERATION_DEFAULT, strlen(operation))) {
- char *value = NULL;
- ret = app_control_get_extra_data(app_control, APP_CONTROL_HOME_OP_KEY, &value);
- if (ret != APP_CONTROL_ERROR_NONE) {
- _print_app_control_err_to_str(ret);
- free(operation);
- return;
- }
-
- if (value && !strncmp(value, APP_CONTROL_HOME_OP_VAL_LAUNCH_BY_HOME_KEY, strlen(value))) {
- /*
- * If the homescreen is launched by home key,
- * show the first view of the homescreen.
- */
- LOGD("launched by home key");
- if (menu_is_show()) {
- menu_hide();
- } else if (popup_is_show()) {
- popup_hide();
- }
- homescreen_efl_hw_home_key_release();
- }
-
- free(value);
- }
-
- free(operation);
-}
-
-void __homescreen_efl_app_pause_cb(void *data)
-{
-
-}
-
-void __homescreen_efl_app_resume_cb(void *data)
-{
-}
-
-void __homescreen_efl_app_terminate_cb(void *data)
-{
- apps_view_app_terminate();
- cluster_view_app_terminate();
- hw_key_unregister();
- feedback_deinitialize();
-}
-
-#if (!TEST_MODE)
-int main(int argc, char *argv[])
-{
- LOGD("Starting homescreen-efl");
-
- int ret = 0;
- ui_app_lifecycle_callback_s event_callback = {0,};
- app_event_handler_h handlers[5] = {NULL, };
-
- event_callback.create = __homescreen_efl_app_create_cb;
- event_callback.terminate = __homescreen_efl_app_terminate_cb;
- event_callback.pause = __homescreen_efl_app_pause_cb;
- event_callback.resume = __homescreen_efl_app_resume_cb;
- event_callback.app_control = __homescreen_efl_app_control_cb;
-
- ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, __homescreen_efl_low_battery_cb, NULL);
- ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, __homescreen_efl_low_memory_cb, NULL);
- ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, __homescreen_efl_orient_changed_cb, NULL);
- ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, __homescreen_efl_lang_changed_cb, NULL);
- ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, __homescreen_efl_region_changed_cb, NULL);
-
- ret = ui_app_main(argc, argv, &event_callback, NULL);
- if (ret != APP_ERROR_NONE)
- LOGE("ui_app_main() is failed. err = %d", ret);
-
- main_info.view_type = HOMESCREEN_VIEW_HOME;
-
- return ret;
-}
-#endif
-
-static void __homescreen_efl_get_window_size(Evas_Object *win)
+static void __get_window_size(Evas_Object *win)
{
elm_win_screen_size_get(win, NULL, NULL, &main_info.root_width, &main_info.root_height);
LOGD("Width: [%d], Height: [%d]", main_info.root_width, main_info.root_height);
}
-static void __homescreen_efl_set_wallpaper(void)
+static void __home_bg_changed_cb(system_settings_key_e key, void *data)
+{
+ __set_wallpaper();
+}
+
+static void __set_wallpaper(void)
{
char *buf = NULL;
int ret = -1;
elm_win_resize_object_add(main_info.win, main_info.main_layout);
evas_object_show(main_info.main_layout);
- system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, __homescreen_efl_home_bg_changed_cb, NULL);
+ system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, __home_bg_changed_cb, NULL);
}
if (main_info.bg != NULL) {
if (buf) free(buf);
}
-static void __homescreen_efl_home_bg_changed_cb(system_settings_key_e key, void *data)
-{
- __homescreen_efl_set_wallpaper();
-}
-static void __homescreen_efl_set_conformant(void)
+static void __set_conformant(void)
{
elm_win_conformant_set(main_info.win, EINA_TRUE);
evas_object_show(main_info.conformant);
}
-static void __homescreen_efl_create_home_btn(void)
-{
- char edj_path[PATH_MAX] = {0, };
-
- snprintf(edj_path, sizeof(edj_path), "%s", util_get_res_file_path(EDJE_DIR"/home_btn.edj"));
-
- main_info.btn_layout = elm_layout_add(main_info.win);
- elm_layout_file_set(main_info.btn_layout, edj_path, GROUP_HOME_BTN_LY);
- evas_object_size_hint_weight_set(main_info.btn_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(main_info.win, main_info.btn_layout);
-
- evas_object_show(main_info.btn_layout);
-
- elm_object_signal_callback_add(main_info.btn_layout, SIGNAL_MENU_BTN_CLICKED, SIGNAL_SOURCE, __homescreen_efl_menu_btn_clicked, NULL);
- elm_object_signal_callback_add(main_info.btn_layout, SIGNAL_HOME_BTN_CLICKED, SIGNAL_SOURCE, __homescreen_efl_home_btn_clicked, NULL);
-}
-
-static void __homescreen_efl_menu_btn_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
+static void __app_menu_btn_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
{
feedback_play_type(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_TAP);
- homescreen_efl_hw_menu_key_release();
+ app_hw_menu_key_release();
}
-static void __homescreen_efl_home_btn_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
+static void __app_home_btn_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
{
feedback_play_type(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_TAP);
- __homescreen_efl_change_view();
+ __app_change_view();
}
-static void __homescreen_efl_change_view(void)
+static void __create_home_btn(void)
{
- if (main_info.animator != NULL) {
- LOGE("main_info.animator != NULL");
- return ;
- }
+ char edj_path[PATH_MAX] = {0, };
- if (main_info.view_type == HOMESCREEN_VIEW_APPS) {
- apps_view_hide();
- main_info.animator = ecore_animator_timeline_add(HOME_ANIMATION_TIME, __homescreen_efl_show_cluster_anim, NULL);
+ snprintf(edj_path, sizeof(edj_path), "%s", util_get_res_file_path(EDJE_DIR"/home_btn.edj"));
- elm_object_signal_emit(main_info.btn_layout, SIGNAL_HOME_BTN_ICON_HIDE, SIGNAL_SOURCE);
- elm_object_signal_emit(main_info.btn_layout, SIGNAL_APPS_BTN_ICON_SHOW, SIGNAL_SOURCE);
- main_info.view_type = HOMESCREEN_VIEW_HOME;
- screen_reader_update(HOME);
- } else if (main_info.view_type == HOMESCREEN_VIEW_HOME) {
- cluster_view_hide();
- main_info.animator = ecore_animator_timeline_add(HOME_ANIMATION_TIME, __homescreen_efl_show_apps_anim, NULL);
+ main_info.btn_layout = elm_layout_add(main_info.win);
+ elm_layout_file_set(main_info.btn_layout, edj_path, GROUP_HOME_BTN_LY);
+ evas_object_size_hint_weight_set(main_info.btn_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(main_info.win, main_info.btn_layout);
- elm_object_signal_emit(main_info.btn_layout, SIGNAL_APPS_BTN_ICON_HIDE, SIGNAL_SOURCE);
- elm_object_signal_emit(main_info.btn_layout, SIGNAL_HOME_BTN_ICON_SHOW, SIGNAL_SOURCE);
- main_info.view_type = HOMESCREEN_VIEW_APPS;
- screen_reader_update(APPS);
- }
+ evas_object_show(main_info.btn_layout);
+
+ elm_object_signal_callback_add(main_info.btn_layout, SIGNAL_MENU_BTN_CLICKED, SIGNAL_SOURCE, __app_menu_btn_clicked, NULL);
+ elm_object_signal_callback_add(main_info.btn_layout, SIGNAL_HOME_BTN_CLICKED, SIGNAL_SOURCE, __app_home_btn_clicked, NULL);
}
-static Eina_Bool __homescreen_efl_show_apps_anim(void *data, double pos)
+static Eina_Bool __app_show_apps_anim(void *data, double pos)
{
cluster_view_hide_anim(pos);
apps_view_show_anim(pos);
return ECORE_CALLBACK_RENEW;
}
-static Eina_Bool __homescreen_efl_show_cluster_anim(void *data, double pos)
+static Eina_Bool __app_show_cluster_anim(void *data, double pos)
{
apps_view_hide_anim(pos);
cluster_view_show_anim(pos);
return ECORE_CALLBACK_RENEW;
}
-Evas_Object *homescreen_efl_get_win(void)
-{
- return main_info.win;
-}
-
-Evas_Object *homescreen_efl_get_conformant(void)
+static void __app_change_view(void)
{
- return main_info.conformant;
-}
-
-void homescreen_efl_hw_menu_key_release(void)
-{
- if (main_info.view_type == HOMESCREEN_VIEW_HOME) {
- cluster_view_hw_menu_key();
- } else if (main_info.view_type == HOMESCREEN_VIEW_APPS) {
- apps_view_hw_menu_key();
+ if (main_info.animator != NULL) {
+ LOGE("main_info.animator != NULL");
+ return ;
}
-}
-void homescreen_efl_hw_home_key_release(void)
-{
if (main_info.view_type == HOMESCREEN_VIEW_APPS) {
- if (apps_view_hw_home_key() == false)
- __homescreen_efl_change_view();
- }
-
- cluster_view_hw_home_key();
-}
+ apps_view_hide();
+ main_info.animator = ecore_animator_timeline_add(HOME_ANIMATION_TIME, __app_show_cluster_anim, NULL);
-void homescreen_efl_hw_back_key_release(void)
-{
- if (main_info.view_type == HOMESCREEN_VIEW_HOME) {
- if (cluster_view_hw_back_key() == false) {
- __homescreen_efl_change_view();
- }
- } else if (main_info.view_type == HOMESCREEN_VIEW_APPS) {
- if (apps_view_hw_back_key() == false) {
- __homescreen_efl_change_view();
- }
- }
-}
+ elm_object_signal_emit(main_info.btn_layout, SIGNAL_HOME_BTN_ICON_HIDE, SIGNAL_SOURCE);
+ elm_object_signal_emit(main_info.btn_layout, SIGNAL_APPS_BTN_ICON_SHOW, SIGNAL_SOURCE);
+ main_info.view_type = HOMESCREEN_VIEW_HOME;
+ screen_reader_update(HOME);
+ } else if (main_info.view_type == HOMESCREEN_VIEW_HOME) {
+ cluster_view_hide();
+ main_info.animator = ecore_animator_timeline_add(HOME_ANIMATION_TIME, __app_show_apps_anim, NULL);
-void homescreen_efl_btn_show(homescreen_view_t view_t)
-{
- LOGD("state %d", view_t);
- switch (view_t) {
- case HOMESCREEN_VIEW_HOME:
- elm_object_signal_emit(main_info.btn_layout, SIGNAL_BTN_SHOW_HOME_STATE, SIGNAL_SOURCE);
- break;
- case HOMESCREEN_VIEW_APPS:
- elm_object_signal_emit(main_info.btn_layout, SIGNAL_BTN_SHOW_APPS_STATE, SIGNAL_SOURCE);
- break;
- default:
- break;
+ elm_object_signal_emit(main_info.btn_layout, SIGNAL_APPS_BTN_ICON_HIDE, SIGNAL_SOURCE);
+ elm_object_signal_emit(main_info.btn_layout, SIGNAL_HOME_BTN_ICON_SHOW, SIGNAL_SOURCE);
+ main_info.view_type = HOMESCREEN_VIEW_APPS;
+ screen_reader_update(APPS);
}
}
-void homescreen_efl_btn_hide(homescreen_view_t view_t)
-{
- LOGD("state %d", view_t);
- switch (view_t) {
- case HOMESCREEN_VIEW_HOME:
- elm_object_signal_emit(main_info.btn_layout, SIGNAL_BTN_HIDE_HOME_STATE, SIGNAL_SOURCE);
- break;
- case HOMESCREEN_VIEW_APPS:
- elm_object_signal_emit(main_info.btn_layout, SIGNAL_BTN_HIDE_APPS_STATE, SIGNAL_SOURCE);
- break;
- default:
- break;
- }
-}
-static bool __homescreen_efl_create_view(void)
+static bool __create_view(void)
{
main_info.cluster_layout = cluster_view_create(main_info.win);
if (main_info.cluster_layout == NULL) {
return true;
}
-static Eina_Bool __homescreen_efl_init_view(void *data)
+static Eina_Bool __init_view(void *data)
{
cluster_view_init();
apps_view_init();
return ECORE_CALLBACK_CANCEL;
}
-void homescreen_efl_get_access_menu_btn(Eina_List **list)
-{
- Evas_Object *menu_btn = NULL;
- access_info_t *btn_info = NULL;
- char buf[STR_MAX] = { 0, };
-
- menu_btn = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(main_info.btn_layout), MENU_BUTTON);
- btn_info = (access_info_t *)malloc(sizeof(access_info_t));
- btn_info->is_access_obj = EINA_FALSE;
- btn_info->target = menu_btn;
- btn_info->parent = main_info.btn_layout;
- btn_info->name = strdup(_("IDS_HS_BODY_MENU"));
- snprintf(buf, sizeof(buf), "%s, %s", _("IDS_ACCS_BODY_BUTTON_TTS"), _("IDS_ST_BODY_DOUBLE_TAP_TO_OPEN_THE_MENU_T_TTS"));
- btn_info->description = strdup(buf);
- btn_info->role = ELM_ATSPI_ROLE_UNKNOWN;
- btn_info->clicked_cb = __homescreen_efl_menu_btn_clicked;
- btn_info->cb_data = NULL;
- btn_info->priority = ACCESS_PRIORITY_MENUBUTTON;
-
- *list = eina_list_append(*list, btn_info);
-}
-
-void homescreen_efl_get_access_apps_btn(Eina_List **list)
-{
- Evas_Object *apps_btn = NULL;
- access_info_t *btn_info = NULL;
- char buf[STR_MAX] = { 0, };
-
- apps_btn = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(main_info.btn_layout), HOME_BUTTON);
- btn_info = (access_info_t *)malloc(sizeof(access_info_t));
- btn_info->is_access_obj = EINA_FALSE;
- btn_info->target = apps_btn;
- btn_info->parent = main_info.btn_layout;
- btn_info->name = strdup(_("IDS_AT_TAB4_ALL_APPS"));
- snprintf(buf, sizeof(buf), "%s, %s", _("IDS_ACCS_BODY_BUTTON_TTS"), _("IDS_HS_TBBODY_DOUBLE_TAP_TO_GO_TO_APPS_SCREEN"));
- btn_info->description = strdup(buf);
- btn_info->role = ELM_ATSPI_ROLE_UNKNOWN;
- btn_info->clicked_cb = __homescreen_efl_home_btn_clicked;
- btn_info->cb_data = NULL;
- btn_info->priority = ACCESS_PRIORITY_APPSBUTTON;
-
- *list = eina_list_append(*list, btn_info);
-}
-
-void homescreen_efl_get_access_home_btn(Eina_List **list)
-{
- Evas_Object *home_btn = NULL;
- access_info_t *btn_info = NULL;
- char buf[STR_MAX] = { 0, };
-
- home_btn = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(main_info.btn_layout), HOME_BUTTON);
- btn_info = (access_info_t *)malloc(sizeof(access_info_t));
- btn_info->is_access_obj = EINA_FALSE;
- btn_info->target = home_btn;
- btn_info->parent = main_info.btn_layout;
- btn_info->name = strdup(_("IDS_HS_TBOPT_HOME_M_HOMESCREEN"));
- snprintf(buf, sizeof(buf), "%s, %s", _("IDS_ACCS_BODY_BUTTON_TTS"), _("IDS_HS_TBBODY_DOUBLE_TAP_TO_GO_TO_HOME_SCREEN"));
- btn_info->description = strdup(buf);
- btn_info->role = ELM_ATSPI_ROLE_UNKNOWN;
- btn_info->clicked_cb = __homescreen_efl_home_btn_clicked;
- btn_info->cb_data = NULL;
- btn_info->priority = ACCESS_PRIORITY_HOMEBUTTON;
-
- *list = eina_list_append(*list, btn_info);
-}
#include "hw_key.h"
#include "util.h"
#include "conf.h"
-#include "homescreen-efl.h"
+#include "homescreen-manager.h"
#include "menu.h"
#include "popup.h"
} else if (popup_is_show()) {
popup_hide();
} else {
- homescreen_efl_hw_back_key_release();
+ app_hw_back_key_release();
}
} else if (!strcmp(ev->keyname, KEY_MENU)) {
- homescreen_efl_hw_menu_key_release();
+ app_hw_menu_key_release();
} else {
hw_key_info.pressed = EINA_FALSE;
--- /dev/null
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "homescreen-manager.h"
+#include "util.h"
+#include "test.h"
+
+#if (!TEST_MODE)
+int main(int argc, char *argv[])
+{
+ LOGD("Starting homescreen-efl");
+
+ int ret = 0;
+ ui_app_lifecycle_callback_s event_callback = {0,};
+ app_event_handler_h handlers[5] = {NULL, };
+
+ event_callback.create = app_create;
+ event_callback.terminate = app_terminate;
+ event_callback.pause = app_pause;
+ event_callback.resume = app_resume;
+ event_callback.app_control = app_control;
+
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, app_low_battery, NULL);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, app_low_memory, NULL);
+ ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, app_orient_changed, NULL);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, app_lang_changed, NULL);
+ ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, app_region_changed, NULL);
+
+ ret = ui_app_main(argc, argv, &event_callback, NULL);
+ if (ret != APP_ERROR_NONE)
+ LOGE("ui_app_main() is failed. err = %d", ret);
+
+ return ret;
+}
+#endif
+
* limitations under the License.
*/
-#include "homescreen-efl.h"
+#include "homescreen-manager.h"
#include "menu.h"
#include "conf.h"
menu_info.is_visible = true;
- menu_info.menu = elm_ctxpopup_add(homescreen_efl_get_win());
+ menu_info.menu = elm_ctxpopup_add(app_get_win());
elm_object_style_set(menu_info.menu, "more/default");
elm_ctxpopup_horizontal_set(menu_info.menu, EINA_FALSE);
//elm_ctxpopup_auto_hide_disabled_set(menu_info.menu, EINA_TRUE);
*/
#include "page_indicator.h"
-#include "homescreen-efl.h"
+#include "homescreen-manager.h"
#include "conf.h"
#include "edc_conf.h"
#include "util.h"
page_indicator->page_count = 0;
page_indicator->current_page = -1;
- page_indicator->box = elm_box_add(homescreen_efl_get_win());
+ page_indicator->box = elm_box_add(app_get_win());
if (!page_indicator->box) {
LOGE("page_index->box == NULL");
free(page_indicator);
evas_object_smart_callback_add(scroller, "scroll,anim,stop", __page_indicator_scroll_anim_stop_cb, page_indicator);
for (i = 0; i < PAGE_INDICATOR_MAX_PAGE_COUNT; i++) {
- page_indicator->unit[i] = elm_layout_add(homescreen_efl_get_win());
+ page_indicator->unit[i] = elm_layout_add(app_get_win());
elm_layout_file_set(page_indicator->unit[i], edj_path, GROUP_PAGE_INDICATOR_UNIT);
evas_object_size_hint_weight_set(page_indicator->unit[i], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_signal_callback_add(page_indicator->unit[i], SIGNAL_PAGE_INDICATOR_UNIT_CLICKED, SIGNAL_SOURCE, __page_indicator_unit_clicked_cb, page_indicator);
- Evas_Object *rect = evas_object_rectangle_add(homescreen_efl_get_win());
+ Evas_Object *rect = evas_object_rectangle_add(app_get_win());
evas_object_color_set(rect, 255, 255, 255, 0);
evas_object_size_hint_min_set(rect, PAGE_INDICATOR_UNIT, PAGE_INDICATOR_UNIT);
evas_object_size_hint_max_set(rect, PAGE_INDICATOR_UNIT, PAGE_INDICATOR_UNIT);
#include <Elementary.h>
#include <efl_extension.h>
-#include "homescreen-efl.h"
+#include "homescreen-manager.h"
#include "popup.h"
#include "util.h"
popup_info.is_visible = true;
- popup_info.popup = elm_popup_add(homescreen_efl_get_win());
+ popup_info.popup = elm_popup_add(app_get_win());
elm_popup_align_set(popup_info.popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
evas_object_size_hint_weight_set(popup_info.popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_part_text_set(popup_info.popup, "title,text", title_text);
{
Evas_Object *popup;
- popup = elm_popup_add(homescreen_efl_get_win());
+ popup = elm_popup_add(app_get_win());
elm_object_style_set(popup, "toast");
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_text_set(popup, str);
#include "screen_reader_handler.h"
#include "cluster_view.h"
#include "apps_view.h"
-#include "homescreen-efl.h"
+#include "homescreen-manager.h"
static struct {
screen_reader_t current_type;
#include "feature_test.h"
#include "cluster_view.h"
#include "view.h"
-#include "homescreen-efl.h"
+#include "homescreen-manager.h"
#include "cluster_page.h"
#include "../test_function.h"
TEST_ASSERT_EQUAL_INT(VIEW_STATE_ALL_PAGE, cluster_view_get_state());
TEST_ASSERT_EQUAL_INT(1, __t__cluster_view_get_current_page());
- homescreen_efl_hw_back_key_release();
+ app_hw_back_key_release();
TEST_ASSERT_EQUAL_INT(VIEW_STATE_NORMAL, cluster_view_get_state());
TEST_ASSERT_EQUAL_INT(1, __t__cluster_view_get_current_page());
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "test.h"
+#if TEST_MODE
+
+#include "function_test.h"
+
+static void __test_complete_cb(void)
+{
+}
+
+void function_test(void)
+{
+ unit_clear_log();
+
+ TEST_GROUP_ADD("group_function_apps_db", group_function_apps_db);
+
+ TEST_RUN(__test_complete_cb);
+}
+
+#endif
+
+
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __FUNCTION_TEST__
+#define __FUNCTION_TEST__
+
+#include "test.h"
+#if TEST_MODE
+
+#include "../unit/inc/unit.h"
+
+void function_test(void);
+void group_function_apps_db(unit_group_t * group);
+
+#endif
+
+#endif
+
+
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "test.h"
+#if TEST_MODE
+
+#include "function_test.h"
+#include "../test_function.h"
+#include "util.h"
+#include "apps_db.h"
+#include "apps_data.h"
+#include "conf.h"
+
+#include <Elementary.h>
+#include <app.h>
+
+static struct {
+ unit_group_t * group;
+} s_info = {
+ .group = NULL,
+};
+
+#define APPS_DB_NAME ".apps-data.db"
+
+app_data_t calendar = {
+ INIT_VALUE,
+ APPS_ROOT,
+ TEMP_OWNER,
+ false,
+ INIT_VALUE,
+ "org.tizen.calendar",
+ "org.tizen.calendar",
+ "Calendar",
+ "/usr/apps/org.tizen.calendar/shared/res/calendar.png",
+ NULL,
+ APPS_DATA_TYPE_APP,
+ false,
+ false,
+ NULL,
+ NULL,
+ 0,
+ false,
+ false,
+ INTERNAL,
+ true};
+
+app_data_t calendar2 = {
+ INIT_VALUE,
+ APPS_ROOT,
+ TEMP_OWNER,
+ false,
+ INIT_VALUE,
+ "org.tizen.calendar2",
+ "org.tizen.calendar",
+ "Calendar",
+ "/usr/apps/org.tizen.calendar/shared/res/calendar.png",
+ NULL,
+ APPS_DATA_TYPE_APP,
+ false,
+ false,
+ NULL,
+ NULL,
+ 0,
+ false,
+ false,
+ INTERNAL,
+ true};
+
+app_data_t clock_app = {
+ INIT_VALUE,
+ APPS_ROOT,
+ TEMP_OWNER,
+ false,
+ INIT_VALUE,
+ "org.tizen.clock",
+ "org.tizen.clock",
+ "Clockr",
+ "/usr/apps/org.tizen.clock/shared/res/clock.png",
+ NULL,
+ APPS_DATA_TYPE_APP,
+ true,
+ false,
+ NULL,
+ NULL,
+ 0,
+ false,
+ false,
+ EXTERNAL,
+ true};
+
+app_data_t folder = {
+ INIT_VALUE,
+ APPS_ROOT,
+ TEMP_OWNER,
+ true,
+ INIT_VALUE,
+ "folder",
+ "folder",
+ "Clockr",
+ "/usr/apps/org.tizen.homescreen-efl/shared/res/folder.png",
+ NULL,
+ APPS_DATA_TYPE_APP,
+ true,
+ false,
+ NULL,
+ NULL,
+ 0,
+ false,
+ false,
+ EXTERNAL,
+ true};
+
+app_data_t shortcut = {
+ INIT_VALUE,
+ APPS_ROOT,
+ TEMP_OWNER,
+ false,
+ INIT_VALUE,
+ "org.tizen.internet",
+ "org.tizen.internet",
+ "Naver",
+ NULL,
+ NULL,
+ APPS_DATA_TYPE_URI_SHORTCUT,
+ true,
+ false,
+ NULL,
+ NULL,
+ 0,
+ false,
+ false,
+ INTERNAL,
+ true};
+
+static void __set_up(void)
+{
+ const char *db_path = util_get_data_file_path(APPS_DB_NAME);
+ remove(db_path);
+
+ apps_db_create();
+
+ s_info.group->set_up_complete(s_info.group);
+}
+
+static void __tear_down(void)
+{
+ const char *db_path = util_get_data_file_path(APPS_DB_NAME);
+ remove(db_path);
+
+ s_info.group->tear_down_complete(s_info.group);
+}
+
+static unit_case_func_t __case_check_apps_db(void * data)
+{
+ const char *db_path = util_get_data_file_path(APPS_DB_NAME);
+ FILE *fp = fopen(db_path, "r");
+
+ TEST_ASSERT_TRUE(fp != NULL);
+
+ fclose(fp);
+
+ TEST_CASE_DONE(s_info.group);
+}
+
+static unit_case_func_t __case_insert_app_item(void * data)
+{
+ Eina_List *list = NULL, *find_list = NULL;
+ app_data_t * item = NULL;
+
+ /* insert calendar */
+ TEST_ASSERT_TRUE(apps_db_insert(&calendar));
+
+ /* check calendar */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ /* insert clock */
+ TEST_ASSERT_TRUE(apps_db_insert(&clock_app));
+
+ /*check calendar, clock */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(clock_app.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ /* insert folder */
+ TEST_ASSERT_TRUE(apps_db_insert(&folder));
+
+ /*check calendar, clock, folder */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(clock_app.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(folder.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ /* insert shorcut */
+ TEST_ASSERT_TRUE(apps_db_insert(&shortcut));
+
+ /*check calendar, clock, folder, shortcut */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(clock_app.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(folder.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(shortcut.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ TEST_CASE_DONE(s_info.group);
+}
+
+static unit_case_func_t __case_delete_app_item(void * data)
+{
+ Eina_List *list = NULL, *find_list = NULL;
+ app_data_t * item = NULL;
+
+ /* insert calendar, clock, folder, shorcut */
+ TEST_ASSERT_TRUE(apps_db_insert(&calendar));
+ TEST_ASSERT_TRUE(apps_db_insert(&clock_app));
+ TEST_ASSERT_TRUE(apps_db_insert(&folder));
+ TEST_ASSERT_TRUE(apps_db_insert(&shortcut));
+
+ /* check calendar, clock, folder, shortcut */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(clock_app.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(folder.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(shortcut.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ /* delete shortcut */
+ TEST_ASSERT_TRUE(apps_db_delete(&shortcut));
+
+ /* check calendar, clock, folder */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(clock_app.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(folder.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ /* delete clock */
+ TEST_ASSERT_TRUE(apps_db_delete(&clock_app));
+
+ /* check calendar, folder */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(folder.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ /* delete calendar */
+ TEST_ASSERT_TRUE(apps_db_delete(&calendar));
+
+ /* check folder */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(folder.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ /* delete folderr */
+ TEST_ASSERT_TRUE(apps_db_delete(&folder));
+
+ /* check empty list */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list == NULL);
+
+ TEST_CASE_DONE(s_info.group);
+}
+
+static unit_case_func_t __case_delete_by_app_id(void * data)
+{
+ Eina_List *list = NULL, *find_list = NULL;
+ app_data_t * item = NULL;
+
+ /* insert calendar, calendar2, clock */
+ TEST_ASSERT_TRUE(apps_db_insert(&calendar));
+ TEST_ASSERT_TRUE(apps_db_insert(&calendar2));
+ TEST_ASSERT_TRUE(apps_db_insert(&clock_app));
+
+ /* check calendar, calendar2, clock */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar2.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(clock_app.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ /* delete calendar2 */
+ TEST_ASSERT_TRUE(apps_db_delete_by_app_id(calendar2.app_id));
+
+ /* check calendar, clock */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(clock_app.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ TEST_CASE_DONE(s_info.group);
+}
+
+static unit_case_func_t __case_delete_by_package_id(void * data)
+{
+ Eina_List *list = NULL, *find_list = NULL;
+ app_data_t * item = NULL;
+
+ /* insert calendar, calendar2, clock */
+ TEST_ASSERT_TRUE(apps_db_insert(&calendar));
+ TEST_ASSERT_TRUE(apps_db_insert(&calendar2));
+ TEST_ASSERT_TRUE(apps_db_insert(&clock_app));
+
+ /* check calendar, calendar2, clock */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar2.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(clock_app.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ /* delete calendar, calendar2 */
+ TEST_ASSERT_TRUE(apps_db_delete_by_pkg_id(calendar.pkg_id));
+
+ /* check clock */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(clock_app.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ TEST_CASE_DONE(s_info.group);
+}
+
+static unit_case_func_t __case_update_app_item(void * data)
+{
+ Eina_List *list = NULL, *find_list = NULL;
+ app_data_t * item = NULL;
+
+ /* insert calendar, clock, folder, shorcut */
+ TEST_ASSERT_TRUE(apps_db_insert(&calendar));
+ TEST_ASSERT_TRUE(apps_db_insert(&clock_app));
+ TEST_ASSERT_TRUE(apps_db_insert(&folder));
+ TEST_ASSERT_TRUE(apps_db_insert(&shortcut));
+
+ /* check calendar, clock, folder, shortcut */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(clock_app.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(folder.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(shortcut.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ /* update calendar -> calendar2 */
+ calendar2.db_id = calendar.db_id;
+ TEST_ASSERT_TRUE(apps_db_update(&calendar2));
+
+ /* check calendar2, clock, folder, shorcut */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar2.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(clock_app.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(folder.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(shortcut.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ /* delete clock */
+ TEST_ASSERT_TRUE(apps_db_delete(&clock_app));
+
+ /* update folder -> clock */
+ clock_app.db_id = folder.db_id;
+ TEST_ASSERT_TRUE(apps_db_update(&clock_app));
+
+ /* check calendar2, clock, shorcut */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar2.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(clock_app.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(shortcut.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ /* delete shorcut */
+ TEST_ASSERT_TRUE(apps_db_delete(&shortcut));
+
+ /* update shorcut */
+ TEST_ASSERT_TRUE(apps_db_update(&shortcut));
+
+ /* check calendar2, clock */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar2.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(clock_app.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ TEST_CASE_DONE(s_info.group);
+}
+
+static unit_case_func_t __case_get_app_type(void * data)
+{
+ Eina_List *list = NULL, *find_list = NULL;
+ app_data_t * item = NULL;
+
+ /* insert calendar, clock, folder, shorcut */
+ TEST_ASSERT_TRUE(apps_db_insert(&calendar));
+ TEST_ASSERT_TRUE(apps_db_insert(&clock_app));
+ TEST_ASSERT_TRUE(apps_db_insert(&folder));
+ TEST_ASSERT_TRUE(apps_db_insert(&shortcut));
+
+ /* check calendar, clock */
+ EINA_LIST_FREE(list, item) {
+ __t__apps_data_item_free(item);
+ }
+ list = NULL;
+ apps_db_get_app_list(&list);
+
+ TEST_ASSERT_TRUE(list != NULL);
+
+ find_list = list;
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(calendar.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ item = eina_list_data_get(find_list);
+ TEST_ASSERT_EQUAL_STRING(clock_app.app_id, item->app_id);
+ find_list = eina_list_next(find_list);
+
+ TEST_ASSERT_TRUE(find_list == NULL);
+
+ TEST_CASE_DONE(s_info.group);
+}
+
+void group_function_apps_db(unit_group_t * group)
+{
+ s_info.group = group;
+ s_info.group->set_up = __set_up;
+ s_info.group->tear_down = __tear_down;
+
+ TEST_CASE_ADD(s_info.group, __case_check_apps_db, NULL);
+ TEST_CASE_ADD(s_info.group, __case_insert_app_item, NULL);
+ TEST_CASE_ADD(s_info.group, __case_delete_app_item, NULL);
+ TEST_CASE_ADD(s_info.group, __case_delete_by_app_id, NULL);
+ TEST_CASE_ADD(s_info.group, __case_delete_by_package_id, NULL);
+ TEST_CASE_ADD(s_info.group, __case_update_app_item, NULL);
+ TEST_CASE_ADD(s_info.group, __case_get_app_type, NULL);
+
+ TEST_GROUP_RUN(s_info.group);
+}
+
+#endif
+
#include <tizen.h>
#include <Evas.h>
-extern bool __homescreen_efl_app_create_cb(void *data);
-extern void __homescreen_efl_app_control_cb(app_control_h app_control, void*data);
-extern void __homescreen_efl_app_pause_cb(void *data);
-extern void __homescreen_efl_app_resume_cb(void *data);
-extern void __homescreen_efl_app_terminate_cb(void *data);
-
extern int __t__cluster_view_get_page_count(void);
extern void __t__cluster_view_page_new(void);
extern void __t__cluster_view_scroll_to_page(int page_idx, bool animation);
extern void __t__add_widget_viewer_insert_widget(const char *id, const char *label, const char *content_info, int type);
extern void __t__cluster_view_page_widget_delete(int page_idx);
+extern bool __t__apps_db_open(void);
+extern bool __t__apps_db_close(void);
+extern void __t__apps_data_item_free(void *item);
+
#endif
#endif
#include "unit/inc/unit.h"
#include "app_log.h"
-#include "homescreen-efl.h"
+#include "homescreen-manager.h"
#include "feature_test/feature_test.h"
+#include "function_test/function_test.h"
#include "test_function.h"
static struct {
static bool __create(void * data)
{
+ function_test();
+
if (s_info.feature_test_run_timer) {
ecore_timer_del(s_info.feature_test_run_timer);
s_info.feature_test_run_timer = NULL;
s_info.feature_test_run_timer = ecore_timer_add(1.5, __run_timer_callback, NULL);
- return __homescreen_efl_app_create_cb(data);
+ return app_create(data);
}
static void __app_control(app_control_h app_control_handle, void * data)
{
- __homescreen_efl_app_control_cb(app_control_handle, data);
+ app_control(app_control_handle, data);
}
static void __resume(void * data)
{
- __homescreen_efl_app_resume_cb(data);
+ app_resume(data);
}
static void __pause(void * data)
{
- __homescreen_efl_app_pause_cb(data);
+ app_pause(data);
}
static void __terminate(void * data)
{
- __homescreen_efl_app_terminate_cb(data);
+ app_terminate(data);
}
static Eina_Bool __run_timer_callback(void * data)
bool unit_assert_equal_string(const char * expected_value, const char * input_value, const char * func, const int line)
{
- if (strcmp(expected_value, input_value)) {
+ if (expected_value == NULL || input_value == NULL || strcmp(expected_value, input_value)) {
unit_group_t * group = unit_get_current_group();
if (group) __T("[%d of %s]", group->current_case, group->name);
__T("%s (%d) FAIL, Expected %s was %s", func, line, expected_value, input_value);
{
unit_group_t * group = (unit_group_t *)data;
- group->current_case += 1;
+ group->current_case += 1;
__run_next_case(group);
return ECORE_CALLBACK_CANCEL;