summaryrefslogtreecommitdiff
path: root/mobile/lock-setting/lockscreen-options/src/lockscreen-options.c
blob: de5eb0055c581e6b7f9b774ecbbdebbd33107971 (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
 /*
  * Copyright 2012  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.
  */



#ifndef UG_MODULE_API
#define UG_MODULE_API __attribute__ ((visibility("default")))
#endif

#include <Elementary.h>
#include <ui-gadget-module.h>

#include "lockscreen-options.h"
#include "lockscreen-options-util.h"
#include "lockscreen-options-main.h"

static Evas_Object *create_bg(Evas_Object * parent)
{
	Evas_Object *bg = elm_bg_add(parent);

	evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND,
					 EVAS_HINT_EXPAND);
	elm_object_style_set(bg, "group_list");

	elm_object_part_content_set(parent, "elm.swallow.bg", bg);
	evas_object_show(bg);

	return bg;
}

static Evas_Object *create_fullview(Evas_Object * parent,
				    lockscreen_options_ug_data * ug_data)
{
	Evas_Object *base = NULL;
	Evas_Object *navi_bar = NULL;

	base = lockscreen_options_util_create_layout(parent, NULL, NULL);

	elm_layout_theme_set(base, "layout", "application", "default");
	elm_win_resize_object_add(parent, base);

	elm_win_indicator_mode_set(parent, ELM_WIN_INDICATOR_SHOW);

	create_bg(base);

	navi_bar = lockscreen_options_util_create_navigation(base);
	ug_data->navi_bar = navi_bar;

	lockscreen_options_main_create_view(ug_data);

	return base;
}

static Evas_Object *create_frameview(Evas_Object * parent,
				     lockscreen_options_ug_data * ug_data)
{
	Evas_Object *base = NULL;

	return base;
}

static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h service,
		       void *priv)
{
	Evas_Object *parent = NULL;
	Evas_Object *win_main = NULL;
	lockscreen_options_ug_data *ug_data = NULL;

	if (!ug || !priv)
		return NULL;

	bindtextdomain(PKGNAME, "/usr/ug/res/locale");

	ug_data = priv;
	ug_data->ug = ug;

	parent = ug_get_parent_layout(ug);
	if (!parent)
		return NULL;

	win_main = ug_get_window();
	if (!win_main) {
		return NULL;
	}

	ug_data->win_main = win_main;

	if (mode == UG_MODE_FULLVIEW)
		ug_data->base = create_fullview(parent, ug_data);
	else
		ug_data->base = create_frameview(parent, ug_data);

	return ug_data->base;
}

static void on_start(ui_gadget_h ug, service_h service, void *priv)
{
}

static void on_pause(ui_gadget_h ug, service_h service, void *priv)
{

}

static void on_resume(ui_gadget_h ug, service_h service, void *priv)
{

}

static void on_destroy(ui_gadget_h ug, service_h service, void *priv)
{
	lockscreen_options_ug_data *ug_data;

	if (!ug || !priv)
		return;

	ug_data = priv;
	evas_object_del(ug_data->base);
	ug_data->base = NULL;
}

static void on_message(ui_gadget_h ug, service_h msg, service_h service,
		       void *priv)
{
}

static void on_event(ui_gadget_h ug, enum ug_event event, service_h service,
		     void *priv)
{
	switch (event) {
	case UG_EVENT_LOW_MEMORY:
		break;
	case UG_EVENT_LOW_BATTERY:
		break;
	case UG_EVENT_LANG_CHANGE:
		break;
	case UG_EVENT_ROTATE_PORTRAIT:
		break;
	case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
		break;
	case UG_EVENT_ROTATE_LANDSCAPE:
		break;
	case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
		break;
	default:
		break;
	}
}

static void on_key_event(ui_gadget_h ug, enum ug_key_event event,
			 service_h service, void *priv)
{
	if (!ug)
		return;

	switch (event) {
	case UG_KEY_EVENT_END:
		ug_destroy_me(ug);
		break;
	default:
		break;
	}
}

UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
{
	lockscreen_options_ug_data *ug_data;

	if (!ops)
		return -1;

	ug_data = calloc(1, sizeof(lockscreen_options_ug_data));
	if (!ug_data)
		return -1;

	ops->create = on_create;
	ops->start = on_start;
	ops->pause = on_pause;
	ops->resume = on_resume;
	ops->destroy = on_destroy;
	ops->message = on_message;
	ops->event = on_event;
	ops->key_event = on_key_event;
	ops->priv = ug_data;
	ops->opt = UG_OPT_INDICATOR_ENABLE;

	return 0;
}

UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
{
	lockscreen_options_ug_data *ug_data;

	if (!ops)
		return;

	ug_data = ops->priv;
	if (ug_data)
		free(ug_data);
}