/*
* setting
- * Copyright (c) 2012 Samsung Electronics Co., Ltd.
*
- * Licensed under the Flora License, Version 1.0 (the License);
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
+ *
+ * Contact: MyoungJune Park <mj2004.park@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (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/
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
+ * 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 <setting-connectivity.h>
-#include <devman.h>
+#include <setting-cfg.h>
#ifndef UG_MODULE_API
#define UG_MODULE_API __attribute__ ((visibility("default")))
#define USB_BTN_NO 0
-setting_view *__get_connective_view_to_load(service_h service)
+/**
+ * This function checks the USB connection status
+ */
+int check_usb_jack_status()
+{
+ SETTING_TRACE_BEGIN;
+ bool usb_connection = false;
+ int ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_USB_CONNECTED, &usb_connection);
+ if (ret == RUNTIME_INFO_ERROR_NONE && usb_connection == true) {
+ return USB_CONNECTED; /* USB is connected */
+ } else {
+ return USB_DISCONNECTED; /* USB is disconnected */
+ }
+}
+
+setting_view *__get_connective_view_to_load(app_control_h service)
{
SETTING_TRACE_BEGIN;
char *viewtype = NULL;
- service_get_extra_data(service, "viewtype", &viewtype);
- if(!viewtype)
+ app_control_get_extra_data(service, "viewtype", &viewtype);
+ if (!viewtype)
return NULL;
SETTING_TRACE("viewtype:%s", viewtype);
if (!safeStrCmp(viewtype, "usb")) {
+ FREE(viewtype);
return &setting_view_connectivity_usb;
} else {
+ FREE(viewtype);
return NULL; /* &setting_view_connective_main; */
}
}
-Evas_Object *__get_connective_layout_to_return(service_h service, void *priv)
+Evas_Object *__get_connective_layout_to_return(app_control_h service, void *priv)
{
SETTING_TRACE_BEGIN;
SettingConnectivityUG *connectiveUG = priv;
char *viewtype = NULL;
- service_get_extra_data(service, "viewtype", &viewtype);
- if(!viewtype)
+ app_control_get_extra_data(service, "viewtype", &viewtype);
+ if (!viewtype)
return NULL;
SETTING_TRACE("viewtype:%s", viewtype);
if (!safeStrCmp(viewtype, "usb")) {
+ FREE(viewtype);
return connectiveUG->ly_usb;
} else {
+ FREE(viewtype);
return NULL; /* &setting_view_connective_main; */
}
}
static void setting_connective_ug_cb_resize(void *data, Evas *e,
- Evas_Object *obj, void *event_info)
+ Evas_Object *obj, void *event_info)
{
SettingConnectivityUG *ad = (SettingConnectivityUG *) data;
/* setting_view_update(&setting_view_about_main, ad); */
}
static void *setting_connective_ug_on_create(ui_gadget_h ug,
- enum ug_mode mode, service_h service,
- void *priv)
+ enum ug_mode mode, app_control_h service,
+ void *priv)
{
setting_retvm_if((!priv), NULL, "!priv");
evas_object_evas_get(connectiveUG->win_main_layout);
setting_retvm_if(connectiveUG->win_main_layout == NULL, NULL,
- "cannot get main window ");
+ "cannot get main window ");
setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR);
setting_view_node_table_intialize();
setting_view_node_table_register(&setting_view_connectivity_usb, NULL);
setting_view_node_table_register(&setting_view_connectivity_usb_help,
- &setting_view_connectivity_usb);
+ &setting_view_connectivity_usb);
/* creating a view. */
- setting_create_Gendial_itc("dialogue/title", &(connectiveUG->itc_title));
- setting_create_Gendial_itc("dialogue/1text", &(connectiveUG->itc_1text));
- setting_create_Gendial_itc("dialogue/1text.1icon", &(connectiveUG->itc_1text_1icon));
- setting_create_Gendial_itc("dialogue/1text.1icon", &(connectiveUG->itc_1text_1icon_gen)); /* toggle */
+ setting_create_Gendial_itc("groupindex", &(connectiveUG->itc_title));
+ setting_create_Gendial_itc("1line", &(connectiveUG->itc_1text));
+ setting_create_Gendial_itc("1line", &(connectiveUG->itc_1text_1icon));
+ setting_create_Gendial_itc("1line", &(connectiveUG->itc_1text_1icon_gen)); /* toggle */
setting_create_Gendial_itc("dialogue/2text.3", &(connectiveUG->itc_2text_3));
- setting_create_Gendial_itc("dialogue/2text.3/expandable", &(connectiveUG->itc_2text_3_parent));
- setting_create_Gendial_itc("dialogue/1text.1icon/expandable2", &(connectiveUG->itc_1icon_1text_sub));
- setting_create_Gendial_itc("multiline/1text", &(connectiveUG->itc_help_style));
-
- connectiveUG->itc_seperator.item_style = "dialogue/separator";
- connectiveUG->itc_seperator.func.text_get = NULL;
- connectiveUG->itc_seperator.func.content_get = NULL;
- connectiveUG->itc_seperator.func.state_get = NULL;
- connectiveUG->itc_seperator.func.del = NULL;
-
-
+ setting_create_Gendial_itc("2line.top", &(connectiveUG->itc_2text_3_parent));
+ setting_create_Gendial_itc("1line", &(connectiveUG->itc_1icon_1text_sub));
+ setting_create_Gendial_itc("multiline_sub", &(connectiveUG->itc_help_style));
connectiveUG->view_to_load = __get_connective_view_to_load(service);
setting_retvm_if(NULL == connectiveUG->view_to_load, NULL,
- "NULL == connectiveUG->view_to_load");
+ "NULL == connectiveUG->view_to_load");
setting_view_node_set_cur_view(connectiveUG->view_to_load);
setting_view_create(connectiveUG->view_to_load, (void *)connectiveUG);
evas_object_event_callback_add(connectiveUG->win_main_layout,
- EVAS_CALLBACK_RESIZE,
- setting_connective_ug_cb_resize,
- connectiveUG);
+ EVAS_CALLBACK_RESIZE,
+ setting_connective_ug_cb_resize,
+ connectiveUG);
return __get_connective_layout_to_return(service, connectiveUG);
}
-static void setting_connective_ug_on_start(ui_gadget_h ug, service_h service,
- void *priv)
+static void setting_connective_ug_on_start(ui_gadget_h ug, app_control_h service,
+ void *priv)
{
}
-static void setting_connective_ug_on_pause(ui_gadget_h ug, service_h service,
- void *priv)
+static void setting_connective_ug_on_pause(ui_gadget_h ug, app_control_h service,
+ void *priv)
{
}
-static void setting_connective_ug_on_resume(ui_gadget_h ug, service_h service,
- void *priv)
+static void setting_connective_ug_on_resume(ui_gadget_h ug, app_control_h service,
+ void *priv)
{
}
static void setting_connective_ug_on_destroy(ui_gadget_h ug,
- service_h service, void *priv)
+ app_control_h service, void *priv)
{
SETTING_TRACE_BEGIN;
setting_retm_if((!priv), "!priv");
/* called when this shared gadget is terminated. similar with app_exit */
if (&setting_view_connectivity_usb == connectiveUG->view_to_load) {
setting_view_destroy(&setting_view_connectivity_usb_help,
- connectiveUG);
+ connectiveUG);
setting_view_destroy(&setting_view_connectivity_usb,
- connectiveUG);
+ connectiveUG);
}
if (NULL != ug_get_layout(connectiveUG->ug)) {
evas_object_hide((Evas_Object *)
- ug_get_layout(connectiveUG->ug));
+ ug_get_layout(connectiveUG->ug));
evas_object_del((Evas_Object *)
- ug_get_layout(connectiveUG->ug));
+ ug_get_layout(connectiveUG->ug));
}
SETTING_TRACE_END;
}
-static void setting_connective_ug_on_message(ui_gadget_h ug, service_h msg,
- service_h service, void *priv)
+static void setting_connective_ug_on_message(ui_gadget_h ug, app_control_h msg,
+ app_control_h service, void *priv)
{
SETTING_TRACE_BEGIN;
}
static void setting_connective_ug_on_event(ui_gadget_h ug,
- enum ug_event event, service_h service,
- void *priv)
+ enum ug_event event, app_control_h service,
+ void *priv)
{
SETTING_TRACE_BEGIN;
switch (event) {
- case UG_EVENT_LOW_MEMORY:
- break;
- case UG_EVENT_LOW_BATTERY:
- break;
- case UG_EVENT_LANG_CHANGE:
- break;
- case UG_EVENT_ROTATE_PORTRAIT:
- break;
- case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
- break;
- case UG_EVENT_ROTATE_LANDSCAPE:
- break;
- case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
- break;
- case UG_EVENT_REGION_CHANGE:
- break;
- default:
- break;
+ case UG_EVENT_LOW_MEMORY:
+ break;
+ case UG_EVENT_LOW_BATTERY:
+ break;
+ case UG_EVENT_LANG_CHANGE:
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT:
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE:
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
+ break;
+ case UG_EVENT_REGION_CHANGE:
+ break;
+ default:
+ break;
}
}
static void setting_connective_ug_on_key_event(ui_gadget_h ug,
- enum ug_key_event event,
- service_h service, void *priv)
+ enum ug_key_event event,
+ app_control_h service, void *priv)
{
SETTING_TRACE_BEGIN;
SettingConnectivityUG *ad = (SettingConnectivityUG *) priv;
switch (event) {
- case UG_KEY_EVENT_END:
- {
- if (elm_naviframe_top_item_get(ad->navi_bar) ==
- elm_naviframe_bottom_item_get(ad->navi_bar)) {
- ug_destroy_me(ug);
- } else {
- /* elm_naviframe_item_pop(ad->navi_bar); */
- setting_view_cb_at_endKey(ad);
+ case UG_KEY_EVENT_END: {
+ if (elm_naviframe_top_item_get(ad->navi_bar) ==
+ elm_naviframe_bottom_item_get(ad->navi_bar)) {
+ ug_destroy_me(ug);
+ } else {
+ /* elm_naviframe_item_pop(ad->navi_bar); */
+ setting_view_cb_at_endKey(ad);
+ }
}
- }
- break;
- default:
- break;
+ break;
+ default:
+ break;
}
}
SettingConnectivityUG *connectiveUG =
calloc(1, sizeof(SettingConnectivityUG));
setting_retvm_if(!connectiveUG, -1,
- "Create SettingConnectivityUG obj failed");
+ "Create SettingConnectivityUG obj failed");
ops->create = setting_connective_ug_on_create;
ops->start = setting_connective_ug_on_start;
}
}
-/*****/
-UG_MODULE_API int setting_plugin_reset(service_h service, void *priv)
+UG_MODULE_API int setting_plugin_search_init(app_control_h service, void *priv,
+ char **applocale)
{
- SETTING_TRACE_BEGIN;
-
- int ret = 0;
- char *ug_type = NULL;
-
- service_get_extra_data(service, "viewtype", &ug_type);
- if(!ug_type)
- return -1;
-
- if (0 == safeStrCmp(ug_type, "usb")) {
- /* usb */
-#if SUPPORT_RUN_SYSTEM_COMMAND
- ret += excuteCmd(SETTING_POSTINST_FILE, 1, "usbconnectivity");
-#else
- ret += vconf_set_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 0);
- /* Resetting VCONFKEY_SETAPPL_USB_MODE_INT (current mode) is not necessary.
- * If USB cable is removed, the key value is SETTING_USB_NONE_MODE by USB-setting.
- * If USB cable is connected, the key value is changed by selected mode. */
- ret += vconf_set_int(VCONFKEY_SETAPPL_USB_IN_MODE_CHANGE, CHANGE_COMPLETE);
-#endif
+ int i, size;
+ Setting_Cfg_Node_T *node;
+ Eina_List **pplist = priv;
+ const Setting_Cfg_Node_T search_configs[] = {
+ {DEVOPTION_STR_USB_DEBUGGING, NULL, NULL, 0, Cfg_Item_unResetable, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
+ {DEVOPTION_STR_SHOW_CPU_USAGE, NULL, NULL, 0, Cfg_Item_unResetable, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
+ {DEVOPTION_STR_RENDERTING_ENGINE, NULL, NULL, 0, Cfg_Item_unResetable, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
+ {DEVOPTION_STR_LIMIT_BACKGROUND_PRECESS, NULL, NULL, 0, Cfg_Item_unResetable, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
+ {DEVOPTION_STR_CRASH_VIEWER, NULL, NULL, 0, Cfg_Item_unResetable, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}
+ };
+
+ retv_if(NULL == priv, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+ retv_if(NULL == applocale, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+
+ *applocale = strdup("setting:/usr/apps/org.tizen.setting/res/locale");
+
+ size = sizeof(search_configs) / sizeof(Setting_Cfg_Node_T);
+
+ for (i = 0; i < size; i++) {
+ node = setting_plugin_search_item_subindex_add(
+ search_configs[i].key_name,
+ "viewtype:usb",
+ IMG_USBconnection,
+ search_configs[i].item_type,
+ search_configs[i].data,
+ "Developer options");
+
+ *pplist = eina_list_append(*pplist, node);
}
- return ret;
+ return 0;
}
+