4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
6 * Contact: MyoungJune Park <mj2004.park@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
21 #include <setting-plugin-main.h>
24 static int setting_plugin_main_create(void *cb);
25 static int setting_plugin_main_destroy(void *cb);
26 static int setting_plugin_main_update(void *cb);
27 static int setting_plugin_main_cleanup(void *cb);
29 setting_view setting_view_plugin_main = {
30 .create = setting_plugin_main_create,
31 .destroy = setting_plugin_main_destroy,
32 .update = setting_plugin_main_update,
33 .cleanup = setting_plugin_main_cleanup,
37 static void setting_plugin_main_click_softkey_back_cb(void *data, Evas_Object *obj, void *event_info);
40 /* ***************************************************
44 ***************************************************/
45 static int setting_plugin_main_create(void *cb)
49 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
51 SettingPluginUG *ad = (SettingPluginUG *) cb;
53 Evas_Object *scroller = NULL;
55 /* add basic layout */
56 char setBtnStr[MAX_DISPLAY_NAME_LEN_ON_UI];
57 snprintf(setBtnStr, sizeof(setBtnStr), "%s",
58 (char *)dgettext("sys_string", "IDS_COM_BODY_BACK"));
60 /////////////////////////////////////////////////////////////////////////////////////////////////
62 //char* plugin_path = "/opt/apps/UBKFwQidax.AppSetting4/setting/setting.xml";
63 if (ad->pkgname == NULL)
66 char plugin_path[1024];
67 snprintf(plugin_path, 1024, "/opt/apps/%s/setting/setting.xml", ad->pkgname);
68 SETTING_TRACE(" >> SELECTED plugin name : %s \n", plugin_path);
70 PluginNode* plugin_node = setting_plugin_create(ad->navi_bar, ad->win_get);
71 plugin_node->win_main_layout = ad->win_main_layout;
73 plugin_node->ug = ad->ug;
75 setting_drawer_list_init();
76 setting_dbus_handler_init( plugin_node );
78 plugin_node->plugin_path = strdup(plugin_path);
79 int ret = setting_plugin_load(plugin_node, (const char *)plugin_node->plugin_path);
83 ad->ly_main = plugin_node->ly_main;
85 ad->plugin_node = plugin_node; // the selected plugin name
88 setting_view_plugin_main.is_create = 1;
89 return SETTING_RETURN_SUCCESS;
92 return SETTING_RETURN_FAIL;
95 static int setting_plugin_main_destroy(void *cb)
99 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
100 SettingPluginUG *ad = (SettingPluginUG *) cb;
103 setting_dbus_handler_fini();
104 setting_drawer_list_fini();
106 // setting_plugin_destroy(ad->plugin_node );
108 //if (ad->ly_main != NULL) {
109 // evas_object_del(ad->ly_main);
110 setting_view_plugin_main.is_create = 0;
113 return SETTING_RETURN_SUCCESS;
116 static int setting_plugin_main_update(void *cb)
120 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
122 SettingPluginUG *ad = (SettingPluginUG *) cb;
124 if (ad->ly_main != NULL) {
125 evas_object_show(ad->ly_main);
128 return SETTING_RETURN_SUCCESS;
131 static int setting_plugin_main_cleanup(void *cb)
134 return SETTING_RETURN_SUCCESS;
137 /* ***************************************************
141 ***************************************************/
143 static void setting_plugin_main_click_softkey_back_cb(void *data, Evas_Object *obj, void *event_info)
147 setting_retm_if(data == NULL,
148 "[Setting > Plugin] Data parameter is NULL");
150 SettingPluginUG *ad = (SettingPluginUG *) data;
152 /* Send destroy request */
153 ug_destroy_me(ad->ug);