summaryrefslogtreecommitdiff
path: root/ug-wifidirect/src/wfd_ug_about_view.c
blob: 306f091ef87cf8a75b7492583e2a63a7f3d102c0 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
*  WiFi-Direct UG
*
* Copyright 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 <libintl.h>

#include <assert.h>
#include <glib.h>

#include <Elementary.h>
#include <vconf.h>
#include <ui-gadget-module.h>
#include <wifi-direct.h>

#include "wfd_ug.h"
#include "wfd_ug_view.h"
#include "wfd_client.h"

static Elm_Genlist_Item_Class itc;

/**
 *	This function let the ug get the label of about
 *	@return   the label of about
 *	@param[in] parent the pointer to the label's parent
  *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static char *_wfd_gl_label_help_dialogue_get(void *data, Evas_Object *obj, const char *part)
{
	return strdup(_("IDS_WFD_BODY_ABOUT_WIFI"));
}

/**
 *	This function let the ug call it when click 'back' button
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] event_info the pointer to the event information
 */
void _about_view_back_btn_cb(void *data, Evas_Object * obj, void *event_info)
{
	__WDUG_LOG_FUNC_ENTER__;
	struct ug_data *ugd = (struct ug_data *) data;

	if (!ugd) {
		WDUG_LOGE("The param is NULL\n");
		return;
	}

	elm_naviframe_item_pop(ugd->naviframe);

	__WDUG_LOG_FUNC_EXIT__;
	return;
}

/**
 *	This function let the ug create about view
 *	@return   void
 *	@param[in] ugd the pointer to the main data structure
 */
void _wifid_create_about_view(struct ug_data *ugd)
{
	__WDUG_LOG_FUNC_ENTER__;

	Evas_Object *back_btn = NULL;
	Elm_Object_Item *navi_item = NULL;
	Evas_Object *genlist = NULL;
	Elm_Object_Item *item = NULL;

	if (ugd == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)");
		return;
	}

	genlist = elm_genlist_add(ugd->naviframe);
	if (NULL == genlist) {
		WDUG_LOGE("Create genlist failed\n");
		return;
	}

	elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);

	/* Set multiline item class */
	itc.item_style = "multiline/1text";
	itc.func.text_get = _wfd_gl_label_help_dialogue_get;
	itc.func.content_get = NULL;
	itc.func.state_get = NULL;
	itc.func.del = NULL;

	item = elm_genlist_item_append(genlist, &itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
	elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);

	back_btn = elm_button_add(ugd->naviframe);
	elm_object_style_set(back_btn, "naviframe/back_btn/default");
	evas_object_smart_callback_add(back_btn, "clicked", _about_view_back_btn_cb, (void *)ugd);
	elm_object_focus_allow_set(back_btn, EINA_FALSE);

	navi_item = elm_naviframe_item_push(ugd->naviframe, IDS_WFD_TITLE_ABOUT_WIFI_DIRECT, back_btn, NULL, genlist, NULL);

	__WDUG_LOG_FUNC_EXIT__;
}