Initialize Tizen 2.3
[apps/home/settings.git] / setting-common / include / setting-common-plugin.h
1 /*
2  * setting
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Flora License, Version 1.1 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://floralicense.org/license/
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an AS IS BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #ifndef _SETTING_PLUGIN_H_
19 #define _SETTING_PLUGIN_H_
20
21 #include <Elementary.h>
22 #include <Eina.h>
23
24 #include <setting-common-general-func.h>
25 #include <setting-common-draw-widget.h>
26
27 #include <libxml/xmlmemory.h>
28 #include <libxml/parser.h>
29
30 #ifndef bool
31 #define bool int
32 #define TRUE 1
33 #define FALSE 0
34 #endif
35
36 #if 1
37 #define PLUGIN_INIT( context ) \
38 {\
39         setting_drawer_list_init();\
40         setting_dbus_handler_init( context );\
41 }
42
43 #define PLUGIN_FINI \
44 {\
45         setting_dbus_handler_fini();\
46         setting_drawer_list_fini();\
47 }
48 #else
49
50 #define PLUGIN_INIT
51 #define PLUGIN_FINI
52
53 #endif
54
55 int setting_dbus_handler_init(void* data);
56 int setting_dbus_handler_fini(void);
57 void setting_drawer_list_init();
58 void setting_drawer_list_fini();
59
60 typedef void* (*drawer_fp)(void *data, xmlNode *xmlObj);
61
62 // draw handler
63 typedef struct
64 {
65         const char* type;                       // ui type
66         drawer_fp draw;
67 } Object_Drawer;
68
69 // draw handler
70 typedef struct
71 {
72         xmlDocPtr doc;
73         xmlNode *root;
74
75         const char *cfg_file;
76         Evas_Object *scroller;                  // genlist
77 } Draw_Data;
78
79 typedef struct PluginNode PluginNode;
80 struct PluginNode
81 {
82         char* plugin_path;
83         Draw_Data *pd;
84         Eina_Hash *ui_list;
85
86         Evas_Object* navi_bar;
87         Evas_Object* win_main;
88
89
90         Evas_Object* ly_main;
91
92         // ug
93         Evas_Object* win_main_layout;
94         ui_gadget_h ug;
95
96         int nitems;
97 };
98
99 PluginNode* setting_plugin_create(Evas_Object* navi, Evas_Object* win);
100 int setting_plugin_load(PluginNode* context, const char *cfg_file);
101 void setting_plugin_destroy(PluginNode* node);
102
103 #endif // _SETTING_PLUGIN_H_