~ubuntu-branches/ubuntu/precise/unity-lens-music/precise-proposed

« back to all changes in this revision

Viewing changes to src/daemon.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2011-08-11 19:37:31 UTC
  • Revision ID: james.westby@ubuntu.com-20110811193731-0dym5igg8sfanj5z
Tags: upstream-0.1.0
ImportĀ upstreamĀ versionĀ 0.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* daemon.c generated by valac 0.12.1, the Vala compiler
 
2
 * generated from daemon.vala, do not modify */
 
3
 
 
4
/*
 
5
 * Copyright (C) 2010 Canonical Ltd
 
6
 *
 
7
 * This program is free software: you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License version 3 as
 
9
 * published by the Free Software Foundation.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 *
 
19
 * Authored by Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com>
 
20
 *
 
21
 */
 
22
 
 
23
#include <glib.h>
 
24
#include <glib-object.h>
 
25
#include <stdlib.h>
 
26
#include <string.h>
 
27
#include <unity.h>
 
28
#include <glib/gi18n-lib.h>
 
29
#include <gio/gio.h>
 
30
#include <stdio.h>
 
31
 
 
32
 
 
33
#define UNITY_MUSIC_LENS_TYPE_DAEMON (unity_music_lens_daemon_get_type ())
 
34
#define UNITY_MUSIC_LENS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_DAEMON, UnityMusicLensDaemon))
 
35
#define UNITY_MUSIC_LENS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_DAEMON, UnityMusicLensDaemonClass))
 
36
#define UNITY_MUSIC_LENS_IS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_DAEMON))
 
37
#define UNITY_MUSIC_LENS_IS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_DAEMON))
 
38
#define UNITY_MUSIC_LENS_DAEMON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_DAEMON, UnityMusicLensDaemonClass))
 
39
 
 
40
typedef struct _UnityMusicLensDaemon UnityMusicLensDaemon;
 
41
typedef struct _UnityMusicLensDaemonClass UnityMusicLensDaemonClass;
 
42
typedef struct _UnityMusicLensDaemonPrivate UnityMusicLensDaemonPrivate;
 
43
 
 
44
#define UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY (unity_music_lens_banshee_scope_proxy_get_type ())
 
45
#define UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY, UnityMusicLensBansheeScopeProxy))
 
46
#define UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY, UnityMusicLensBansheeScopeProxyClass))
 
47
#define UNITY_MUSIC_LENS_IS_BANSHEE_SCOPE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY))
 
48
#define UNITY_MUSIC_LENS_IS_BANSHEE_SCOPE_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY))
 
49
#define UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY, UnityMusicLensBansheeScopeProxyClass))
 
50
 
 
51
typedef struct _UnityMusicLensBansheeScopeProxy UnityMusicLensBansheeScopeProxy;
 
52
typedef struct _UnityMusicLensBansheeScopeProxyClass UnityMusicLensBansheeScopeProxyClass;
 
53
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 
54
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 
55
 
 
56
struct _UnityMusicLensDaemon {
 
57
        GObject parent_instance;
 
58
        UnityMusicLensDaemonPrivate * priv;
 
59
};
 
60
 
 
61
struct _UnityMusicLensDaemonClass {
 
62
        GObjectClass parent_class;
 
63
};
 
64
 
 
65
struct _UnityMusicLensDaemonPrivate {
 
66
        UnityLens* lens;
 
67
        UnityMusicLensBansheeScopeProxy* banshee;
 
68
};
 
69
 
 
70
 
 
71
static gpointer unity_music_lens_daemon_parent_class = NULL;
 
72
 
 
73
#define CONFIG_DATADIR "/home/njpatel/build/share"
 
74
#define UNITY_MUSIC_LENS_ICON_PATH CONFIG_DATADIR "/icons/unity-icon-theme/lenses/svg/"
 
75
GType unity_music_lens_daemon_get_type (void) G_GNUC_CONST;
 
76
GType unity_music_lens_banshee_scope_proxy_get_type (void) G_GNUC_CONST;
 
77
#define UNITY_MUSIC_LENS_DAEMON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_MUSIC_LENS_TYPE_DAEMON, UnityMusicLensDaemonPrivate))
 
78
enum  {
 
79
        UNITY_MUSIC_LENS_DAEMON_DUMMY_PROPERTY
 
80
};
 
81
static void unity_music_lens_daemon_populate_filters (UnityMusicLensDaemon* self);
 
82
static void _vala_array_add1 (UnityFilter*** array, int* length, int* size, UnityFilter* value);
 
83
#define UNITY_MUSIC_LENS_GENRE_BLUES_ID "blues"
 
84
#define UNITY_MUSIC_LENS_GENRE_CLASSIC_ID "classic"
 
85
#define UNITY_MUSIC_LENS_GENRE_COUNTRY_ID "country"
 
86
#define UNITY_MUSIC_LENS_GENRE_DISCO_ID "disco"
 
87
#define UNITY_MUSIC_LENS_GENRE_FUNK_ID "funk"
 
88
#define UNITY_MUSIC_LENS_GENRE_ROCK_ID "rock"
 
89
#define UNITY_MUSIC_LENS_GENRE_METAL_ID "metal"
 
90
#define UNITY_MUSIC_LENS_GENRE_HIPHOP_ID "hip-hop"
 
91
#define UNITY_MUSIC_LENS_GENRE_HOUSE_ID "house"
 
92
#define UNITY_MUSIC_LENS_GENRE_NEWWAVE_ID "new-wave"
 
93
#define UNITY_MUSIC_LENS_GENRE_RANDB_ID "r-and-b"
 
94
#define UNITY_MUSIC_LENS_GENRE_PUNK_ID "punk"
 
95
#define UNITY_MUSIC_LENS_GENRE_JAZZ_ID "jazz"
 
96
#define UNITY_MUSIC_LENS_GENRE_POP_ID "pop"
 
97
#define UNITY_MUSIC_LENS_GENRE_REGGAE_ID "reggae"
 
98
#define UNITY_MUSIC_LENS_GENRE_SOUL_ID "soul"
 
99
#define UNITY_MUSIC_LENS_GENRE_TECHNO_ID "techno"
 
100
#define UNITY_MUSIC_LENS_GENRE_OTHER_ID "other"
 
101
static void _vala_array_add2 (UnityFilter*** array, int* length, int* size, UnityFilter* value);
 
102
static void unity_music_lens_daemon_populate_categories (UnityMusicLensDaemon* self);
 
103
static void _vala_array_add3 (UnityCategory*** array, int* length, int* size, UnityCategory* value);
 
104
static void _vala_array_add4 (UnityCategory*** array, int* length, int* size, UnityCategory* value);
 
105
static void _vala_array_add5 (UnityCategory*** array, int* length, int* size, UnityCategory* value);
 
106
UnityMusicLensDaemon* unity_music_lens_daemon_new (void);
 
107
UnityMusicLensDaemon* unity_music_lens_daemon_construct (GType object_type);
 
108
static GObject * unity_music_lens_daemon_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
 
109
UnityMusicLensBansheeScopeProxy* unity_music_lens_banshee_scope_proxy_new (void);
 
110
UnityMusicLensBansheeScopeProxy* unity_music_lens_banshee_scope_proxy_construct (GType object_type);
 
111
UnityScope* unity_music_lens_banshee_scope_proxy_get_Scope (UnityMusicLensBansheeScopeProxy* self);
 
112
static void unity_music_lens_daemon_finalize (GObject* obj);
 
113
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
114
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
115
 
 
116
 
 
117
static gpointer _g_object_ref0 (gpointer self) {
 
118
        return self ? g_object_ref (self) : NULL;
 
119
}
 
120
 
 
121
 
 
122
static void _vala_array_add1 (UnityFilter*** array, int* length, int* size, UnityFilter* value) {
 
123
        if ((*length) == (*size)) {
 
124
                *size = (*size) ? (2 * (*size)) : 4;
 
125
                *array = g_renew (UnityFilter*, *array, (*size) + 1);
 
126
        }
 
127
        (*array)[(*length)++] = value;
 
128
        (*array)[*length] = NULL;
 
129
}
 
130
 
 
131
 
 
132
static void _vala_array_add2 (UnityFilter*** array, int* length, int* size, UnityFilter* value) {
 
133
        if ((*length) == (*size)) {
 
134
                *size = (*size) ? (2 * (*size)) : 4;
 
135
                *array = g_renew (UnityFilter*, *array, (*size) + 1);
 
136
        }
 
137
        (*array)[(*length)++] = value;
 
138
        (*array)[*length] = NULL;
 
139
}
 
140
 
 
141
 
 
142
static void unity_music_lens_daemon_populate_filters (UnityMusicLensDaemon* self) {
 
143
        UnityFilter** _tmp0_ = NULL;
 
144
        UnityFilter** filters;
 
145
        gint filters_length1;
 
146
        gint _filters_size_;
 
147
        UnityFilter** _tmp79_;
 
148
        g_return_if_fail (self != NULL);
 
149
        _tmp0_ = g_new0 (UnityFilter*, 0 + 1);
 
150
        filters = _tmp0_;
 
151
        filters_length1 = 0;
 
152
        _filters_size_ = 0;
 
153
        {
 
154
                const gchar* _tmp1_ = NULL;
 
155
                UnityMultiRangeFilter* _tmp2_ = NULL;
 
156
                UnityMultiRangeFilter* filter;
 
157
                const gchar* _tmp3_ = NULL;
 
158
                UnityFilterOption* _tmp4_ = NULL;
 
159
                UnityFilterOption* _tmp5_;
 
160
                const gchar* _tmp6_ = NULL;
 
161
                UnityFilterOption* _tmp7_ = NULL;
 
162
                UnityFilterOption* _tmp8_;
 
163
                const gchar* _tmp9_ = NULL;
 
164
                UnityFilterOption* _tmp10_ = NULL;
 
165
                UnityFilterOption* _tmp11_;
 
166
                const gchar* _tmp12_ = NULL;
 
167
                UnityFilterOption* _tmp13_ = NULL;
 
168
                UnityFilterOption* _tmp14_;
 
169
                const gchar* _tmp15_ = NULL;
 
170
                UnityFilterOption* _tmp16_ = NULL;
 
171
                UnityFilterOption* _tmp17_;
 
172
                const gchar* _tmp18_ = NULL;
 
173
                UnityFilterOption* _tmp19_ = NULL;
 
174
                UnityFilterOption* _tmp20_;
 
175
                UnityFilter* _tmp21_;
 
176
                _tmp1_ = _ ("Decade");
 
177
                _tmp2_ = unity_multi_range_filter_new ("decade", _tmp1_, "", FALSE);
 
178
                filter = _tmp2_;
 
179
                _tmp3_ = _ ("Old");
 
180
                _tmp4_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "0", _tmp3_, "");
 
181
                _tmp5_ = _tmp4_;
 
182
                _g_object_unref0 (_tmp5_);
 
183
                _tmp6_ = _ ("60s");
 
184
                _tmp7_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1960", _tmp6_, "");
 
185
                _tmp8_ = _tmp7_;
 
186
                _g_object_unref0 (_tmp8_);
 
187
                _tmp9_ = _ ("70s");
 
188
                _tmp10_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1970", _tmp9_, "");
 
189
                _tmp11_ = _tmp10_;
 
190
                _g_object_unref0 (_tmp11_);
 
191
                _tmp12_ = _ ("80s");
 
192
                _tmp13_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1990", _tmp12_, "");
 
193
                _tmp14_ = _tmp13_;
 
194
                _g_object_unref0 (_tmp14_);
 
195
                _tmp15_ = _ ("00s");
 
196
                _tmp16_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "2000", _tmp15_, "");
 
197
                _tmp17_ = _tmp16_;
 
198
                _g_object_unref0 (_tmp17_);
 
199
                _tmp18_ = _ ("10s");
 
200
                _tmp19_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "2010", _tmp18_, "");
 
201
                _tmp20_ = _tmp19_;
 
202
                _g_object_unref0 (_tmp20_);
 
203
                _tmp21_ = _g_object_ref0 ((UnityFilter*) filter);
 
204
                _vala_array_add1 (&filters, &filters_length1, &_filters_size_, _tmp21_);
 
205
                _g_object_unref0 (filter);
 
206
        }
 
207
        {
 
208
                const gchar* _tmp22_ = NULL;
 
209
                UnityCheckOptionFilter* _tmp23_ = NULL;
 
210
                UnityCheckOptionFilter* filter;
 
211
                const gchar* _tmp24_ = NULL;
 
212
                UnityFilterOption* _tmp25_ = NULL;
 
213
                UnityFilterOption* _tmp26_;
 
214
                const gchar* _tmp27_ = NULL;
 
215
                UnityFilterOption* _tmp28_ = NULL;
 
216
                UnityFilterOption* _tmp29_;
 
217
                const gchar* _tmp30_ = NULL;
 
218
                UnityFilterOption* _tmp31_ = NULL;
 
219
                UnityFilterOption* _tmp32_;
 
220
                const gchar* _tmp33_ = NULL;
 
221
                UnityFilterOption* _tmp34_ = NULL;
 
222
                UnityFilterOption* _tmp35_;
 
223
                const gchar* _tmp36_ = NULL;
 
224
                UnityFilterOption* _tmp37_ = NULL;
 
225
                UnityFilterOption* _tmp38_;
 
226
                const gchar* _tmp39_ = NULL;
 
227
                UnityFilterOption* _tmp40_ = NULL;
 
228
                UnityFilterOption* _tmp41_;
 
229
                const gchar* _tmp42_ = NULL;
 
230
                UnityFilterOption* _tmp43_ = NULL;
 
231
                UnityFilterOption* _tmp44_;
 
232
                const gchar* _tmp45_ = NULL;
 
233
                UnityFilterOption* _tmp46_ = NULL;
 
234
                UnityFilterOption* _tmp47_;
 
235
                const gchar* _tmp48_ = NULL;
 
236
                UnityFilterOption* _tmp49_ = NULL;
 
237
                UnityFilterOption* _tmp50_;
 
238
                const gchar* _tmp51_ = NULL;
 
239
                UnityFilterOption* _tmp52_ = NULL;
 
240
                UnityFilterOption* _tmp53_;
 
241
                const gchar* _tmp54_ = NULL;
 
242
                UnityFilterOption* _tmp55_ = NULL;
 
243
                UnityFilterOption* _tmp56_;
 
244
                const gchar* _tmp57_ = NULL;
 
245
                UnityFilterOption* _tmp58_ = NULL;
 
246
                UnityFilterOption* _tmp59_;
 
247
                const gchar* _tmp60_ = NULL;
 
248
                UnityFilterOption* _tmp61_ = NULL;
 
249
                UnityFilterOption* _tmp62_;
 
250
                const gchar* _tmp63_ = NULL;
 
251
                UnityFilterOption* _tmp64_ = NULL;
 
252
                UnityFilterOption* _tmp65_;
 
253
                const gchar* _tmp66_ = NULL;
 
254
                UnityFilterOption* _tmp67_ = NULL;
 
255
                UnityFilterOption* _tmp68_;
 
256
                const gchar* _tmp69_ = NULL;
 
257
                UnityFilterOption* _tmp70_ = NULL;
 
258
                UnityFilterOption* _tmp71_;
 
259
                const gchar* _tmp72_ = NULL;
 
260
                UnityFilterOption* _tmp73_ = NULL;
 
261
                UnityFilterOption* _tmp74_;
 
262
                const gchar* _tmp75_ = NULL;
 
263
                UnityFilterOption* _tmp76_ = NULL;
 
264
                UnityFilterOption* _tmp77_;
 
265
                UnityFilter* _tmp78_;
 
266
                _tmp22_ = _ ("Genre");
 
267
                _tmp23_ = unity_check_option_filter_new ("genre", _tmp22_, "", FALSE);
 
268
                filter = _tmp23_;
 
269
                _tmp24_ = _ ("Blues");
 
270
                _tmp25_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_BLUES_ID, _tmp24_, "");
 
271
                _tmp26_ = _tmp25_;
 
272
                _g_object_unref0 (_tmp26_);
 
273
                _tmp27_ = _ ("Classic");
 
274
                _tmp28_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_CLASSIC_ID, _tmp27_, "");
 
275
                _tmp29_ = _tmp28_;
 
276
                _g_object_unref0 (_tmp29_);
 
277
                _tmp30_ = _ ("Country");
 
278
                _tmp31_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_COUNTRY_ID, _tmp30_, "");
 
279
                _tmp32_ = _tmp31_;
 
280
                _g_object_unref0 (_tmp32_);
 
281
                _tmp33_ = _ ("Disco");
 
282
                _tmp34_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_DISCO_ID, _tmp33_, "");
 
283
                _tmp35_ = _tmp34_;
 
284
                _g_object_unref0 (_tmp35_);
 
285
                _tmp36_ = _ ("funk");
 
286
                _tmp37_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_FUNK_ID, _tmp36_, "");
 
287
                _tmp38_ = _tmp37_;
 
288
                _g_object_unref0 (_tmp38_);
 
289
                _tmp39_ = _ ("rock");
 
290
                _tmp40_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_ROCK_ID, _tmp39_, "");
 
291
                _tmp41_ = _tmp40_;
 
292
                _g_object_unref0 (_tmp41_);
 
293
                _tmp42_ = _ ("Metal");
 
294
                _tmp43_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_METAL_ID, _tmp42_, "");
 
295
                _tmp44_ = _tmp43_;
 
296
                _g_object_unref0 (_tmp44_);
 
297
                _tmp45_ = _ ("Hip-hop");
 
298
                _tmp46_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_HIPHOP_ID, _tmp45_, "");
 
299
                _tmp47_ = _tmp46_;
 
300
                _g_object_unref0 (_tmp47_);
 
301
                _tmp48_ = _ ("House");
 
302
                _tmp49_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_HOUSE_ID, _tmp48_, "");
 
303
                _tmp50_ = _tmp49_;
 
304
                _g_object_unref0 (_tmp50_);
 
305
                _tmp51_ = _ ("New-wave");
 
306
                _tmp52_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_NEWWAVE_ID, _tmp51_, "");
 
307
                _tmp53_ = _tmp52_;
 
308
                _g_object_unref0 (_tmp53_);
 
309
                _tmp54_ = _ ("R&B");
 
310
                _tmp55_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_RANDB_ID, _tmp54_, "");
 
311
                _tmp56_ = _tmp55_;
 
312
                _g_object_unref0 (_tmp56_);
 
313
                _tmp57_ = _ ("Punk");
 
314
                _tmp58_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_PUNK_ID, _tmp57_, "");
 
315
                _tmp59_ = _tmp58_;
 
316
                _g_object_unref0 (_tmp59_);
 
317
                _tmp60_ = _ ("Jazz");
 
318
                _tmp61_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_JAZZ_ID, _tmp60_, "");
 
319
                _tmp62_ = _tmp61_;
 
320
                _g_object_unref0 (_tmp62_);
 
321
                _tmp63_ = _ ("Pop");
 
322
                _tmp64_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_POP_ID, _tmp63_, "");
 
323
                _tmp65_ = _tmp64_;
 
324
                _g_object_unref0 (_tmp65_);
 
325
                _tmp66_ = _ ("Reggae");
 
326
                _tmp67_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_REGGAE_ID, _tmp66_, "");
 
327
                _tmp68_ = _tmp67_;
 
328
                _g_object_unref0 (_tmp68_);
 
329
                _tmp69_ = _ ("Soul");
 
330
                _tmp70_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_SOUL_ID, _tmp69_, "");
 
331
                _tmp71_ = _tmp70_;
 
332
                _g_object_unref0 (_tmp71_);
 
333
                _tmp72_ = _ ("Techno");
 
334
                _tmp73_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_TECHNO_ID, _tmp72_, "");
 
335
                _tmp74_ = _tmp73_;
 
336
                _g_object_unref0 (_tmp74_);
 
337
                _tmp75_ = _ ("Other");
 
338
                _tmp76_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_OTHER_ID, _tmp75_, "");
 
339
                _tmp77_ = _tmp76_;
 
340
                _g_object_unref0 (_tmp77_);
 
341
                _tmp78_ = _g_object_ref0 ((UnityFilter*) filter);
 
342
                _vala_array_add2 (&filters, &filters_length1, &_filters_size_, _tmp78_);
 
343
                _g_object_unref0 (filter);
 
344
        }
 
345
        _tmp79_ = filters;
 
346
        unity_lens_set_filters (self->priv->lens, _tmp79_, filters_length1);
 
347
        filters = (_vala_array_free (filters, filters_length1, (GDestroyNotify) g_object_unref), NULL);
 
348
}
 
349
 
 
350
 
 
351
static void _vala_array_add3 (UnityCategory*** array, int* length, int* size, UnityCategory* value) {
 
352
        if ((*length) == (*size)) {
 
353
                *size = (*size) ? (2 * (*size)) : 4;
 
354
                *array = g_renew (UnityCategory*, *array, (*size) + 1);
 
355
        }
 
356
        (*array)[(*length)++] = value;
 
357
        (*array)[*length] = NULL;
 
358
}
 
359
 
 
360
 
 
361
static void _vala_array_add4 (UnityCategory*** array, int* length, int* size, UnityCategory* value) {
 
362
        if ((*length) == (*size)) {
 
363
                *size = (*size) ? (2 * (*size)) : 4;
 
364
                *array = g_renew (UnityCategory*, *array, (*size) + 1);
 
365
        }
 
366
        (*array)[(*length)++] = value;
 
367
        (*array)[*length] = NULL;
 
368
}
 
369
 
 
370
 
 
371
static void _vala_array_add5 (UnityCategory*** array, int* length, int* size, UnityCategory* value) {
 
372
        if ((*length) == (*size)) {
 
373
                *size = (*size) ? (2 * (*size)) : 4;
 
374
                *array = g_renew (UnityCategory*, *array, (*size) + 1);
 
375
        }
 
376
        (*array)[(*length)++] = value;
 
377
        (*array)[*length] = NULL;
 
378
}
 
379
 
 
380
 
 
381
static void unity_music_lens_daemon_populate_categories (UnityMusicLensDaemon* self) {
 
382
        UnityCategory** _tmp0_ = NULL;
 
383
        UnityCategory** categories;
 
384
        gint categories_length1;
 
385
        gint _categories_size_;
 
386
        const gchar* _tmp1_ = NULL;
 
387
        UnityCategory* _tmp2_ = NULL;
 
388
        UnityCategory* cat;
 
389
        UnityCategory* _tmp3_;
 
390
        const gchar* _tmp4_ = NULL;
 
391
        UnityCategory* _tmp5_ = NULL;
 
392
        UnityCategory* _tmp6_;
 
393
        const gchar* _tmp7_ = NULL;
 
394
        UnityCategory* _tmp8_ = NULL;
 
395
        UnityCategory* _tmp9_;
 
396
        UnityCategory** _tmp10_;
 
397
        g_return_if_fail (self != NULL);
 
398
        _tmp0_ = g_new0 (UnityCategory*, 0 + 1);
 
399
        categories = _tmp0_;
 
400
        categories_length1 = 0;
 
401
        _categories_size_ = 0;
 
402
        _tmp1_ = _ ("Songs");
 
403
        _tmp2_ = unity_category_new (_tmp1_, UNITY_MUSIC_LENS_ICON_PATH "category-recent.svg", UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
 
404
        cat = _tmp2_;
 
405
        _tmp3_ = _g_object_ref0 (cat);
 
406
        _vala_array_add3 (&categories, &categories_length1, &_categories_size_, _tmp3_);
 
407
        _tmp4_ = _ ("Albums");
 
408
        _tmp5_ = unity_category_new (_tmp4_, UNITY_MUSIC_LENS_ICON_PATH "category-downloads.svg", UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
 
409
        _g_object_unref0 (cat);
 
410
        cat = _tmp5_;
 
411
        _tmp6_ = _g_object_ref0 (cat);
 
412
        _vala_array_add4 (&categories, &categories_length1, &_categories_size_, _tmp6_);
 
413
        _tmp7_ = _ ("Available for Purchase");
 
414
        _tmp8_ = unity_category_new (_tmp7_, UNITY_MUSIC_LENS_ICON_PATH "category-favoritefolders.svg", UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
 
415
        _g_object_unref0 (cat);
 
416
        cat = _tmp8_;
 
417
        _tmp9_ = _g_object_ref0 (cat);
 
418
        _vala_array_add5 (&categories, &categories_length1, &_categories_size_, _tmp9_);
 
419
        _tmp10_ = categories;
 
420
        unity_lens_set_categories (self->priv->lens, _tmp10_, categories_length1);
 
421
        _g_object_unref0 (cat);
 
422
        categories = (_vala_array_free (categories, categories_length1, (GDestroyNotify) g_object_unref), NULL);
 
423
}
 
424
 
 
425
 
 
426
UnityMusicLensDaemon* unity_music_lens_daemon_construct (GType object_type) {
 
427
        UnityMusicLensDaemon * self = NULL;
 
428
        self = (UnityMusicLensDaemon*) g_object_new (object_type, NULL);
 
429
        return self;
 
430
}
 
431
 
 
432
 
 
433
UnityMusicLensDaemon* unity_music_lens_daemon_new (void) {
 
434
        return unity_music_lens_daemon_construct (UNITY_MUSIC_LENS_TYPE_DAEMON);
 
435
}
 
436
 
 
437
 
 
438
static GObject * unity_music_lens_daemon_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
 
439
        GObject * obj;
 
440
        GObjectClass * parent_class;
 
441
        UnityMusicLensDaemon * self;
 
442
        UnityMusicLensBansheeScopeProxy* _tmp0_ = NULL;
 
443
        UnityLens* _tmp1_ = NULL;
 
444
        const gchar* _tmp2_ = NULL;
 
445
        UnityScope* _tmp3_ = NULL;
 
446
        GError * _inner_error_ = NULL;
 
447
        parent_class = G_OBJECT_CLASS (unity_music_lens_daemon_parent_class);
 
448
        obj = parent_class->constructor (type, n_construct_properties, construct_properties);
 
449
        self = UNITY_MUSIC_LENS_DAEMON (obj);
 
450
        _tmp0_ = unity_music_lens_banshee_scope_proxy_new ();
 
451
        _g_object_unref0 (self->priv->banshee);
 
452
        self->priv->banshee = _tmp0_;
 
453
        _tmp1_ = unity_lens_new ("/com/canonical/unity/lens/music", "music");
 
454
        _g_object_unref0 (self->priv->lens);
 
455
        self->priv->lens = _tmp1_;
 
456
        unity_lens_set_search_in_global (self->priv->lens, TRUE);
 
457
        _tmp2_ = _ ("Search Music Collection");
 
458
        unity_lens_set_search_hint (self->priv->lens, _tmp2_);
 
459
        unity_lens_set_visible (self->priv->lens, TRUE);
 
460
        unity_music_lens_daemon_populate_categories (self);
 
461
        unity_music_lens_daemon_populate_filters (self);
 
462
        _tmp3_ = unity_music_lens_banshee_scope_proxy_get_Scope (self->priv->banshee);
 
463
        unity_lens_add_local_scope (self->priv->lens, _tmp3_);
 
464
        unity_lens_export (self->priv->lens, &_inner_error_);
 
465
        if (_inner_error_ != NULL) {
 
466
                if (_inner_error_->domain == G_IO_ERROR) {
 
467
                        goto __catch2_g_io_error;
 
468
                }
 
469
                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
470
                g_clear_error (&_inner_error_);
 
471
        }
 
472
        goto __finally2;
 
473
        __catch2_g_io_error:
 
474
        {
 
475
                GError * e;
 
476
                e = _inner_error_;
 
477
                _inner_error_ = NULL;
 
478
                fprintf (stdout, "error %s\n", e->message);
 
479
                _g_error_free0 (e);
 
480
        }
 
481
        __finally2:
 
482
        if (_inner_error_ != NULL) {
 
483
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
484
                g_clear_error (&_inner_error_);
 
485
        }
 
486
        return obj;
 
487
}
 
488
 
 
489
 
 
490
static void unity_music_lens_daemon_class_init (UnityMusicLensDaemonClass * klass) {
 
491
        unity_music_lens_daemon_parent_class = g_type_class_peek_parent (klass);
 
492
        g_type_class_add_private (klass, sizeof (UnityMusicLensDaemonPrivate));
 
493
        G_OBJECT_CLASS (klass)->constructor = unity_music_lens_daemon_constructor;
 
494
        G_OBJECT_CLASS (klass)->finalize = unity_music_lens_daemon_finalize;
 
495
}
 
496
 
 
497
 
 
498
static void unity_music_lens_daemon_instance_init (UnityMusicLensDaemon * self) {
 
499
        self->priv = UNITY_MUSIC_LENS_DAEMON_GET_PRIVATE (self);
 
500
}
 
501
 
 
502
 
 
503
static void unity_music_lens_daemon_finalize (GObject* obj) {
 
504
        UnityMusicLensDaemon * self;
 
505
        self = UNITY_MUSIC_LENS_DAEMON (obj);
 
506
        _g_object_unref0 (self->priv->lens);
 
507
        _g_object_unref0 (self->priv->banshee);
 
508
        G_OBJECT_CLASS (unity_music_lens_daemon_parent_class)->finalize (obj);
 
509
}
 
510
 
 
511
 
 
512
GType unity_music_lens_daemon_get_type (void) {
 
513
        static volatile gsize unity_music_lens_daemon_type_id__volatile = 0;
 
514
        if (g_once_init_enter (&unity_music_lens_daemon_type_id__volatile)) {
 
515
                static const GTypeInfo g_define_type_info = { sizeof (UnityMusicLensDaemonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_music_lens_daemon_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMusicLensDaemon), 0, (GInstanceInitFunc) unity_music_lens_daemon_instance_init, NULL };
 
516
                GType unity_music_lens_daemon_type_id;
 
517
                unity_music_lens_daemon_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityMusicLensDaemon", &g_define_type_info, 0);
 
518
                g_once_init_leave (&unity_music_lens_daemon_type_id__volatile, unity_music_lens_daemon_type_id);
 
519
        }
 
520
        return unity_music_lens_daemon_type_id__volatile;
 
521
}
 
522
 
 
523
 
 
524
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
525
        if ((array != NULL) && (destroy_func != NULL)) {
 
526
                int i;
 
527
                for (i = 0; i < array_length; i = i + 1) {
 
528
                        if (((gpointer*) array)[i] != NULL) {
 
529
                                destroy_func (((gpointer*) array)[i]);
 
530
                        }
 
531
                }
 
532
        }
 
533
}
 
534
 
 
535
 
 
536
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
537
        _vala_array_destroy (array, array_length, destroy_func);
 
538
        g_free (array);
 
539
}
 
540
 
 
541
 
 
542