Change the manifest and remove rule files
[apps/native/ug-wifi-direct.git] / ug-wifidirect / src / wfd_ug_about_view.c
1 /*
2 *  WiFi-Direct UG
3 *
4 * Copyright 2012 Samsung Electronics Co., Ltd
5
6 * Licensed under the Flora License, Version 1.1 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9
10 * http://floralicense.org/license
11
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20 #include <libintl.h>
21
22 #include <assert.h>
23 #include <glib.h>
24
25 #include <Elementary.h>
26 #include <vconf.h>
27 #include <ui-gadget-module.h>
28 #include <wifi-direct.h>
29
30 #include "wfd_ug.h"
31 #include "wfd_ug_view.h"
32 #include "wfd_client.h"
33
34 static Elm_Genlist_Item_Class itc;
35
36 /**
37  *      This function let the ug get the label of about
38  *      @return   the label of about
39  *      @param[in] parent the pointer to the label's parent
40   *     @param[in] obj the pointer to the evas object
41  *      @param[in] part the pointer to the part of item
42  */
43 static char *_wfd_gl_label_help_dialogue_get(void *data, Evas_Object *obj, const char *part)
44 {
45         return strdup(_("IDS_WFD_BODY_ABOUT_WIFI"));
46 }
47
48 /**
49  *      This function let the ug call it when click 'back' button
50  *      @return   void
51  *      @param[in] data the pointer to the main data structure
52  *      @param[in] obj the pointer to the evas object
53  *      @param[in] event_info the pointer to the event information
54  */
55 void _about_view_back_btn_cb(void *data, Evas_Object * obj, void *event_info)
56 {
57         __WDUG_LOG_FUNC_ENTER__;
58         struct ug_data *ugd = (struct ug_data *) data;
59
60         if (!ugd) {
61                 WDUG_LOGE("The param is NULL\n");
62                 return;
63         }
64
65         elm_naviframe_item_pop(ugd->naviframe);
66
67         __WDUG_LOG_FUNC_EXIT__;
68         return;
69 }
70
71 /**
72  *      This function let the ug create about view
73  *      @return   void
74  *      @param[in] ugd the pointer to the main data structure
75  */
76 void _wifid_create_about_view(struct ug_data *ugd)
77 {
78         __WDUG_LOG_FUNC_ENTER__;
79
80         Evas_Object *back_btn = NULL;
81         Elm_Object_Item *navi_item = NULL;
82         Evas_Object *genlist = NULL;
83         Elm_Object_Item *item = NULL;
84
85         if (ugd == NULL) {
86                 WDUG_LOGE("Incorrect parameter(NULL)");
87                 return;
88         }
89
90         genlist = elm_genlist_add(ugd->naviframe);
91         if (NULL == genlist) {
92                 WDUG_LOGE("Create genlist failed\n");
93                 return;
94         }
95
96         elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
97
98         /* Set multiline item class */
99         itc.item_style = "multiline/1text";
100         itc.func.text_get = _wfd_gl_label_help_dialogue_get;
101         itc.func.content_get = NULL;
102         itc.func.state_get = NULL;
103         itc.func.del = NULL;
104
105         item = elm_genlist_item_append(genlist, &itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
106         elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
107
108         back_btn = elm_button_add(ugd->naviframe);
109         elm_object_style_set(back_btn, "naviframe/back_btn/default");
110         evas_object_smart_callback_add(back_btn, "clicked", _about_view_back_btn_cb, (void *)ugd);
111         elm_object_focus_allow_set(back_btn, EINA_FALSE);
112
113         navi_item = elm_naviframe_item_push(ugd->naviframe, IDS_WFD_TITLE_ABOUT_WIFI_DIRECT, back_btn, NULL, genlist, NULL);
114
115         __WDUG_LOG_FUNC_EXIT__;
116 }