Back to index

unity-lens-music  6.0.0
daemon.c
Go to the documentation of this file.
00001 /* daemon.c generated by valac 0.14.2, the Vala compiler
00002  * generated from daemon.vala, do not modify */
00003 
00004 /*
00005  * Copyright (C) 2010 Canonical Ltd
00006  *
00007  * This program is free software: you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License version 3 as
00009  * published by the Free Software Foundation.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018  *
00019  * Authored by Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com>
00020  *
00021  */
00022 
00023 #include <glib.h>
00024 #include <glib-object.h>
00025 #include <stdlib.h>
00026 #include <string.h>
00027 #include <unity.h>
00028 #include <glib/gi18n-lib.h>
00029 #include <gio/gio.h>
00030 #include <gio/gdesktopappinfo.h>
00031 #include <stdio.h>
00032 
00033 
00034 #define UNITY_MUSIC_LENS_TYPE_DAEMON (unity_music_lens_daemon_get_type ())
00035 #define UNITY_MUSIC_LENS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_DAEMON, UnityMusicLensDaemon))
00036 #define UNITY_MUSIC_LENS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_DAEMON, UnityMusicLensDaemonClass))
00037 #define UNITY_MUSIC_LENS_IS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_DAEMON))
00038 #define UNITY_MUSIC_LENS_IS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_DAEMON))
00039 #define UNITY_MUSIC_LENS_DAEMON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_DAEMON, UnityMusicLensDaemonClass))
00040 
00041 typedef struct _UnityMusicLensDaemon UnityMusicLensDaemon;
00042 typedef struct _UnityMusicLensDaemonClass UnityMusicLensDaemonClass;
00043 typedef struct _UnityMusicLensDaemonPrivate UnityMusicLensDaemonPrivate;
00044 
00045 #define UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE (unity_music_lens_simple_scope_get_type ())
00046 #define UNITY_MUSIC_LENS_SIMPLE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScope))
00047 #define UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))
00048 #define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))
00049 #define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))
00050 #define UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))
00051 
00052 typedef struct _UnityMusicLensSimpleScope UnityMusicLensSimpleScope;
00053 typedef struct _UnityMusicLensSimpleScopeClass UnityMusicLensSimpleScopeClass;
00054 
00055 #define UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY (unity_music_lens_banshee_scope_proxy_get_type ())
00056 #define UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY, UnityMusicLensBansheeScopeProxy))
00057 #define UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY, UnityMusicLensBansheeScopeProxyClass))
00058 #define UNITY_MUSIC_LENS_IS_BANSHEE_SCOPE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY))
00059 #define UNITY_MUSIC_LENS_IS_BANSHEE_SCOPE_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY))
00060 #define UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY, UnityMusicLensBansheeScopeProxyClass))
00061 
00062 typedef struct _UnityMusicLensBansheeScopeProxy UnityMusicLensBansheeScopeProxy;
00063 typedef struct _UnityMusicLensBansheeScopeProxyClass UnityMusicLensBansheeScopeProxyClass;
00064 
00065 #define UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE (unity_music_lens_rhythmbox_scope_get_type ())
00066 #define UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE, UnityMusicLensRhythmboxScope))
00067 #define UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE, UnityMusicLensRhythmboxScopeClass))
00068 #define UNITY_MUSIC_LENS_IS_RHYTHMBOX_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE))
00069 #define UNITY_MUSIC_LENS_IS_RHYTHMBOX_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE))
00070 #define UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE, UnityMusicLensRhythmboxScopeClass))
00071 
00072 typedef struct _UnityMusicLensRhythmboxScope UnityMusicLensRhythmboxScope;
00073 typedef struct _UnityMusicLensRhythmboxScopeClass UnityMusicLensRhythmboxScopeClass;
00074 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
00075 #define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
00076 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
00077 
00078 struct _UnityMusicLensDaemon {
00079        GObject parent_instance;
00080        UnityMusicLensDaemonPrivate * priv;
00081 };
00082 
00083 struct _UnityMusicLensDaemonClass {
00084        GObjectClass parent_class;
00085 };
00086 
00087 struct _UnityMusicLensDaemonPrivate {
00088        UnityLens* lens;
00089        UnityMusicLensBansheeScopeProxy* banshee;
00090        UnityMusicLensRhythmboxScope* rb;
00091 };
00092 
00093 
00094 static gpointer unity_music_lens_daemon_parent_class = NULL;
00095 
00096 #define UNITY_MUSIC_LENS_ICON_PATH "/usr/share/icons/unity-icon-theme/places/svg/"
00097 GType unity_music_lens_daemon_get_type (void) G_GNUC_CONST;
00098 GType unity_music_lens_simple_scope_get_type (void) G_GNUC_CONST;
00099 GType unity_music_lens_banshee_scope_proxy_get_type (void) G_GNUC_CONST;
00100 GType unity_music_lens_rhythmbox_scope_get_type (void) G_GNUC_CONST;
00101 #define UNITY_MUSIC_LENS_DAEMON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_MUSIC_LENS_TYPE_DAEMON, UnityMusicLensDaemonPrivate))
00102 enum  {
00103        UNITY_MUSIC_LENS_DAEMON_DUMMY_PROPERTY
00104 };
00105 static void unity_music_lens_daemon_populate_filters (UnityMusicLensDaemon* self);
00106 #define UNITY_MUSIC_LENS_GENRE_BLUES_ID "blues"
00107 #define UNITY_MUSIC_LENS_GENRE_CLASSIC_ID "classic"
00108 #define UNITY_MUSIC_LENS_GENRE_COUNTRY_ID "country"
00109 #define UNITY_MUSIC_LENS_GENRE_DISCO_ID "disco"
00110 #define UNITY_MUSIC_LENS_GENRE_FUNK_ID "funk"
00111 #define UNITY_MUSIC_LENS_GENRE_ROCK_ID "rock"
00112 #define UNITY_MUSIC_LENS_GENRE_METAL_ID "metal"
00113 #define UNITY_MUSIC_LENS_GENRE_HIPHOP_ID "hip-hop"
00114 #define UNITY_MUSIC_LENS_GENRE_HOUSE_ID "house"
00115 #define UNITY_MUSIC_LENS_GENRE_NEWWAVE_ID "new-wave"
00116 #define UNITY_MUSIC_LENS_GENRE_RANDB_ID "r-and-b"
00117 #define UNITY_MUSIC_LENS_GENRE_PUNK_ID "punk"
00118 #define UNITY_MUSIC_LENS_GENRE_JAZZ_ID "jazz"
00119 #define UNITY_MUSIC_LENS_GENRE_POP_ID "pop"
00120 #define UNITY_MUSIC_LENS_GENRE_REGGAE_ID "reggae"
00121 #define UNITY_MUSIC_LENS_GENRE_SOUL_ID "soul"
00122 #define UNITY_MUSIC_LENS_GENRE_TECHNO_ID "techno"
00123 #define UNITY_MUSIC_LENS_GENRE_OTHER_ID "other"
00124 static void _g_object_unref0_ (gpointer var);
00125 static void _g_list_free__g_object_unref0_ (GList* self);
00126 static void unity_music_lens_daemon_populate_categories (UnityMusicLensDaemon* self);
00127 UnityMusicLensDaemon* unity_music_lens_daemon_new (void);
00128 UnityMusicLensDaemon* unity_music_lens_daemon_construct (GType object_type);
00129 static GObject * unity_music_lens_daemon_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
00130 UnityMusicLensBansheeScopeProxy* unity_music_lens_banshee_scope_proxy_new (void);
00131 UnityMusicLensBansheeScopeProxy* unity_music_lens_banshee_scope_proxy_construct (GType object_type);
00132 UnityScope* unity_music_lens_simple_scope_get_scope (UnityMusicLensSimpleScope* self);
00133 UnityMusicLensRhythmboxScope* unity_music_lens_rhythmbox_scope_new (void);
00134 UnityMusicLensRhythmboxScope* unity_music_lens_rhythmbox_scope_construct (GType object_type);
00135 static void unity_music_lens_daemon_finalize (GObject* obj);
00136 
00137 
00138 static gpointer _g_object_ref0 (gpointer self) {
00139        return self ? g_object_ref (self) : NULL;
00140 }
00141 
00142 
00143 static void _g_object_unref0_ (gpointer var) {
00144        (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
00145 }
00146 
00147 
00148 static void _g_list_free__g_object_unref0_ (GList* self) {
00149        g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
00150        g_list_free (self);
00151 }
00152 
00153 
00154 static void unity_music_lens_daemon_populate_filters (UnityMusicLensDaemon* self) {
00155        GList* filters;
00156        UnityLens* _tmp81_;
00157        g_return_if_fail (self != NULL);
00158        filters = NULL;
00159        {
00160               const gchar* _tmp0_ = NULL;
00161               UnityMultiRangeFilter* _tmp1_;
00162               UnityMultiRangeFilter* filter;
00163               const gchar* _tmp2_ = NULL;
00164               UnityFilterOption* _tmp3_ = NULL;
00165               UnityFilterOption* _tmp4_;
00166               const gchar* _tmp5_ = NULL;
00167               UnityFilterOption* _tmp6_ = NULL;
00168               UnityFilterOption* _tmp7_;
00169               const gchar* _tmp8_ = NULL;
00170               UnityFilterOption* _tmp9_ = NULL;
00171               UnityFilterOption* _tmp10_;
00172               const gchar* _tmp11_ = NULL;
00173               UnityFilterOption* _tmp12_ = NULL;
00174               UnityFilterOption* _tmp13_;
00175               const gchar* _tmp14_ = NULL;
00176               UnityFilterOption* _tmp15_ = NULL;
00177               UnityFilterOption* _tmp16_;
00178               const gchar* _tmp17_ = NULL;
00179               UnityFilterOption* _tmp18_ = NULL;
00180               UnityFilterOption* _tmp19_;
00181               const gchar* _tmp20_ = NULL;
00182               UnityFilterOption* _tmp21_ = NULL;
00183               UnityFilterOption* _tmp22_;
00184               UnityFilter* _tmp23_;
00185               _tmp0_ = _ ("Decade");
00186               _tmp1_ = unity_multi_range_filter_new ("decade", _tmp0_, NULL, FALSE);
00187               filter = _tmp1_;
00188               _tmp2_ = _ ("Old");
00189               _tmp3_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "0", _tmp2_, NULL);
00190               _tmp4_ = _tmp3_;
00191               _g_object_unref0 (_tmp4_);
00192               _tmp5_ = _ ("60s");
00193               _tmp6_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1960", _tmp5_, NULL);
00194               _tmp7_ = _tmp6_;
00195               _g_object_unref0 (_tmp7_);
00196               _tmp8_ = _ ("70s");
00197               _tmp9_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1970", _tmp8_, NULL);
00198               _tmp10_ = _tmp9_;
00199               _g_object_unref0 (_tmp10_);
00200               _tmp11_ = _ ("80s");
00201               _tmp12_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1980", _tmp11_, NULL);
00202               _tmp13_ = _tmp12_;
00203               _g_object_unref0 (_tmp13_);
00204               _tmp14_ = _ ("90s");
00205               _tmp15_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "1990", _tmp14_, NULL);
00206               _tmp16_ = _tmp15_;
00207               _g_object_unref0 (_tmp16_);
00208               _tmp17_ = _ ("00s");
00209               _tmp18_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "2000", _tmp17_, NULL);
00210               _tmp19_ = _tmp18_;
00211               _g_object_unref0 (_tmp19_);
00212               _tmp20_ = _ ("10s");
00213               _tmp21_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, "2010", _tmp20_, NULL);
00214               _tmp22_ = _tmp21_;
00215               _g_object_unref0 (_tmp22_);
00216               _tmp23_ = _g_object_ref0 ((UnityFilter*) filter);
00217               filters = g_list_append (filters, _tmp23_);
00218               _g_object_unref0 (filter);
00219        }
00220        {
00221               const gchar* _tmp24_ = NULL;
00222               UnityCheckOptionFilterCompact* _tmp25_;
00223               UnityCheckOptionFilterCompact* filter;
00224               const gchar* _tmp26_ = NULL;
00225               UnityFilterOption* _tmp27_ = NULL;
00226               UnityFilterOption* _tmp28_;
00227               const gchar* _tmp29_ = NULL;
00228               UnityFilterOption* _tmp30_ = NULL;
00229               UnityFilterOption* _tmp31_;
00230               const gchar* _tmp32_ = NULL;
00231               UnityFilterOption* _tmp33_ = NULL;
00232               UnityFilterOption* _tmp34_;
00233               const gchar* _tmp35_ = NULL;
00234               UnityFilterOption* _tmp36_ = NULL;
00235               UnityFilterOption* _tmp37_;
00236               const gchar* _tmp38_ = NULL;
00237               UnityFilterOption* _tmp39_ = NULL;
00238               UnityFilterOption* _tmp40_;
00239               const gchar* _tmp41_ = NULL;
00240               UnityFilterOption* _tmp42_ = NULL;
00241               UnityFilterOption* _tmp43_;
00242               const gchar* _tmp44_ = NULL;
00243               UnityFilterOption* _tmp45_ = NULL;
00244               UnityFilterOption* _tmp46_;
00245               const gchar* _tmp47_ = NULL;
00246               UnityFilterOption* _tmp48_ = NULL;
00247               UnityFilterOption* _tmp49_;
00248               const gchar* _tmp50_ = NULL;
00249               UnityFilterOption* _tmp51_ = NULL;
00250               UnityFilterOption* _tmp52_;
00251               const gchar* _tmp53_ = NULL;
00252               UnityFilterOption* _tmp54_ = NULL;
00253               UnityFilterOption* _tmp55_;
00254               const gchar* _tmp56_ = NULL;
00255               UnityFilterOption* _tmp57_ = NULL;
00256               UnityFilterOption* _tmp58_;
00257               const gchar* _tmp59_ = NULL;
00258               UnityFilterOption* _tmp60_ = NULL;
00259               UnityFilterOption* _tmp61_;
00260               const gchar* _tmp62_ = NULL;
00261               UnityFilterOption* _tmp63_ = NULL;
00262               UnityFilterOption* _tmp64_;
00263               const gchar* _tmp65_ = NULL;
00264               UnityFilterOption* _tmp66_ = NULL;
00265               UnityFilterOption* _tmp67_;
00266               const gchar* _tmp68_ = NULL;
00267               UnityFilterOption* _tmp69_ = NULL;
00268               UnityFilterOption* _tmp70_;
00269               const gchar* _tmp71_ = NULL;
00270               UnityFilterOption* _tmp72_ = NULL;
00271               UnityFilterOption* _tmp73_;
00272               const gchar* _tmp74_ = NULL;
00273               UnityFilterOption* _tmp75_ = NULL;
00274               UnityFilterOption* _tmp76_;
00275               const gchar* _tmp77_ = NULL;
00276               UnityFilterOption* _tmp78_ = NULL;
00277               UnityFilterOption* _tmp79_;
00278               UnityFilter* _tmp80_;
00279               _tmp24_ = _ ("Genre");
00280               _tmp25_ = unity_check_option_filter_compact_new ("genre", _tmp24_, NULL, FALSE);
00281               filter = _tmp25_;
00282               unity_options_filter_set_sort_type ((UnityOptionsFilter*) filter, UNITY_OPTIONS_FILTER_SORT_TYPE_DISPLAY_NAME);
00283               _tmp26_ = _ ("Blues");
00284               _tmp27_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_BLUES_ID, _tmp26_, NULL);
00285               _tmp28_ = _tmp27_;
00286               _g_object_unref0 (_tmp28_);
00287               _tmp29_ = _ ("Classic");
00288               _tmp30_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_CLASSIC_ID, _tmp29_, NULL);
00289               _tmp31_ = _tmp30_;
00290               _g_object_unref0 (_tmp31_);
00291               _tmp32_ = _ ("Country");
00292               _tmp33_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_COUNTRY_ID, _tmp32_, NULL);
00293               _tmp34_ = _tmp33_;
00294               _g_object_unref0 (_tmp34_);
00295               _tmp35_ = _ ("Disco");
00296               _tmp36_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_DISCO_ID, _tmp35_, NULL);
00297               _tmp37_ = _tmp36_;
00298               _g_object_unref0 (_tmp37_);
00299               _tmp38_ = _ ("Funk");
00300               _tmp39_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_FUNK_ID, _tmp38_, NULL);
00301               _tmp40_ = _tmp39_;
00302               _g_object_unref0 (_tmp40_);
00303               _tmp41_ = _ ("Rock");
00304               _tmp42_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_ROCK_ID, _tmp41_, NULL);
00305               _tmp43_ = _tmp42_;
00306               _g_object_unref0 (_tmp43_);
00307               _tmp44_ = _ ("Metal");
00308               _tmp45_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_METAL_ID, _tmp44_, NULL);
00309               _tmp46_ = _tmp45_;
00310               _g_object_unref0 (_tmp46_);
00311               _tmp47_ = _ ("Hip-hop");
00312               _tmp48_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_HIPHOP_ID, _tmp47_, NULL);
00313               _tmp49_ = _tmp48_;
00314               _g_object_unref0 (_tmp49_);
00315               _tmp50_ = _ ("House");
00316               _tmp51_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_HOUSE_ID, _tmp50_, NULL);
00317               _tmp52_ = _tmp51_;
00318               _g_object_unref0 (_tmp52_);
00319               _tmp53_ = _ ("New-wave");
00320               _tmp54_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_NEWWAVE_ID, _tmp53_, NULL);
00321               _tmp55_ = _tmp54_;
00322               _g_object_unref0 (_tmp55_);
00323               _tmp56_ = _ ("R&B");
00324               _tmp57_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_RANDB_ID, _tmp56_, NULL);
00325               _tmp58_ = _tmp57_;
00326               _g_object_unref0 (_tmp58_);
00327               _tmp59_ = _ ("Punk");
00328               _tmp60_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_PUNK_ID, _tmp59_, NULL);
00329               _tmp61_ = _tmp60_;
00330               _g_object_unref0 (_tmp61_);
00331               _tmp62_ = _ ("Jazz");
00332               _tmp63_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_JAZZ_ID, _tmp62_, NULL);
00333               _tmp64_ = _tmp63_;
00334               _g_object_unref0 (_tmp64_);
00335               _tmp65_ = _ ("Pop");
00336               _tmp66_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_POP_ID, _tmp65_, NULL);
00337               _tmp67_ = _tmp66_;
00338               _g_object_unref0 (_tmp67_);
00339               _tmp68_ = _ ("Reggae");
00340               _tmp69_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_REGGAE_ID, _tmp68_, NULL);
00341               _tmp70_ = _tmp69_;
00342               _g_object_unref0 (_tmp70_);
00343               _tmp71_ = _ ("Soul");
00344               _tmp72_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_SOUL_ID, _tmp71_, NULL);
00345               _tmp73_ = _tmp72_;
00346               _g_object_unref0 (_tmp73_);
00347               _tmp74_ = _ ("Techno");
00348               _tmp75_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_TECHNO_ID, _tmp74_, NULL);
00349               _tmp76_ = _tmp75_;
00350               _g_object_unref0 (_tmp76_);
00351               _tmp77_ = _ ("Other");
00352               _tmp78_ = unity_options_filter_add_option ((UnityOptionsFilter*) filter, UNITY_MUSIC_LENS_GENRE_OTHER_ID, _tmp77_, NULL);
00353               _tmp79_ = _tmp78_;
00354               _g_object_unref0 (_tmp79_);
00355               _tmp80_ = _g_object_ref0 ((UnityFilter*) filter);
00356               filters = g_list_append (filters, _tmp80_);
00357               _g_object_unref0 (filter);
00358        }
00359        _tmp81_ = self->priv->lens;
00360        unity_lens_set_filters (_tmp81_, filters);
00361        __g_list_free__g_object_unref0_0 (filters);
00362 }
00363 
00364 
00365 static void unity_music_lens_daemon_populate_categories (UnityMusicLensDaemon* self) {
00366        GList* categories;
00367        GFile* _tmp0_ = NULL;
00368        GFile* icon_dir;
00369        const gchar* _tmp1_ = NULL;
00370        GFile* _tmp2_ = NULL;
00371        GFile* _tmp3_;
00372        GFileIcon* _tmp4_;
00373        GFileIcon* _tmp5_;
00374        UnityCategory* _tmp6_;
00375        UnityCategory* _tmp7_;
00376        UnityCategory* cat;
00377        UnityCategory* _tmp8_;
00378        UnityCategory* _tmp9_;
00379        const gchar* _tmp10_ = NULL;
00380        GFile* _tmp11_ = NULL;
00381        GFile* _tmp12_;
00382        GFileIcon* _tmp13_;
00383        GFileIcon* _tmp14_;
00384        UnityCategory* _tmp15_;
00385        UnityCategory* _tmp16_;
00386        UnityCategory* _tmp17_;
00387        const gchar* _tmp18_ = NULL;
00388        GFile* _tmp19_ = NULL;
00389        GFile* _tmp20_;
00390        GFileIcon* _tmp21_;
00391        GFileIcon* _tmp22_;
00392        UnityCategory* _tmp23_;
00393        UnityCategory* _tmp24_;
00394        UnityCategory* _tmp25_;
00395        const gchar* _tmp26_ = NULL;
00396        GFile* _tmp27_ = NULL;
00397        GFile* _tmp28_;
00398        GFileIcon* _tmp29_;
00399        GFileIcon* _tmp30_;
00400        UnityCategory* _tmp31_;
00401        UnityCategory* _tmp32_;
00402        UnityCategory* _tmp33_;
00403        const gchar* _tmp34_ = NULL;
00404        GFile* _tmp35_ = NULL;
00405        GFile* _tmp36_;
00406        GFileIcon* _tmp37_;
00407        GFileIcon* _tmp38_;
00408        UnityCategory* _tmp39_;
00409        UnityCategory* _tmp40_;
00410        UnityCategory* _tmp41_;
00411        UnityLens* _tmp42_;
00412        g_return_if_fail (self != NULL);
00413        categories = NULL;
00414        _tmp0_ = g_file_new_for_path (UNITY_MUSIC_LENS_ICON_PATH);
00415        icon_dir = _tmp0_;
00416        _tmp1_ = _ ("Songs");
00417        _tmp2_ = g_file_get_child (icon_dir, "group-songs.svg");
00418        _tmp3_ = _tmp2_;
00419        _tmp4_ = (GFileIcon*) g_file_icon_new (_tmp3_);
00420        _tmp5_ = _tmp4_;
00421        _tmp6_ = unity_category_new (_tmp1_, (GIcon*) _tmp5_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
00422        _tmp7_ = _tmp6_;
00423        _g_object_unref0 (_tmp5_);
00424        _g_object_unref0 (_tmp3_);
00425        cat = _tmp7_;
00426        _tmp8_ = cat;
00427        _tmp9_ = _g_object_ref0 (_tmp8_);
00428        categories = g_list_append (categories, _tmp9_);
00429        _tmp10_ = _ ("Albums");
00430        _tmp11_ = g_file_get_child (icon_dir, "group-albums.svg");
00431        _tmp12_ = _tmp11_;
00432        _tmp13_ = (GFileIcon*) g_file_icon_new (_tmp12_);
00433        _tmp14_ = _tmp13_;
00434        _tmp15_ = unity_category_new (_tmp10_, (GIcon*) _tmp14_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
00435        _g_object_unref0 (cat);
00436        cat = _tmp15_;
00437        _g_object_unref0 (_tmp14_);
00438        _g_object_unref0 (_tmp12_);
00439        _tmp16_ = cat;
00440        _tmp17_ = _g_object_ref0 (_tmp16_);
00441        categories = g_list_append (categories, _tmp17_);
00442        _tmp18_ = _ ("Available for Purchase");
00443        _tmp19_ = g_file_get_child (icon_dir, "group-purchase.svg");
00444        _tmp20_ = _tmp19_;
00445        _tmp21_ = (GFileIcon*) g_file_icon_new (_tmp20_);
00446        _tmp22_ = _tmp21_;
00447        _tmp23_ = unity_category_new (_tmp18_, (GIcon*) _tmp22_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
00448        _g_object_unref0 (cat);
00449        cat = _tmp23_;
00450        _g_object_unref0 (_tmp22_);
00451        _g_object_unref0 (_tmp20_);
00452        _tmp24_ = cat;
00453        _tmp25_ = _g_object_ref0 (_tmp24_);
00454        categories = g_list_append (categories, _tmp25_);
00455        _tmp26_ = _ ("Music");
00456        _tmp27_ = g_file_get_child (icon_dir, "group-songs.svg");
00457        _tmp28_ = _tmp27_;
00458        _tmp29_ = (GFileIcon*) g_file_icon_new (_tmp28_);
00459        _tmp30_ = _tmp29_;
00460        _tmp31_ = unity_category_new (_tmp26_, (GIcon*) _tmp30_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
00461        _g_object_unref0 (cat);
00462        cat = _tmp31_;
00463        _g_object_unref0 (_tmp30_);
00464        _g_object_unref0 (_tmp28_);
00465        _tmp32_ = cat;
00466        _tmp33_ = _g_object_ref0 (_tmp32_);
00467        categories = g_list_append (categories, _tmp33_);
00468        _tmp34_ = _ ("Radio");
00469        _tmp35_ = g_file_get_child (icon_dir, "group-songs.svg");
00470        _tmp36_ = _tmp35_;
00471        _tmp37_ = (GFileIcon*) g_file_icon_new (_tmp36_);
00472        _tmp38_ = _tmp37_;
00473        _tmp39_ = unity_category_new (_tmp34_, (GIcon*) _tmp38_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
00474        _g_object_unref0 (cat);
00475        cat = _tmp39_;
00476        _g_object_unref0 (_tmp38_);
00477        _g_object_unref0 (_tmp36_);
00478        _tmp40_ = cat;
00479        _tmp41_ = _g_object_ref0 (_tmp40_);
00480        categories = g_list_append (categories, _tmp41_);
00481        _tmp42_ = self->priv->lens;
00482        unity_lens_set_categories (_tmp42_, categories);
00483        _g_object_unref0 (cat);
00484        _g_object_unref0 (icon_dir);
00485        __g_list_free__g_object_unref0_0 (categories);
00486 }
00487 
00488 
00489 UnityMusicLensDaemon* unity_music_lens_daemon_construct (GType object_type) {
00490        UnityMusicLensDaemon * self = NULL;
00491        self = (UnityMusicLensDaemon*) g_object_new (object_type, NULL);
00492        return self;
00493 }
00494 
00495 
00496 UnityMusicLensDaemon* unity_music_lens_daemon_new (void) {
00497        return unity_music_lens_daemon_construct (UNITY_MUSIC_LENS_TYPE_DAEMON);
00498 }
00499 
00500 
00501 static GObject * unity_music_lens_daemon_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
00502        GObject * obj;
00503        GObjectClass * parent_class;
00504        UnityMusicLensDaemon * self;
00505        UnityLens* _tmp0_;
00506        UnityLens* _tmp1_;
00507        UnityLens* _tmp2_;
00508        const gchar* _tmp3_ = NULL;
00509        UnityLens* _tmp4_;
00510        const gchar* _tmp5_ = NULL;
00511        UnityLens* _tmp6_;
00512        GDesktopAppInfo* _tmp7_;
00513        GDesktopAppInfo* app_check;
00514        GDesktopAppInfo* _tmp8_;
00515        GDesktopAppInfo* _tmp14_;
00516        GDesktopAppInfo* _tmp15_;
00517        GError * _inner_error_ = NULL;
00518        parent_class = G_OBJECT_CLASS (unity_music_lens_daemon_parent_class);
00519        obj = parent_class->constructor (type, n_construct_properties, construct_properties);
00520        self = UNITY_MUSIC_LENS_DAEMON (obj);
00521        _tmp0_ = unity_lens_new ("/com/canonical/unity/lens/music", "music");
00522        _g_object_unref0 (self->priv->lens);
00523        self->priv->lens = _tmp0_;
00524        _tmp1_ = self->priv->lens;
00525        unity_lens_set_search_in_global (_tmp1_, TRUE);
00526        _tmp2_ = self->priv->lens;
00527        _tmp3_ = _ ("Search Music Collection");
00528        unity_lens_set_search_hint (_tmp2_, _tmp3_);
00529        _tmp4_ = self->priv->lens;
00530        _tmp5_ = _ ("Sources");
00531        unity_lens_set_sources_display_name (_tmp4_, _tmp5_);
00532        _tmp6_ = self->priv->lens;
00533        unity_lens_set_visible (_tmp6_, TRUE);
00534        unity_music_lens_daemon_populate_categories (self);
00535        unity_music_lens_daemon_populate_filters (self);
00536        _tmp7_ = g_desktop_app_info_new ("banshee.desktop");
00537        app_check = _tmp7_;
00538        _tmp8_ = app_check;
00539        if (_tmp8_ != NULL) {
00540               UnityMusicLensBansheeScopeProxy* _tmp9_;
00541               UnityLens* _tmp10_;
00542               UnityMusicLensBansheeScopeProxy* _tmp11_;
00543               UnityScope* _tmp12_;
00544               UnityScope* _tmp13_;
00545               _tmp9_ = unity_music_lens_banshee_scope_proxy_new ();
00546               _g_object_unref0 (self->priv->banshee);
00547               self->priv->banshee = _tmp9_;
00548               _tmp10_ = self->priv->lens;
00549               _tmp11_ = self->priv->banshee;
00550               _tmp12_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) _tmp11_);
00551               _tmp13_ = _tmp12_;
00552               unity_lens_add_local_scope (_tmp10_, _tmp13_);
00553        }
00554        _tmp14_ = g_desktop_app_info_new ("rhythmbox.desktop");
00555        _g_object_unref0 (app_check);
00556        app_check = _tmp14_;
00557        _tmp15_ = app_check;
00558        if (_tmp15_ != NULL) {
00559               UnityMusicLensRhythmboxScope* _tmp16_;
00560               UnityLens* _tmp17_;
00561               UnityMusicLensRhythmboxScope* _tmp18_;
00562               UnityScope* _tmp19_;
00563               UnityScope* _tmp20_;
00564               _tmp16_ = unity_music_lens_rhythmbox_scope_new ();
00565               _g_object_unref0 (self->priv->rb);
00566               self->priv->rb = _tmp16_;
00567               _tmp17_ = self->priv->lens;
00568               _tmp18_ = self->priv->rb;
00569               _tmp19_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) _tmp18_);
00570               _tmp20_ = _tmp19_;
00571               unity_lens_add_local_scope (_tmp17_, _tmp20_);
00572        }
00573        {
00574               UnityLens* _tmp21_;
00575               _tmp21_ = self->priv->lens;
00576               unity_lens_export (_tmp21_, &_inner_error_);
00577               if (_inner_error_ != NULL) {
00578                      if (_inner_error_->domain == G_IO_ERROR) {
00579                             goto __catch2_g_io_error;
00580                      }
00581                      _g_object_unref0 (app_check);
00582                      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);
00583                      g_clear_error (&_inner_error_);
00584               }
00585        }
00586        goto __finally2;
00587        __catch2_g_io_error:
00588        {
00589               GError* e = NULL;
00590               FILE* _tmp22_;
00591               GError* _tmp23_;
00592               const gchar* _tmp24_;
00593               e = _inner_error_;
00594               _inner_error_ = NULL;
00595               _tmp22_ = stdout;
00596               _tmp23_ = e;
00597               _tmp24_ = _tmp23_->message;
00598               fprintf (_tmp22_, "error %s\n", _tmp24_);
00599               _g_error_free0 (e);
00600        }
00601        __finally2:
00602        if (_inner_error_ != NULL) {
00603               _g_object_unref0 (app_check);
00604               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);
00605               g_clear_error (&_inner_error_);
00606        }
00607        _g_object_unref0 (app_check);
00608        return obj;
00609 }
00610 
00611 
00612 static void unity_music_lens_daemon_class_init (UnityMusicLensDaemonClass * klass) {
00613        unity_music_lens_daemon_parent_class = g_type_class_peek_parent (klass);
00614        g_type_class_add_private (klass, sizeof (UnityMusicLensDaemonPrivate));
00615        G_OBJECT_CLASS (klass)->constructor = unity_music_lens_daemon_constructor;
00616        G_OBJECT_CLASS (klass)->finalize = unity_music_lens_daemon_finalize;
00617 }
00618 
00619 
00620 static void unity_music_lens_daemon_instance_init (UnityMusicLensDaemon * self) {
00621        self->priv = UNITY_MUSIC_LENS_DAEMON_GET_PRIVATE (self);
00622 }
00623 
00624 
00625 static void unity_music_lens_daemon_finalize (GObject* obj) {
00626        UnityMusicLensDaemon * self;
00627        self = UNITY_MUSIC_LENS_DAEMON (obj);
00628        _g_object_unref0 (self->priv->lens);
00629        _g_object_unref0 (self->priv->banshee);
00630        _g_object_unref0 (self->priv->rb);
00631        G_OBJECT_CLASS (unity_music_lens_daemon_parent_class)->finalize (obj);
00632 }
00633 
00634 
00635 GType unity_music_lens_daemon_get_type (void) {
00636        static volatile gsize unity_music_lens_daemon_type_id__volatile = 0;
00637        if (g_once_init_enter (&unity_music_lens_daemon_type_id__volatile)) {
00638               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 };
00639               GType unity_music_lens_daemon_type_id;
00640               unity_music_lens_daemon_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityMusicLensDaemon", &g_define_type_info, 0);
00641               g_once_init_leave (&unity_music_lens_daemon_type_id__volatile, unity_music_lens_daemon_type_id);
00642        }
00643        return unity_music_lens_daemon_type_id__volatile;
00644 }
00645 
00646 
00647