Back to index

unity-lens-music  6.0.0
rhythmbox-scope.c
Go to the documentation of this file.
00001 /* rhythmbox-scope.c generated by valac 0.14.2, the Vala compiler
00002  * generated from rhythmbox-scope.vala, do not modify */
00003 
00004 /*
00005  * Copyright (C) 2011 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 Alex Launi <alex.launi@canonical.com>
00020  *
00021  */
00022 
00023 #include <glib.h>
00024 #include <glib-object.h>
00025 #include <gio/gio.h>
00026 #include <unity.h>
00027 #include <stdlib.h>
00028 #include <string.h>
00029 #include <glib/gi18n-lib.h>
00030 
00031 
00032 #define UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE (unity_music_lens_simple_scope_get_type ())
00033 #define UNITY_MUSIC_LENS_SIMPLE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScope))
00034 #define UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))
00035 #define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))
00036 #define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))
00037 #define UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))
00038 
00039 typedef struct _UnityMusicLensSimpleScope UnityMusicLensSimpleScope;
00040 typedef struct _UnityMusicLensSimpleScopeClass UnityMusicLensSimpleScopeClass;
00041 typedef struct _UnityMusicLensSimpleScopePrivate UnityMusicLensSimpleScopePrivate;
00042 
00043 #define UNITY_MUSIC_LENS_TYPE_FILTER_PARSER (unity_music_lens_filter_parser_get_type ())
00044 #define UNITY_MUSIC_LENS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParser))
00045 #define UNITY_MUSIC_LENS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
00046 #define UNITY_MUSIC_LENS_IS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
00047 #define UNITY_MUSIC_LENS_IS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
00048 #define UNITY_MUSIC_LENS_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
00049 
00050 typedef struct _UnityMusicLensFilterParser UnityMusicLensFilterParser;
00051 typedef struct _UnityMusicLensFilterParserClass UnityMusicLensFilterParserClass;
00052 
00053 #define UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE (unity_music_lens_rhythmbox_scope_get_type ())
00054 #define UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE, UnityMusicLensRhythmboxScope))
00055 #define UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE, UnityMusicLensRhythmboxScopeClass))
00056 #define UNITY_MUSIC_LENS_IS_RHYTHMBOX_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE))
00057 #define UNITY_MUSIC_LENS_IS_RHYTHMBOX_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE))
00058 #define UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE, UnityMusicLensRhythmboxScopeClass))
00059 
00060 typedef struct _UnityMusicLensRhythmboxScope UnityMusicLensRhythmboxScope;
00061 typedef struct _UnityMusicLensRhythmboxScopeClass UnityMusicLensRhythmboxScopeClass;
00062 typedef struct _UnityMusicLensRhythmboxScopePrivate UnityMusicLensRhythmboxScopePrivate;
00063 
00064 #define UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_COLLECTION (unity_music_lens_rhythmbox_collection_get_type ())
00065 #define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_COLLECTION, UnityMusicLensRhythmboxCollection))
00066 #define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_COLLECTION, UnityMusicLensRhythmboxCollectionClass))
00067 #define UNITY_MUSIC_LENS_IS_RHYTHMBOX_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_COLLECTION))
00068 #define UNITY_MUSIC_LENS_IS_RHYTHMBOX_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_COLLECTION))
00069 #define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_COLLECTION, UnityMusicLensRhythmboxCollectionClass))
00070 
00071 typedef struct _UnityMusicLensRhythmboxCollection UnityMusicLensRhythmboxCollection;
00072 typedef struct _UnityMusicLensRhythmboxCollectionClass UnityMusicLensRhythmboxCollectionClass;
00073 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
00074 typedef struct _Block1Data Block1Data;
00075 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
00076 typedef struct _UnityMusicLensRhythmboxScopePrepareRhythmboxPlayQueueData UnityMusicLensRhythmboxScopePrepareRhythmboxPlayQueueData;
00077 #define _g_free0(var) (var = (g_free (var), NULL))
00078 #define _g_slist_free0(var) ((var == NULL) ? NULL : (var = (g_slist_free (var), NULL)))
00079 #define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
00080 
00081 #define UNITY_MUSIC_LENS_TYPE_CATEGORY (unity_music_lens_category_get_type ())
00082 typedef struct _UnityMusicLensRhythmboxScopePerformSearchData UnityMusicLensRhythmboxScopePerformSearchData;
00083 
00084 struct _UnityMusicLensSimpleScope {
00085        GObject parent_instance;
00086        UnityMusicLensSimpleScopePrivate * priv;
00087 };
00088 
00089 struct _UnityMusicLensSimpleScopeClass {
00090        GObjectClass parent_class;
00091        void (*perform_search) (UnityMusicLensSimpleScope* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
00092        void (*perform_search_finish) (UnityMusicLensSimpleScope* self, GAsyncResult* _res_);
00093        gint (*get_num_results_without_search) (UnityMusicLensSimpleScope* self);
00094        gint (*get_num_results_global_search) (UnityMusicLensSimpleScope* self);
00095        gint (*get_num_results_lens_search) (UnityMusicLensSimpleScope* self);
00096 };
00097 
00098 struct _UnityMusicLensRhythmboxScope {
00099        UnityMusicLensSimpleScope parent_instance;
00100        UnityMusicLensRhythmboxScopePrivate * priv;
00101 };
00102 
00103 struct _UnityMusicLensRhythmboxScopeClass {
00104        UnityMusicLensSimpleScopeClass parent_class;
00105 };
00106 
00107 struct _UnityMusicLensRhythmboxScopePrivate {
00108        UnityMusicLensRhythmboxCollection* collection;
00109        gboolean db_ready;
00110        GFileMonitor* rb_xml_monitor;
00111 };
00112 
00113 struct _Block1Data {
00114        int _ref_count_;
00115        UnityMusicLensRhythmboxScope * self;
00116        gchar** main_exec;
00117        gint main_exec_length1;
00118        gpointer _async_data_;
00119 };
00120 
00121 struct _UnityMusicLensRhythmboxScopePrepareRhythmboxPlayQueueData {
00122        int _state_;
00123        GObject* _source_object_;
00124        GAsyncResult* _res_;
00125        GSimpleAsyncResult* _async_result;
00126        UnityMusicLensRhythmboxScope* self;
00127        gchar** main_exec;
00128        gint main_exec_length1;
00129        Block1Data* _data1_;
00130        gchar** _tmp0_;
00131        gint _tmp0__length1;
00132        gchar** _tmp1_;
00133        gint _tmp1__length1;
00134        GError * _inner_error_;
00135 };
00136 
00137 typedef enum  {
00138        UNITY_MUSIC_LENS_CATEGORY_SONGS,
00139        UNITY_MUSIC_LENS_CATEGORY_ALBUMS,
00140        UNITY_MUSIC_LENS_CATEGORY_PURCHASE,
00141        UNITY_MUSIC_LENS_CATEGORY_MUSIC,
00142        UNITY_MUSIC_LENS_CATEGORY_RADIOS
00143 } UnityMusicLensCategory;
00144 
00145 struct _UnityMusicLensRhythmboxScopePerformSearchData {
00146        int _state_;
00147        GObject* _source_object_;
00148        GAsyncResult* _res_;
00149        GSimpleAsyncResult* _async_result;
00150        UnityMusicLensRhythmboxScope* self;
00151        UnityLensSearch* search;
00152        UnitySearchType search_type;
00153        GList* filters;
00154        gint max_results;
00155        GCancellable* cancellable;
00156        gint category_override;
00157        UnitySearchType _tmp0_;
00158        UnityLensSearch* _tmp1_;
00159        gboolean _tmp2_;
00160        gboolean _tmp3_;
00161        const gchar* _tmp4_;
00162        gchar* _tmp5_;
00163        gchar* tdb_path;
00164        UnityMusicLensRhythmboxCollection* _tmp6_;
00165        const gchar* _tmp7_;
00166        const gchar* _tmp8_;
00167        gchar* _tmp9_;
00168        gchar* xml_path;
00169        UnityMusicLensRhythmboxCollection* _tmp10_;
00170        const gchar* _tmp11_;
00171        GFileMonitor* _tmp12_;
00172        const gchar* _tmp13_;
00173        GFile* _tmp14_;
00174        GFile* xml_file;
00175        GFile* _tmp15_;
00176        GFileMonitor* _tmp16_;
00177        GFileMonitor* _tmp17_;
00178        GFileMonitor* _tmp18_;
00179        GFileMonitor* _tmp19_;
00180        GError* err;
00181        GError* _tmp20_;
00182        const gchar* _tmp21_;
00183        UnityMusicLensRhythmboxCollection* _tmp22_;
00184        UnityLensSearch* _tmp23_;
00185        UnitySearchType _tmp24_;
00186        GList* _tmp25_;
00187        gint _tmp26_;
00188        gint _tmp27_;
00189        GError * _inner_error_;
00190 };
00191 
00192 
00193 static gpointer unity_music_lens_rhythmbox_scope_parent_class = NULL;
00194 
00195 GType unity_music_lens_simple_scope_get_type (void) G_GNUC_CONST;
00196 GType unity_music_lens_filter_parser_get_type (void) G_GNUC_CONST;
00197 GType unity_music_lens_rhythmbox_scope_get_type (void) G_GNUC_CONST;
00198 GType unity_music_lens_rhythmbox_collection_get_type (void) G_GNUC_CONST;
00199 #define UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE, UnityMusicLensRhythmboxScopePrivate))
00200 enum  {
00201        UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_DUMMY_PROPERTY,
00202        UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_NUM_RESULTS_WITHOUT_SEARCH,
00203        UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_NUM_RESULTS_GLOBAL_SEARCH,
00204        UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_NUM_RESULTS_LENS_SEARCH
00205 };
00206 UnityMusicLensRhythmboxScope* unity_music_lens_rhythmbox_scope_new (void);
00207 UnityMusicLensRhythmboxScope* unity_music_lens_rhythmbox_scope_construct (GType object_type);
00208 UnityMusicLensSimpleScope* unity_music_lens_simple_scope_construct (GType object_type);
00209 void unity_music_lens_simple_scope_set_scope (UnityMusicLensSimpleScope* self, UnityScope* value);
00210 UnityScope* unity_music_lens_simple_scope_get_scope (UnityMusicLensSimpleScope* self);
00211 UnityActivationResponse* unity_music_lens_rhythmbox_scope_activate (UnityMusicLensRhythmboxScope* self, const gchar* uri);
00212 static UnityActivationResponse* _unity_music_lens_rhythmbox_scope_activate_unity_scope_activate_uri (UnityScope* _sender, const gchar* uri, gpointer self);
00213 void unity_music_lens_simple_scope_initialize (UnityMusicLensSimpleScope* self);
00214 UnityMusicLensRhythmboxCollection* unity_music_lens_rhythmbox_collection_new (void);
00215 UnityMusicLensRhythmboxCollection* unity_music_lens_rhythmbox_collection_construct (GType object_type);
00216 static void unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue_data_free (gpointer _data);
00217 static gchar** _vala_array_dup1 (gchar** self, int length);
00218 static void unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue (UnityMusicLensRhythmboxScope* self, gchar** main_exec, int main_exec_length1, GAsyncReadyCallback _callback_, gpointer _user_data_);
00219 static void unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue_finish (UnityMusicLensRhythmboxScope* self, GAsyncResult* _res_);
00220 static gboolean unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue_co (UnityMusicLensRhythmboxScopePrepareRhythmboxPlayQueueData* _data_);
00221 static gchar** _vala_array_dup2 (gchar** self, int length);
00222 static Block1Data* block1_data_ref (Block1Data* _data1_);
00223 static void block1_data_unref (Block1Data* _data1_);
00224 static void __lambda11_ (Block1Data* _data1_);
00225 static gboolean _unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue_co_gsource_func (gpointer self);
00226 static gpointer ___lambda11__gthread_func (gpointer self);
00227 static void _vala_array_add4 (gchar*** array, int* length, int* size, gchar* value);
00228 GSList* unity_music_lens_rhythmbox_collection_get_album_tracks (UnityMusicLensRhythmboxCollection* self, const gchar* album_key);
00229 static void _vala_array_add5 (gchar*** array, int* length, int* size, gchar* value);
00230 static void _vala_array_add6 (gchar*** array, int* length, int* size, gchar* value);
00231 static void _vala_array_add7 (gchar*** array, int* length, int* size, gchar* value);
00232 static void _vala_array_add8 (gchar*** array, int* length, int* size, gchar* value);
00233 static void _vala_array_add9 (gchar*** array, int* length, int* size, gchar* value);
00234 static void _g_object_unref0_ (gpointer var);
00235 static void _g_list_free__g_object_unref0_ (GList* self);
00236 static void unity_music_lens_rhythmbox_scope_real_perform_search_data_free (gpointer _data);
00237 static void unity_music_lens_rhythmbox_scope_real_perform_search (UnityMusicLensSimpleScope* base, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
00238 static gboolean unity_music_lens_rhythmbox_scope_real_perform_search_co (UnityMusicLensRhythmboxScopePerformSearchData* _data_);
00239 GType unity_music_lens_category_get_type (void) G_GNUC_CONST;
00240 gboolean unity_music_lens_simple_scope_is_search_empty (UnityMusicLensSimpleScope* self, UnityLensSearch* search);
00241 void unity_music_lens_rhythmbox_collection_parse_metadata_file (UnityMusicLensRhythmboxCollection* self, const gchar* path);
00242 void unity_music_lens_rhythmbox_collection_parse_file (UnityMusicLensRhythmboxCollection* self, const gchar* path);
00243 static void _____lambda12_ (UnityMusicLensRhythmboxScope* self);
00244 static void ______lambda12__g_file_monitor_changed (GFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self);
00245 void unity_music_lens_rhythmbox_collection_search (UnityMusicLensRhythmboxCollection* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, gint category_override);
00246 static void unity_music_lens_rhythmbox_scope_finalize (GObject* obj);
00247 gint unity_music_lens_simple_scope_get_num_results_without_search (UnityMusicLensSimpleScope* self);
00248 gint unity_music_lens_simple_scope_get_num_results_global_search (UnityMusicLensSimpleScope* self);
00249 gint unity_music_lens_simple_scope_get_num_results_lens_search (UnityMusicLensSimpleScope* self);
00250 static void _vala_unity_music_lens_rhythmbox_scope_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
00251 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
00252 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
00253 
00254 
00255 static UnityActivationResponse* _unity_music_lens_rhythmbox_scope_activate_unity_scope_activate_uri (UnityScope* _sender, const gchar* uri, gpointer self) {
00256        UnityActivationResponse* result;
00257        result = unity_music_lens_rhythmbox_scope_activate (self, uri);
00258        return result;
00259 }
00260 
00261 
00262 UnityMusicLensRhythmboxScope* unity_music_lens_rhythmbox_scope_construct (GType object_type) {
00263        UnityMusicLensRhythmboxScope * self = NULL;
00264        UnityScope* _tmp0_;
00265        UnityScope* _tmp1_;
00266        UnityScope* _tmp2_;
00267        UnityScope* _tmp3_;
00268        UnityScope* _tmp4_;
00269        UnityScope* _tmp5_;
00270        UnityScope* _tmp6_;
00271        UnityScope* _tmp7_;
00272        UnityOptionsFilter* _tmp8_;
00273        UnityOptionsFilter* _tmp9_;
00274        const gchar* _tmp10_ = NULL;
00275        UnityFilterOption* _tmp11_ = NULL;
00276        UnityFilterOption* _tmp12_;
00277        UnityMusicLensRhythmboxCollection* _tmp13_;
00278        self = (UnityMusicLensRhythmboxScope*) unity_music_lens_simple_scope_construct (object_type);
00279        _tmp0_ = unity_scope_new ("/com/canonical/unity/scope/rhythmbox");
00280        _tmp1_ = _tmp0_;
00281        unity_music_lens_simple_scope_set_scope ((UnityMusicLensSimpleScope*) self, _tmp1_);
00282        _g_object_unref0 (_tmp1_);
00283        _tmp2_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) self);
00284        _tmp3_ = _tmp2_;
00285        unity_scope_set_search_in_global (_tmp3_, TRUE);
00286        _tmp4_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) self);
00287        _tmp5_ = _tmp4_;
00288        g_signal_connect_object (_tmp5_, "activate-uri", (GCallback) _unity_music_lens_rhythmbox_scope_activate_unity_scope_activate_uri, self, 0);
00289        _tmp6_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) self);
00290        _tmp7_ = _tmp6_;
00291        _tmp8_ = unity_scope_get_sources (_tmp7_);
00292        _tmp9_ = _tmp8_;
00293        _tmp10_ = _ ("Rhythmbox");
00294        _tmp11_ = unity_options_filter_add_option (_tmp9_, "rhythmbox", _tmp10_, NULL);
00295        _tmp12_ = _tmp11_;
00296        _g_object_unref0 (_tmp12_);
00297        unity_music_lens_simple_scope_initialize (UNITY_MUSIC_LENS_SIMPLE_SCOPE (self));
00298        _tmp13_ = unity_music_lens_rhythmbox_collection_new ();
00299        _g_object_unref0 (self->priv->collection);
00300        self->priv->collection = _tmp13_;
00301        self->priv->db_ready = FALSE;
00302        return self;
00303 }
00304 
00305 
00306 UnityMusicLensRhythmboxScope* unity_music_lens_rhythmbox_scope_new (void) {
00307        return unity_music_lens_rhythmbox_scope_construct (UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_SCOPE);
00308 }
00309 
00310 
00311 static void unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue_data_free (gpointer _data) {
00312        UnityMusicLensRhythmboxScopePrepareRhythmboxPlayQueueData* _data_;
00313        _data_ = _data;
00314        _data_->main_exec = (_vala_array_free (_data_->main_exec, _data_->main_exec_length1, (GDestroyNotify) g_free), NULL);
00315        _g_object_unref0 (_data_->self);
00316        g_slice_free (UnityMusicLensRhythmboxScopePrepareRhythmboxPlayQueueData, _data_);
00317 }
00318 
00319 
00320 static gpointer _g_object_ref0 (gpointer self) {
00321        return self ? g_object_ref (self) : NULL;
00322 }
00323 
00324 
00325 static gchar** _vala_array_dup1 (gchar** self, int length) {
00326        gchar** result;
00327        int i;
00328        result = g_new0 (gchar*, length + 1);
00329        for (i = 0; i < length; i++) {
00330               gchar* _tmp0_;
00331               _tmp0_ = g_strdup (self[i]);
00332               result[i] = _tmp0_;
00333        }
00334        return result;
00335 }
00336 
00337 
00338 static void unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue (UnityMusicLensRhythmboxScope* self, gchar** main_exec, int main_exec_length1, GAsyncReadyCallback _callback_, gpointer _user_data_) {
00339        UnityMusicLensRhythmboxScopePrepareRhythmboxPlayQueueData* _data_;
00340        UnityMusicLensRhythmboxScope* _tmp0_;
00341        gchar** _tmp1_;
00342        gint _tmp1__length1;
00343        gchar** _tmp2_;
00344        gint _tmp2__length1;
00345        _data_ = g_slice_new0 (UnityMusicLensRhythmboxScopePrepareRhythmboxPlayQueueData);
00346        _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue);
00347        g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue_data_free);
00348        _tmp0_ = _g_object_ref0 (self);
00349        _data_->self = _tmp0_;
00350        _tmp1_ = main_exec;
00351        _tmp1__length1 = main_exec_length1;
00352        _tmp2_ = (_tmp1_ != NULL) ? _vala_array_dup1 (_tmp1_, _tmp1__length1) : ((gpointer) _tmp1_);
00353        _tmp2__length1 = _tmp1__length1;
00354        _data_->main_exec = _tmp2_;
00355        _data_->main_exec_length1 = _tmp2__length1;
00356        unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue_co (_data_);
00357 }
00358 
00359 
00360 static void unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue_finish (UnityMusicLensRhythmboxScope* self, GAsyncResult* _res_) {
00361        UnityMusicLensRhythmboxScopePrepareRhythmboxPlayQueueData* _data_;
00362        _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
00363 }
00364 
00365 
00366 static gchar** _vala_array_dup2 (gchar** self, int length) {
00367        gchar** result;
00368        int i;
00369        result = g_new0 (gchar*, length + 1);
00370        for (i = 0; i < length; i++) {
00371               gchar* _tmp0_;
00372               _tmp0_ = g_strdup (self[i]);
00373               result[i] = _tmp0_;
00374        }
00375        return result;
00376 }
00377 
00378 
00379 static Block1Data* block1_data_ref (Block1Data* _data1_) {
00380        g_atomic_int_inc (&_data1_->_ref_count_);
00381        return _data1_;
00382 }
00383 
00384 
00385 static void block1_data_unref (Block1Data* _data1_) {
00386        if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
00387               _g_object_unref0 (_data1_->self);
00388               _data1_->main_exec = (_vala_array_free (_data1_->main_exec, _data1_->main_exec_length1, (GDestroyNotify) g_free), NULL);
00389               g_slice_free (Block1Data, _data1_);
00390        }
00391 }
00392 
00393 
00394 static gboolean _unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue_co_gsource_func (gpointer self) {
00395        gboolean result;
00396        result = unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue_co (self);
00397        return result;
00398 }
00399 
00400 
00401 static void __lambda11_ (Block1Data* _data1_) {
00402        UnityMusicLensRhythmboxScope * self;
00403        GError * _inner_error_ = NULL;
00404        self = _data1_->self;
00405        {
00406               gchar** _tmp0_;
00407               gint _tmp0__length1;
00408               g_spawn_command_line_sync ("rhythmbox-client --pause", NULL, NULL, NULL, &_inner_error_);
00409               if (_inner_error_ != NULL) {
00410                      goto __catch5_g_error;
00411               }
00412               g_spawn_command_line_sync ("rhythmbox-client --clear-queue", NULL, NULL, NULL, &_inner_error_);
00413               if (_inner_error_ != NULL) {
00414                      goto __catch5_g_error;
00415               }
00416               _tmp0_ = _data1_->main_exec;
00417               _tmp0__length1 = _data1_->main_exec_length1;
00418               g_spawn_sync (NULL, _tmp0_, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, NULL, &_inner_error_);
00419               if (_inner_error_ != NULL) {
00420                      goto __catch5_g_error;
00421               }
00422               g_spawn_command_line_sync ("rhythmbox-client --next", NULL, NULL, NULL, &_inner_error_);
00423               if (_inner_error_ != NULL) {
00424                      goto __catch5_g_error;
00425               }
00426               g_spawn_command_line_sync ("rhythmbox-client --play", NULL, NULL, NULL, &_inner_error_);
00427               if (_inner_error_ != NULL) {
00428                      goto __catch5_g_error;
00429               }
00430        }
00431        goto __finally5;
00432        __catch5_g_error:
00433        {
00434               GError* err = NULL;
00435               GError* _tmp1_;
00436               const gchar* _tmp2_;
00437               err = _inner_error_;
00438               _inner_error_ = NULL;
00439               _tmp1_ = err;
00440               _tmp2_ = _tmp1_->message;
00441               g_warning ("rhythmbox-scope.vala:64: %s", _tmp2_);
00442               _g_error_free0 (err);
00443        }
00444        __finally5:
00445        if (_inner_error_ != NULL) {
00446               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);
00447               g_clear_error (&_inner_error_);
00448               return;
00449        }
00450        g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue_co_gsource_func, _data1_->_async_data_, NULL);
00451 }
00452 
00453 
00454 static gpointer ___lambda11__gthread_func (gpointer self) {
00455        __lambda11_ (self);
00456 }
00457 
00458 
00459 static gboolean unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue_co (UnityMusicLensRhythmboxScopePrepareRhythmboxPlayQueueData* _data_) {
00460        switch (_data_->_state_) {
00461               case 0:
00462               goto _state_0;
00463               case 1:
00464               goto _state_1;
00465               default:
00466               g_assert_not_reached ();
00467        }
00468        _state_0:
00469        _data_->_data1_ = g_slice_new0 (Block1Data);
00470        _data_->_data1_->_ref_count_ = 1;
00471        _data_->_data1_->self = g_object_ref (_data_->self);
00472        _data_->_tmp0_ = _data_->main_exec;
00473        _data_->_tmp0__length1 = _data_->main_exec_length1;
00474        _data_->_tmp1_ = (_data_->_tmp0_ != NULL) ? _vala_array_dup2 (_data_->_tmp0_, _data_->_tmp0__length1) : ((gpointer) _data_->_tmp0_);
00475        _data_->_tmp1__length1 = _data_->_tmp0__length1;
00476        _data_->_data1_->main_exec = _data_->_tmp1_;
00477        _data_->_data1_->main_exec_length1 = _data_->_tmp1__length1;
00478        _data_->_data1_->_async_data_ = _data_;
00479        g_thread_create (___lambda11__gthread_func, _data_->_data1_, FALSE, &_data_->_inner_error_);
00480        if (_data_->_inner_error_ != NULL) {
00481               block1_data_unref (_data_->_data1_);
00482               _data_->_data1_ = NULL;
00483               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
00484               g_clear_error (&_data_->_inner_error_);
00485               return FALSE;
00486        }
00487        _data_->_state_ = 1;
00488        return FALSE;
00489        _state_1:
00490        ;
00491        block1_data_unref (_data_->_data1_);
00492        _data_->_data1_ = NULL;
00493        if (_data_->_state_ == 0) {
00494               g_simple_async_result_complete_in_idle (_data_->_async_result);
00495        } else {
00496               g_simple_async_result_complete (_data_->_async_result);
00497        }
00498        g_object_unref (_data_->_async_result);
00499        return FALSE;
00500 }
00501 
00502 
00506 static void _vala_array_add4 (gchar*** array, int* length, int* size, gchar* value) {
00507        if ((*length) == (*size)) {
00508               *size = (*size) ? (2 * (*size)) : 4;
00509               *array = g_renew (gchar*, *array, (*size) + 1);
00510        }
00511        (*array)[(*length)++] = value;
00512        (*array)[*length] = NULL;
00513 }
00514 
00515 
00516 static glong string_strnlen (gchar* str, glong maxlen) {
00517        glong result = 0L;
00518        gchar* _tmp0_;
00519        glong _tmp1_;
00520        gchar* _tmp2_ = NULL;
00521        gchar* end;
00522        gchar* _tmp3_;
00523        _tmp0_ = str;
00524        _tmp1_ = maxlen;
00525        _tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_);
00526        end = _tmp2_;
00527        _tmp3_ = end;
00528        if (_tmp3_ == NULL) {
00529               glong _tmp4_;
00530               _tmp4_ = maxlen;
00531               result = _tmp4_;
00532               return result;
00533        } else {
00534               gchar* _tmp5_;
00535               gchar* _tmp6_;
00536               _tmp5_ = end;
00537               _tmp6_ = str;
00538               result = (glong) (_tmp5_ - _tmp6_);
00539               return result;
00540        }
00541 }
00542 
00543 
00544 static gchar* string_substring (const gchar* self, glong offset, glong len) {
00545        gchar* result = NULL;
00546        glong string_length = 0L;
00547        gboolean _tmp0_ = FALSE;
00548        glong _tmp1_;
00549        gboolean _tmp3_;
00550        glong _tmp9_;
00551        glong _tmp15_;
00552        glong _tmp18_;
00553        glong _tmp19_;
00554        glong _tmp20_;
00555        glong _tmp21_;
00556        glong _tmp22_;
00557        gchar* _tmp23_ = NULL;
00558        g_return_val_if_fail (self != NULL, NULL);
00559        _tmp1_ = offset;
00560        if (_tmp1_ >= ((glong) 0)) {
00561               glong _tmp2_;
00562               _tmp2_ = len;
00563               _tmp0_ = _tmp2_ >= ((glong) 0);
00564        } else {
00565               _tmp0_ = FALSE;
00566        }
00567        _tmp3_ = _tmp0_;
00568        if (_tmp3_) {
00569               glong _tmp4_;
00570               glong _tmp5_;
00571               glong _tmp6_ = 0L;
00572               _tmp4_ = offset;
00573               _tmp5_ = len;
00574               _tmp6_ = string_strnlen ((gchar*) self, _tmp4_ + _tmp5_);
00575               string_length = _tmp6_;
00576        } else {
00577               gint _tmp7_;
00578               gint _tmp8_;
00579               _tmp7_ = strlen (self);
00580               _tmp8_ = _tmp7_;
00581               string_length = (glong) _tmp8_;
00582        }
00583        _tmp9_ = offset;
00584        if (_tmp9_ < ((glong) 0)) {
00585               glong _tmp10_;
00586               glong _tmp11_;
00587               glong _tmp12_;
00588               _tmp10_ = string_length;
00589               _tmp11_ = offset;
00590               offset = _tmp10_ + _tmp11_;
00591               _tmp12_ = offset;
00592               g_return_val_if_fail (_tmp12_ >= ((glong) 0), NULL);
00593        } else {
00594               glong _tmp13_;
00595               glong _tmp14_;
00596               _tmp13_ = offset;
00597               _tmp14_ = string_length;
00598               g_return_val_if_fail (_tmp13_ <= _tmp14_, NULL);
00599        }
00600        _tmp15_ = len;
00601        if (_tmp15_ < ((glong) 0)) {
00602               glong _tmp16_;
00603               glong _tmp17_;
00604               _tmp16_ = string_length;
00605               _tmp17_ = offset;
00606               len = _tmp16_ - _tmp17_;
00607        }
00608        _tmp18_ = offset;
00609        _tmp19_ = len;
00610        _tmp20_ = string_length;
00611        g_return_val_if_fail ((_tmp18_ + _tmp19_) <= _tmp20_, NULL);
00612        _tmp21_ = offset;
00613        _tmp22_ = len;
00614        _tmp23_ = g_strndup (((gchar*) self) + _tmp21_, (gsize) _tmp22_);
00615        result = _tmp23_;
00616        return result;
00617 }
00618 
00619 
00620 static void _vala_array_add5 (gchar*** array, int* length, int* size, gchar* value) {
00621        if ((*length) == (*size)) {
00622               *size = (*size) ? (2 * (*size)) : 4;
00623               *array = g_renew (gchar*, *array, (*size) + 1);
00624        }
00625        (*array)[(*length)++] = value;
00626        (*array)[*length] = NULL;
00627 }
00628 
00629 
00630 static void _vala_array_add6 (gchar*** array, int* length, int* size, gchar* value) {
00631        if ((*length) == (*size)) {
00632               *size = (*size) ? (2 * (*size)) : 4;
00633               *array = g_renew (gchar*, *array, (*size) + 1);
00634        }
00635        (*array)[(*length)++] = value;
00636        (*array)[*length] = NULL;
00637 }
00638 
00639 
00640 static void _vala_array_add7 (gchar*** array, int* length, int* size, gchar* value) {
00641        if ((*length) == (*size)) {
00642               *size = (*size) ? (2 * (*size)) : 4;
00643               *array = g_renew (gchar*, *array, (*size) + 1);
00644        }
00645        (*array)[(*length)++] = value;
00646        (*array)[*length] = NULL;
00647 }
00648 
00649 
00650 static void _vala_array_add8 (gchar*** array, int* length, int* size, gchar* value) {
00651        if ((*length) == (*size)) {
00652               *size = (*size) ? (2 * (*size)) : 4;
00653               *array = g_renew (gchar*, *array, (*size) + 1);
00654        }
00655        (*array)[(*length)++] = value;
00656        (*array)[*length] = NULL;
00657 }
00658 
00659 
00660 static void _vala_array_add9 (gchar*** array, int* length, int* size, gchar* value) {
00661        if ((*length) == (*size)) {
00662               *size = (*size) ? (2 * (*size)) : 4;
00663               *array = g_renew (gchar*, *array, (*size) + 1);
00664        }
00665        (*array)[(*length)++] = value;
00666        (*array)[*length] = NULL;
00667 }
00668 
00669 
00670 UnityActivationResponse* unity_music_lens_rhythmbox_scope_activate (UnityMusicLensRhythmboxScope* self, const gchar* uri) {
00671        UnityActivationResponse* result = NULL;
00672        gchar* _tmp0_;
00673        gchar** _tmp1_ = NULL;
00674        gchar** exec;
00675        gint exec_length1;
00676        gint _exec_size_;
00677        GError * _inner_error_ = NULL;
00678        g_return_val_if_fail (self != NULL, NULL);
00679        g_return_val_if_fail (uri != NULL, NULL);
00680        _tmp0_ = g_strdup ("rhythmbox-client");
00681        _tmp1_ = g_new0 (gchar*, 1 + 1);
00682        _tmp1_[0] = _tmp0_;
00683        exec = _tmp1_;
00684        exec_length1 = 1;
00685        _exec_size_ = exec_length1;
00686        {
00687               const gchar* _tmp2_;
00688               gchar* _tmp3_ = NULL;
00689               gchar* _tmp4_;
00690               gboolean _tmp5_;
00691               gchar** _tmp25_;
00692               gint _tmp25__length1;
00693               gchar** _tmp26_;
00694               gint _tmp26__length1;
00695               gchar* _tmp27_ = NULL;
00696               gchar* _tmp28_;
00697               gchar** _tmp29_;
00698               gint _tmp29__length1;
00699               UnityActivationResponse* _tmp30_;
00700               UnityActivationResponse* _tmp31_;
00701               _tmp2_ = uri;
00702               _tmp3_ = g_uri_parse_scheme (_tmp2_);
00703               _tmp4_ = _tmp3_;
00704               _tmp5_ = g_strcmp0 (_tmp4_, "album") == 0;
00705               _g_free0 (_tmp4_);
00706               if (_tmp5_) {
00707                      gchar** _tmp6_;
00708                      gint _tmp6__length1;
00709                      gchar* _tmp7_;
00710                      const gchar* _tmp8_;
00711                      gchar* _tmp9_ = NULL;
00712                      gchar* album_key;
00713                      UnityMusicLensRhythmboxCollection* _tmp10_;
00714                      const gchar* _tmp11_;
00715                      GSList* _tmp12_ = NULL;
00716                      gchar** _tmp16_;
00717                      gint _tmp16__length1;
00718                      gchar** _tmp17_;
00719                      gint _tmp17__length1;
00720                      UnityActivationResponse* _tmp18_;
00721                      UnityActivationResponse* _tmp19_;
00722                      _tmp6_ = exec;
00723                      _tmp6__length1 = exec_length1;
00724                      _tmp7_ = g_strdup ("--enqueue");
00725                      _vala_array_add4 (&exec, &exec_length1, &_exec_size_, _tmp7_);
00726                      _tmp8_ = uri;
00727                      _tmp9_ = string_substring (_tmp8_, (glong) 8, (glong) (-1));
00728                      album_key = _tmp9_;
00729                      _tmp10_ = self->priv->collection;
00730                      _tmp11_ = album_key;
00731                      _tmp12_ = unity_music_lens_rhythmbox_collection_get_album_tracks (_tmp10_, _tmp11_);
00732                      {
00733                             GSList* track_uri_collection = NULL;
00734                             GSList* track_uri_it = NULL;
00735                             track_uri_collection = _tmp12_;
00736                             for (track_uri_it = track_uri_collection; track_uri_it != NULL; track_uri_it = track_uri_it->next) {
00737                                    const gchar* track_uri = NULL;
00738                                    track_uri = (const gchar*) track_uri_it->data;
00739                                    {
00740                                           gchar** _tmp13_;
00741                                           gint _tmp13__length1;
00742                                           const gchar* _tmp14_;
00743                                           gchar* _tmp15_;
00744                                           _tmp13_ = exec;
00745                                           _tmp13__length1 = exec_length1;
00746                                           _tmp14_ = track_uri;
00747                                           _tmp15_ = g_strdup (_tmp14_);
00748                                           _vala_array_add5 (&exec, &exec_length1, &_exec_size_, _tmp15_);
00749                                    }
00750                             }
00751                             _g_slist_free0 (track_uri_collection);
00752                      }
00753                      _tmp16_ = exec;
00754                      _tmp16__length1 = exec_length1;
00755                      _vala_array_add6 (&exec, &exec_length1, &_exec_size_, NULL);
00756                      _tmp17_ = exec;
00757                      _tmp17__length1 = exec_length1;
00758                      unity_music_lens_rhythmbox_scope_prepare_rhythmbox_play_queue (self, _tmp17_, _tmp17__length1, NULL, NULL);
00759                      _tmp18_ = unity_activation_response_new (UNITY_HANDLED_TYPE_HIDE_DASH, "");
00760                      _tmp19_ = g_object_ref_sink (_tmp18_);
00761                      result = _tmp19_;
00762                      _g_free0 (album_key);
00763                      exec = (_vala_array_free (exec, exec_length1, (GDestroyNotify) g_free), NULL);
00764                      return result;
00765               } else {
00766                      gchar** _tmp20_;
00767                      gint _tmp20__length1;
00768                      gchar* _tmp21_;
00769                      gchar** _tmp22_;
00770                      gint _tmp22__length1;
00771                      const gchar* _tmp23_;
00772                      gchar* _tmp24_;
00773                      _tmp20_ = exec;
00774                      _tmp20__length1 = exec_length1;
00775                      _tmp21_ = g_strdup ("--play-uri");
00776                      _vala_array_add7 (&exec, &exec_length1, &_exec_size_, _tmp21_);
00777                      _tmp22_ = exec;
00778                      _tmp22__length1 = exec_length1;
00779                      _tmp23_ = uri;
00780                      _tmp24_ = g_strdup (_tmp23_);
00781                      _vala_array_add8 (&exec, &exec_length1, &_exec_size_, _tmp24_);
00782               }
00783               _tmp25_ = exec;
00784               _tmp25__length1 = exec_length1;
00785               _vala_array_add9 (&exec, &exec_length1, &_exec_size_, NULL);
00786               _tmp26_ = exec;
00787               _tmp26__length1 = exec_length1;
00788               _tmp27_ = g_strjoinv (" ", _tmp26_);
00789               _tmp28_ = _tmp27_;
00790               g_debug ("rhythmbox-scope.vala:100: Spawning rb '%s'", _tmp28_);
00791               _g_free0 (_tmp28_);
00792               _tmp29_ = exec;
00793               _tmp29__length1 = exec_length1;
00794               g_spawn_async (NULL, _tmp29_, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &_inner_error_);
00795               if (_inner_error_ != NULL) {
00796                      if (_inner_error_->domain == G_SPAWN_ERROR) {
00797                             goto __catch6_g_spawn_error;
00798                      }
00799                      exec = (_vala_array_free (exec, exec_length1, (GDestroyNotify) g_free), NULL);
00800                      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);
00801                      g_clear_error (&_inner_error_);
00802                      return NULL;
00803               }
00804               _tmp30_ = unity_activation_response_new (UNITY_HANDLED_TYPE_HIDE_DASH, "");
00805               _tmp31_ = g_object_ref_sink (_tmp30_);
00806               result = _tmp31_;
00807               exec = (_vala_array_free (exec, exec_length1, (GDestroyNotify) g_free), NULL);
00808               return result;
00809        }
00810        goto __finally6;
00811        __catch6_g_spawn_error:
00812        {
00813               GError* _error_ = NULL;
00814               const gchar* _tmp32_;
00815               UnityActivationResponse* _tmp33_;
00816               UnityActivationResponse* _tmp34_;
00817               _error_ = _inner_error_;
00818               _inner_error_ = NULL;
00819               _tmp32_ = uri;
00820               g_warning ("rhythmbox-scope.vala:110: Failed to launch URI %s", _tmp32_);
00821               _tmp33_ = unity_activation_response_new (UNITY_HANDLED_TYPE_NOT_HANDLED, "");
00822               _tmp34_ = g_object_ref_sink (_tmp33_);
00823               result = _tmp34_;
00824               _g_error_free0 (_error_);
00825               exec = (_vala_array_free (exec, exec_length1, (GDestroyNotify) g_free), NULL);
00826               return result;
00827        }
00828        __finally6:
00829        exec = (_vala_array_free (exec, exec_length1, (GDestroyNotify) g_free), NULL);
00830        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);
00831        g_clear_error (&_inner_error_);
00832        return NULL;
00833 }
00834 
00835 
00836 static void _g_object_unref0_ (gpointer var) {
00837        (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
00838 }
00839 
00840 
00841 static void _g_list_free__g_object_unref0_ (GList* self) {
00842        g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
00843        g_list_free (self);
00844 }
00845 
00846 
00847 static void unity_music_lens_rhythmbox_scope_real_perform_search_data_free (gpointer _data) {
00848        UnityMusicLensRhythmboxScopePerformSearchData* _data_;
00849        _data_ = _data;
00850        _g_object_unref0 (_data_->search);
00851        __g_list_free__g_object_unref0_0 (_data_->filters);
00852        _g_object_unref0 (_data_->cancellable);
00853        _g_object_unref0 (_data_->self);
00854        g_slice_free (UnityMusicLensRhythmboxScopePerformSearchData, _data_);
00855 }
00856 
00857 
00858 static void unity_music_lens_rhythmbox_scope_real_perform_search (UnityMusicLensSimpleScope* base, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
00859        UnityMusicLensRhythmboxScope * self;
00860        UnityMusicLensRhythmboxScopePerformSearchData* _data_;
00861        UnityMusicLensRhythmboxScope* _tmp0_;
00862        UnityLensSearch* _tmp1_;
00863        UnityLensSearch* _tmp2_;
00864        UnitySearchType _tmp3_;
00865        GList* _tmp4_;
00866        gint _tmp5_;
00867        GCancellable* _tmp6_;
00868        GCancellable* _tmp7_;
00869        self = (UnityMusicLensRhythmboxScope*) base;
00870        _data_ = g_slice_new0 (UnityMusicLensRhythmboxScopePerformSearchData);
00871        _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_music_lens_rhythmbox_scope_real_perform_search);
00872        g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_music_lens_rhythmbox_scope_real_perform_search_data_free);
00873        _tmp0_ = _g_object_ref0 (self);
00874        _data_->self = _tmp0_;
00875        _tmp1_ = search;
00876        _tmp2_ = _g_object_ref0 (_tmp1_);
00877        _data_->search = _tmp2_;
00878        _tmp3_ = search_type;
00879        _data_->search_type = _tmp3_;
00880        _tmp4_ = filters;
00881        __g_list_free__g_object_unref0_0 (_data_->filters);
00882        _data_->filters = _tmp4_;
00883        _tmp5_ = max_results;
00884        _data_->max_results = _tmp5_;
00885        _tmp6_ = cancellable;
00886        _tmp7_ = _g_object_ref0 (_tmp6_);
00887        _data_->cancellable = _tmp7_;
00888        unity_music_lens_rhythmbox_scope_real_perform_search_co (_data_);
00889 }
00890 
00891 
00892 static void unity_music_lens_rhythmbox_scope_real_perform_search_finish (UnityMusicLensSimpleScope* base, GAsyncResult* _res_) {
00893        UnityMusicLensRhythmboxScopePerformSearchData* _data_;
00894        _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
00895 }
00896 
00897 
00898 static void _____lambda12_ (UnityMusicLensRhythmboxScope* self) {
00899        self->priv->db_ready = FALSE;
00900 }
00901 
00902 
00903 static void ______lambda12__g_file_monitor_changed (GFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self) {
00904        _____lambda12_ (self);
00905 }
00906 
00907 
00908 static gboolean unity_music_lens_rhythmbox_scope_real_perform_search_co (UnityMusicLensRhythmboxScopePerformSearchData* _data_) {
00909        switch (_data_->_state_) {
00910               case 0:
00911               goto _state_0;
00912               default:
00913               g_assert_not_reached ();
00914        }
00915        _state_0:
00916        _data_->category_override = -1;
00917        _data_->_tmp0_ = _data_->search_type;
00918        if (_data_->_tmp0_ == UNITY_SEARCH_TYPE_GLOBAL) {
00919               _data_->category_override = (gint) UNITY_MUSIC_LENS_CATEGORY_MUSIC;
00920               _data_->_tmp1_ = _data_->search;
00921               _data_->_tmp2_ = FALSE;
00922               _data_->_tmp2_ = unity_music_lens_simple_scope_is_search_empty ((UnityMusicLensSimpleScope*) _data_->self, _data_->_tmp1_);
00923               if (_data_->_tmp2_) {
00924                      __g_list_free__g_object_unref0_0 (_data_->filters);
00925                      if (_data_->_state_ == 0) {
00926                             g_simple_async_result_complete_in_idle (_data_->_async_result);
00927                      } else {
00928                             g_simple_async_result_complete (_data_->_async_result);
00929                      }
00930                      g_object_unref (_data_->_async_result);
00931                      return FALSE;
00932               }
00933        }
00934        _data_->_tmp3_ = _data_->self->priv->db_ready;
00935        if (!_data_->_tmp3_) {
00936               _data_->_tmp4_ = NULL;
00937               _data_->_tmp4_ = g_get_user_cache_dir ();
00938               _data_->_tmp5_ = NULL;
00939               _data_->_tmp5_ = g_build_filename (_data_->_tmp4_, "rhythmbox", "album-art", "store.tdb", NULL);
00940               _data_->tdb_path = _data_->_tmp5_;
00941               _data_->_tmp6_ = _data_->self->priv->collection;
00942               _data_->_tmp7_ = _data_->tdb_path;
00943               unity_music_lens_rhythmbox_collection_parse_metadata_file (_data_->_tmp6_, _data_->_tmp7_);
00944               _data_->_tmp8_ = NULL;
00945               _data_->_tmp8_ = g_get_user_data_dir ();
00946               _data_->_tmp9_ = NULL;
00947               _data_->_tmp9_ = g_build_filename (_data_->_tmp8_, "rhythmbox", "rhythmdb.xml", NULL);
00948               _data_->xml_path = _data_->_tmp9_;
00949               _data_->_tmp10_ = _data_->self->priv->collection;
00950               _data_->_tmp11_ = _data_->xml_path;
00951               unity_music_lens_rhythmbox_collection_parse_file (_data_->_tmp10_, _data_->_tmp11_);
00952               _data_->_tmp12_ = _data_->self->priv->rb_xml_monitor;
00953               if (_data_->_tmp12_ == NULL) {
00954                      _data_->_tmp13_ = _data_->xml_path;
00955                      _data_->_tmp14_ = NULL;
00956                      _data_->_tmp14_ = g_file_new_for_path (_data_->_tmp13_);
00957                      _data_->xml_file = _data_->_tmp14_;
00958                      {
00959                             _data_->_tmp15_ = _data_->xml_file;
00960                             _data_->_tmp16_ = NULL;
00961                             _data_->_tmp16_ = g_file_monitor (_data_->_tmp15_, G_FILE_MONITOR_NONE, NULL, &_data_->_inner_error_);
00962                             _data_->_tmp17_ = _data_->_tmp16_;
00963                             if (_data_->_inner_error_ != NULL) {
00964                                    goto __catch7_g_error;
00965                             }
00966                             _data_->_tmp18_ = _g_object_ref0 (_data_->_tmp17_);
00967                             _g_object_unref0 (_data_->self->priv->rb_xml_monitor);
00968                             _data_->self->priv->rb_xml_monitor = _data_->_tmp18_;
00969                             _data_->_tmp19_ = _data_->self->priv->rb_xml_monitor;
00970                             g_signal_connect_object (_data_->_tmp19_, "changed", (GCallback) ______lambda12__g_file_monitor_changed, _data_->self, 0);
00971                      }
00972                      goto __finally7;
00973                      __catch7_g_error:
00974                      {
00975                             _data_->err = _data_->_inner_error_;
00976                             _data_->_inner_error_ = NULL;
00977                             _data_->_tmp20_ = _data_->err;
00978                             _data_->_tmp21_ = _data_->_tmp20_->message;
00979                             g_warning ("rhythmbox-scope.vala:151: %s", _data_->_tmp21_);
00980                             _g_error_free0 (_data_->err);
00981                      }
00982                      __finally7:
00983                      if (_data_->_inner_error_ != NULL) {
00984                             _g_object_unref0 (_data_->xml_file);
00985                             _g_free0 (_data_->xml_path);
00986                             _g_free0 (_data_->tdb_path);
00987                             __g_list_free__g_object_unref0_0 (_data_->filters);
00988                             g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
00989                             g_clear_error (&_data_->_inner_error_);
00990                             return FALSE;
00991                      }
00992                      _g_object_unref0 (_data_->xml_file);
00993               }
00994               _data_->self->priv->db_ready = TRUE;
00995               _g_free0 (_data_->xml_path);
00996               _g_free0 (_data_->tdb_path);
00997        }
00998        _data_->_tmp22_ = _data_->self->priv->collection;
00999        _data_->_tmp23_ = _data_->search;
01000        _data_->_tmp24_ = _data_->search_type;
01001        _data_->_tmp25_ = _data_->filters;
01002        _data_->_tmp26_ = _data_->max_results;
01003        _data_->_tmp27_ = _data_->category_override;
01004        unity_music_lens_rhythmbox_collection_search (_data_->_tmp22_, _data_->_tmp23_, _data_->_tmp24_, _data_->_tmp25_, _data_->_tmp26_, _data_->_tmp27_);
01005        __g_list_free__g_object_unref0_0 (_data_->filters);
01006        if (_data_->_state_ == 0) {
01007               g_simple_async_result_complete_in_idle (_data_->_async_result);
01008        } else {
01009               g_simple_async_result_complete (_data_->_async_result);
01010        }
01011        g_object_unref (_data_->_async_result);
01012        return FALSE;
01013 }
01014 
01015 
01016 static gint unity_music_lens_rhythmbox_scope_real_get_num_results_without_search (UnityMusicLensSimpleScope* base) {
01017        gint result;
01018        UnityMusicLensRhythmboxScope* self;
01019        self = (UnityMusicLensRhythmboxScope*) base;
01020        result = 100;
01021        return result;
01022 }
01023 
01024 
01025 static gint unity_music_lens_rhythmbox_scope_real_get_num_results_global_search (UnityMusicLensSimpleScope* base) {
01026        gint result;
01027        UnityMusicLensRhythmboxScope* self;
01028        self = (UnityMusicLensRhythmboxScope*) base;
01029        result = 20;
01030        return result;
01031 }
01032 
01033 
01034 static gint unity_music_lens_rhythmbox_scope_real_get_num_results_lens_search (UnityMusicLensSimpleScope* base) {
01035        gint result;
01036        UnityMusicLensRhythmboxScope* self;
01037        self = (UnityMusicLensRhythmboxScope*) base;
01038        result = 50;
01039        return result;
01040 }
01041 
01042 
01043 static void unity_music_lens_rhythmbox_scope_class_init (UnityMusicLensRhythmboxScopeClass * klass) {
01044        unity_music_lens_rhythmbox_scope_parent_class = g_type_class_peek_parent (klass);
01045        g_type_class_add_private (klass, sizeof (UnityMusicLensRhythmboxScopePrivate));
01046        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->perform_search = unity_music_lens_rhythmbox_scope_real_perform_search;
01047        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->perform_search_finish = unity_music_lens_rhythmbox_scope_real_perform_search_finish;
01048        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_without_search = unity_music_lens_rhythmbox_scope_real_get_num_results_without_search;
01049        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_global_search = unity_music_lens_rhythmbox_scope_real_get_num_results_global_search;
01050        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_lens_search = unity_music_lens_rhythmbox_scope_real_get_num_results_lens_search;
01051        G_OBJECT_CLASS (klass)->get_property = _vala_unity_music_lens_rhythmbox_scope_get_property;
01052        G_OBJECT_CLASS (klass)->finalize = unity_music_lens_rhythmbox_scope_finalize;
01053        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_NUM_RESULTS_WITHOUT_SEARCH, g_param_spec_int ("num-results-without-search", "num-results-without-search", "num-results-without-search", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
01054        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_NUM_RESULTS_GLOBAL_SEARCH, g_param_spec_int ("num-results-global-search", "num-results-global-search", "num-results-global-search", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
01055        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_NUM_RESULTS_LENS_SEARCH, g_param_spec_int ("num-results-lens-search", "num-results-lens-search", "num-results-lens-search", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
01056 }
01057 
01058 
01059 static void unity_music_lens_rhythmbox_scope_instance_init (UnityMusicLensRhythmboxScope * self) {
01060        self->priv = UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_GET_PRIVATE (self);
01061 }
01062 
01063 
01064 static void unity_music_lens_rhythmbox_scope_finalize (GObject* obj) {
01065        UnityMusicLensRhythmboxScope * self;
01066        self = UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE (obj);
01067        _g_object_unref0 (self->priv->collection);
01068        _g_object_unref0 (self->priv->rb_xml_monitor);
01069        G_OBJECT_CLASS (unity_music_lens_rhythmbox_scope_parent_class)->finalize (obj);
01070 }
01071 
01072 
01073 GType unity_music_lens_rhythmbox_scope_get_type (void) {
01074        static volatile gsize unity_music_lens_rhythmbox_scope_type_id__volatile = 0;
01075        if (g_once_init_enter (&unity_music_lens_rhythmbox_scope_type_id__volatile)) {
01076               static const GTypeInfo g_define_type_info = { sizeof (UnityMusicLensRhythmboxScopeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_music_lens_rhythmbox_scope_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMusicLensRhythmboxScope), 0, (GInstanceInitFunc) unity_music_lens_rhythmbox_scope_instance_init, NULL };
01077               GType unity_music_lens_rhythmbox_scope_type_id;
01078               unity_music_lens_rhythmbox_scope_type_id = g_type_register_static (UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, "UnityMusicLensRhythmboxScope", &g_define_type_info, 0);
01079               g_once_init_leave (&unity_music_lens_rhythmbox_scope_type_id__volatile, unity_music_lens_rhythmbox_scope_type_id);
01080        }
01081        return unity_music_lens_rhythmbox_scope_type_id__volatile;
01082 }
01083 
01084 
01085 static void _vala_unity_music_lens_rhythmbox_scope_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
01086        UnityMusicLensRhythmboxScope * self;
01087        self = UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE (object);
01088        switch (property_id) {
01089               case UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_NUM_RESULTS_WITHOUT_SEARCH:
01090               g_value_set_int (value, unity_music_lens_simple_scope_get_num_results_without_search ((UnityMusicLensSimpleScope*) self));
01091               break;
01092               case UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_NUM_RESULTS_GLOBAL_SEARCH:
01093               g_value_set_int (value, unity_music_lens_simple_scope_get_num_results_global_search ((UnityMusicLensSimpleScope*) self));
01094               break;
01095               case UNITY_MUSIC_LENS_RHYTHMBOX_SCOPE_NUM_RESULTS_LENS_SEARCH:
01096               g_value_set_int (value, unity_music_lens_simple_scope_get_num_results_lens_search ((UnityMusicLensSimpleScope*) self));
01097               break;
01098               default:
01099               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
01100               break;
01101        }
01102 }
01103 
01104 
01105 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
01106        if ((array != NULL) && (destroy_func != NULL)) {
01107               int i;
01108               for (i = 0; i < array_length; i = i + 1) {
01109                      if (((gpointer*) array)[i] != NULL) {
01110                             destroy_func (((gpointer*) array)[i]);
01111                      }
01112               }
01113        }
01114 }
01115 
01116 
01117 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
01118        _vala_array_destroy (array, array_length, destroy_func);
01119        g_free (array);
01120 }
01121 
01122 
01123