~ricmm/+junk/unity-lens_music-sc

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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
/* filter-parser-genre.c generated by valac 0.16.1, the Vala compiler
 * generated from filter-parser-genre.vala, do not modify */

/*
 * Copyright (C) 2011 Canonical Ltd
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 3 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authored by Alex Launi <alex.launi@canonical.com>
 *
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <unity.h>


#define UNITY_MUSIC_LENS_TYPE_FILTER_PARSER (unity_music_lens_filter_parser_get_type ())
#define UNITY_MUSIC_LENS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParser))
#define UNITY_MUSIC_LENS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
#define UNITY_MUSIC_LENS_IS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
#define UNITY_MUSIC_LENS_IS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
#define UNITY_MUSIC_LENS_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))

typedef struct _UnityMusicLensFilterParser UnityMusicLensFilterParser;
typedef struct _UnityMusicLensFilterParserClass UnityMusicLensFilterParserClass;
typedef struct _UnityMusicLensFilterParserPrivate UnityMusicLensFilterParserPrivate;

#define UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER (unity_music_lens_genre_filter_parser_get_type ())
#define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParser))
#define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParserClass))
#define UNITY_MUSIC_LENS_IS_GENRE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER))
#define UNITY_MUSIC_LENS_IS_GENRE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER))
#define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParserClass))

typedef struct _UnityMusicLensGenreFilterParser UnityMusicLensGenreFilterParser;
typedef struct _UnityMusicLensGenreFilterParserClass UnityMusicLensGenreFilterParserClass;
typedef struct _UnityMusicLensGenreFilterParserPrivate UnityMusicLensGenreFilterParserPrivate;

#define UNITY_MUSIC_LENS_TYPE_GENRE (unity_music_lens_genre_get_type ())
#define UNITY_MUSIC_LENS_GENRE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_GENRE, UnityMusicLensGenre))
#define UNITY_MUSIC_LENS_GENRE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_GENRE, UnityMusicLensGenreClass))
#define UNITY_MUSIC_LENS_IS_GENRE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_GENRE))
#define UNITY_MUSIC_LENS_IS_GENRE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_GENRE))
#define UNITY_MUSIC_LENS_GENRE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_GENRE, UnityMusicLensGenreClass))

typedef struct _UnityMusicLensGenre UnityMusicLensGenre;
typedef struct _UnityMusicLensGenreClass UnityMusicLensGenreClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))

struct _UnityMusicLensFilterParser {
	GObject parent_instance;
	UnityMusicLensFilterParserPrivate * priv;
};

struct _UnityMusicLensFilterParserClass {
	GObjectClass parent_class;
	gchar* (*parse) (UnityMusicLensFilterParser* self);
	const gchar* (*get_id) (UnityMusicLensFilterParser* self);
};

struct _UnityMusicLensGenreFilterParser {
	UnityMusicLensFilterParser parent_instance;
	UnityMusicLensGenreFilterParserPrivate * priv;
};

struct _UnityMusicLensGenreFilterParserClass {
	UnityMusicLensFilterParserClass parent_class;
};

struct _UnityMusicLensGenreFilterParserPrivate {
	UnityMusicLensGenre* _map;
};


static gpointer unity_music_lens_genre_filter_parser_parent_class = NULL;

GType unity_music_lens_filter_parser_get_type (void) G_GNUC_CONST;
GType unity_music_lens_genre_filter_parser_get_type (void) G_GNUC_CONST;
GType unity_music_lens_genre_get_type (void) G_GNUC_CONST;
#define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParserPrivate))
enum  {
	UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_DUMMY_PROPERTY,
	UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_ID,
	UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_MAP
};
UnityMusicLensGenreFilterParser* unity_music_lens_genre_filter_parser_new (UnityCheckOptionFilterCompact* filter);
UnityMusicLensGenreFilterParser* unity_music_lens_genre_filter_parser_construct (GType object_type, UnityCheckOptionFilterCompact* filter);
UnityMusicLensFilterParser* unity_music_lens_filter_parser_construct (GType object_type, UnityFilter* filter);
UnityMusicLensGenre* unity_music_lens_genre_new (void);
UnityMusicLensGenre* unity_music_lens_genre_construct (GType object_type);
static void unity_music_lens_genre_filter_parser_set_map (UnityMusicLensGenreFilterParser* self, UnityMusicLensGenre* value);
static gchar* unity_music_lens_genre_filter_parser_real_parse (UnityMusicLensFilterParser* base);
GList* unity_music_lens_genre_filter_parser_get_all_selected_genres (UnityMusicLensGenreFilterParser* self);
UnityFilter* unity_music_lens_filter_parser_get_filter (UnityMusicLensFilterParser* self);
static void _g_object_unref0_ (gpointer var);
static void _g_list_free__g_object_unref0_ (GList* self);
UnityMusicLensGenre* unity_music_lens_genre_filter_parser_get_map (UnityMusicLensGenreFilterParser* self);
static void unity_music_lens_genre_filter_parser_finalize (GObject* obj);
const gchar* unity_music_lens_filter_parser_get_id (UnityMusicLensFilterParser* self);
static void _vala_unity_music_lens_genre_filter_parser_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_unity_music_lens_genre_filter_parser_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


UnityMusicLensGenreFilterParser* unity_music_lens_genre_filter_parser_construct (GType object_type, UnityCheckOptionFilterCompact* filter) {
	UnityMusicLensGenreFilterParser * self = NULL;
	UnityCheckOptionFilterCompact* _tmp0_;
	UnityMusicLensGenre* _tmp1_;
	UnityMusicLensGenre* _tmp2_;
	g_return_val_if_fail (filter != NULL, NULL);
	_tmp0_ = filter;
	self = (UnityMusicLensGenreFilterParser*) unity_music_lens_filter_parser_construct (object_type, (UnityFilter*) _tmp0_);
	_tmp1_ = unity_music_lens_genre_new ();
	_tmp2_ = _tmp1_;
	unity_music_lens_genre_filter_parser_set_map (self, _tmp2_);
	_g_object_unref0 (_tmp2_);
	return self;
}


UnityMusicLensGenreFilterParser* unity_music_lens_genre_filter_parser_new (UnityCheckOptionFilterCompact* filter) {
	return unity_music_lens_genre_filter_parser_construct (UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, filter);
}


static gchar* unity_music_lens_genre_filter_parser_real_parse (UnityMusicLensFilterParser* base) {
	UnityMusicLensGenreFilterParser * self;
	gchar* result = NULL;
	gchar* _tmp0_;
	self = (UnityMusicLensGenreFilterParser*) base;
	_tmp0_ = g_strdup ("");
	result = _tmp0_;
	return result;
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static void _g_object_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}


static void _g_list_free__g_object_unref0_ (GList* self) {
	g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
	g_list_free (self);
}


GList* unity_music_lens_genre_filter_parser_get_all_selected_genres (UnityMusicLensGenreFilterParser* self) {
	GList* result = NULL;
	UnityFilter* _tmp0_;
	UnityFilter* _tmp1_;
	GList* _tmp2_;
	GList* options;
	GList* active;
	GList* _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = unity_music_lens_filter_parser_get_filter ((UnityMusicLensFilterParser*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = ((UnityOptionsFilter*) (UNITY_IS_CHECK_OPTION_FILTER_COMPACT (_tmp1_) ? ((UnityCheckOptionFilterCompact*) _tmp1_) : NULL))->options;
	options = _tmp2_;
	active = NULL;
	_tmp3_ = options;
	{
		GList* option_collection = NULL;
		GList* option_it = NULL;
		option_collection = _tmp3_;
		for (option_it = option_collection; option_it != NULL; option_it = option_it->next) {
			UnityFilterOption* _tmp4_;
			UnityFilterOption* option = NULL;
			_tmp4_ = _g_object_ref0 ((UnityFilterOption*) option_it->data);
			option = _tmp4_;
			{
				UnityFilterOption* _tmp5_;
				gboolean _tmp6_;
				gboolean _tmp7_;
				_tmp5_ = option;
				_tmp6_ = unity_filter_option_get_active (_tmp5_);
				_tmp7_ = _tmp6_;
				if (_tmp7_) {
					UnityFilterOption* _tmp8_;
					UnityFilterOption* _tmp9_;
					_tmp8_ = option;
					_tmp9_ = _g_object_ref0 (_tmp8_);
					active = g_list_append (active, _tmp9_);
				}
				_g_object_unref0 (option);
			}
		}
	}
	result = active;
	return result;
}


static const gchar* unity_music_lens_genre_filter_parser_real_get_id (UnityMusicLensFilterParser* base) {
	const gchar* result;
	UnityMusicLensGenreFilterParser* self;
	self = (UnityMusicLensGenreFilterParser*) base;
	result = "genre";
	return result;
}


UnityMusicLensGenre* unity_music_lens_genre_filter_parser_get_map (UnityMusicLensGenreFilterParser* self) {
	UnityMusicLensGenre* result;
	UnityMusicLensGenre* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_map;
	result = _tmp0_;
	return result;
}


static void unity_music_lens_genre_filter_parser_set_map (UnityMusicLensGenreFilterParser* self, UnityMusicLensGenre* value) {
	UnityMusicLensGenre* _tmp0_;
	UnityMusicLensGenre* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_map);
	self->priv->_map = _tmp1_;
	g_object_notify ((GObject *) self, "map");
}


static void unity_music_lens_genre_filter_parser_class_init (UnityMusicLensGenreFilterParserClass * klass) {
	unity_music_lens_genre_filter_parser_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (UnityMusicLensGenreFilterParserPrivate));
	UNITY_MUSIC_LENS_FILTER_PARSER_CLASS (klass)->parse = unity_music_lens_genre_filter_parser_real_parse;
	UNITY_MUSIC_LENS_FILTER_PARSER_CLASS (klass)->get_id = unity_music_lens_genre_filter_parser_real_get_id;
	G_OBJECT_CLASS (klass)->get_property = _vala_unity_music_lens_genre_filter_parser_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_unity_music_lens_genre_filter_parser_set_property;
	G_OBJECT_CLASS (klass)->finalize = unity_music_lens_genre_filter_parser_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_ID, g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_MAP, g_param_spec_object ("map", "map", "map", UNITY_MUSIC_LENS_TYPE_GENRE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void unity_music_lens_genre_filter_parser_instance_init (UnityMusicLensGenreFilterParser * self) {
	self->priv = UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_GET_PRIVATE (self);
}


static void unity_music_lens_genre_filter_parser_finalize (GObject* obj) {
	UnityMusicLensGenreFilterParser * self;
	self = UNITY_MUSIC_LENS_GENRE_FILTER_PARSER (obj);
	_g_object_unref0 (self->priv->_map);
	G_OBJECT_CLASS (unity_music_lens_genre_filter_parser_parent_class)->finalize (obj);
}


GType unity_music_lens_genre_filter_parser_get_type (void) {
	static volatile gsize unity_music_lens_genre_filter_parser_type_id__volatile = 0;
	if (g_once_init_enter (&unity_music_lens_genre_filter_parser_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (UnityMusicLensGenreFilterParserClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_music_lens_genre_filter_parser_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMusicLensGenreFilterParser), 0, (GInstanceInitFunc) unity_music_lens_genre_filter_parser_instance_init, NULL };
		GType unity_music_lens_genre_filter_parser_type_id;
		unity_music_lens_genre_filter_parser_type_id = g_type_register_static (UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, "UnityMusicLensGenreFilterParser", &g_define_type_info, 0);
		g_once_init_leave (&unity_music_lens_genre_filter_parser_type_id__volatile, unity_music_lens_genre_filter_parser_type_id);
	}
	return unity_music_lens_genre_filter_parser_type_id__volatile;
}


static void _vala_unity_music_lens_genre_filter_parser_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	UnityMusicLensGenreFilterParser * self;
	self = UNITY_MUSIC_LENS_GENRE_FILTER_PARSER (object);
	switch (property_id) {
		case UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_ID:
		g_value_set_string (value, unity_music_lens_filter_parser_get_id ((UnityMusicLensFilterParser*) self));
		break;
		case UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_MAP:
		g_value_set_object (value, unity_music_lens_genre_filter_parser_get_map (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_unity_music_lens_genre_filter_parser_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	UnityMusicLensGenreFilterParser * self;
	self = UNITY_MUSIC_LENS_GENRE_FILTER_PARSER (object);
	switch (property_id) {
		case UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_MAP:
		unity_music_lens_genre_filter_parser_set_map (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}