Fix ug-setting-location-efl build into pure Wayland profile.
[platform/core/location/ug-setting-location-efl.git] / libug-setting-location-efl-help.c
1 /*
2  * Open Service Platform
3  * Copyright (c) 2012-2013  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 #include "libug-setting-location-efl.h"
19 #include "libug-setting-location-efl-help.h"
20 #include "libug-setting-location-efl-log.h"
21
22 static char *help_menu[] = {
23         N_("IDS_LBS_BODY_GPS"),
24         N_("IDS_LBS_BODY_ADVANCED_GPS"),
25         N_("IDS_LBS_BODY_NETWORK_POSITION"),
26 };
27
28 static char *help_msg[] = {
29         N_("IDS_LBS_POP_APPLICATIONS_WILL_BE_PERMITTED_TO_USE_YOUR_LOCATION"),
30         N_("IDS_LBS_BODY_DOWNLOADING_DATA_WILL_SPEED_UP_GPS_OPERATION_BUT_INCUR_CHARGES"),
31         N_("IDS_LBS_BODY_ENABLING_NETWORK_POSITIONING_WILL_HELP_YOU_FIND_YOUR_LOCATION_EVEN_IF_YOU_ARE_INDOORS_MSG"),
32 };
33
34 #define EDJ_NAME        EDJDIR"/setting-location.edj"
35
36 #define GROUP_NAME      "help"
37
38 #define LOCATION_HELP_MENU_GPS          0
39 #define LOCATION_HELP_MENU_AGPS         1
40 #define LOCATION_HELP_MENU_NET          2
41
42 static void setting_location_help_back_cb(void *data, Evas_Object * obj, void *event_info)
43 {
44         LOC_LOG("setting_location_help_back_cb");
45         struct ug_data *ugd = (struct ug_data *)data;
46         elm_naviframe_item_pop(ugd->naviframe);
47 }
48
49 static char *setting_location_get_help_msg(void)
50 {
51         char help_message[1024] = {0,};
52
53         snprintf(help_message, sizeof(help_message) - 1,
54                 "<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>",
55                 _(help_menu[LOCATION_HELP_MENU_GPS]), _(help_msg[LOCATION_HELP_MENU_GPS]),\
56                 _(help_menu[LOCATION_HELP_MENU_AGPS]), _(help_msg[LOCATION_HELP_MENU_AGPS]),\
57                 _(help_menu[LOCATION_HELP_MENU_NET]), _(help_msg[LOCATION_HELP_MENU_NET]));
58
59         return strdup(help_message);
60 }
61
62 static Evas_Object *setting_location_get_layout(Evas_Object * parent, void *data)
63 {
64         Evas_Object *layout = elm_layout_add(parent);
65
66         elm_layout_file_set(layout, EDJ_NAME, GROUP_NAME);
67         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
68         evas_object_show(layout);
69
70         edje_object_part_text_set(_EDJ(layout), "help_msg", setting_location_get_help_msg());
71
72         return layout;
73 }
74
75 int setting_location_help_view(void *data)
76 {
77         struct ug_data *ugd = (struct ug_data *)data;
78
79         Evas_Object *layout;
80         Evas_Object *l_button;
81
82         l_button = elm_button_add(ugd->naviframe);
83         evas_object_smart_callback_add(l_button, "clicked", setting_location_help_back_cb, ugd);
84
85         layout = setting_location_get_layout(ugd->naviframe, ugd);
86         elm_naviframe_item_push(ugd->naviframe, S_("IDS_COM_BODY_HELP"), l_button, NULL, layout, NULL);
87         elm_object_style_set(l_button, "naviframe/back_btn/default");
88
89         return 0;
90 }