summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjinwang.an <jinwang.an@samsung.com>2020-01-14 16:38:00 +0900
committerjinwang.an <jinwang.an@samsung.com>2020-01-14 16:38:00 +0900
commit0963e691140eddffa83561382d1e9c3be80844b6 (patch)
treee70a11c107626d21765ded8a7e43271e53a4f4a5
parentbabd991d82a76b09cfde7d9b45c90568f30d3012 (diff)
downloadwatch-setting-0963e691140eddffa83561382d1e9c3be80844b6.tar.gz
watch-setting-0963e691140eddffa83561382d1e9c3be80844b6.tar.bz2
watch-setting-0963e691140eddffa83561382d1e9c3be80844b6.zip
Add launch_extra_app() at settings.csubmit/tizen/20200114.081833
Change-Id: I025609c1337a8dc3192b3f5d8c17a93ffa088607 Signed-off-by: jinwang.an <jinwang.an@samsung.com>
-rw-r--r--src/setting.c243
1 files changed, 94 insertions, 149 deletions
diff --git a/src/setting.c b/src/setting.c
index 0403272..a585e04 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -74,6 +74,46 @@ _gl_menu_title_text_get(void *data, Evas_Object *obj, const char *part)
return strdup(buf);
}
+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 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)
{
@@ -195,62 +235,32 @@ void display_cb(void *data, Evas_Object *obj, void *event_info)
void keyboard_cb(void *data, Evas_Object *obj, void *event_info)
{
+ DBG("enter");
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
- appdata *ad = data;
- setting_ret_if(!data);
-
- if (running) {
- return;
- }
-
- if (!running) {
- app_control_h service;
- app_control_create(&service);
- app_control_add_extra_data(service, "caller", "settings");
- app_control_set_app_id(service, "org.tizen.inputmethod-setting-list");
- app_control_send_launch_request(service, NULL, NULL);
-
- ad->service_input = 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);
- }
+ extra_app_data extra_app = {
+ .app_id = "org.tizen.inputmethod-setting-list",
+ .extra_data_name = "caller",
+ .extra_value = "settings",
+ .set_operation = NULL,
+ .launch_group_mode = false
+ };
+ launch_extra_app(extra_app);
}
void autofill_cb(void *data, Evas_Object *obj, void *event_info)
{
+ DBG("enter");
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
- appdata *ad = data;
- setting_ret_if(!data);
-
- if (running) {
- return;
- }
-
- if (!running) {
- app_control_h service;
- app_control_create(&service);
- app_control_add_extra_data(service, "caller", "settings");
- app_control_set_app_id(service, "org.tizen.autofill-setting-wearable");
- app_control_send_launch_request(service, NULL, NULL);
-
- ad->service_input = 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);
- }
+ extra_app_data extra_app = {
+ .app_id = "org.tizen.autofill-setting-wearable",
+ .extra_data_name = "caller",
+ .extra_value = "settings",
+ .set_operation = NULL,
+ .launch_group_mode = false
+ };
+ launch_extra_app(extra_app);
}
void back_key_connection_cb(void *data, Evas_Object *obj, void *event_info)
@@ -415,130 +425,65 @@ static Eina_Bool _scroller_timer_cb(void *data)
void account_cb(void *data, Evas_Object *obj, void *event_info)
{
+ DBG("enter");
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
- DBG("account_cb in");
- appdata *ad = data;
-
- if (ad == NULL) {
- DBG("Setting - ad is null");
- return;
- }
-
- if (running) {
- return;
- }
-
- app_control_h service;
- app_control_create(&service);
- app_control_set_app_id(service, "org.tizen.my-account");
- app_control_add_extra_data(service, "launch-type", "setting");
- 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);
+ extra_app_data extra_app = {
+ .app_id = "org.tizen.my-account",
+ .extra_data_name = "launch-type",
+ .extra_value = "setting",
+ .set_operation = NULL,
+ .launch_group_mode = false
+ };
+ launch_extra_app(extra_app);
}
void call_cb(void *data, Evas_Object *obj, void *event_info)
{
+ DBG("enter");
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
- DBG("call_cb in");
- appdata *ad = data;
-
- if (ad == NULL) {
- DBG("Setting - ad is null");
- return;
- }
-
- if (running) {
- return;
- }
-
- app_control_h service;
- app_control_create(&service);
- app_control_set_app_id(service, "org.tizen.w-call-setting");
- app_control_set_launch_mode(service, APP_CONTROL_LAUNCH_MODE_GROUP);
- app_control_send_launch_request(service, NULL, NULL);
- app_control_destroy(service);
-
- running = true;
+ extra_app_data extra_app = {
+ .app_id = "org.tizen.w-call-setting",
+ .extra_data_name = NULL,
+ .extra_value = NULL,
+ .set_operation = NULL,
+ .launch_group_mode = 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 message_cb(void *data, Evas_Object *obj, void *event_info)
{
+ DBG("enter");
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
- DBG("message_cb in");
- appdata *ad = data;
-
- if (ad == NULL) {
- DBG("Setting - ad is null");
- return;
- }
-
- if (running) {
- return;
- }
+ extra_app_data extra_app = {
+ .app_id = "org.tizen.w-message",
+ .extra_data_name = NULL,
+ .extra_value = NULL,
+ .set_operation = "http://tizen.org/appcontrol/operation/setting/messages",
+ .launch_group_mode = true
+ };
+ launch_extra_app(extra_app);
- app_control_h service;
- app_control_create(&service);
- app_control_set_app_id(service, "org.tizen.w-message");
- app_control_set_operation(service, "http://tizen.org/appcontrol/operation/setting/messages");
- app_control_set_launch_mode(service, APP_CONTROL_LAUNCH_MODE_GROUP);
- 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);
}
void accessiblity_cb(void *data, Evas_Object *obj, void *event_info)
{
+ DBG("enter");
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
- DBG("accessiblity_cb in");
- appdata *ad = data;
-
- if (ad == NULL) {
- DBG("Setting - ad is null");
- return;
- }
+ extra_app_data extra_app = {
+ .app_id = "org.tizen.accessibility-setting-wearable",
+ .extra_data_name = NULL,
+ .extra_value = NULL,
+ .set_operation = NULL,
+ .launch_group_mode = true
+ };
- if (running) {
- return;
- }
-
- app_control_h service;
- app_control_create(&service);
- app_control_set_app_id(service, "org.tizen.accessibility-setting-wearable");
- 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);
+ launch_extra_app(extra_app);
}