1
/* daemon.c generated by valac 0.16.1, the Vala compiler
2
* generated from daemon.vala, do not modify */
5
* Copyright (C) 2010 Canonical Ltd
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.
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.
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/>.
19
* Authored by Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com>
24
#include <glib-object.h>
28
#include <glib/gi18n-lib.h>
30
#include <gio/gdesktopappinfo.h>
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))
41
typedef struct _UnityMusicLensDaemon UnityMusicLensDaemon;
42
typedef struct _UnityMusicLensDaemonClass UnityMusicLensDaemonClass;
43
typedef struct _UnityMusicLensDaemonPrivate UnityMusicLensDaemonPrivate;
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))
52
typedef struct _UnityMusicLensSimpleScope UnityMusicLensSimpleScope;
53
typedef struct _UnityMusicLensSimpleScopeClass UnityMusicLensSimpleScopeClass;
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))
62
typedef struct _UnityMusicLensBansheeScopeProxy UnityMusicLensBansheeScopeProxy;
63
typedef struct _UnityMusicLensBansheeScopeProxyClass UnityMusicLensBansheeScopeProxyClass;
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))
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)))
78
struct _UnityMusicLensDaemon {
79
GObject parent_instance;
80
UnityMusicLensDaemonPrivate * priv;
83
struct _UnityMusicLensDaemonClass {
84
GObjectClass parent_class;
87
struct _UnityMusicLensDaemonPrivate {
89
UnityMusicLensBansheeScopeProxy* banshee;
90
UnityMusicLensRhythmboxScope* rb;
94
static gpointer unity_music_lens_daemon_parent_class = NULL;
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))
103
UNITY_MUSIC_LENS_DAEMON_DUMMY_PROPERTY
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);
138
static gpointer _g_object_ref0 (gpointer self) {
139
return self ? g_object_ref (self) : NULL;
143
static void _g_object_unref0_ (gpointer var) {
144
(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
148
static void _g_list_free__g_object_unref0_ (GList* self) {
149
g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
154
static void unity_music_lens_daemon_populate_filters (UnityMusicLensDaemon* self) {
157
g_return_if_fail (self != NULL);
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);
189
_tmp3_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "0", _tmp2_, NULL);
191
_g_object_unref0 (_tmp4_);
193
_tmp6_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1960", _tmp5_, NULL);
195
_g_object_unref0 (_tmp7_);
197
_tmp9_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1970", _tmp8_, NULL);
199
_g_object_unref0 (_tmp10_);
201
_tmp12_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1980", _tmp11_, NULL);
203
_g_object_unref0 (_tmp13_);
205
_tmp15_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1990", _tmp14_, NULL);
207
_g_object_unref0 (_tmp16_);
209
_tmp18_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "2000", _tmp17_, NULL);
211
_g_object_unref0 (_tmp19_);
213
_tmp21_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "2010", _tmp20_, NULL);
215
_g_object_unref0 (_tmp22_);
216
_tmp23_ = _g_object_ref0 ((UnityFilter*) filter);
217
filters = g_list_append (filters, _tmp23_);
218
_g_object_unref0 (filter);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
322
_g_object_unref0 (_tmp55_);
324
_tmp57_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_RANDB_ID, _tmp56_, NULL);
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);
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);
334
_g_object_unref0 (_tmp64_);
336
_tmp66_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_POP_ID, _tmp65_, NULL);
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);
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);
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);
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);
354
_g_object_unref0 (_tmp79_);
355
_tmp80_ = _g_object_ref0 ((UnityFilter*) filter);
356
filters = g_list_append (filters, _tmp80_);
357
_g_object_unref0 (filter);
359
_tmp81_ = self->priv->lens;
360
unity_lens_set_filters (_tmp81_, filters);
361
__g_list_free__g_object_unref0_0 (filters);
365
static void unity_music_lens_daemon_populate_categories (UnityMusicLensDaemon* self) {
367
GFile* _tmp0_ = NULL;
369
const gchar* _tmp1_ = NULL;
370
GFile* _tmp2_ = NULL;
374
UnityCategory* _tmp6_;
375
UnityCategory* _tmp7_;
377
UnityCategory* _tmp8_;
378
UnityCategory* _tmp9_;
379
const gchar* _tmp10_ = NULL;
380
GFile* _tmp11_ = NULL;
384
UnityCategory* _tmp15_;
385
UnityCategory* _tmp16_;
386
UnityCategory* _tmp17_;
387
const gchar* _tmp18_ = NULL;
388
GFile* _tmp19_ = NULL;
392
UnityCategory* _tmp23_;
393
UnityCategory* _tmp24_;
394
UnityCategory* _tmp25_;
395
const gchar* _tmp26_ = NULL;
396
GFile* _tmp27_ = NULL;
400
UnityCategory* _tmp31_;
401
UnityCategory* _tmp32_;
402
UnityCategory* _tmp33_;
403
const gchar* _tmp34_ = NULL;
404
GFile* _tmp35_ = NULL;
408
UnityCategory* _tmp39_;
409
UnityCategory* _tmp40_;
410
UnityCategory* _tmp41_;
412
g_return_if_fail (self != NULL);
414
_tmp0_ = g_file_new_for_path (UNITY_MUSIC_LENS_ICON_PATH);
416
_tmp1_ = _ ("Songs");
417
_tmp2_ = g_file_get_child (icon_dir, "group-songs.svg");
419
_tmp4_ = (GFileIcon*) g_file_icon_new (_tmp3_);
421
_tmp6_ = unity_category_new (_tmp1_, (GIcon*) _tmp5_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
423
_g_object_unref0 (_tmp5_);
424
_g_object_unref0 (_tmp3_);
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");
432
_tmp13_ = (GFileIcon*) g_file_icon_new (_tmp12_);
434
_tmp15_ = unity_category_new (_tmp10_, (GIcon*) _tmp14_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
435
_g_object_unref0 (cat);
437
_g_object_unref0 (_tmp14_);
438
_g_object_unref0 (_tmp12_);
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");
445
_tmp21_ = (GFileIcon*) g_file_icon_new (_tmp20_);
447
_tmp23_ = unity_category_new (_tmp18_, (GIcon*) _tmp22_, UNITY_CATEGORY_RENDERER_FLOW);
448
_g_object_unref0 (cat);
450
_g_object_unref0 (_tmp22_);
451
_g_object_unref0 (_tmp20_);
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");
458
_tmp29_ = (GFileIcon*) g_file_icon_new (_tmp28_);
460
_tmp31_ = unity_category_new (_tmp26_, (GIcon*) _tmp30_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
461
_g_object_unref0 (cat);
463
_g_object_unref0 (_tmp30_);
464
_g_object_unref0 (_tmp28_);
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");
471
_tmp37_ = (GFileIcon*) g_file_icon_new (_tmp36_);
473
_tmp39_ = unity_category_new (_tmp34_, (GIcon*) _tmp38_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
474
_g_object_unref0 (cat);
476
_g_object_unref0 (_tmp38_);
477
_g_object_unref0 (_tmp36_);
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);
489
UnityMusicLensDaemon* unity_music_lens_daemon_construct (GType object_type) {
490
UnityMusicLensDaemon * self = NULL;
491
self = (UnityMusicLensDaemon*) g_object_new (object_type, NULL);
496
UnityMusicLensDaemon* unity_music_lens_daemon_new (void) {
497
return unity_music_lens_daemon_construct (UNITY_MUSIC_LENS_TYPE_DAEMON);
501
static GObject * unity_music_lens_daemon_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
503
GObjectClass * parent_class;
504
UnityMusicLensDaemon * self;
508
const gchar* _tmp3_ = NULL;
510
const gchar* _tmp5_ = NULL;
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");
539
if (_tmp8_ != NULL) {
540
UnityMusicLensBansheeScopeProxy* _tmp9_;
542
UnityMusicLensBansheeScopeProxy* _tmp11_;
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_);
552
unity_lens_add_local_scope (_tmp10_, _tmp13_);
554
_tmp14_ = g_desktop_app_info_new ("rhythmbox.desktop");
555
_g_object_unref0 (app_check);
558
if (_tmp15_ != NULL) {
559
UnityMusicLensRhythmboxScope* _tmp16_;
561
UnityMusicLensRhythmboxScope* _tmp18_;
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_);
571
unity_lens_add_local_scope (_tmp17_, _tmp20_);
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;
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_);
592
const gchar* _tmp24_;
594
_inner_error_ = NULL;
597
_tmp24_ = _tmp23_->message;
598
fprintf (_tmp22_, "error %s\n", _tmp24_);
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_);
607
_g_object_unref0 (app_check);
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;
620
static void unity_music_lens_daemon_instance_init (UnityMusicLensDaemon * self) {
621
self->priv = UNITY_MUSIC_LENS_DAEMON_GET_PRIVATE (self);
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);
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);
643
return unity_music_lens_daemon_type_id__volatile;