Back to index

unity-lens-music  6.0.0
banshee-collection.c
Go to the documentation of this file.
00001 /* banshee-collection.c generated by valac 0.14.2, the Vala compiler
00002  * generated from banshee-collection.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 <sqlite3.h>
00026 #include <stdlib.h>
00027 #include <string.h>
00028 #include <unity.h>
00029 #include <dee.h>
00030 #include <gee.h>
00031 #include <gio/gio.h>
00032 
00033 
00034 #define UNITY_MUSIC_LENS_TYPE_BANSHEE_COLLECTION (unity_music_lens_banshee_collection_get_type ())
00035 #define UNITY_MUSIC_LENS_BANSHEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_COLLECTION, UnityMusicLensBansheeCollection))
00036 #define UNITY_MUSIC_LENS_BANSHEE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_COLLECTION, UnityMusicLensBansheeCollectionClass))
00037 #define UNITY_MUSIC_LENS_IS_BANSHEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_COLLECTION))
00038 #define UNITY_MUSIC_LENS_IS_BANSHEE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_COLLECTION))
00039 #define UNITY_MUSIC_LENS_BANSHEE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_COLLECTION, UnityMusicLensBansheeCollectionClass))
00040 
00041 typedef struct _UnityMusicLensBansheeCollection UnityMusicLensBansheeCollection;
00042 typedef struct _UnityMusicLensBansheeCollectionClass UnityMusicLensBansheeCollectionClass;
00043 typedef struct _UnityMusicLensBansheeCollectionPrivate UnityMusicLensBansheeCollectionPrivate;
00044 #define _sqlite3_close0(var) ((var == NULL) ? NULL : (var = (sqlite3_close (var), NULL)))
00045 #define _g_free0(var) (var = (g_free (var), NULL))
00046 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
00047 
00048 #define UNITY_MUSIC_LENS_TYPE_FILTER_PARSER (unity_music_lens_filter_parser_get_type ())
00049 #define UNITY_MUSIC_LENS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParser))
00050 #define UNITY_MUSIC_LENS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
00051 #define UNITY_MUSIC_LENS_IS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
00052 #define UNITY_MUSIC_LENS_IS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
00053 #define UNITY_MUSIC_LENS_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
00054 
00055 typedef struct _UnityMusicLensFilterParser UnityMusicLensFilterParser;
00056 typedef struct _UnityMusicLensFilterParserClass UnityMusicLensFilterParserClass;
00057 #define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL)))
00058 
00059 #define UNITY_MUSIC_LENS_TYPE_TRACK (unity_music_lens_track_get_type ())
00060 #define UNITY_MUSIC_LENS_TRACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrack))
00061 #define UNITY_MUSIC_LENS_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrackClass))
00062 #define UNITY_MUSIC_LENS_IS_TRACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_TRACK))
00063 #define UNITY_MUSIC_LENS_IS_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_TRACK))
00064 #define UNITY_MUSIC_LENS_TRACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrackClass))
00065 
00066 typedef struct _UnityMusicLensTrack UnityMusicLensTrack;
00067 typedef struct _UnityMusicLensTrackClass UnityMusicLensTrackClass;
00068 
00069 #define UNITY_MUSIC_LENS_TYPE_ALBUM (unity_music_lens_album_get_type ())
00070 #define UNITY_MUSIC_LENS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbum))
00071 #define UNITY_MUSIC_LENS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbumClass))
00072 #define UNITY_MUSIC_LENS_IS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM))
00073 #define UNITY_MUSIC_LENS_IS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_ALBUM))
00074 #define UNITY_MUSIC_LENS_ALBUM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbumClass))
00075 
00076 typedef struct _UnityMusicLensAlbum UnityMusicLensAlbum;
00077 typedef struct _UnityMusicLensAlbumClass UnityMusicLensAlbumClass;
00078 
00079 #define UNITY_MUSIC_LENS_TYPE_CATEGORY (unity_music_lens_category_get_type ())
00080 #define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
00081 
00082 #define UNITY_MUSIC_LENS_TYPE_BANSHEE_FILTER_PARSER (unity_music_lens_banshee_filter_parser_get_type ())
00083 #define UNITY_MUSIC_LENS_BANSHEE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_FILTER_PARSER, UnityMusicLensBansheeFilterParser))
00084 #define UNITY_MUSIC_LENS_IS_BANSHEE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_FILTER_PARSER))
00085 #define UNITY_MUSIC_LENS_BANSHEE_FILTER_PARSER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_FILTER_PARSER, UnityMusicLensBansheeFilterParserIface))
00086 
00087 typedef struct _UnityMusicLensBansheeFilterParser UnityMusicLensBansheeFilterParser;
00088 typedef struct _UnityMusicLensBansheeFilterParserIface UnityMusicLensBansheeFilterParserIface;
00089 
00090 #define UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER (unity_music_lens_genre_filter_parser_get_type ())
00091 #define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParser))
00092 #define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParserClass))
00093 #define UNITY_MUSIC_LENS_IS_GENRE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER))
00094 #define UNITY_MUSIC_LENS_IS_GENRE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER))
00095 #define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParserClass))
00096 
00097 typedef struct _UnityMusicLensGenreFilterParser UnityMusicLensGenreFilterParser;
00098 typedef struct _UnityMusicLensGenreFilterParserClass UnityMusicLensGenreFilterParserClass;
00099 
00100 #define UNITY_MUSIC_LENS_TYPE_BANSHEE_GENRE_FILTER_PARSER (unity_music_lens_banshee_genre_filter_parser_get_type ())
00101 #define UNITY_MUSIC_LENS_BANSHEE_GENRE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_GENRE_FILTER_PARSER, UnityMusicLensBansheeGenreFilterParser))
00102 #define UNITY_MUSIC_LENS_BANSHEE_GENRE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_GENRE_FILTER_PARSER, UnityMusicLensBansheeGenreFilterParserClass))
00103 #define UNITY_MUSIC_LENS_IS_BANSHEE_GENRE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_GENRE_FILTER_PARSER))
00104 #define UNITY_MUSIC_LENS_IS_BANSHEE_GENRE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_GENRE_FILTER_PARSER))
00105 #define UNITY_MUSIC_LENS_BANSHEE_GENRE_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_GENRE_FILTER_PARSER, UnityMusicLensBansheeGenreFilterParserClass))
00106 
00107 typedef struct _UnityMusicLensBansheeGenreFilterParser UnityMusicLensBansheeGenreFilterParser;
00108 typedef struct _UnityMusicLensBansheeGenreFilterParserClass UnityMusicLensBansheeGenreFilterParserClass;
00109 
00110 #define UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER (unity_music_lens_decade_filter_parser_get_type ())
00111 #define UNITY_MUSIC_LENS_DECADE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER, UnityMusicLensDecadeFilterParser))
00112 #define UNITY_MUSIC_LENS_DECADE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER, UnityMusicLensDecadeFilterParserClass))
00113 #define UNITY_MUSIC_LENS_IS_DECADE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER))
00114 #define UNITY_MUSIC_LENS_IS_DECADE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER))
00115 #define UNITY_MUSIC_LENS_DECADE_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER, UnityMusicLensDecadeFilterParserClass))
00116 
00117 typedef struct _UnityMusicLensDecadeFilterParser UnityMusicLensDecadeFilterParser;
00118 typedef struct _UnityMusicLensDecadeFilterParserClass UnityMusicLensDecadeFilterParserClass;
00119 
00120 #define UNITY_MUSIC_LENS_TYPE_BANSHEE_DECADE_FILTER_PARSER (unity_music_lens_banshee_decade_filter_parser_get_type ())
00121 #define UNITY_MUSIC_LENS_BANSHEE_DECADE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_DECADE_FILTER_PARSER, UnityMusicLensBansheeDecadeFilterParser))
00122 #define UNITY_MUSIC_LENS_BANSHEE_DECADE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_DECADE_FILTER_PARSER, UnityMusicLensBansheeDecadeFilterParserClass))
00123 #define UNITY_MUSIC_LENS_IS_BANSHEE_DECADE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_DECADE_FILTER_PARSER))
00124 #define UNITY_MUSIC_LENS_IS_BANSHEE_DECADE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_DECADE_FILTER_PARSER))
00125 #define UNITY_MUSIC_LENS_BANSHEE_DECADE_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_DECADE_FILTER_PARSER, UnityMusicLensBansheeDecadeFilterParserClass))
00126 
00127 typedef struct _UnityMusicLensBansheeDecadeFilterParser UnityMusicLensBansheeDecadeFilterParser;
00128 typedef struct _UnityMusicLensBansheeDecadeFilterParserClass UnityMusicLensBansheeDecadeFilterParserClass;
00129 
00130 typedef enum  {
00131        UNITY_MUSIC_LENS_DATABASE_ERROR_FAILED_TO_OPEN
00132 } UnityMusicLensDatabaseError;
00133 #define UNITY_MUSIC_LENS_DATABASE_ERROR unity_music_lens_database_error_quark ()
00134 struct _UnityMusicLensBansheeCollection {
00135        GObject parent_instance;
00136        UnityMusicLensBansheeCollectionPrivate * priv;
00137 };
00138 
00139 struct _UnityMusicLensBansheeCollectionClass {
00140        GObjectClass parent_class;
00141 };
00142 
00143 struct _UnityMusicLensBansheeCollectionPrivate {
00144        sqlite3* db;
00145 };
00146 
00147 typedef enum  {
00148        UNITY_MUSIC_LENS_CATEGORY_SONGS,
00149        UNITY_MUSIC_LENS_CATEGORY_ALBUMS,
00150        UNITY_MUSIC_LENS_CATEGORY_PURCHASE,
00151        UNITY_MUSIC_LENS_CATEGORY_MUSIC,
00152        UNITY_MUSIC_LENS_CATEGORY_RADIOS
00153 } UnityMusicLensCategory;
00154 
00155 struct _UnityMusicLensBansheeFilterParserIface {
00156        GTypeInterface parent_iface;
00157 };
00158 
00159 
00160 static gpointer unity_music_lens_banshee_collection_parent_class = NULL;
00161 
00162 GQuark unity_music_lens_database_error_quark (void);
00163 GType unity_music_lens_banshee_collection_get_type (void) G_GNUC_CONST;
00164 #define UNITY_MUSIC_LENS_BANSHEE_COLLECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_MUSIC_LENS_TYPE_BANSHEE_COLLECTION, UnityMusicLensBansheeCollectionPrivate))
00165 enum  {
00166        UNITY_MUSIC_LENS_BANSHEE_COLLECTION_DUMMY_PROPERTY
00167 };
00168 #define UNITY_MUSIC_LENS_BANSHEE_COLLECTION_MAX_RESULTS 100
00169 UnityMusicLensBansheeCollection* unity_music_lens_banshee_collection_new (GError** error);
00170 UnityMusicLensBansheeCollection* unity_music_lens_banshee_collection_construct (GType object_type, GError** error);
00171 GType unity_music_lens_filter_parser_get_type (void) G_GNUC_CONST;
00172 void unity_music_lens_banshee_collection_search (UnityMusicLensBansheeCollection* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, gint category_override);
00173 static gchar* unity_music_lens_banshee_collection_build_sql_from_filters (UnityMusicLensBansheeCollection* self, GList* filters);
00174 static gint unity_music_lens_banshee_collection_execute_sql (UnityMusicLensBansheeCollection* self, const gchar* sql, sqlite3_stmt** stmt);
00175 UnityMusicLensTrack* unity_music_lens_track_new (void);
00176 UnityMusicLensTrack* unity_music_lens_track_construct (GType object_type);
00177 GType unity_music_lens_track_get_type (void) G_GNUC_CONST;
00178 void unity_music_lens_track_set_title (UnityMusicLensTrack* self, const gchar* value);
00179 void unity_music_lens_track_set_artist (UnityMusicLensTrack* self, const gchar* value);
00180 void unity_music_lens_track_set_uri (UnityMusicLensTrack* self, const gchar* value);
00181 void unity_music_lens_track_set_mime_type (UnityMusicLensTrack* self, const gchar* value);
00182 void unity_music_lens_track_set_artwork_path (UnityMusicLensTrack* self, const gchar* value);
00183 UnityMusicLensAlbum* unity_music_lens_album_new (void);
00184 UnityMusicLensAlbum* unity_music_lens_album_construct (GType object_type);
00185 GType unity_music_lens_album_get_type (void) G_GNUC_CONST;
00186 void unity_music_lens_album_set_title (UnityMusicLensAlbum* self, const gchar* value);
00187 void unity_music_lens_album_set_artist (UnityMusicLensAlbum* self, const gchar* value);
00188 const gchar* unity_music_lens_album_get_artist (UnityMusicLensAlbum* self);
00189 const gchar* unity_music_lens_album_get_title (UnityMusicLensAlbum* self);
00190 void unity_music_lens_album_set_uri (UnityMusicLensAlbum* self, const gchar* value);
00191 void unity_music_lens_album_set_artwork_path (UnityMusicLensAlbum* self, const gchar* value);
00192 GType unity_music_lens_category_get_type (void) G_GNUC_CONST;
00193 const gchar* unity_music_lens_track_get_uri (UnityMusicLensTrack* self);
00194 const gchar* unity_music_lens_track_get_artwork_path (UnityMusicLensTrack* self);
00195 const gchar* unity_music_lens_track_get_mime_type (UnityMusicLensTrack* self);
00196 const gchar* unity_music_lens_track_get_title (UnityMusicLensTrack* self);
00197 const gchar* unity_music_lens_track_get_artist (UnityMusicLensTrack* self);
00198 gchar** unity_music_lens_banshee_collection_get_track_uris (UnityMusicLensBansheeCollection* self, UnityMusicLensAlbum* album, int* result_length1);
00199 const gchar* unity_music_lens_album_get_uri (UnityMusicLensAlbum* self);
00200 const gchar* unity_music_lens_album_get_artwork_path (UnityMusicLensAlbum* self);
00201 GType unity_music_lens_banshee_filter_parser_get_type (void) G_GNUC_CONST;
00202 GType unity_music_lens_genre_filter_parser_get_type (void) G_GNUC_CONST;
00203 UnityMusicLensBansheeGenreFilterParser* unity_music_lens_banshee_genre_filter_parser_new (UnityMusicLensGenreFilterParser* parser);
00204 UnityMusicLensBansheeGenreFilterParser* unity_music_lens_banshee_genre_filter_parser_construct (GType object_type, UnityMusicLensGenreFilterParser* parser);
00205 GType unity_music_lens_banshee_genre_filter_parser_get_type (void) G_GNUC_CONST;
00206 GType unity_music_lens_decade_filter_parser_get_type (void) G_GNUC_CONST;
00207 UnityMusicLensBansheeDecadeFilterParser* unity_music_lens_banshee_decade_filter_parser_new (UnityMusicLensDecadeFilterParser* parser);
00208 UnityMusicLensBansheeDecadeFilterParser* unity_music_lens_banshee_decade_filter_parser_construct (GType object_type, UnityMusicLensDecadeFilterParser* parser);
00209 GType unity_music_lens_banshee_decade_filter_parser_get_type (void) G_GNUC_CONST;
00210 gchar* unity_music_lens_filter_parser_parse (UnityMusicLensFilterParser* self);
00211 static void unity_music_lens_banshee_collection_finalize (GObject* obj);
00212 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
00213 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
00214 static gint _vala_array_length (gpointer array);
00215 
00216 
00217 GQuark unity_music_lens_database_error_quark (void) {
00218        return g_quark_from_static_string ("unity_music_lens_database_error-quark");
00219 }
00220 
00221 
00222 UnityMusicLensBansheeCollection* unity_music_lens_banshee_collection_construct (GType object_type, GError** error) {
00223        UnityMusicLensBansheeCollection * self = NULL;
00224        const gchar* _tmp0_ = NULL;
00225        gchar* _tmp1_ = NULL;
00226        gchar* _tmp2_;
00227        sqlite3* _tmp3_ = NULL;
00228        gint _tmp4_ = 0;
00229        gint _tmp5_;
00230        gint rc;
00231        gint _tmp6_;
00232        GError * _inner_error_ = NULL;
00233        self = (UnityMusicLensBansheeCollection*) g_object_new (object_type, NULL);
00234        _tmp0_ = g_get_user_config_dir ();
00235        _tmp1_ = g_strdup_printf ("%s/banshee-1/banshee.db", _tmp0_);
00236        _tmp2_ = _tmp1_;
00237        _tmp4_ = sqlite3_open (_tmp2_, &_tmp3_);
00238        _sqlite3_close0 (self->priv->db);
00239        self->priv->db = _tmp3_;
00240        _tmp5_ = _tmp4_;
00241        _g_free0 (_tmp2_);
00242        rc = _tmp5_;
00243        _tmp6_ = rc;
00244        if (_tmp6_ != SQLITE_OK) {
00245               gint _tmp7_;
00246               sqlite3* _tmp8_;
00247               const gchar* _tmp9_ = NULL;
00248               GError* _tmp10_;
00249               _tmp7_ = rc;
00250               _tmp8_ = self->priv->db;
00251               _tmp9_ = sqlite3_errmsg (_tmp8_);
00252               g_printerr ("failed to open db, %d, %s\n", _tmp7_, _tmp9_);
00253               _tmp10_ = g_error_new_literal (UNITY_MUSIC_LENS_DATABASE_ERROR, UNITY_MUSIC_LENS_DATABASE_ERROR_FAILED_TO_OPEN, "Failed to open banshee database");
00254               _inner_error_ = _tmp10_;
00255               if (_inner_error_->domain == UNITY_MUSIC_LENS_DATABASE_ERROR) {
00256                      g_propagate_error (error, _inner_error_);
00257                      _g_object_unref0 (self);
00258                      return NULL;
00259               } else {
00260                      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);
00261                      g_clear_error (&_inner_error_);
00262                      return NULL;
00263               }
00264        }
00265        return self;
00266 }
00267 
00268 
00269 UnityMusicLensBansheeCollection* unity_music_lens_banshee_collection_new (GError** error) {
00270        return unity_music_lens_banshee_collection_construct (UNITY_MUSIC_LENS_TYPE_BANSHEE_COLLECTION, error);
00271 }
00272 
00273 
00277 static gpointer _g_object_ref0 (gpointer self) {
00278        return self ? g_object_ref (self) : NULL;
00279 }
00280 
00281 
00282 void unity_music_lens_banshee_collection_search (UnityMusicLensBansheeCollection* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, gint category_override) {
00283        static const gint TRACK_TITLE = 0;
00284        static const gint TRACK_URI = 1;
00285        static const gint TRACK_MIMETYPE = 2;
00286        static const gint ALBUM_TITLE = 3;
00287        static const gint ALBUM_ARTWORKID = 4;
00288        static const gint ARTIST_NAME = 5;
00289        gint rc;
00290        sqlite3_stmt* stmt = NULL;
00291        const gchar* _tmp0_ = NULL;
00292        gchar* _tmp1_ = NULL;
00293        gchar* album_art_dir;
00294        UnityLensSearch* _tmp2_;
00295        DeeSerializableModel* _tmp3_;
00296        DeeSerializableModel* _tmp4_;
00297        DeeSerializableModel* _tmp5_;
00298        DeeSerializableModel* results_model;
00299        DeeSerializableModel* _tmp6_;
00300        DeeSerializableModel* _tmp7_;
00301        DeeSerializableModel* helper_model;
00302        gint _tmp8_;
00303        GeeTreeSet* _tmp14_;
00304        GeeTreeSet* albums;
00305        GList* _tmp15_;
00306        gchar* _tmp16_ = NULL;
00307        gchar* filters_sql;
00308        gint _tmp17_ = 0;
00309        gint _tmp18_;
00310        UnityLensSearch* _tmp20_;
00311        const gchar* _tmp21_;
00312        const gchar* _tmp22_;
00313        UnityLensSearch* _tmp23_;
00314        const gchar* _tmp24_;
00315        const gchar* _tmp25_;
00316        UnityLensSearch* _tmp26_;
00317        const gchar* _tmp27_;
00318        const gchar* _tmp28_;
00319        const gchar* _tmp29_;
00320        gint _tmp30_;
00321        gchar* _tmp31_ = NULL;
00322        gchar* sql;
00323        const gchar* _tmp32_;
00324        sqlite3_stmt* _tmp33_ = NULL;
00325        gint _tmp34_ = 0;
00326        sqlite3_stmt* _tmp35_;
00327        DeeSerializableModel* _tmp144_;
00328        DeeSerializableModel* _tmp145_;
00329        DeeSerializableModel* _tmp146_;
00330        DeeModelIter* _tmp147_ = NULL;
00331        DeeModelIter* iter;
00332        DeeSerializableModel* _tmp148_;
00333        DeeModelIter* _tmp149_ = NULL;
00334        DeeModelIter* last;
00335        g_return_if_fail (self != NULL);
00336        g_return_if_fail (search != NULL);
00337        rc = 0;
00338        _tmp0_ = g_get_user_cache_dir ();
00339        _tmp1_ = g_strdup_printf ("%s/media-art/", _tmp0_);
00340        album_art_dir = _tmp1_;
00341        _tmp2_ = search;
00342        _tmp3_ = unity_lens_search_get_results_model (_tmp2_);
00343        _tmp4_ = _tmp3_;
00344        _tmp5_ = _g_object_ref0 (_tmp4_);
00345        results_model = _tmp5_;
00346        _tmp6_ = results_model;
00347        _tmp7_ = _g_object_ref0 (_tmp6_);
00348        helper_model = _tmp7_;
00349        _tmp8_ = category_override;
00350        if (_tmp8_ >= 0) {
00351               DeeSequenceModel* _tmp9_;
00352               DeeSerializableModel* _tmp10_;
00353               DeeSerializableModel* _tmp11_;
00354               guint _tmp12_;
00355               gchar** _tmp13_ = NULL;
00356               _tmp9_ = (DeeSequenceModel*) dee_sequence_model_new ();
00357               _g_object_unref0 (helper_model);
00358               helper_model = (DeeSerializableModel*) _tmp9_;
00359               _tmp10_ = helper_model;
00360               _tmp11_ = results_model;
00361               _tmp13_ = dee_model_get_schema ((DeeModel*) _tmp11_, &_tmp12_);
00362               dee_model_set_schema_full ((DeeModel*) _tmp10_, _tmp13_, (guint) _tmp12_);
00363        }
00364        _tmp14_ = gee_tree_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
00365        albums = _tmp14_;
00366        _tmp15_ = filters;
00367        _tmp16_ = unity_music_lens_banshee_collection_build_sql_from_filters (self, _tmp15_);
00368        filters_sql = _tmp16_;
00369        _tmp18_ = max_results;
00370        if (_tmp18_ == (-1)) {
00371               _tmp17_ = UNITY_MUSIC_LENS_BANSHEE_COLLECTION_MAX_RESULTS;
00372        } else {
00373               gint _tmp19_;
00374               _tmp19_ = max_results;
00375               _tmp17_ = _tmp19_;
00376        }
00377        _tmp20_ = search;
00378        _tmp21_ = unity_lens_search_get_search_string (_tmp20_);
00379        _tmp22_ = _tmp21_;
00380        _tmp23_ = search;
00381        _tmp24_ = unity_lens_search_get_search_string (_tmp23_);
00382        _tmp25_ = _tmp24_;
00383        _tmp26_ = search;
00384        _tmp27_ = unity_lens_search_get_search_string (_tmp26_);
00385        _tmp28_ = _tmp27_;
00386        _tmp29_ = filters_sql;
00387        _tmp30_ = _tmp17_;
00388        _tmp31_ = g_strdup_printf ("SELECT CoreTracks.Title, CoreTracks.Uri, CoreTracks.MimeType, CoreAlbu" \
00389 "ms.Title, CoreAlbums.ArtworkID, CoreArtists.Name                      " \
00390 "FROM CoreTracks \n" \
00391 "                      CROSS JOIN CoreArtists, CoreAlbums \n" \
00392 "                      WHERE CoreArtists.ArtistID = CoreTracks.ArtistID" \
00393 " \n" \
00394 "                                                   AND CoreAlbums.Albu" \
00395 "mID = CoreTracks.AlbumID \n" \
00396 "                                                   AND CoreTracks.Prim" \
00397 "arySourceID = 1 \n" \
00398 "\t\t\t\t\t\t   AND ((CoreArtists.NameLowered LIKE '%%%s%%' ESCAPE '\\'" \
00399 " \n" \
00400 "\t\t\t\t\t\t  \t AND CoreArtists.NameLowered IS NOT NULL) \n" \
00401 "\t\t\t\t\t\t        OR (CoreAlbums.TitleLowered LIKE '%%%s%%' ESCAPE '" \
00402 "\\' \n" \
00403 "\t\t\t\t\t\t  \t    AND CoreAlbums.TitleLowered IS NOT NULL) \n" \
00404 "\t\t\t\t\t\t  \tOR (CoreTracks.TitleLowered LIKE '%%%s%%' ESCAPE '\\' " \
00405 "\n" \
00406 "\t\t\t\t\t\t  \t    AND CoreTracks.TitleLowered IS NOT NULL)\n" \
00407 "                                                       )\n" \
00408 "                                 %s\n" \
00409 "                      ORDER BY CoreTracks.Score DESC\n" \
00410 "                      LIMIT 0, %d;", _tmp22_, _tmp25_, _tmp28_, _tmp29_, _tmp30_);
00411        sql = _tmp31_;
00412        _tmp32_ = sql;
00413        _tmp34_ = unity_music_lens_banshee_collection_execute_sql (self, _tmp32_, &_tmp33_);
00414        _sqlite3_finalize0 (stmt);
00415        stmt = _tmp33_;
00416        rc = _tmp34_;
00417        _tmp35_ = stmt;
00418        if (_tmp35_ == NULL) {
00419               _g_free0 (sql);
00420               _g_free0 (filters_sql);
00421               _g_object_unref0 (albums);
00422               _g_object_unref0 (helper_model);
00423               _g_object_unref0 (results_model);
00424               _g_free0 (album_art_dir);
00425               _sqlite3_finalize0 (stmt);
00426               return;
00427        }
00428        {
00429               gboolean _tmp36_;
00430               _tmp36_ = TRUE;
00431               while (TRUE) {
00432                      gboolean _tmp37_;
00433                      sqlite3_stmt* _tmp39_;
00434                      gint _tmp40_ = 0;
00435                      gint _tmp41_;
00436                      _tmp37_ = _tmp36_;
00437                      if (!_tmp37_) {
00438                             gint _tmp38_;
00439                             _tmp38_ = rc;
00440                             if (!(_tmp38_ == SQLITE_ROW)) {
00441                                    break;
00442                             }
00443                      }
00444                      _tmp36_ = FALSE;
00445                      _tmp39_ = stmt;
00446                      _tmp40_ = sqlite3_step (_tmp39_);
00447                      rc = _tmp40_;
00448                      _tmp41_ = rc;
00449                      switch (_tmp41_) {
00450                             case SQLITE_DONE:
00451                             {
00452                                    break;
00453                             }
00454                             case SQLITE_ROW:
00455                             {
00456                                    const gchar* _tmp42_;
00457                                    sqlite3_stmt* _tmp43_;
00458                                    const gchar* _tmp44_ = NULL;
00459                                    gchar* _tmp45_ = NULL;
00460                                    gchar* artwork_path;
00461                                    const gchar* _tmp46_;
00462                                    GFile* _tmp47_ = NULL;
00463                                    GFile* artwork_file;
00464                                    GFile* _tmp48_;
00465                                    gboolean _tmp49_ = FALSE;
00466                                    UnityMusicLensTrack* _tmp51_;
00467                                    UnityMusicLensTrack* track;
00468                                    UnityMusicLensTrack* _tmp52_;
00469                                    sqlite3_stmt* _tmp53_;
00470                                    const gchar* _tmp54_ = NULL;
00471                                    UnityMusicLensTrack* _tmp55_;
00472                                    sqlite3_stmt* _tmp56_;
00473                                    const gchar* _tmp57_ = NULL;
00474                                    UnityMusicLensTrack* _tmp58_;
00475                                    sqlite3_stmt* _tmp59_;
00476                                    const gchar* _tmp60_ = NULL;
00477                                    UnityMusicLensTrack* _tmp61_;
00478                                    sqlite3_stmt* _tmp62_;
00479                                    const gchar* _tmp63_ = NULL;
00480                                    UnityMusicLensTrack* _tmp64_;
00481                                    const gchar* _tmp65_;
00482                                    UnityMusicLensAlbum* _tmp66_;
00483                                    UnityMusicLensAlbum* album;
00484                                    UnityMusicLensAlbum* _tmp67_;
00485                                    sqlite3_stmt* _tmp68_;
00486                                    const gchar* _tmp69_ = NULL;
00487                                    UnityMusicLensAlbum* _tmp70_;
00488                                    sqlite3_stmt* _tmp71_;
00489                                    const gchar* _tmp72_ = NULL;
00490                                    UnityMusicLensAlbum* _tmp73_;
00491                                    UnityMusicLensAlbum* _tmp74_;
00492                                    const gchar* _tmp75_;
00493                                    const gchar* _tmp76_;
00494                                    UnityMusicLensAlbum* _tmp77_;
00495                                    const gchar* _tmp78_;
00496                                    const gchar* _tmp79_;
00497                                    gchar* _tmp80_ = NULL;
00498                                    gchar* _tmp81_;
00499                                    UnityMusicLensAlbum* _tmp82_;
00500                                    const gchar* _tmp83_;
00501                                    guint category_id;
00502                                    gint _tmp84_;
00503                                    DeeSerializableModel* _tmp86_;
00504                                    UnityMusicLensTrack* _tmp87_;
00505                                    const gchar* _tmp88_;
00506                                    const gchar* _tmp89_;
00507                                    UnityMusicLensTrack* _tmp90_;
00508                                    const gchar* _tmp91_;
00509                                    const gchar* _tmp92_;
00510                                    guint _tmp93_;
00511                                    UnityMusicLensTrack* _tmp94_;
00512                                    const gchar* _tmp95_;
00513                                    const gchar* _tmp96_;
00514                                    UnityMusicLensTrack* _tmp97_;
00515                                    const gchar* _tmp98_;
00516                                    const gchar* _tmp99_;
00517                                    UnityMusicLensTrack* _tmp100_;
00518                                    const gchar* _tmp101_;
00519                                    const gchar* _tmp102_;
00520                                    UnityMusicLensTrack* _tmp103_;
00521                                    const gchar* _tmp104_;
00522                                    const gchar* _tmp105_;
00523                                    GeeTreeSet* _tmp106_;
00524                                    UnityMusicLensAlbum* _tmp107_;
00525                                    const gchar* _tmp108_;
00526                                    const gchar* _tmp109_;
00527                                    UnityMusicLensAlbum* _tmp110_;
00528                                    const gchar* _tmp111_;
00529                                    const gchar* _tmp112_;
00530                                    gchar* _tmp113_;
00531                                    gchar* _tmp114_;
00532                                    gboolean _tmp115_ = FALSE;
00533                                    gboolean _tmp116_;
00534                                    _tmp42_ = album_art_dir;
00535                                    _tmp43_ = stmt;
00536                                    _tmp44_ = sqlite3_column_text (_tmp43_, ALBUM_ARTWORKID);
00537                                    _tmp45_ = g_strdup_printf ("%s/%s.jpg", _tmp42_, _tmp44_);
00538                                    artwork_path = _tmp45_;
00539                                    _tmp46_ = artwork_path;
00540                                    _tmp47_ = g_file_new_for_path (_tmp46_);
00541                                    artwork_file = _tmp47_;
00542                                    _tmp48_ = artwork_file;
00543                                    _tmp49_ = g_file_query_exists (_tmp48_, NULL);
00544                                    if (!_tmp49_) {
00545                                           gchar* _tmp50_;
00546                                           _tmp50_ = g_strdup ("audio-x-generic");
00547                                           _g_free0 (artwork_path);
00548                                           artwork_path = _tmp50_;
00549                                    }
00550                                    _tmp51_ = unity_music_lens_track_new ();
00551                                    track = _tmp51_;
00552                                    _tmp52_ = track;
00553                                    _tmp53_ = stmt;
00554                                    _tmp54_ = sqlite3_column_text (_tmp53_, TRACK_TITLE);
00555                                    unity_music_lens_track_set_title (_tmp52_, _tmp54_);
00556                                    _tmp55_ = track;
00557                                    _tmp56_ = stmt;
00558                                    _tmp57_ = sqlite3_column_text (_tmp56_, ARTIST_NAME);
00559                                    unity_music_lens_track_set_artist (_tmp55_, _tmp57_);
00560                                    _tmp58_ = track;
00561                                    _tmp59_ = stmt;
00562                                    _tmp60_ = sqlite3_column_text (_tmp59_, TRACK_URI);
00563                                    unity_music_lens_track_set_uri (_tmp58_, _tmp60_);
00564                                    _tmp61_ = track;
00565                                    _tmp62_ = stmt;
00566                                    _tmp63_ = sqlite3_column_text (_tmp62_, TRACK_MIMETYPE);
00567                                    unity_music_lens_track_set_mime_type (_tmp61_, _tmp63_);
00568                                    _tmp64_ = track;
00569                                    _tmp65_ = artwork_path;
00570                                    unity_music_lens_track_set_artwork_path (_tmp64_, _tmp65_);
00571                                    _tmp66_ = unity_music_lens_album_new ();
00572                                    album = _tmp66_;
00573                                    _tmp67_ = album;
00574                                    _tmp68_ = stmt;
00575                                    _tmp69_ = sqlite3_column_text (_tmp68_, ALBUM_TITLE);
00576                                    unity_music_lens_album_set_title (_tmp67_, _tmp69_);
00577                                    _tmp70_ = album;
00578                                    _tmp71_ = stmt;
00579                                    _tmp72_ = sqlite3_column_text (_tmp71_, ARTIST_NAME);
00580                                    unity_music_lens_album_set_artist (_tmp70_, _tmp72_);
00581                                    _tmp73_ = album;
00582                                    _tmp74_ = album;
00583                                    _tmp75_ = unity_music_lens_album_get_artist (_tmp74_);
00584                                    _tmp76_ = _tmp75_;
00585                                    _tmp77_ = album;
00586                                    _tmp78_ = unity_music_lens_album_get_title (_tmp77_);
00587                                    _tmp79_ = _tmp78_;
00588                                    _tmp80_ = g_strdup_printf ("album://%s/%s", _tmp76_, _tmp79_);
00589                                    _tmp81_ = _tmp80_;
00590                                    unity_music_lens_album_set_uri (_tmp73_, _tmp81_);
00591                                    _g_free0 (_tmp81_);
00592                                    _tmp82_ = album;
00593                                    _tmp83_ = artwork_path;
00594                                    unity_music_lens_album_set_artwork_path (_tmp82_, _tmp83_);
00595                                    category_id = (guint) UNITY_MUSIC_LENS_CATEGORY_SONGS;
00596                                    _tmp84_ = category_override;
00597                                    if (_tmp84_ >= 0) {
00598                                           gint _tmp85_;
00599                                           _tmp85_ = category_override;
00600                                           category_id = (guint) _tmp85_;
00601                                    }
00602                                    _tmp86_ = helper_model;
00603                                    _tmp87_ = track;
00604                                    _tmp88_ = unity_music_lens_track_get_uri (_tmp87_);
00605                                    _tmp89_ = _tmp88_;
00606                                    _tmp90_ = track;
00607                                    _tmp91_ = unity_music_lens_track_get_artwork_path (_tmp90_);
00608                                    _tmp92_ = _tmp91_;
00609                                    _tmp93_ = category_id;
00610                                    _tmp94_ = track;
00611                                    _tmp95_ = unity_music_lens_track_get_mime_type (_tmp94_);
00612                                    _tmp96_ = _tmp95_;
00613                                    _tmp97_ = track;
00614                                    _tmp98_ = unity_music_lens_track_get_title (_tmp97_);
00615                                    _tmp99_ = _tmp98_;
00616                                    _tmp100_ = track;
00617                                    _tmp101_ = unity_music_lens_track_get_artist (_tmp100_);
00618                                    _tmp102_ = _tmp101_;
00619                                    _tmp103_ = track;
00620                                    _tmp104_ = unity_music_lens_track_get_uri (_tmp103_);
00621                                    _tmp105_ = _tmp104_;
00622                                    dee_model_append ((DeeModel*) _tmp86_, _tmp89_, _tmp92_, _tmp93_, _tmp96_, _tmp99_, _tmp102_, _tmp105_, NULL);
00623                                    _tmp106_ = albums;
00624                                    _tmp107_ = album;
00625                                    _tmp108_ = unity_music_lens_album_get_artist (_tmp107_);
00626                                    _tmp109_ = _tmp108_;
00627                                    _tmp110_ = album;
00628                                    _tmp111_ = unity_music_lens_album_get_title (_tmp110_);
00629                                    _tmp112_ = _tmp111_;
00630                                    _tmp113_ = g_strconcat (_tmp109_, _tmp112_, NULL);
00631                                    _tmp114_ = _tmp113_;
00632                                    _tmp115_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp106_, _tmp114_);
00633                                    _tmp116_ = _tmp115_;
00634                                    _g_free0 (_tmp114_);
00635                                    if (_tmp116_) {
00636                                           GString* _tmp117_;
00637                                           GString* uri_list_builder;
00638                                           UnityMusicLensAlbum* _tmp118_;
00639                                           gint _tmp119_ = 0;
00640                                           gchar** _tmp120_ = NULL;
00641                                           gint _tmp126_;
00642                                           DeeSerializableModel* _tmp128_;
00643                                           UnityMusicLensAlbum* _tmp129_;
00644                                           const gchar* _tmp130_;
00645                                           const gchar* _tmp131_;
00646                                           UnityMusicLensAlbum* _tmp132_;
00647                                           const gchar* _tmp133_;
00648                                           const gchar* _tmp134_;
00649                                           guint _tmp135_;
00650                                           UnityMusicLensAlbum* _tmp136_;
00651                                           const gchar* _tmp137_;
00652                                           const gchar* _tmp138_;
00653                                           UnityMusicLensAlbum* _tmp139_;
00654                                           const gchar* _tmp140_;
00655                                           const gchar* _tmp141_;
00656                                           GString* _tmp142_;
00657                                           const gchar* _tmp143_;
00658                                           _tmp117_ = g_string_new ("");
00659                                           uri_list_builder = _tmp117_;
00660                                           _tmp118_ = album;
00661                                           _tmp120_ = unity_music_lens_banshee_collection_get_track_uris (self, _tmp118_, &_tmp119_);
00662                                           {
00663                                                  gchar** uri_collection = NULL;
00664                                                  gint uri_collection_length1 = 0;
00665                                                  gint _uri_collection_size_ = 0;
00666                                                  gint uri_it = 0;
00667                                                  uri_collection = _tmp120_;
00668                                                  uri_collection_length1 = _tmp119_;
00669                                                  for (uri_it = 0; uri_it < _tmp119_; uri_it = uri_it + 1) {
00670                                                         gchar* _tmp121_;
00671                                                         gchar* uri = NULL;
00672                                                         _tmp121_ = g_strdup (uri_collection[uri_it]);
00673                                                         uri = _tmp121_;
00674                                                         {
00675                                                                GString* _tmp122_;
00676                                                                GString* _tmp123_;
00677                                                                const gchar* _tmp124_;
00678                                                                GString* _tmp125_;
00679                                                                _tmp122_ = uri_list_builder;
00680                                                                g_string_append (_tmp122_, "'");
00681                                                                _tmp123_ = uri_list_builder;
00682                                                                _tmp124_ = uri;
00683                                                                g_string_append (_tmp123_, _tmp124_);
00684                                                                _tmp125_ = uri_list_builder;
00685                                                                g_string_append (_tmp125_, "' ");
00686                                                                _g_free0 (uri);
00687                                                         }
00688                                                  }
00689                                                  uri_collection = (_vala_array_free (uri_collection, uri_collection_length1, (GDestroyNotify) g_free), NULL);
00690                                           }
00691                                           category_id = (guint) UNITY_MUSIC_LENS_CATEGORY_ALBUMS;
00692                                           _tmp126_ = category_override;
00693                                           if (_tmp126_ >= 0) {
00694                                                  gint _tmp127_;
00695                                                  _tmp127_ = category_override;
00696                                                  category_id = (guint) _tmp127_;
00697                                           }
00698                                           _tmp128_ = results_model;
00699                                           _tmp129_ = album;
00700                                           _tmp130_ = unity_music_lens_album_get_uri (_tmp129_);
00701                                           _tmp131_ = _tmp130_;
00702                                           _tmp132_ = album;
00703                                           _tmp133_ = unity_music_lens_album_get_artwork_path (_tmp132_);
00704                                           _tmp134_ = _tmp133_;
00705                                           _tmp135_ = category_id;
00706                                           _tmp136_ = album;
00707                                           _tmp137_ = unity_music_lens_album_get_title (_tmp136_);
00708                                           _tmp138_ = _tmp137_;
00709                                           _tmp139_ = album;
00710                                           _tmp140_ = unity_music_lens_album_get_artist (_tmp139_);
00711                                           _tmp141_ = _tmp140_;
00712                                           _tmp142_ = uri_list_builder;
00713                                           _tmp143_ = _tmp142_->str;
00714                                           dee_model_append ((DeeModel*) _tmp128_, _tmp131_, _tmp134_, _tmp135_, "audio/mp3", _tmp138_, _tmp141_, _tmp143_, NULL);
00715                                           _g_string_free0 (uri_list_builder);
00716                                    }
00717                                    _g_object_unref0 (album);
00718                                    _g_object_unref0 (track);
00719                                    _g_object_unref0 (artwork_file);
00720                                    _g_free0 (artwork_path);
00721                                    break;
00722                             }
00723                             default:
00724                             {
00725                                    break;
00726                             }
00727                      }
00728               }
00729        }
00730        _tmp144_ = helper_model;
00731        _tmp145_ = results_model;
00732        if (_tmp144_ == _tmp145_) {
00733               _g_free0 (sql);
00734               _g_free0 (filters_sql);
00735               _g_object_unref0 (albums);
00736               _g_object_unref0 (helper_model);
00737               _g_object_unref0 (results_model);
00738               _g_free0 (album_art_dir);
00739               _sqlite3_finalize0 (stmt);
00740               return;
00741        }
00742        _tmp146_ = helper_model;
00743        _tmp147_ = dee_model_get_first_iter ((DeeModel*) _tmp146_);
00744        iter = _tmp147_;
00745        _tmp148_ = helper_model;
00746        _tmp149_ = dee_model_get_last_iter ((DeeModel*) _tmp148_);
00747        last = _tmp149_;
00748        while (TRUE) {
00749               DeeModelIter* _tmp150_;
00750               DeeModelIter* _tmp151_;
00751               DeeSerializableModel* _tmp152_;
00752               DeeModelIter* _tmp153_;
00753               GVariant** _tmp154_;
00754               GVariant** _tmp155_ = NULL;
00755               GVariant** row;
00756               gint row_length1;
00757               gint _row_size_;
00758               DeeSerializableModel* _tmp156_;
00759               GVariant** _tmp157_;
00760               gint _tmp157__length1;
00761               DeeSerializableModel* _tmp158_;
00762               DeeModelIter* _tmp159_;
00763               DeeModelIter* _tmp160_ = NULL;
00764               _tmp150_ = iter;
00765               _tmp151_ = last;
00766               if (!(_tmp150_ != _tmp151_)) {
00767                      break;
00768               }
00769               _tmp152_ = helper_model;
00770               _tmp153_ = iter;
00771               _tmp155_ = _tmp154_ = dee_model_get_row ((DeeModel*) _tmp152_, _tmp153_, NULL);
00772               row = _tmp155_;
00773               row_length1 = _vala_array_length (_tmp154_);
00774               _row_size_ = row_length1;
00775               _tmp156_ = results_model;
00776               _tmp157_ = row;
00777               _tmp157__length1 = row_length1;
00778               dee_model_append_row ((DeeModel*) _tmp156_, _tmp157_);
00779               _tmp158_ = helper_model;
00780               _tmp159_ = iter;
00781               _tmp160_ = dee_model_next ((DeeModel*) _tmp158_, _tmp159_);
00782               iter = _tmp160_;
00783               row = (_vala_array_free (row, row_length1, (GDestroyNotify) g_variant_unref), NULL);
00784        }
00785        _g_free0 (sql);
00786        _g_free0 (filters_sql);
00787        _g_object_unref0 (albums);
00788        _g_object_unref0 (helper_model);
00789        _g_object_unref0 (results_model);
00790        _g_free0 (album_art_dir);
00791        _sqlite3_finalize0 (stmt);
00792 }
00793 
00794 
00798 gchar** unity_music_lens_banshee_collection_get_track_uris (UnityMusicLensBansheeCollection* self, UnityMusicLensAlbum* album, int* result_length1) {
00799        gchar** result = NULL;
00800        static const gint URI_COLUMN = 0;
00801        gint rc = 0;
00802        sqlite3_stmt* stmt = NULL;
00803        UnityMusicLensAlbum* _tmp0_;
00804        const gchar* _tmp1_;
00805        const gchar* _tmp2_;
00806        UnityMusicLensAlbum* _tmp3_;
00807        const gchar* _tmp4_;
00808        const gchar* _tmp5_;
00809        gchar* _tmp6_ = NULL;
00810        gchar* sql;
00811        const gchar* _tmp7_;
00812        sqlite3_stmt* _tmp8_ = NULL;
00813        gint _tmp9_ = 0;
00814        GeeArrayList* _tmp10_;
00815        GeeArrayList* uris;
00816        GeeArrayList* _tmp20_;
00817        gint _tmp21_ = 0;
00818        gpointer* _tmp22_ = NULL;
00819        gchar** _tmp23_;
00820        gint _tmp23__length1;
00821        g_return_val_if_fail (self != NULL, NULL);
00822        g_return_val_if_fail (album != NULL, NULL);
00823        _tmp0_ = album;
00824        _tmp1_ = unity_music_lens_album_get_title (_tmp0_);
00825        _tmp2_ = _tmp1_;
00826        _tmp3_ = album;
00827        _tmp4_ = unity_music_lens_album_get_artist (_tmp3_);
00828        _tmp5_ = _tmp4_;
00829        _tmp6_ = g_strdup_printf ("SELECT CoreTracks.Uri \n" \
00830 "                    FROM CoreTracks \n" \
00831 "                    CROSS JOIN CoreAlbums, CoreArtists \n" \
00832 "                    WHERE CoreArtists.ArtistID = CoreTracks.ArtistID \n" \
00833 "                          AND CoreAlbums.AlbumID = CoreTracks.AlbumID " \
00834 "\n" \
00835 "                          AND CoreAlbums.Title IS '%s'\n" \
00836 "                          AND CoreArtists.Name IS '%s'\n" \
00837 "                          AND CoreTracks.URI IS NOT NULL\n" \
00838 "                    ORDER BY CoreTracks.TrackNumber ASC", _tmp2_, _tmp5_);
00839        sql = _tmp6_;
00840        _tmp7_ = sql;
00841        _tmp9_ = unity_music_lens_banshee_collection_execute_sql (self, _tmp7_, &_tmp8_);
00842        _sqlite3_finalize0 (stmt);
00843        stmt = _tmp8_;
00844        rc = _tmp9_;
00845        _tmp10_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
00846        uris = _tmp10_;
00847        {
00848               gboolean _tmp11_;
00849               _tmp11_ = TRUE;
00850               while (TRUE) {
00851                      gboolean _tmp12_;
00852                      sqlite3_stmt* _tmp14_;
00853                      gint _tmp15_ = 0;
00854                      gint _tmp16_;
00855                      _tmp12_ = _tmp11_;
00856                      if (!_tmp12_) {
00857                             gint _tmp13_;
00858                             _tmp13_ = rc;
00859                             if (!(_tmp13_ == SQLITE_ROW)) {
00860                                    break;
00861                             }
00862                      }
00863                      _tmp11_ = FALSE;
00864                      _tmp14_ = stmt;
00865                      _tmp15_ = sqlite3_step (_tmp14_);
00866                      rc = _tmp15_;
00867                      _tmp16_ = rc;
00868                      switch (_tmp16_) {
00869                             case SQLITE_DONE:
00870                             {
00871                                    break;
00872                             }
00873                             case SQLITE_ROW:
00874                             {
00875                                    GeeArrayList* _tmp17_;
00876                                    sqlite3_stmt* _tmp18_;
00877                                    const gchar* _tmp19_ = NULL;
00878                                    _tmp17_ = uris;
00879                                    _tmp18_ = stmt;
00880                                    _tmp19_ = sqlite3_column_text (_tmp18_, URI_COLUMN);
00881                                    gee_abstract_collection_add ((GeeAbstractCollection*) _tmp17_, _tmp19_);
00882                                    break;
00883                             }
00884                             default:
00885                             {
00886                                    break;
00887                             }
00888                      }
00889               }
00890        }
00891        _tmp20_ = uris;
00892        _tmp22_ = gee_abstract_collection_to_array ((GeeAbstractCollection*) _tmp20_, &_tmp21_);
00893        _tmp23_ = _tmp22_;
00894        _tmp23__length1 = _tmp21_;
00895        if (result_length1) {
00896               *result_length1 = _tmp23__length1;
00897        }
00898        result = _tmp23_;
00899        _g_object_unref0 (uris);
00900        _g_free0 (sql);
00901        _sqlite3_finalize0 (stmt);
00902        return result;
00903 }
00904 
00905 
00910 static gchar* unity_music_lens_banshee_collection_build_sql_from_filters (UnityMusicLensBansheeCollection* self, GList* filters) {
00911        gchar* result = NULL;
00912        gboolean _tmp0_ = FALSE;
00913        GList* _tmp1_;
00914        gboolean _tmp4_;
00915        GString* _tmp6_;
00916        GString* builder;
00917        GList* _tmp7_;
00918        GString* _tmp24_;
00919        GString* _tmp25_;
00920        const gchar* _tmp26_;
00921        gchar* _tmp27_;
00922        g_return_val_if_fail (self != NULL, NULL);
00923        _tmp1_ = filters;
00924        if (_tmp1_ == NULL) {
00925               _tmp0_ = TRUE;
00926        } else {
00927               GList* _tmp2_;
00928               guint _tmp3_ = 0U;
00929               _tmp2_ = filters;
00930               _tmp3_ = g_list_length (_tmp2_);
00931               _tmp0_ = _tmp3_ == ((guint) 0);
00932        }
00933        _tmp4_ = _tmp0_;
00934        if (_tmp4_) {
00935               gchar* _tmp5_;
00936               _tmp5_ = g_strdup ("");
00937               result = _tmp5_;
00938               return result;
00939        }
00940        _tmp6_ = g_string_new ("");
00941        builder = _tmp6_;
00942        _tmp7_ = filters;
00943        {
00944               GList* parser_collection = NULL;
00945               GList* parser_it = NULL;
00946               parser_collection = _tmp7_;
00947               for (parser_it = parser_collection; parser_it != NULL; parser_it = parser_it->next) {
00948                      UnityMusicLensFilterParser* _tmp8_;
00949                      UnityMusicLensFilterParser* parser = NULL;
00950                      _tmp8_ = _g_object_ref0 ((UnityMusicLensFilterParser*) parser_it->data);
00951                      parser = _tmp8_;
00952                      {
00953                             UnityMusicLensBansheeFilterParser* bparser = NULL;
00954                             UnityMusicLensFilterParser* _tmp9_;
00955                             UnityMusicLensBansheeFilterParser* _tmp15_;
00956                             gchar* _tmp16_ = NULL;
00957                             gchar* parsed;
00958                             gboolean _tmp17_ = FALSE;
00959                             const gchar* _tmp18_;
00960                             gboolean _tmp20_;
00961                             GString* _tmp21_;
00962                             GString* _tmp22_;
00963                             const gchar* _tmp23_;
00964                             _tmp9_ = parser;
00965                             if (UNITY_MUSIC_LENS_IS_GENRE_FILTER_PARSER (_tmp9_)) {
00966                                    UnityMusicLensFilterParser* _tmp10_;
00967                                    UnityMusicLensBansheeGenreFilterParser* _tmp11_;
00968                                    _tmp10_ = parser;
00969                                    _tmp11_ = unity_music_lens_banshee_genre_filter_parser_new (UNITY_MUSIC_LENS_IS_GENRE_FILTER_PARSER (_tmp10_) ? ((UnityMusicLensGenreFilterParser*) _tmp10_) : NULL);
00970                                    _g_object_unref0 (bparser);
00971                                    bparser = (UnityMusicLensBansheeFilterParser*) _tmp11_;
00972                             } else {
00973                                    UnityMusicLensFilterParser* _tmp12_;
00974                                    _tmp12_ = parser;
00975                                    if (UNITY_MUSIC_LENS_IS_DECADE_FILTER_PARSER (_tmp12_)) {
00976                                           UnityMusicLensFilterParser* _tmp13_;
00977                                           UnityMusicLensBansheeDecadeFilterParser* _tmp14_;
00978                                           _tmp13_ = parser;
00979                                           _tmp14_ = unity_music_lens_banshee_decade_filter_parser_new (UNITY_MUSIC_LENS_IS_DECADE_FILTER_PARSER (_tmp13_) ? ((UnityMusicLensDecadeFilterParser*) _tmp13_) : NULL);
00980                                           _g_object_unref0 (bparser);
00981                                           bparser = (UnityMusicLensBansheeFilterParser*) _tmp14_;
00982                                    } else {
00983                                           g_warning ("banshee-collection.vala:236: Recieved an unimplemented filter type");
00984                                           _g_object_unref0 (bparser);
00985                                           _g_object_unref0 (parser);
00986                                           continue;
00987                                    }
00988                             }
00989                             _tmp15_ = bparser;
00990                             _tmp16_ = unity_music_lens_filter_parser_parse ((UnityMusicLensFilterParser*) _tmp15_);
00991                             parsed = _tmp16_;
00992                             _tmp18_ = parsed;
00993                             if (_tmp18_ == NULL) {
00994                                    _tmp17_ = TRUE;
00995                             } else {
00996                                    const gchar* _tmp19_;
00997                                    _tmp19_ = parsed;
00998                                    _tmp17_ = g_strcmp0 (_tmp19_, "") == 0;
00999                             }
01000                             _tmp20_ = _tmp17_;
01001                             if (_tmp20_) {
01002                                    _g_free0 (parsed);
01003                                    _g_object_unref0 (bparser);
01004                                    _g_object_unref0 (parser);
01005                                    continue;
01006                             }
01007                             _tmp21_ = builder;
01008                             g_string_append (_tmp21_, " AND ");
01009                             _tmp22_ = builder;
01010                             _tmp23_ = parsed;
01011                             g_string_append (_tmp22_, _tmp23_);
01012                             _g_free0 (parsed);
01013                             _g_object_unref0 (bparser);
01014                             _g_object_unref0 (parser);
01015                      }
01016               }
01017        }
01018        _tmp24_ = builder;
01019        g_string_append (_tmp24_, " ");
01020        _tmp25_ = builder;
01021        _tmp26_ = _tmp25_->str;
01022        _tmp27_ = g_strdup (_tmp26_);
01023        result = _tmp27_;
01024        _g_string_free0 (builder);
01025        return result;
01026 }
01027 
01028 
01029 static gint unity_music_lens_banshee_collection_execute_sql (UnityMusicLensBansheeCollection* self, const gchar* sql, sqlite3_stmt** stmt) {
01030        sqlite3_stmt* _vala_stmt = NULL;
01031        gint result = 0;
01032        gint rc = 0;
01033        const gchar* _tmp0_;
01034        sqlite3* _tmp1_;
01035        const gchar* _tmp2_;
01036        sqlite3_stmt* _tmp3_ = NULL;
01037        gint _tmp4_ = 0;
01038        gint _tmp5_;
01039        g_return_val_if_fail (self != NULL, 0);
01040        g_return_val_if_fail (sql != NULL, 0);
01041        _tmp0_ = sql;
01042        g_debug ("banshee-collection.vala:256: preparing to execute sql %s\n", _tmp0_);
01043        _tmp1_ = self->priv->db;
01044        _tmp2_ = sql;
01045        _tmp4_ = sqlite3_prepare_v2 (_tmp1_, _tmp2_, -1, &_tmp3_, NULL);
01046        _sqlite3_finalize0 (_vala_stmt);
01047        _vala_stmt = _tmp3_;
01048        rc = _tmp4_;
01049        _tmp5_ = rc;
01050        if (_tmp5_ == 1) {
01051               gint _tmp6_;
01052               sqlite3* _tmp7_;
01053               const gchar* _tmp8_ = NULL;
01054               _tmp6_ = rc;
01055               _tmp7_ = self->priv->db;
01056               _tmp8_ = sqlite3_errmsg (_tmp7_);
01057               g_warning ("banshee-collection.vala:260: SQL Error: %d, %s\n", _tmp6_, _tmp8_);
01058        }
01059        result = rc;
01060        if (stmt) {
01061               *stmt = _vala_stmt;
01062        } else {
01063               _sqlite3_finalize0 (_vala_stmt);
01064        }
01065        return result;
01066 }
01067 
01068 
01069 static void unity_music_lens_banshee_collection_class_init (UnityMusicLensBansheeCollectionClass * klass) {
01070        unity_music_lens_banshee_collection_parent_class = g_type_class_peek_parent (klass);
01071        g_type_class_add_private (klass, sizeof (UnityMusicLensBansheeCollectionPrivate));
01072        G_OBJECT_CLASS (klass)->finalize = unity_music_lens_banshee_collection_finalize;
01073 }
01074 
01075 
01076 static void unity_music_lens_banshee_collection_instance_init (UnityMusicLensBansheeCollection * self) {
01077        self->priv = UNITY_MUSIC_LENS_BANSHEE_COLLECTION_GET_PRIVATE (self);
01078 }
01079 
01080 
01081 static void unity_music_lens_banshee_collection_finalize (GObject* obj) {
01082        UnityMusicLensBansheeCollection * self;
01083        self = UNITY_MUSIC_LENS_BANSHEE_COLLECTION (obj);
01084        _sqlite3_close0 (self->priv->db);
01085        G_OBJECT_CLASS (unity_music_lens_banshee_collection_parent_class)->finalize (obj);
01086 }
01087 
01088 
01092 GType unity_music_lens_banshee_collection_get_type (void) {
01093        static volatile gsize unity_music_lens_banshee_collection_type_id__volatile = 0;
01094        if (g_once_init_enter (&unity_music_lens_banshee_collection_type_id__volatile)) {
01095               static const GTypeInfo g_define_type_info = { sizeof (UnityMusicLensBansheeCollectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_music_lens_banshee_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMusicLensBansheeCollection), 0, (GInstanceInitFunc) unity_music_lens_banshee_collection_instance_init, NULL };
01096               GType unity_music_lens_banshee_collection_type_id;
01097               unity_music_lens_banshee_collection_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityMusicLensBansheeCollection", &g_define_type_info, 0);
01098               g_once_init_leave (&unity_music_lens_banshee_collection_type_id__volatile, unity_music_lens_banshee_collection_type_id);
01099        }
01100        return unity_music_lens_banshee_collection_type_id__volatile;
01101 }
01102 
01103 
01104 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
01105        if ((array != NULL) && (destroy_func != NULL)) {
01106               int i;
01107               for (i = 0; i < array_length; i = i + 1) {
01108                      if (((gpointer*) array)[i] != NULL) {
01109                             destroy_func (((gpointer*) array)[i]);
01110                      }
01111               }
01112        }
01113 }
01114 
01115 
01116 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
01117        _vala_array_destroy (array, array_length, destroy_func);
01118        g_free (array);
01119 }
01120 
01121 
01122 static gint _vala_array_length (gpointer array) {
01123        int length;
01124        length = 0;
01125        if (array) {
01126               while (((gpointer*) array)[length]) {
01127                      length++;
01128               }
01129        }
01130        return length;
01131 }
01132 
01133 
01134