tizen 2.3 release
[apps/home/settings.git] / setting-connectivity / src / setting-connectivity-usb-help.c
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  */
21 #include <setting-connectivity-usb-help.h>
22 #define HELP_LEN 2048
23
24 static int setting_connectivity_usb_help_create(void *cb);
25 static int setting_connectivity_usb_help_destroy(void *cb);
26 static int setting_connectivity_usb_help_update(void *cb);
27 static int setting_connectivity_usb_help_cleanup(void *cb);
28
29 setting_view setting_view_connectivity_usb_help = {
30         .create = setting_connectivity_usb_help_create,
31         .destroy = setting_connectivity_usb_help_destroy,
32         .update = setting_connectivity_usb_help_update,
33         .cleanup = setting_connectivity_usb_help_cleanup,
34 };
35
36 /* ***************************************************
37  *
38  *basic func
39  *
40  ***************************************************/
41
42 static int setting_connectivity_usb_help_create(void *cb)
43 {
44         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
45
46         SettingConnectivityUG *ad = (SettingConnectivityUG *) cb;
47
48         char samsung_kies_help[HELP_LEN];
49         char mass_storage_help[HELP_LEN];
50         char debugging_mode_help[HELP_LEN];
51
52         snprintf(samsung_kies_help, HELP_LEN,
53                 "%s%s%s%s", "<b>", _("IDS_ST_HEADER_SAMSUNG_KIES"), "</b><br>",
54                 evas_textblock_text_utf8_to_markup(NULL, _("IDS_ST_BODY_SAMSUNG_KIES_CONNECTION_CONNECTING_USB_HELP_MSG")));
55         snprintf(mass_storage_help, HELP_LEN,
56                 "%s%s%s%s", "<b>", _("IDS_ST_OPT_MASS_STORAGE_ABB"), "</b><br>",
57                 evas_textblock_text_utf8_to_markup(NULL, _("IDS_ST_BODY_MASS_STORAGE_HELP_MSG")));
58         snprintf(debugging_mode_help, HELP_LEN,
59                 "%s%s%s%s", "<b>", _("IDS_ST_BODY_USB_DEBUGGING"), "</b><br>",
60                 evas_textblock_text_utf8_to_markup(NULL, _("IDS_ST_BODY_USB_DEBUGGING_IS_INTENDED_FOR_DEVELOPMENT_PURPOSES_ONLY_MSG")));
61
62
63         Evas_Object *genlist;
64         setting_push_layout_navi_bar_genlist(ad->win_main_layout,
65                                              ad->win_get,
66                                              "IDS_COM_BODY_HELP",
67                                              _("IDS_COM_BODY_BACK"),
68                                              NULL,
69                                              setting_connectivity_usb_help_click_back_cb,
70                                              NULL, ad, &genlist,
71                                              ad->navi_bar);
72
73         char * strsamsung_kies_help = samsung_kies_help;
74         char * strmass_storage_help = mass_storage_help;
75         char * strdebugging_mode_help = debugging_mode_help;
76         ADD_GL_LABLE(genlist, strsamsung_kies_help);
77         ADD_GL_LABLE(genlist, strmass_storage_help);
78         ADD_GL_LABLE(genlist, strdebugging_mode_help);
79
80         setting_view_connectivity_usb_help.is_create = 1;
81
82         return SETTING_RETURN_SUCCESS;
83 }
84
85 static int setting_connectivity_usb_help_destroy(void *cb)
86 {
87         /* error check */
88         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
89
90         SettingConnectivityUG *ad = (SettingConnectivityUG *) cb;
91
92         if (setting_view_connectivity_usb_help.is_create)
93         {
94                 elm_naviframe_item_pop(ad->navi_bar);
95                 setting_view_connectivity_usb_help.is_create = 0;
96         }
97
98         return SETTING_RETURN_SUCCESS;
99 }
100
101 static int setting_connectivity_usb_help_update(void *cb)
102 {
103         return SETTING_RETURN_SUCCESS;
104 }
105
106 static int setting_connectivity_usb_help_cleanup(void *cb)
107 {
108         return setting_connectivity_usb_help_destroy(cb);
109 }
110
111 /* ***************************************************
112  *
113  *call back func
114  *
115  ***************************************************/
116
117 static void
118 setting_connectivity_usb_help_click_back_cb(void *data, Evas_Object *obj,
119                                             void *event_info)
120 {
121         /* error check */
122         setting_retm_if(data == NULL, " Data parameter is NULL");
123
124         SettingConnectivityUG *ad = (SettingConnectivityUG *) data;
125         setting_view_change(&setting_view_connectivity_usb_help,
126                             &setting_view_connectivity_usb, ad);
127 }