Release Tizen2.0 beta
[framework/location/ug-setting-location-efl.git] / libug-setting-location-efl-help.c
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *    http://www.tizenopensource.org/license
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include "libug-setting-location-efl.h"
18 #include "libug-setting-location-efl-help.h"
19
20 static char *help_menu[] = {
21         N_("IDS_LBS_BODY_GPS"),
22         N_("IDS_LBS_BODY_ADVANCED_GPS"),
23         N_("IDS_LBS_BODY_NETWORK_POSITION"),
24 };
25
26 static char *help_msg[] = {
27         N_("IDS_POP_APPLICATIONS_WILL_BE_PERMITTED_TO_USE_YOUR_LOCATION"),
28         N_("IDS_LBS_BODY_DOWNLOADING_DATA_WILL_SEPPD_UP_GPS_OPERATION_BUT_INCUR_CHARGES"),
29         N_("IDS_LBS_BODY_ENABLING_NETWORK_POSITIONING_WILL_HELP_YOU_FIND_YOUR_LOCATION_EVEN_IF_YOU_ARE_INDOORS_MSG"),
30 };
31
32 #define EDJ_NAME        EDJDIR"/setting-location.edj"
33
34 #define GROUP_NAME      "help"
35
36 #define LOCATION_HELP_MENU_GPS          0
37 #define LOCATION_HELP_MENU_AGPS         1
38 #define LOCATION_HELP_MENU_NET          2
39
40 static void setting_location_help_back_cb(void *data, Evas_Object * obj, void *event_info)
41 {
42         struct ug_data *ugd = (struct ug_data *)data;
43         elm_naviframe_item_pop(ugd->naviframe);
44 }
45
46 static char *setting_location_get_help_msg(void)
47 {
48         char help_message[1024];
49
50         snprintf(help_message, sizeof(help_message) - 1,
51                 "<title>%s</title><br><msg>%s</msg><br><br><title>%s</title>><br><msg>%s</msg><br><br><title>%s</title><br><msg>%s</msg><br>",
52                 _(help_menu[LOCATION_HELP_MENU_GPS]), _(help_msg[LOCATION_HELP_MENU_GPS]),\
53                 _(help_menu[LOCATION_HELP_MENU_AGPS]), _(help_msg[LOCATION_HELP_MENU_AGPS]),\
54                 _(help_menu[LOCATION_HELP_MENU_NET]), _(help_msg[LOCATION_HELP_MENU_NET]));
55
56         return strdup(help_message);
57 }
58
59 static Evas_Object *setting_location_get_layout(Evas_Object * parent, void *data)
60 {
61         Evas_Object *layout = elm_layout_add(parent);
62
63         elm_layout_file_set(layout, EDJ_NAME, GROUP_NAME);
64         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
65         evas_object_show(layout);
66
67         edje_object_part_text_set(_EDJ(layout), "help_msg", setting_location_get_help_msg());
68
69         return layout;
70 }
71
72 int setting_location_help_view(void *data)
73 {
74         struct ug_data *ugd = (struct ug_data *)data;
75
76         Evas_Object *layout;
77         Evas_Object *l_button;
78
79         l_button = elm_button_add(ugd->naviframe);
80         evas_object_smart_callback_add(l_button, "clicked", setting_location_help_back_cb, ugd);
81
82         layout = setting_location_get_layout(ugd->naviframe, ugd);
83         elm_naviframe_item_push(ugd->naviframe, _("IDS_COM_BODY_HELP"), l_button, NULL, layout, NULL);
84         elm_object_style_set(l_button, "naviframe/back_btn/default");
85
86         return 0;
87 }