Eext_Circle_Surface *circle_surface;
Evas_Object *indicator_layout;
- app_control_h service_bt;
- app_control_h service_nfc;
- app_control_h service_input;
- app_control_h service_wifi;
- app_control_h service_tizen_connect;
-
} appdata;
typedef struct _Item_Data {
double posx1, posy1, posx2, posy2;
};
+typedef struct _extra_app_data {
+ char *app_id;
+ char *extra_data_name;
+ char *extra_value;
+ char *set_operation;
+ bool launch_group_mode;;
+} extra_app_data;
+
+
typedef void (*back_btn_cb_ptr)(void *data, Evas_Object *obj, void *event_info);
void back_button_cb_push(back_btn_cb_ptr cb, void *data, Evas_Object *obj, Evas_Object *genlist_obj, char *genlist_name);
void _screen_reader_information_set(Evas_Object *obj);
int is_telephony_enable(void);
+
+void launch_extra_app(extra_app_data data);
+bool check_to_run_submenu(void *event_info);
+void set_running(bool val);
+bool get_running();
+void clear_running_timer();
#endif
static appdata *g_app_context = NULL;
-static bool running_connection = false;
-static Ecore_Timer *running_timer = NULL;
static char *
_gl_menu_title_text_get(void *data, Evas_Object *obj, const char *part)
return strdup(buf);
}
-static Eina_Bool _app_ctrl_timer_cb(void *data)
-{
- DBG("reset flag");
- running_connection = false;
- running_timer = NULL;
- return ECORE_CALLBACK_CANCEL;
-}
void _clear_connection_resource()
{
- if (running_timer) {
- ecore_timer_del(running_timer);
- running_timer = NULL;
- }
-
g_connection_genlist = NULL;
g_BT_item = NULL;
g_WIFI_item = NULL;
void _bluetooth_cb(void *data, Evas_Object *obj, void *event_info)
{
- elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
-
DBG("bluetooth_cb in");
- appdata *ad = data;
-
- if (ad == NULL) {
- DBG("Setting - ad is null");
- return;
- }
-
- if (running_connection) {
- return;
- }
-
- app_control_h service;
- app_control_create(&service);
- app_control_set_app_id(service, "org.tizen.bluetooth");
- app_control_add_extra_data(service, "launch-type", "setting");
- app_control_send_launch_request(service, NULL, NULL);
+ elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
- ad->service_bt = service;
+ extra_app_data extra_app = {
+ .app_id = "org.tizen.bluetooth",
+ .extra_data_name = "launch-type",
+ .extra_value = "settings",
+ .set_operation = NULL,
+ .launch_group_mode = false
+ };
- running_connection = true;
+ launch_extra_app(extra_app);
- if (running_timer) {
- ecore_timer_del(running_timer);
- running_timer = NULL;
- }
- running_timer = ecore_timer_add(0.5, (Ecore_Task_Cb)_app_ctrl_timer_cb, NULL);
}
void _wifi_cb(void *data, Evas_Object *obj, void *event_info)
{
- elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
-
DBG("wifi_cb in");
- appdata *ad = data;
-
- if (ad == NULL) {
- DBG("Setting - ad is null");
- return;
- }
-
- if (running_connection) {
- return;
- }
-
- app_control_h service;
- app_control_create(&service);
- app_control_set_app_id(service, "org.tizen.w-wifi");
- app_control_send_launch_request(service, NULL, NULL);
-
- ad->service_wifi = service;
+ elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
- running_connection = true;
+ extra_app_data extra_app = {
+ .app_id = "org.tizen.w-wifi",
+ .extra_data_name = NULL,
+ .extra_value = NULL,
+ .set_operation = NULL,
+ .launch_group_mode = false
+ };
- if (running_timer) {
- ecore_timer_del(running_timer);
- running_timer = NULL;
- }
- running_timer = ecore_timer_add(0.5, (Ecore_Task_Cb)_app_ctrl_timer_cb, NULL);
+ launch_extra_app(extra_app);
}
void _nfc_cb(void *data, Evas_Object *obj, void *event_info)
{
- elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
-
DBG("_nfc_cb in");
- appdata *ad = data;
-
- if (ad == NULL) {
- DBG("Setting - ad is null");
- return;
- }
-
- if (running_connection) {
- return;
- }
-
- app_control_h service;
- app_control_create(&service);
- app_control_set_app_id(service, "org.tizen.nfc-setting-app");
- app_control_send_launch_request(service, NULL, NULL);
-
- ad->service_nfc = service;
+ elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
- running_connection = true;
+ extra_app_data extra_app = {
+ .app_id = "org.tizen.nfc-setting-app",
+ .extra_data_name = NULL,
+ .extra_value = NULL,
+ .set_operation = NULL,
+ .launch_group_mode = false
+ };
- if (running_timer) {
- ecore_timer_del(running_timer);
- running_timer = NULL;
- }
- running_timer = ecore_timer_add(0.5, (Ecore_Task_Cb)_app_ctrl_timer_cb, NULL);
+ launch_extra_app(extra_app);
}
void _location_cb(void *data, Evas_Object *obj, void *event_info)
{
- elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
-
DBG("_location_cb in");
- appdata *ad = data;
-
- if (ad == NULL) {
- DBG("Setting - ad is null");
- return;
- }
-
- if (running_connection) {
- return;
- }
-
- app_control_h service;
- app_control_create(&service);
- app_control_set_app_id(service, "org.tizen.setting-location-wearable");
- app_control_send_launch_request(service, NULL, NULL);
-
- ad->service_nfc = service;
+ elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
- running_connection = true;
+ extra_app_data extra_app = {
+ .app_id = "org.tizen.setting-location-wearable",
+ .extra_data_name = NULL,
+ .extra_value = NULL,
+ .set_operation = NULL,
+ .launch_group_mode = false
+ };
- if (running_timer) {
- ecore_timer_del(running_timer);
- running_timer = NULL;
- }
- running_timer = ecore_timer_add(0.5, (Ecore_Task_Cb)_app_ctrl_timer_cb, NULL);
+ launch_extra_app(extra_app);
}
void _flight_mode_cb(void *data, Evas_Object *obj, void *event_info)
#include "setting.h"
#include "setting_view_toast.h"
-typedef struct _extra_app_data {
- char *app_id;
- char *extra_data_name;
- char *extra_value;
- char *set_operation;
- bool launch_group_mode;;
-} extra_app_data;
-
static struct _main_menu_item setting_menu_its[] = {
{ SETTING_MAIN_MENU_WATCH_FACE_STYLES, "WDS_CLOCK_MBODY_WATCH_FACES_AND_STYLES", "b_settings_list_watchface_style.png", clock_cb},
{ SETTING_MAIN_MENU_SOUND, "IDS_ST_OPT_SOUND_ABB2", "b_setting_list_sound.png", sound_cb},
{ SETTING_MAIN_MENU_MAX, NULL, NULL, NULL }
};
-static bool running = false;
-static Ecore_Timer *running_timer = NULL;
static Ecore_Timer *scrl_timer = NULL;
static Evas_Object *_create_bg(Evas_Object *parent);
static Evas_Object *_create_layout_main(Evas_Object *parent);
static Evas_Object *_create_naviframe_layout(Evas_Object *parent);
static void _create_view_layout(appdata *ad);
static int init_watch_setting(appdata *ad);
-static Eina_Bool _app_ctrl_timer_cb(void *data);
static Eina_Bool _scroller_timer_cb(void *data);
static void _update_main_menu_title(void *data);
return strdup(buf);
}
-static Eina_Bool _app_ctrl_timer_cb(void *data)
-{
- DBG("reset flag");
- running = false;
- running_timer = NULL;
- return ECORE_CALLBACK_CANCEL;
-}
-
static Eina_Bool _scroller_timer_cb(void *data)
{
DBG("hide scroller bar");
return ECORE_CALLBACK_CANCEL;
}
-static void launch_extra_app(extra_app_data data)
-{
- if (running) {
- return;
- }
- app_control_h service;
- app_control_create(&service);
- app_control_set_app_id(service, data.app_id);
-
- if (data.extra_data_name)
- app_control_add_extra_data(service, data.extra_data_name, data.extra_value);
-
- if (data.set_operation)
- app_control_set_operation(service, data.set_operation);
-
- if (data.launch_group_mode)
- app_control_set_launch_mode(service, APP_CONTROL_LAUNCH_MODE_GROUP);
-
- DBG("app_control_send_launch_request() %s", data.app_id);
- app_control_send_launch_request(service, NULL, NULL);
- app_control_destroy(service);
-
- running = true;
-
- if (running_timer) {
- ecore_timer_del(running_timer);
- running_timer = NULL;
- }
- running_timer = ecore_timer_add(0.5, (Ecore_Task_Cb)_app_ctrl_timer_cb, NULL);
- DBG("return");
- return;
-}
-
void clock_cb(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *genlist = NULL;
setting_ret_if(!data);
- if (running) {
- elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
+ if (false == check_to_run_submenu(event_info))
return;
- }
genlist = _create_clock_list(data);
if (genlist == NULL) {
setting_ret_if(!data);
- if (running) {
- elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
+ if (false == check_to_run_submenu(event_info))
return;
- }
_initialize();
setting_ret_if(!data);
- if (running) {
- elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
+ if (false == check_to_run_submenu(event_info))
return;
- }
genlist = _create_device_action_list(data);
if (genlist == NULL) {
setting_ret_if(!data);
- if (running) {
- elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
+ if (false == check_to_run_submenu(event_info))
return;
- }
_init_display();
setting_ret_if(!data);
- if (running) {
- elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
+ if (false == check_to_run_submenu(event_info))
return;
- }
layout = _create_connection_list(data);
if (layout == NULL) {
setting_ret_if(!data);
- if (running) {
- elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
+ if (false == check_to_run_submenu(event_info))
return;
- }
if (is_connected_GM()) {
DBG("Setting - language can not change!!");
setting_ret_if(!data);
- if (running) {
- elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
+ if (false == check_to_run_submenu(event_info))
return;
- }
genlist = _create_info_list(data);
if (genlist == NULL) {
setting_ret_if(!data);
- if (running) {
- elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
+ if (false == check_to_run_submenu(event_info))
return;
- }
genlist = _create_developer_option_list(data);
if (genlist == NULL) {
setting_retv_if(!data, EINA_FALSE);
- if (running_timer) {
- ecore_timer_del(running_timer);
- running_timer = NULL;
- }
- if (running)
- running = false;
+ clear_running_timer();
+
+ if (true == get_running())
+ set_running(false);
if (scrl_timer) {
ecore_timer_del(scrl_timer);
ad->double_press_item = NULL;
}
- __FREE_SERVICE(ad->service_wifi);
- __FREE_SERVICE(ad->service_nfc);
- __FREE_SERVICE(ad->service_tizen_connect);
- __FREE_SERVICE(ad->service_bt);
- __FREE_SERVICE(ad->service_input);
-
eext_circle_surface_del(ad->circle_surface);
}
setting_ret_if(!data);
- if (running)
- running = false;
+ if (true == get_running())
+ set_running(false);
}
if (ad->main_navi)
elm_naviframe_item_pop_to(bottom);
- __DISTROY_FREE_SERVICE(ad->service_wifi);
- __DISTROY_FREE_SERVICE(ad->service_nfc);
- __DISTROY_FREE_SERVICE(ad->service_tizen_connect);
- __DISTROY_FREE_SERVICE(ad->service_bt);
- __DISTROY_FREE_SERVICE(ad->service_input);
-
return;
}
#include "util.h"
#include <utils_i18n.h>
+#define CALLBACK_TIMER 0.5
+
typedef struct {
back_btn_cb_ptr cb;
void *data;
char *cur_genlist_name;
} back_button_cb_data;
+static Ecore_Timer *running_timer = NULL;
static Eina_List *back_button_cb_stack = NULL;
+static bool running = false;
void back_button_cb_push(back_btn_cb_ptr cb, void *data, Evas_Object *obj, Evas_Object *genlist_obj, char *genlist_name)
{
return ret;
}
+static Eina_Bool _app_ctrl_timer_cb(void *data)
+{
+ DBG("reset flags");
+ running = false;
+ running_timer = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+bool check_to_run_submenu(void *event_info)
+{
+ if (running) {
+ elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
+ return false;
+ }
+ return true;
+}
+
+void set_running(bool val)
+{
+ running = val;
+}
+
+bool get_running()
+{
+ return running;
+}
+
+void clear_running_timer()
+{
+ if (running_timer) {
+ ecore_timer_del(running_timer);
+ running_timer = NULL;
+ }
+}
+
+void launch_extra_app(extra_app_data data)
+{
+ if (running) {
+ DBG("running timer is working");
+ return;
+ }
+ app_control_h service;
+ app_control_create(&service);
+ app_control_set_app_id(service, data.app_id);
+
+ if (data.extra_data_name)
+ app_control_add_extra_data(service, data.extra_data_name, data.extra_value);
+
+ if (data.set_operation)
+ app_control_set_operation(service, data.set_operation);
+
+ if (data.launch_group_mode)
+ app_control_set_launch_mode(service, APP_CONTROL_LAUNCH_MODE_GROUP);
+
+ DBG("app_control_send_launch_request() %s", data.app_id);
+ app_control_send_launch_request(service, NULL, NULL);
+ app_control_destroy(service);
+
+ if (running) {
+ DBG("running timer is working");
+ return;
+ }
+ running = true;
+
+ clear_running_timer();
+
+ running_timer = ecore_timer_add(CALLBACK_TIMER, (Ecore_Task_Cb)_app_ctrl_timer_cb, NULL);
+ DBG("return");
+ return;
+}