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 extern int service_to_bundle(service_h service, bundle **data);
26 static int setting_plugin_main_create(void *cb);
27 static int setting_plugin_main_destroy(void *cb);
28 static int setting_plugin_main_update(void *cb);
29 static int setting_plugin_main_cleanup(void *cb);
31 setting_view setting_view_plugin_main = {
32 .create = setting_plugin_main_create,
33 .destroy = setting_plugin_main_destroy,
34 .update = setting_plugin_main_update,
35 .cleanup = setting_plugin_main_cleanup,
41 static void setting_plugin_main_click_softkey_back_cb(void *data, Evas_Object *obj, void *event_info);
44 /* ***************************************************
48 ***************************************************/
49 static int setting_plugin_main_create(void *cb)
53 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
55 SettingPluginUG *ad = (SettingPluginUG *) cb;
57 Evas_Object *scroller = NULL;
59 /* add basic layout */
60 char setBtnStr[MAX_DISPLAY_NAME_LEN_ON_UI];
61 snprintf(setBtnStr, sizeof(setBtnStr), "%s",
62 (char *)dgettext("sys_string", "IDS_COM_BODY_BACK"));
64 /////////////////////////////////////////////////////////////////////////////////////////////////
66 // there's no argument, use pappid
67 if (ad->pkgname == NULL) {
68 SETTING_TRACE("pkgname is NULL, it's error, assign it");
72 char plugin_path[1024];
73 snprintf(plugin_path, 1024, "/opt/apps/%s/setting/setting.xml", ad->pkgname);
74 SETTING_TRACE(" >> SELECTED plugin name : %s \n", plugin_path);
77 PluginNode* plugin_node = setting_plugin_create(ad->navi_bar, ad->win_get);
78 plugin_node->win_main_layout = ad->win_main_layout;
80 plugin_node->ug = ad->ug;
82 setting_drawer_list_init();
83 setting_dbus_handler_init( plugin_node );
85 plugin_node->plugin_path = strdup(plugin_path);
86 int ret = setting_plugin_load(plugin_node, (const char *)plugin_node->plugin_path);
90 ad->ly_main = plugin_node->ly_main;
92 ad->plugin_node = plugin_node; // the selected plugin name
95 setting_view_plugin_main.is_create = 1;
96 return SETTING_RETURN_SUCCESS;
99 return SETTING_RETURN_FAIL;
102 static int setting_plugin_main_destroy(void *cb)
106 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
107 SettingPluginUG *ad = (SettingPluginUG *) cb;
110 setting_dbus_handler_fini();
111 setting_drawer_list_fini();
113 // setting_plugin_destroy(ad->plugin_node );
115 //if (ad->ly_main != NULL) {
116 // evas_object_del(ad->ly_main);
117 setting_view_plugin_main.is_create = 0;
120 return SETTING_RETURN_SUCCESS;
123 static int setting_plugin_main_update(void *cb)
127 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
129 SettingPluginUG *ad = (SettingPluginUG *) cb;
131 if (ad->ly_main != NULL) {
132 evas_object_show(ad->ly_main);
135 return SETTING_RETURN_SUCCESS;
138 static int setting_plugin_main_cleanup(void *cb)
141 return SETTING_RETURN_SUCCESS;
144 /* ***************************************************
148 ***************************************************/
150 static void setting_plugin_main_click_softkey_back_cb(void *data, Evas_Object *obj, void *event_info)
154 setting_retm_if(data == NULL,
155 "[Setting > Plugin] Data parameter is NULL");
157 SettingPluginUG *ad = (SettingPluginUG *) data;
159 /* Send destroy request */
160 ug_destroy_me(ad->ug);