~ricmm/+junk/unity-lens_music-sc

« back to all changes in this revision

Viewing changes to src/daemon.c

  • Committer: Ricardo Mendoza
  • Date: 2012-09-05 14:20:15 UTC
  • Revision ID: ricardo.mendoza@canonical.com-20120905142015-prem6hiyfshwgm8q
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* daemon.c generated by valac 0.16.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 <gio/gdesktopappinfo.h>
 
31
#include <stdio.h>
 
32
 
 
33
 
 
34
#define UNITY_MUSIC_LENS_TYPE_DAEMON (unity_music_lens_daemon_get_type ())
 
35
#define UNITY_MUSIC_LENS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_DAEMON, UnityMusicLensDaemon))
 
36
#define UNITY_MUSIC_LENS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_DAEMON, UnityMusicLensDaemonClass))
 
37
#define UNITY_MUSIC_LENS_IS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_DAEMON))
 
38
#define UNITY_MUSIC_LENS_IS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_DAEMON))
 
39
#define UNITY_MUSIC_LENS_DAEMON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_DAEMON, UnityMusicLensDaemonClass))
 
40
 
 
41
typedef struct _UnityMusicLensDaemon UnityMusicLensDaemon;
 
42
typedef struct _UnityMusicLensDaemonClass UnityMusicLensDaemonClass;
 
43
typedef struct _UnityMusicLensDaemonPrivate UnityMusicLensDaemonPrivate;
 
44
 
 
45
#define UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE (unity_music_lens_simple_scope_get_type ())
 
46
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScope))
 
47
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))
 
48
#define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))
 
49
#define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))
 
50
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))
 
51
 
 
52
typedef struct _UnityMusicLensSimpleScope UnityMusicLensSimpleScope;
 
53
typedef struct _UnityMusicLensSimpleScopeClass UnityMusicLensSimpleScopeClass;
 
54
 
 
55
#define UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY (unity_music_lens_banshee_scope_proxy_get_type ())
 
56
#define UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY, UnityMusicLensBansheeScopeProxy))
 
57
#define UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY, UnityMusicLensBansheeScopeProxyClass))
 
58
#define UNITY_MUSIC_LENS_IS_BANSHEE_SCOPE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY))
 
59
#define UNITY_MUSIC_LENS_IS_BANSHEE_SCOPE_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY))
 
60
#define UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY, UnityMusicLensBansheeScopeProxyClass))
 
61
 
 
62
typedef struct _UnityMusicLensBansheeScopeProxy UnityMusicLensBansheeScopeProxy;
 
63
typedef struct _UnityMusicLensBansheeScopeProxyClass UnityMusicLensBansheeScopeProxyClass;
 
64
 
 
65
#define UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE (unity_music_lens_rhythmbox_scope_get_type ())
 
66
#define UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE, UnityMusicLensRhythmboxScope))
 
67
#define UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE, UnityMusicLensRhythmboxScopeClass))
 
68
#define UNITY_MUSIC_LENS_IS_RHYTHMBOX_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE))
 
69
#define UNITY_MUSIC_LENS_IS_RHYTHMBOX_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE))
 
70
#define UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE, UnityMusicLensRhythmboxScopeClass))
 
71
 
 
72
typedef struct _UnityMusicLensRhythmboxScope UnityMusicLensRhythmboxScope;
 
73
typedef struct _UnityMusicLensRhythmboxScopeClass UnityMusicLensRhythmboxScopeClass;
 
74
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 
75
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
 
76
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 
77
 
 
78
struct _UnityMusicLensDaemon {
 
79
        GObject parent_instance;
 
80
        UnityMusicLensDaemonPrivate * priv;
 
81
};
 
82
 
 
83
struct _UnityMusicLensDaemonClass {
 
84
        GObjectClass parent_class;
 
85
};
 
86
 
 
87
struct _UnityMusicLensDaemonPrivate {
 
88
        UnityLens* lens;
 
89
        UnityMusicLensBansheeScopeProxy* banshee;
 
90
        UnityMusicLensRhythmboxScope* rb;
 
91
};
 
92
 
 
93
 
 
94
static gpointer unity_music_lens_daemon_parent_class = NULL;
 
95
 
 
96
#define UNITY_MUSIC_LENS_ICON_PATH "/usr/share/icons/unity-icon-theme/places/svg/"
 
97
GType unity_music_lens_daemon_get_type (void) G_GNUC_CONST;
 
98
GType unity_music_lens_simple_scope_get_type (void) G_GNUC_CONST;
 
99
GType unity_music_lens_banshee_scope_proxy_get_type (void) G_GNUC_CONST;
 
100
GType unity_music_lens_rhythmbox_scope_get_type (void) G_GNUC_CONST;
 
101
#define UNITY_MUSIC_LENS_DAEMON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_MUSIC_LENS_TYPE_DAEMON, UnityMusicLensDaemonPrivate))
 
102
enum  {
 
103
        UNITY_MUSIC_LENS_DAEMON_DUMMY_PROPERTY
 
104
};
 
105
static void unity_music_lens_daemon_populate_filters (UnityMusicLensDaemon* self);
 
106
#define UNITY_MUSIC_LENS_GENRE_BLUES_ID "blues"
 
107
#define UNITY_MUSIC_LENS_GENRE_CLASSIC_ID "classic"
 
108
#define UNITY_MUSIC_LENS_GENRE_COUNTRY_ID "country"
 
109
#define UNITY_MUSIC_LENS_GENRE_DISCO_ID "disco"
 
110
#define UNITY_MUSIC_LENS_GENRE_FUNK_ID "funk"
 
111
#define UNITY_MUSIC_LENS_GENRE_ROCK_ID "rock"
 
112
#define UNITY_MUSIC_LENS_GENRE_METAL_ID "metal"
 
113
#define UNITY_MUSIC_LENS_GENRE_HIPHOP_ID "hip-hop"
 
114
#define UNITY_MUSIC_LENS_GENRE_HOUSE_ID "house"
 
115
#define UNITY_MUSIC_LENS_GENRE_NEWWAVE_ID "new-wave"
 
116
#define UNITY_MUSIC_LENS_GENRE_RANDB_ID "r-and-b"
 
117
#define UNITY_MUSIC_LENS_GENRE_PUNK_ID "punk"
 
118
#define UNITY_MUSIC_LENS_GENRE_JAZZ_ID "jazz"
 
119
#define UNITY_MUSIC_LENS_GENRE_POP_ID "pop"
 
120
#define UNITY_MUSIC_LENS_GENRE_REGGAE_ID "reggae"
 
121
#define UNITY_MUSIC_LENS_GENRE_SOUL_ID "soul"
 
122
#define UNITY_MUSIC_LENS_GENRE_TECHNO_ID "techno"
 
123
#define UNITY_MUSIC_LENS_GENRE_OTHER_ID "other"
 
124
static void _g_object_unref0_ (gpointer var);
 
125
static void _g_list_free__g_object_unref0_ (GList* self);
 
126
static void unity_music_lens_daemon_populate_categories (UnityMusicLensDaemon* self);
 
127
UnityMusicLensDaemon* unity_music_lens_daemon_new (void);
 
128
UnityMusicLensDaemon* unity_music_lens_daemon_construct (GType object_type);
 
129
static GObject * unity_music_lens_daemon_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
 
130
UnityMusicLensBansheeScopeProxy* unity_music_lens_banshee_scope_proxy_new (void);
 
131
UnityMusicLensBansheeScopeProxy* unity_music_lens_banshee_scope_proxy_construct (GType object_type);
 
132
UnityScope* unity_music_lens_simple_scope_get_scope (UnityMusicLensSimpleScope* self);
 
133
UnityMusicLensRhythmboxScope* unity_music_lens_rhythmbox_scope_new (void);
 
134
UnityMusicLensRhythmboxScope* unity_music_lens_rhythmbox_scope_construct (GType object_type);
 
135
static void unity_music_lens_daemon_finalize (GObject* obj);
 
136
 
 
137
 
 
138
static gpointer _g_object_ref0 (gpointer self) {
 
139
        return self ? g_object_ref (self) : NULL;
 
140
}
 
141
 
 
142
 
 
143
static void _g_object_unref0_ (gpointer var) {
 
144
        (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
 
145
}
 
146
 
 
147
 
 
148
static void _g_list_free__g_object_unref0_ (GList* self) {
 
149
        g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
 
150
        g_list_free (self);
 
151
}
 
152
 
 
153
 
 
154
static void unity_music_lens_daemon_populate_filters (UnityMusicLensDaemon* self) {
 
155
        GList* filters;
 
156
        UnityLens* _tmp81_;
 
157
        g_return_if_fail (self != NULL);
 
158
        filters = NULL;
 
159
        {
 
160
                const gchar* _tmp0_ = NULL;
 
161
                UnityMultiRangeFilter* _tmp1_;
 
162
                UnityMultiRangeFilter* filter;
 
163
                const gchar* _tmp2_ = NULL;
 
164
                UnityFilterOption* _tmp3_ = NULL;
 
165
                UnityFilterOption* _tmp4_;
 
166
                const gchar* _tmp5_ = NULL;
 
167
                UnityFilterOption* _tmp6_ = NULL;
 
168
                UnityFilterOption* _tmp7_;
 
169
                const gchar* _tmp8_ = NULL;
 
170
                UnityFilterOption* _tmp9_ = NULL;
 
171
                UnityFilterOption* _tmp10_;
 
172
                const gchar* _tmp11_ = NULL;
 
173
                UnityFilterOption* _tmp12_ = NULL;
 
174
                UnityFilterOption* _tmp13_;
 
175
                const gchar* _tmp14_ = NULL;
 
176
                UnityFilterOption* _tmp15_ = NULL;
 
177
                UnityFilterOption* _tmp16_;
 
178
                const gchar* _tmp17_ = NULL;
 
179
                UnityFilterOption* _tmp18_ = NULL;
 
180
                UnityFilterOption* _tmp19_;
 
181
                const gchar* _tmp20_ = NULL;
 
182
                UnityFilterOption* _tmp21_ = NULL;
 
183
                UnityFilterOption* _tmp22_;
 
184
                UnityFilter* _tmp23_;
 
185
                _tmp0_ = _ ("Decade");
 
186
                _tmp1_ = unity_multi_range_filter_new ("decade", _tmp0_, NULL, FALSE);
 
187
                filter = _tmp1_;
 
188
                _tmp2_ = _ ("Old");
 
189
                _tmp3_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "0", _tmp2_, NULL);
 
190
                _tmp4_ = _tmp3_;
 
191
                _g_object_unref0 (_tmp4_);
 
192
                _tmp5_ = _ ("60s");
 
193
                _tmp6_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1960", _tmp5_, NULL);
 
194
                _tmp7_ = _tmp6_;
 
195
                _g_object_unref0 (_tmp7_);
 
196
                _tmp8_ = _ ("70s");
 
197
                _tmp9_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1970", _tmp8_, NULL);
 
198
                _tmp10_ = _tmp9_;
 
199
                _g_object_unref0 (_tmp10_);
 
200
                _tmp11_ = _ ("80s");
 
201
                _tmp12_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1980", _tmp11_, NULL);
 
202
                _tmp13_ = _tmp12_;
 
203
                _g_object_unref0 (_tmp13_);
 
204
                _tmp14_ = _ ("90s");
 
205
                _tmp15_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1990", _tmp14_, NULL);
 
206
                _tmp16_ = _tmp15_;
 
207
                _g_object_unref0 (_tmp16_);
 
208
                _tmp17_ = _ ("00s");
 
209
                _tmp18_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "2000", _tmp17_, NULL);
 
210
                _tmp19_ = _tmp18_;
 
211
                _g_object_unref0 (_tmp19_);
 
212
                _tmp20_ = _ ("10s");
 
213
                _tmp21_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "2010", _tmp20_, NULL);
 
214
                _tmp22_ = _tmp21_;
 
215
                _g_object_unref0 (_tmp22_);
 
216
                _tmp23_ = _g_object_ref0 ((UnityFilter*) filter);
 
217
                filters = g_list_append (filters, _tmp23_);
 
218
                _g_object_unref0 (filter);
 
219
        }
 
220
        {
 
221
                const gchar* _tmp24_ = NULL;
 
222
                UnityCheckOptionFilterCompact* _tmp25_;
 
223
                UnityCheckOptionFilterCompact* filter;
 
224
                const gchar* _tmp26_ = NULL;
 
225
                UnityFilterOption* _tmp27_ = NULL;
 
226
                UnityFilterOption* _tmp28_;
 
227
                const gchar* _tmp29_ = NULL;
 
228
                UnityFilterOption* _tmp30_ = NULL;
 
229
                UnityFilterOption* _tmp31_;
 
230
                const gchar* _tmp32_ = NULL;
 
231
                UnityFilterOption* _tmp33_ = NULL;
 
232
                UnityFilterOption* _tmp34_;
 
233
                const gchar* _tmp35_ = NULL;
 
234
                UnityFilterOption* _tmp36_ = NULL;
 
235
                UnityFilterOption* _tmp37_;
 
236
                const gchar* _tmp38_ = NULL;
 
237
                UnityFilterOption* _tmp39_ = NULL;
 
238
                UnityFilterOption* _tmp40_;
 
239
                const gchar* _tmp41_ = NULL;
 
240
                UnityFilterOption* _tmp42_ = NULL;
 
241
                UnityFilterOption* _tmp43_;
 
242
                const gchar* _tmp44_ = NULL;
 
243
                UnityFilterOption* _tmp45_ = NULL;
 
244
                UnityFilterOption* _tmp46_;
 
245
                const gchar* _tmp47_ = NULL;
 
246
                UnityFilterOption* _tmp48_ = NULL;
 
247
                UnityFilterOption* _tmp49_;
 
248
                const gchar* _tmp50_ = NULL;
 
249
                UnityFilterOption* _tmp51_ = NULL;
 
250
                UnityFilterOption* _tmp52_;
 
251
                const gchar* _tmp53_ = NULL;
 
252
                UnityFilterOption* _tmp54_ = NULL;
 
253
                UnityFilterOption* _tmp55_;
 
254
                const gchar* _tmp56_ = NULL;
 
255
                UnityFilterOption* _tmp57_ = NULL;
 
256
                UnityFilterOption* _tmp58_;
 
257
                const gchar* _tmp59_ = NULL;
 
258
                UnityFilterOption* _tmp60_ = NULL;
 
259
                UnityFilterOption* _tmp61_;
 
260
                const gchar* _tmp62_ = NULL;
 
261
                UnityFilterOption* _tmp63_ = NULL;
 
262
                UnityFilterOption* _tmp64_;
 
263
                const gchar* _tmp65_ = NULL;
 
264
                UnityFilterOption* _tmp66_ = NULL;
 
265
                UnityFilterOption* _tmp67_;
 
266
                const gchar* _tmp68_ = NULL;
 
267
                UnityFilterOption* _tmp69_ = NULL;
 
268
                UnityFilterOption* _tmp70_;
 
269
                const gchar* _tmp71_ = NULL;
 
270
                UnityFilterOption* _tmp72_ = NULL;
 
271
                UnityFilterOption* _tmp73_;
 
272
                const gchar* _tmp74_ = NULL;
 
273
                UnityFilterOption* _tmp75_ = NULL;
 
274
                UnityFilterOption* _tmp76_;
 
275
                const gchar* _tmp77_ = NULL;
 
276
                UnityFilterOption* _tmp78_ = NULL;
 
277
                UnityFilterOption* _tmp79_;
 
278
                UnityFilter* _tmp80_;
 
279
                _tmp24_ = _ ("Genre");
 
280
                _tmp25_ = unity_check_option_filter_compact_new ("genre", _tmp24_, NULL, FALSE);
 
281
                filter = _tmp25_;
 
282
                unity_options_filter_set_sort_type ((UnityOptionsFilter*) filter, UNITY_OPTIONS_FILTER_SORT_TYPE_DISPLAY_NAME);
 
283
                _tmp26_ = _ ("Blues");
 
284
                _tmp27_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_BLUES_ID, _tmp26_, NULL);
 
285
                _tmp28_ = _tmp27_;
 
286
                _g_object_unref0 (_tmp28_);
 
287
                _tmp29_ = _ ("Classic");
 
288
                _tmp30_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_CLASSIC_ID, _tmp29_, NULL);
 
289
                _tmp31_ = _tmp30_;
 
290
                _g_object_unref0 (_tmp31_);
 
291
                _tmp32_ = _ ("Country");
 
292
                _tmp33_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_COUNTRY_ID, _tmp32_, NULL);
 
293
                _tmp34_ = _tmp33_;
 
294
                _g_object_unref0 (_tmp34_);
 
295
                _tmp35_ = _ ("Disco");
 
296
                _tmp36_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_DISCO_ID, _tmp35_, NULL);
 
297
                _tmp37_ = _tmp36_;
 
298
                _g_object_unref0 (_tmp37_);
 
299
                _tmp38_ = _ ("Funk");
 
300
                _tmp39_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_FUNK_ID, _tmp38_, NULL);
 
301
                _tmp40_ = _tmp39_;
 
302
                _g_object_unref0 (_tmp40_);
 
303
                _tmp41_ = _ ("Rock");
 
304
                _tmp42_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_ROCK_ID, _tmp41_, NULL);
 
305
                _tmp43_ = _tmp42_;
 
306
                _g_object_unref0 (_tmp43_);
 
307
                _tmp44_ = _ ("Metal");
 
308
                _tmp45_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_METAL_ID, _tmp44_, NULL);
 
309
                _tmp46_ = _tmp45_;
 
310
                _g_object_unref0 (_tmp46_);
 
311
                _tmp47_ = _ ("Hip-hop");
 
312
                _tmp48_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_HIPHOP_ID, _tmp47_, NULL);
 
313
                _tmp49_ = _tmp48_;
 
314
                _g_object_unref0 (_tmp49_);
 
315
                _tmp50_ = _ ("House");
 
316
                _tmp51_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_HOUSE_ID, _tmp50_, NULL);
 
317
                _tmp52_ = _tmp51_;
 
318
                _g_object_unref0 (_tmp52_);
 
319
                _tmp53_ = _ ("New-wave");
 
320
                _tmp54_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_NEWWAVE_ID, _tmp53_, NULL);
 
321
                _tmp55_ = _tmp54_;
 
322
                _g_object_unref0 (_tmp55_);
 
323
                _tmp56_ = _ ("R&B");
 
324
                _tmp57_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_RANDB_ID, _tmp56_, NULL);
 
325
                _tmp58_ = _tmp57_;
 
326
                _g_object_unref0 (_tmp58_);
 
327
                _tmp59_ = _ ("Punk");
 
328
                _tmp60_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_PUNK_ID, _tmp59_, NULL);
 
329
                _tmp61_ = _tmp60_;
 
330
                _g_object_unref0 (_tmp61_);
 
331
                _tmp62_ = _ ("Jazz");
 
332
                _tmp63_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_JAZZ_ID, _tmp62_, NULL);
 
333
                _tmp64_ = _tmp63_;
 
334
                _g_object_unref0 (_tmp64_);
 
335
                _tmp65_ = _ ("Pop");
 
336
                _tmp66_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_POP_ID, _tmp65_, NULL);
 
337
                _tmp67_ = _tmp66_;
 
338
                _g_object_unref0 (_tmp67_);
 
339
                _tmp68_ = _ ("Reggae");
 
340
                _tmp69_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_REGGAE_ID, _tmp68_, NULL);
 
341
                _tmp70_ = _tmp69_;
 
342
                _g_object_unref0 (_tmp70_);
 
343
                _tmp71_ = _ ("Soul");
 
344
                _tmp72_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_SOUL_ID, _tmp71_, NULL);
 
345
                _tmp73_ = _tmp72_;
 
346
                _g_object_unref0 (_tmp73_);
 
347
                _tmp74_ = _ ("Techno");
 
348
                _tmp75_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_TECHNO_ID, _tmp74_, NULL);
 
349
                _tmp76_ = _tmp75_;
 
350
                _g_object_unref0 (_tmp76_);
 
351
                _tmp77_ = _ ("Other");
 
352
                _tmp78_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_OTHER_ID, _tmp77_, NULL);
 
353
                _tmp79_ = _tmp78_;
 
354
                _g_object_unref0 (_tmp79_);
 
355
                _tmp80_ = _g_object_ref0 ((UnityFilter*) filter);
 
356
                filters = g_list_append (filters, _tmp80_);
 
357
                _g_object_unref0 (filter);
 
358
        }
 
359
        _tmp81_ = self->priv->lens;
 
360
        unity_lens_set_filters (_tmp81_, filters);
 
361
        __g_list_free__g_object_unref0_0 (filters);
 
362
}
 
363
 
 
364
 
 
365
static void unity_music_lens_daemon_populate_categories (UnityMusicLensDaemon* self) {
 
366
        GList* categories;
 
367
        GFile* _tmp0_ = NULL;
 
368
        GFile* icon_dir;
 
369
        const gchar* _tmp1_ = NULL;
 
370
        GFile* _tmp2_ = NULL;
 
371
        GFile* _tmp3_;
 
372
        GFileIcon* _tmp4_;
 
373
        GFileIcon* _tmp5_;
 
374
        UnityCategory* _tmp6_;
 
375
        UnityCategory* _tmp7_;
 
376
        UnityCategory* cat;
 
377
        UnityCategory* _tmp8_;
 
378
        UnityCategory* _tmp9_;
 
379
        const gchar* _tmp10_ = NULL;
 
380
        GFile* _tmp11_ = NULL;
 
381
        GFile* _tmp12_;
 
382
        GFileIcon* _tmp13_;
 
383
        GFileIcon* _tmp14_;
 
384
        UnityCategory* _tmp15_;
 
385
        UnityCategory* _tmp16_;
 
386
        UnityCategory* _tmp17_;
 
387
        const gchar* _tmp18_ = NULL;
 
388
        GFile* _tmp19_ = NULL;
 
389
        GFile* _tmp20_;
 
390
        GFileIcon* _tmp21_;
 
391
        GFileIcon* _tmp22_;
 
392
        UnityCategory* _tmp23_;
 
393
        UnityCategory* _tmp24_;
 
394
        UnityCategory* _tmp25_;
 
395
        const gchar* _tmp26_ = NULL;
 
396
        GFile* _tmp27_ = NULL;
 
397
        GFile* _tmp28_;
 
398
        GFileIcon* _tmp29_;
 
399
        GFileIcon* _tmp30_;
 
400
        UnityCategory* _tmp31_;
 
401
        UnityCategory* _tmp32_;
 
402
        UnityCategory* _tmp33_;
 
403
        const gchar* _tmp34_ = NULL;
 
404
        GFile* _tmp35_ = NULL;
 
405
        GFile* _tmp36_;
 
406
        GFileIcon* _tmp37_;
 
407
        GFileIcon* _tmp38_;
 
408
        UnityCategory* _tmp39_;
 
409
        UnityCategory* _tmp40_;
 
410
        UnityCategory* _tmp41_;
 
411
        UnityLens* _tmp42_;
 
412
        g_return_if_fail (self != NULL);
 
413
        categories = NULL;
 
414
        _tmp0_ = g_file_new_for_path (UNITY_MUSIC_LENS_ICON_PATH);
 
415
        icon_dir = _tmp0_;
 
416
        _tmp1_ = _ ("Songs");
 
417
        _tmp2_ = g_file_get_child (icon_dir, "group-songs.svg");
 
418
        _tmp3_ = _tmp2_;
 
419
        _tmp4_ = (GFileIcon*) g_file_icon_new (_tmp3_);
 
420
        _tmp5_ = _tmp4_;
 
421
        _tmp6_ = unity_category_new (_tmp1_, (GIcon*) _tmp5_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
 
422
        _tmp7_ = _tmp6_;
 
423
        _g_object_unref0 (_tmp5_);
 
424
        _g_object_unref0 (_tmp3_);
 
425
        cat = _tmp7_;
 
426
        _tmp8_ = cat;
 
427
        _tmp9_ = _g_object_ref0 (_tmp8_);
 
428
        categories = g_list_append (categories, _tmp9_);
 
429
        _tmp10_ = _ ("Albums");
 
430
        _tmp11_ = g_file_get_child (icon_dir, "group-albums.svg");
 
431
        _tmp12_ = _tmp11_;
 
432
        _tmp13_ = (GFileIcon*) g_file_icon_new (_tmp12_);
 
433
        _tmp14_ = _tmp13_;
 
434
        _tmp15_ = unity_category_new (_tmp10_, (GIcon*) _tmp14_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
 
435
        _g_object_unref0 (cat);
 
436
        cat = _tmp15_;
 
437
        _g_object_unref0 (_tmp14_);
 
438
        _g_object_unref0 (_tmp12_);
 
439
        _tmp16_ = cat;
 
440
        _tmp17_ = _g_object_ref0 (_tmp16_);
 
441
        categories = g_list_append (categories, _tmp17_);
 
442
        _tmp18_ = _ ("Available for Purchase");
 
443
        _tmp19_ = g_file_get_child (icon_dir, "group-purchase.svg");
 
444
        _tmp20_ = _tmp19_;
 
445
        _tmp21_ = (GFileIcon*) g_file_icon_new (_tmp20_);
 
446
        _tmp22_ = _tmp21_;
 
447
        _tmp23_ = unity_category_new (_tmp18_, (GIcon*) _tmp22_, UNITY_CATEGORY_RENDERER_FLOW);
 
448
        _g_object_unref0 (cat);
 
449
        cat = _tmp23_;
 
450
        _g_object_unref0 (_tmp22_);
 
451
        _g_object_unref0 (_tmp20_);
 
452
        _tmp24_ = cat;
 
453
        _tmp25_ = _g_object_ref0 (_tmp24_);
 
454
        categories = g_list_append (categories, _tmp25_);
 
455
        _tmp26_ = _ ("Music");
 
456
        _tmp27_ = g_file_get_child (icon_dir, "group-songs.svg");
 
457
        _tmp28_ = _tmp27_;
 
458
        _tmp29_ = (GFileIcon*) g_file_icon_new (_tmp28_);
 
459
        _tmp30_ = _tmp29_;
 
460
        _tmp31_ = unity_category_new (_tmp26_, (GIcon*) _tmp30_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
 
461
        _g_object_unref0 (cat);
 
462
        cat = _tmp31_;
 
463
        _g_object_unref0 (_tmp30_);
 
464
        _g_object_unref0 (_tmp28_);
 
465
        _tmp32_ = cat;
 
466
        _tmp33_ = _g_object_ref0 (_tmp32_);
 
467
        categories = g_list_append (categories, _tmp33_);
 
468
        _tmp34_ = _ ("Radio");
 
469
        _tmp35_ = g_file_get_child (icon_dir, "group-songs.svg");
 
470
        _tmp36_ = _tmp35_;
 
471
        _tmp37_ = (GFileIcon*) g_file_icon_new (_tmp36_);
 
472
        _tmp38_ = _tmp37_;
 
473
        _tmp39_ = unity_category_new (_tmp34_, (GIcon*) _tmp38_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
 
474
        _g_object_unref0 (cat);
 
475
        cat = _tmp39_;
 
476
        _g_object_unref0 (_tmp38_);
 
477
        _g_object_unref0 (_tmp36_);
 
478
        _tmp40_ = cat;
 
479
        _tmp41_ = _g_object_ref0 (_tmp40_);
 
480
        categories = g_list_append (categories, _tmp41_);
 
481
        _tmp42_ = self->priv->lens;
 
482
        unity_lens_set_categories (_tmp42_, categories);
 
483
        _g_object_unref0 (cat);
 
484
        _g_object_unref0 (icon_dir);
 
485
        __g_list_free__g_object_unref0_0 (categories);
 
486
}
 
487
 
 
488
 
 
489
UnityMusicLensDaemon* unity_music_lens_daemon_construct (GType object_type) {
 
490
        UnityMusicLensDaemon * self = NULL;
 
491
        self = (UnityMusicLensDaemon*) g_object_new (object_type, NULL);
 
492
        return self;
 
493
}
 
494
 
 
495
 
 
496
UnityMusicLensDaemon* unity_music_lens_daemon_new (void) {
 
497
        return unity_music_lens_daemon_construct (UNITY_MUSIC_LENS_TYPE_DAEMON);
 
498
}
 
499
 
 
500
 
 
501
static GObject * unity_music_lens_daemon_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
 
502
        GObject * obj;
 
503
        GObjectClass * parent_class;
 
504
        UnityMusicLensDaemon * self;
 
505
        UnityLens* _tmp0_;
 
506
        UnityLens* _tmp1_;
 
507
        UnityLens* _tmp2_;
 
508
        const gchar* _tmp3_ = NULL;
 
509
        UnityLens* _tmp4_;
 
510
        const gchar* _tmp5_ = NULL;
 
511
        UnityLens* _tmp6_;
 
512
        GDesktopAppInfo* _tmp7_;
 
513
        GDesktopAppInfo* app_check;
 
514
        GDesktopAppInfo* _tmp8_;
 
515
        GDesktopAppInfo* _tmp14_;
 
516
        GDesktopAppInfo* _tmp15_;
 
517
        GError * _inner_error_ = NULL;
 
518
        parent_class = G_OBJECT_CLASS (unity_music_lens_daemon_parent_class);
 
519
        obj = parent_class->constructor (type, n_construct_properties, construct_properties);
 
520
        self = UNITY_MUSIC_LENS_DAEMON (obj);
 
521
        _tmp0_ = unity_lens_new ("/com/canonical/unity/lens/music", "music");
 
522
        _g_object_unref0 (self->priv->lens);
 
523
        self->priv->lens = _tmp0_;
 
524
        _tmp1_ = self->priv->lens;
 
525
        unity_lens_set_search_in_global (_tmp1_, TRUE);
 
526
        _tmp2_ = self->priv->lens;
 
527
        _tmp3_ = _ ("Search Music Collection");
 
528
        unity_lens_set_search_hint (_tmp2_, _tmp3_);
 
529
        _tmp4_ = self->priv->lens;
 
530
        _tmp5_ = _ ("Sources");
 
531
        unity_lens_set_sources_display_name (_tmp4_, _tmp5_);
 
532
        _tmp6_ = self->priv->lens;
 
533
        unity_lens_set_visible (_tmp6_, TRUE);
 
534
        unity_music_lens_daemon_populate_categories (self);
 
535
        unity_music_lens_daemon_populate_filters (self);
 
536
        _tmp7_ = g_desktop_app_info_new ("banshee.desktop");
 
537
        app_check = _tmp7_;
 
538
        _tmp8_ = app_check;
 
539
        if (_tmp8_ != NULL) {
 
540
                UnityMusicLensBansheeScopeProxy* _tmp9_;
 
541
                UnityLens* _tmp10_;
 
542
                UnityMusicLensBansheeScopeProxy* _tmp11_;
 
543
                UnityScope* _tmp12_;
 
544
                UnityScope* _tmp13_;
 
545
                _tmp9_ = unity_music_lens_banshee_scope_proxy_new ();
 
546
                _g_object_unref0 (self->priv->banshee);
 
547
                self->priv->banshee = _tmp9_;
 
548
                _tmp10_ = self->priv->lens;
 
549
                _tmp11_ = self->priv->banshee;
 
550
                _tmp12_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) _tmp11_);
 
551
                _tmp13_ = _tmp12_;
 
552
                unity_lens_add_local_scope (_tmp10_, _tmp13_);
 
553
        }
 
554
        _tmp14_ = g_desktop_app_info_new ("rhythmbox.desktop");
 
555
        _g_object_unref0 (app_check);
 
556
        app_check = _tmp14_;
 
557
        _tmp15_ = app_check;
 
558
        if (_tmp15_ != NULL) {
 
559
                UnityMusicLensRhythmboxScope* _tmp16_;
 
560
                UnityLens* _tmp17_;
 
561
                UnityMusicLensRhythmboxScope* _tmp18_;
 
562
                UnityScope* _tmp19_;
 
563
                UnityScope* _tmp20_;
 
564
                _tmp16_ = unity_music_lens_rhythmbox_scope_new ();
 
565
                _g_object_unref0 (self->priv->rb);
 
566
                self->priv->rb = _tmp16_;
 
567
                _tmp17_ = self->priv->lens;
 
568
                _tmp18_ = self->priv->rb;
 
569
                _tmp19_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) _tmp18_);
 
570
                _tmp20_ = _tmp19_;
 
571
                unity_lens_add_local_scope (_tmp17_, _tmp20_);
 
572
        }
 
573
        {
 
574
                UnityLens* _tmp21_;
 
575
                _tmp21_ = self->priv->lens;
 
576
                unity_lens_export (_tmp21_, &_inner_error_);
 
577
                if (_inner_error_ != NULL) {
 
578
                        if (_inner_error_->domain == G_IO_ERROR) {
 
579
                                goto __catch2_g_io_error;
 
580
                        }
 
581
                        _g_object_unref0 (app_check);
 
582
                        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);
 
583
                        g_clear_error (&_inner_error_);
 
584
                }
 
585
        }
 
586
        goto __finally2;
 
587
        __catch2_g_io_error:
 
588
        {
 
589
                GError* e = NULL;
 
590
                FILE* _tmp22_;
 
591
                GError* _tmp23_;
 
592
                const gchar* _tmp24_;
 
593
                e = _inner_error_;
 
594
                _inner_error_ = NULL;
 
595
                _tmp22_ = stdout;
 
596
                _tmp23_ = e;
 
597
                _tmp24_ = _tmp23_->message;
 
598
                fprintf (_tmp22_, "error %s\n", _tmp24_);
 
599
                _g_error_free0 (e);
 
600
        }
 
601
        __finally2:
 
602
        if (_inner_error_ != NULL) {
 
603
                _g_object_unref0 (app_check);
 
604
                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);
 
605
                g_clear_error (&_inner_error_);
 
606
        }
 
607
        _g_object_unref0 (app_check);
 
608
        return obj;
 
609
}
 
610
 
 
611
 
 
612
static void unity_music_lens_daemon_class_init (UnityMusicLensDaemonClass * klass) {
 
613
        unity_music_lens_daemon_parent_class = g_type_class_peek_parent (klass);
 
614
        g_type_class_add_private (klass, sizeof (UnityMusicLensDaemonPrivate));
 
615
        G_OBJECT_CLASS (klass)->constructor = unity_music_lens_daemon_constructor;
 
616
        G_OBJECT_CLASS (klass)->finalize = unity_music_lens_daemon_finalize;
 
617
}
 
618
 
 
619
 
 
620
static void unity_music_lens_daemon_instance_init (UnityMusicLensDaemon * self) {
 
621
        self->priv = UNITY_MUSIC_LENS_DAEMON_GET_PRIVATE (self);
 
622
}
 
623
 
 
624
 
 
625
static void unity_music_lens_daemon_finalize (GObject* obj) {
 
626
        UnityMusicLensDaemon * self;
 
627
        self = UNITY_MUSIC_LENS_DAEMON (obj);
 
628
        _g_object_unref0 (self->priv->lens);
 
629
        _g_object_unref0 (self->priv->banshee);
 
630
        _g_object_unref0 (self->priv->rb);
 
631
        G_OBJECT_CLASS (unity_music_lens_daemon_parent_class)->finalize (obj);
 
632
}
 
633
 
 
634
 
 
635
GType unity_music_lens_daemon_get_type (void) {
 
636
        static volatile gsize unity_music_lens_daemon_type_id__volatile = 0;
 
637
        if (g_once_init_enter (&unity_music_lens_daemon_type_id__volatile)) {
 
638
                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 };
 
639
                GType unity_music_lens_daemon_type_id;
 
640
                unity_music_lens_daemon_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityMusicLensDaemon", &g_define_type_info, 0);
 
641
                g_once_init_leave (&unity_music_lens_daemon_type_id__volatile, unity_music_lens_daemon_type_id);
 
642
        }
 
643
        return unity_music_lens_daemon_type_id__volatile;
 
644
}
 
645
 
 
646
 
 
647