summaryrefslogtreecommitdiff
path: root/libug-setting-location-efl-help.c
blob: 206a017700c91b3959386170fdde2fe64c9f543f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
 * Open Service Platform
 * Copyright (c) 2012-2013  Samsung Electronics Co., Ltd
 *
 * Licensed under the Flora License, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://floralicense.org/license/
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "libug-setting-location-efl.h"
#include "libug-setting-location-efl-help.h"
#include "libug-setting-location-efl-log.h"

static char *help_menu[] = {
	N_("IDS_LBS_BODY_GPS"),
	N_("IDS_LBS_BODY_ADVANCED_GPS"),
	N_("IDS_LBS_BODY_NETWORK_POSITION"),
};

static char *help_msg[] = {
	N_("IDS_LBS_POP_APPLICATIONS_WILL_BE_PERMITTED_TO_USE_YOUR_LOCATION"),
	N_("IDS_LBS_BODY_DOWNLOADING_DATA_WILL_SPEED_UP_GPS_OPERATION_BUT_INCUR_CHARGES"),
	N_("IDS_LBS_BODY_ENABLING_NETWORK_POSITIONING_WILL_HELP_YOU_FIND_YOUR_LOCATION_EVEN_IF_YOU_ARE_INDOORS_MSG"),
};

#define EDJ_NAME	EDJDIR"/setting-location.edj"

#define GROUP_NAME	"help"

#define LOCATION_HELP_MENU_GPS 		0
#define LOCATION_HELP_MENU_AGPS		1
#define LOCATION_HELP_MENU_NET		2

static void setting_location_help_back_cb(void *data, Evas_Object * obj, void *event_info)
{
	LOC_LOG("setting_location_help_back_cb");
	struct ug_data *ugd = (struct ug_data *)data;
	elm_naviframe_item_pop(ugd->naviframe);
}

static char *setting_location_get_help_msg(void)
{
	char help_message[1024] = {0,};

	snprintf(help_message, sizeof(help_message) - 1,
		"<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>",
		_(help_menu[LOCATION_HELP_MENU_GPS]), _(help_msg[LOCATION_HELP_MENU_GPS]),\
		_(help_menu[LOCATION_HELP_MENU_AGPS]), _(help_msg[LOCATION_HELP_MENU_AGPS]),\
		_(help_menu[LOCATION_HELP_MENU_NET]), _(help_msg[LOCATION_HELP_MENU_NET]));

	return strdup(help_message);
}

static Evas_Object *setting_location_get_layout(Evas_Object * parent, void *data)
{
	Evas_Object *layout = elm_layout_add(parent);

	elm_layout_file_set(layout, EDJ_NAME, GROUP_NAME);
	evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_show(layout);

	edje_object_part_text_set(_EDJ(layout), "help_msg", setting_location_get_help_msg());

	return layout;
}

int setting_location_help_view(void *data)
{
	struct ug_data *ugd = (struct ug_data *)data;

	Evas_Object *layout;
	Evas_Object *l_button;

	l_button = elm_button_add(ugd->naviframe);
	evas_object_smart_callback_add(l_button, "clicked", setting_location_help_back_cb, ugd);

	layout = setting_location_get_layout(ugd->naviframe, ugd);
	elm_naviframe_item_push(ugd->naviframe, S_("IDS_COM_BODY_HELP"), l_button, NULL, layout, NULL);
	elm_object_style_set(l_button, "naviframe/back_btn/default");

	return 0;
}