~ricmm/+junk/unity-lens_music-sc

« back to all changes in this revision

Viewing changes to src/rhythmbox-collection.c

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* rhythmbox-collection.c generated by valac 0.16.1, the Vala compiler
 
2
 * generated from rhythmbox-collection.vala, do not modify */
 
3
 
 
4
/*
 
5
 * Copyright (C) 2012 Canonical Ltd
 
6
 *
 
7
 * This program is free software: you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License version 3 as
 
9
 * published by the Free Software Foundation.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 *
 
19
 * Authored by David Calle <davidc@framli.eu>
 
20
 *             Michal Hruby <michal.hruby@canonical.com>
 
21
 *
 
22
 */
 
23
 
 
24
#include <glib.h>
 
25
#include <glib-object.h>
 
26
#include <dee.h>
 
27
#include <stdlib.h>
 
28
#include <string.h>
 
29
#include <tdb.h>
 
30
#include <gio/gio.h>
 
31
#include <dee-icu.h>
 
32
#include <glib/gi18n-lib.h>
 
33
#include <glib/gstdio.h>
 
34
#include <fcntl.h>
 
35
#include <sys/types.h>
 
36
#include <unity.h>
 
37
#include <gee.h>
 
38
 
 
39
 
 
40
#define UNITY_MUSIC_LENS_TYPE_COLUMNS (unity_music_lens_columns_get_type ())
 
41
 
 
42
#define UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_COLLECTION (unity_music_lens_rhythmbox_collection_get_type ())
 
43
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_COLLECTION, UnityMusicLensRhythmboxCollection))
 
44
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_COLLECTION, UnityMusicLensRhythmboxCollectionClass))
 
45
#define UNITY_MUSIC_LENS_IS_RHYTHMBOX_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_COLLECTION))
 
46
#define UNITY_MUSIC_LENS_IS_RHYTHMBOX_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_COLLECTION))
 
47
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_COLLECTION, UnityMusicLensRhythmboxCollectionClass))
 
48
 
 
49
typedef struct _UnityMusicLensRhythmboxCollection UnityMusicLensRhythmboxCollection;
 
50
typedef struct _UnityMusicLensRhythmboxCollectionClass UnityMusicLensRhythmboxCollectionClass;
 
51
typedef struct _UnityMusicLensRhythmboxCollectionPrivate UnityMusicLensRhythmboxCollectionPrivate;
 
52
 
 
53
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_RESULT_TYPE (unity_music_lens_rhythmbox_collection_result_type_get_type ())
 
54
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 
55
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
 
56
#define _tdb_close0(var) ((var == NULL) ? NULL : (var = (tdb_close (var), NULL)))
 
57
#define _dee_icu_term_filter_destroy0(var) ((var == NULL) ? NULL : (var = (dee_icu_term_filter_destroy (var), NULL)))
 
58
#define _g_free0(var) (var = (g_free (var), NULL))
 
59
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
 
60
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
 
61
#define _g_byte_array_unref0(var) ((var == NULL) ? NULL : (var = (g_byte_array_unref (var), NULL)))
 
62
 
 
63
#define UNITY_MUSIC_LENS_TYPE_TRACK (unity_music_lens_track_get_type ())
 
64
#define UNITY_MUSIC_LENS_TRACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrack))
 
65
#define UNITY_MUSIC_LENS_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrackClass))
 
66
#define UNITY_MUSIC_LENS_IS_TRACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_TRACK))
 
67
#define UNITY_MUSIC_LENS_IS_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_TRACK))
 
68
#define UNITY_MUSIC_LENS_TRACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrackClass))
 
69
 
 
70
typedef struct _UnityMusicLensTrack UnityMusicLensTrack;
 
71
typedef struct _UnityMusicLensTrackClass UnityMusicLensTrackClass;
 
72
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
 
73
#define _g_slist_free0(var) ((var == NULL) ? NULL : (var = (g_slist_free (var), NULL)))
 
74
#define __g_slist_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_slist_free__g_object_unref0_ (var), NULL)))
 
75
 
 
76
#define UNITY_MUSIC_LENS_TYPE_TRACK_TYPE (unity_music_lens_track_type_get_type ())
 
77
typedef struct _Block2Data Block2Data;
 
78
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 
79
 
 
80
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER (unity_music_lens_rhythmbox_collection_xml_parser_get_type ())
 
81
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_XML_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER, UnityMusicLensRhythmboxCollectionXmlParser))
 
82
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_XML_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER, UnityMusicLensRhythmboxCollectionXmlParserClass))
 
83
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_IS_XML_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER))
 
84
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_IS_XML_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER))
 
85
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_XML_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER, UnityMusicLensRhythmboxCollectionXmlParserClass))
 
86
 
 
87
typedef struct _UnityMusicLensRhythmboxCollectionXmlParser UnityMusicLensRhythmboxCollectionXmlParser;
 
88
typedef struct _UnityMusicLensRhythmboxCollectionXmlParserClass UnityMusicLensRhythmboxCollectionXmlParserClass;
 
89
typedef struct _Block3Data Block3Data;
 
90
#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))
 
91
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
 
92
 
 
93
#define UNITY_MUSIC_LENS_TYPE_FILTER_PARSER (unity_music_lens_filter_parser_get_type ())
 
94
#define UNITY_MUSIC_LENS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParser))
 
95
#define UNITY_MUSIC_LENS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
 
96
#define UNITY_MUSIC_LENS_IS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
 
97
#define UNITY_MUSIC_LENS_IS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
 
98
#define UNITY_MUSIC_LENS_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
 
99
 
 
100
typedef struct _UnityMusicLensFilterParser UnityMusicLensFilterParser;
 
101
typedef struct _UnityMusicLensFilterParserClass UnityMusicLensFilterParserClass;
 
102
 
 
103
#define UNITY_MUSIC_LENS_TYPE_CATEGORY (unity_music_lens_category_get_type ())
 
104
#define _g_sequence_free0(var) ((var == NULL) ? NULL : (var = (g_sequence_free (var), NULL)))
 
105
 
 
106
#define UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER (unity_music_lens_decade_filter_parser_get_type ())
 
107
#define UNITY_MUSIC_LENS_DECADE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER, UnityMusicLensDecadeFilterParser))
 
108
#define UNITY_MUSIC_LENS_DECADE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER, UnityMusicLensDecadeFilterParserClass))
 
109
#define UNITY_MUSIC_LENS_IS_DECADE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER))
 
110
#define UNITY_MUSIC_LENS_IS_DECADE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER))
 
111
#define UNITY_MUSIC_LENS_DECADE_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER, UnityMusicLensDecadeFilterParserClass))
 
112
 
 
113
typedef struct _UnityMusicLensDecadeFilterParser UnityMusicLensDecadeFilterParser;
 
114
typedef struct _UnityMusicLensDecadeFilterParserClass UnityMusicLensDecadeFilterParserClass;
 
115
 
 
116
#define UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER (unity_music_lens_genre_filter_parser_get_type ())
 
117
#define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParser))
 
118
#define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParserClass))
 
119
#define UNITY_MUSIC_LENS_IS_GENRE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER))
 
120
#define UNITY_MUSIC_LENS_IS_GENRE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER))
 
121
#define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParserClass))
 
122
 
 
123
typedef struct _UnityMusicLensGenreFilterParser UnityMusicLensGenreFilterParser;
 
124
typedef struct _UnityMusicLensGenreFilterParserClass UnityMusicLensGenreFilterParserClass;
 
125
typedef struct _UnityMusicLensRhythmboxCollectionXmlParserPrivate UnityMusicLensRhythmboxCollectionXmlParserPrivate;
 
126
 
 
127
#define UNITY_MUSIC_LENS_TYPE_GENRE (unity_music_lens_genre_get_type ())
 
128
#define UNITY_MUSIC_LENS_GENRE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_GENRE, UnityMusicLensGenre))
 
129
#define UNITY_MUSIC_LENS_GENRE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_GENRE, UnityMusicLensGenreClass))
 
130
#define UNITY_MUSIC_LENS_IS_GENRE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_GENRE))
 
131
#define UNITY_MUSIC_LENS_IS_GENRE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_GENRE))
 
132
#define UNITY_MUSIC_LENS_GENRE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_GENRE, UnityMusicLensGenreClass))
 
133
 
 
134
typedef struct _UnityMusicLensGenre UnityMusicLensGenre;
 
135
typedef struct _UnityMusicLensGenreClass UnityMusicLensGenreClass;
 
136
#define _g_markup_parse_context_free0(var) ((var == NULL) ? NULL : (var = (g_markup_parse_context_free (var), NULL)))
 
137
 
 
138
typedef enum  {
 
139
        UNITY_MUSIC_LENS_COLUMNS_TYPE,
 
140
        UNITY_MUSIC_LENS_COLUMNS_URI,
 
141
        UNITY_MUSIC_LENS_COLUMNS_TITLE,
 
142
        UNITY_MUSIC_LENS_COLUMNS_ARTIST,
 
143
        UNITY_MUSIC_LENS_COLUMNS_ALBUM,
 
144
        UNITY_MUSIC_LENS_COLUMNS_ARTWORK,
 
145
        UNITY_MUSIC_LENS_COLUMNS_MIMETYPE,
 
146
        UNITY_MUSIC_LENS_COLUMNS_GENRE,
 
147
        UNITY_MUSIC_LENS_COLUMNS_ALBUM_ARTIST,
 
148
        UNITY_MUSIC_LENS_COLUMNS_TRACK_NUMBER,
 
149
        UNITY_MUSIC_LENS_COLUMNS_YEAR,
 
150
        UNITY_MUSIC_LENS_COLUMNS_PLAY_COUNT,
 
151
        UNITY_MUSIC_LENS_COLUMNS_DURATION,
 
152
        UNITY_MUSIC_LENS_COLUMNS_N_COLUMNS
 
153
} UnityMusicLensColumns;
 
154
 
 
155
struct _UnityMusicLensRhythmboxCollection {
 
156
        GObject parent_instance;
 
157
        UnityMusicLensRhythmboxCollectionPrivate * priv;
 
158
};
 
159
 
 
160
struct _UnityMusicLensRhythmboxCollectionClass {
 
161
        GObjectClass parent_class;
 
162
};
 
163
 
 
164
struct _UnityMusicLensRhythmboxCollectionPrivate {
 
165
        DeeSequenceModel* all_tracks;
 
166
        DeeModelTag* album_art_tag;
 
167
        DeeFilterModel* tracks_by_play_count;
 
168
        GHashTable* album_to_tracks_map;
 
169
        TDB_CONTEXT* album_art_tdb;
 
170
        GFileMonitor* tdb_monitor;
 
171
        gint current_album_art_tag;
 
172
        GHashTable* variant_store;
 
173
        GHashTable* int_variant_store;
 
174
        GVariant* row_buffer[13];
 
175
        DeeAnalyzer* analyzer;
 
176
        DeeIndex* index;
 
177
        DeeICUTermFilter* ascii_filter;
 
178
        gchar* media_art_dir;
 
179
};
 
180
 
 
181
typedef enum  {
 
182
        UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_ALBUM,
 
183
        UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_SONG,
 
184
        UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_RADIO
 
185
} UnityMusicLensRhythmboxCollectionResultType;
 
186
 
 
187
typedef enum  {
 
188
        UNITY_MUSIC_LENS_TRACK_TYPE_SONG,
 
189
        UNITY_MUSIC_LENS_TRACK_TYPE_RADIO
 
190
} UnityMusicLensTrackType;
 
191
 
 
192
struct _Block2Data {
 
193
        int _ref_count_;
 
194
        UnityMusicLensRhythmboxCollection * self;
 
195
        gchar* path;
 
196
};
 
197
 
 
198
struct _Block3Data {
 
199
        int _ref_count_;
 
200
        GPtrArray * self;
 
201
        GCompareDataFunc compare_func;
 
202
        gpointer compare_func_target;
 
203
};
 
204
 
 
205
typedef enum  {
 
206
        UNITY_MUSIC_LENS_CATEGORY_SONGS,
 
207
        UNITY_MUSIC_LENS_CATEGORY_ALBUMS,
 
208
        UNITY_MUSIC_LENS_CATEGORY_PURCHASE,
 
209
        UNITY_MUSIC_LENS_CATEGORY_MUSIC,
 
210
        UNITY_MUSIC_LENS_CATEGORY_RADIOS
 
211
} UnityMusicLensCategory;
 
212
 
 
213
struct _UnityMusicLensRhythmboxCollectionXmlParser {
 
214
        GObject parent_instance;
 
215
        UnityMusicLensRhythmboxCollectionXmlParserPrivate * priv;
 
216
};
 
217
 
 
218
struct _UnityMusicLensRhythmboxCollectionXmlParserClass {
 
219
        GObjectClass parent_class;
 
220
};
 
221
 
 
222
struct _UnityMusicLensRhythmboxCollectionXmlParserPrivate {
 
223
        UnityMusicLensGenre* genre;
 
224
        GMarkupParseContext* context;
 
225
        gboolean is_rhythmdb_xml;
 
226
        gboolean processing_track;
 
227
        UnityMusicLensTrack* current_track;
 
228
        gint current_data;
 
229
};
 
230
 
 
231
 
 
232
static gpointer unity_music_lens_rhythmbox_collection_parent_class = NULL;
 
233
static gpointer unity_music_lens_rhythmbox_collection_xml_parser_parent_class = NULL;
 
234
 
 
235
GType unity_music_lens_columns_get_type (void) G_GNUC_CONST;
 
236
GType unity_music_lens_rhythmbox_collection_get_type (void) G_GNUC_CONST;
 
237
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_COLLECTION, UnityMusicLensRhythmboxCollectionPrivate))
 
238
enum  {
 
239
        UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_DUMMY_PROPERTY
 
240
};
 
241
static GType unity_music_lens_rhythmbox_collection_result_type_get_type (void) G_GNUC_UNUSED;
 
242
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_UNKNOWN_ALBUM _ ("Unknown")
 
243
static void unity_music_lens_rhythmbox_collection_initialize_index (UnityMusicLensRhythmboxCollection* self);
 
244
static gchar* __lambda6_ (UnityMusicLensRhythmboxCollection* self, DeeModel* model, DeeModelIter* iter);
 
245
static gchar* ___lambda6__dee_model_reader_func (DeeModel* model, DeeModelIter* iter, gpointer self);
 
246
static gchar* unity_music_lens_rhythmbox_collection_check_album_art_tdb (UnityMusicLensRhythmboxCollection* self, const gchar* artist, const gchar* album);
 
247
GType unity_music_lens_track_get_type (void) G_GNUC_CONST;
 
248
static gchar* unity_music_lens_rhythmbox_collection_get_albumart (UnityMusicLensRhythmboxCollection* self, UnityMusicLensTrack* track);
 
249
const gchar* unity_music_lens_track_get_album_artist (UnityMusicLensTrack* self);
 
250
const gchar* unity_music_lens_track_get_artist (UnityMusicLensTrack* self);
 
251
const gchar* unity_music_lens_track_get_album (UnityMusicLensTrack* self);
 
252
const gchar* unity_music_lens_track_get_uri (UnityMusicLensTrack* self);
 
253
GSList* unity_music_lens_rhythmbox_collection_get_album_tracks (UnityMusicLensRhythmboxCollection* self, const gchar* album_key);
 
254
static UnityMusicLensTrack* unity_music_lens_rhythmbox_collection_get_track (UnityMusicLensRhythmboxCollection* self, DeeModelIter* iter);
 
255
UnityMusicLensTrack* unity_music_lens_track_new (void);
 
256
UnityMusicLensTrack* unity_music_lens_track_construct (GType object_type);
 
257
void unity_music_lens_track_set_uri (UnityMusicLensTrack* self, const gchar* value);
 
258
void unity_music_lens_track_set_title (UnityMusicLensTrack* self, const gchar* value);
 
259
void unity_music_lens_track_set_artist (UnityMusicLensTrack* self, const gchar* value);
 
260
void unity_music_lens_track_set_album (UnityMusicLensTrack* self, const gchar* value);
 
261
void unity_music_lens_track_set_artwork_path (UnityMusicLensTrack* self, const gchar* value);
 
262
void unity_music_lens_track_set_mime_type (UnityMusicLensTrack* self, const gchar* value);
 
263
void unity_music_lens_track_set_genre (UnityMusicLensTrack* self, const gchar* value);
 
264
void unity_music_lens_track_set_album_artist (UnityMusicLensTrack* self, const gchar* value);
 
265
void unity_music_lens_track_set_track_number (UnityMusicLensTrack* self, gint value);
 
266
void unity_music_lens_track_set_year (UnityMusicLensTrack* self, gint value);
 
267
void unity_music_lens_track_set_play_count (UnityMusicLensTrack* self, gint value);
 
268
void unity_music_lens_track_set_duration (UnityMusicLensTrack* self, gint value);
 
269
UnityMusicLensTrack* unity_music_lens_rhythmbox_collection_get_album_track (UnityMusicLensRhythmboxCollection* self, const gchar* uri);
 
270
GSList* unity_music_lens_rhythmbox_collection_get_album_tracks_detailed (UnityMusicLensRhythmboxCollection* self, const gchar* album_key);
 
271
static void _g_object_unref0_ (gpointer var);
 
272
static void _g_slist_free__g_object_unref0_ (GSList* self);
 
273
static GVariant* unity_music_lens_rhythmbox_collection_cached_variant_for_string (UnityMusicLensRhythmboxCollection* self, const gchar* input);
 
274
static GVariant* unity_music_lens_rhythmbox_collection_cached_variant_for_int (UnityMusicLensRhythmboxCollection* self, gint input);
 
275
static void unity_music_lens_rhythmbox_collection_prepare_row_buffer (UnityMusicLensRhythmboxCollection* self, UnityMusicLensTrack* track);
 
276
GType unity_music_lens_track_type_get_type (void) G_GNUC_CONST;
 
277
UnityMusicLensTrackType unity_music_lens_track_get_type_track (UnityMusicLensTrack* self);
 
278
const gchar* unity_music_lens_track_get_title (UnityMusicLensTrack* self);
 
279
const gchar* unity_music_lens_track_get_mime_type (UnityMusicLensTrack* self);
 
280
const gchar* unity_music_lens_track_get_artwork_path (UnityMusicLensTrack* self);
 
281
const gchar* unity_music_lens_track_get_genre (UnityMusicLensTrack* self);
 
282
gint unity_music_lens_track_get_track_number (UnityMusicLensTrack* self);
 
283
gint unity_music_lens_track_get_year (UnityMusicLensTrack* self);
 
284
gint unity_music_lens_track_get_play_count (UnityMusicLensTrack* self);
 
285
gint unity_music_lens_track_get_duration (UnityMusicLensTrack* self);
 
286
void unity_music_lens_rhythmbox_collection_parse_metadata_file (UnityMusicLensRhythmboxCollection* self, const gchar* path);
 
287
static Block2Data* block2_data_ref (Block2Data* _data2_);
 
288
static void block2_data_unref (void * _userdata_);
 
289
static void ____lambda7_ (Block2Data* _data2_);
 
290
static void _____lambda7__g_file_monitor_changed (GFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self);
 
291
void unity_music_lens_rhythmbox_collection_parse_file (UnityMusicLensRhythmboxCollection* self, const gchar* path);
 
292
UnityMusicLensRhythmboxCollectionXmlParser* unity_music_lens_rhythmbox_collection_xml_parser_new (void);
 
293
UnityMusicLensRhythmboxCollectionXmlParser* unity_music_lens_rhythmbox_collection_xml_parser_construct (GType object_type);
 
294
GType unity_music_lens_rhythmbox_collection_xml_parser_get_type (void) G_GNUC_CONST;
 
295
static void __lambda8_ (UnityMusicLensRhythmboxCollection* self, UnityMusicLensTrack* track);
 
296
static void ___lambda8__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready (UnityMusicLensRhythmboxCollectionXmlParser* _sender, UnityMusicLensTrack* track, gpointer self);
 
297
gboolean unity_music_lens_rhythmbox_collection_xml_parser_parse (UnityMusicLensRhythmboxCollectionXmlParser* self, const gchar* content, gsize len, GError** error);
 
298
static Block3Data* block3_data_ref (Block3Data* _data3_);
 
299
static void block3_data_unref (void * _userdata_);
 
300
static gint ___lambda1__gcompare_data_func (gconstpointer a, gconstpointer b, gpointer self);
 
301
static gint ____lambda9_ (UnityMusicLensRhythmboxCollection* self, DeeModelIter* a, DeeModelIter* b);
 
302
static gint _____lambda9__gcompare_data_func (gconstpointer a, gconstpointer b, gpointer self);
 
303
static void unity_music_lens_rhythmbox_collection_add_result (UnityMusicLensRhythmboxCollection* self, DeeModel* results_model, DeeModel* model, DeeModelIter* iter, UnityMusicLensRhythmboxCollectionResultType result_type, guint category_id);
 
304
GType unity_music_lens_filter_parser_get_type (void) G_GNUC_CONST;
 
305
void unity_music_lens_rhythmbox_collection_search (UnityMusicLensRhythmboxCollection* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, gint category_override);
 
306
static void unity_music_lens_rhythmbox_collection_get_decade_filter (UnityMusicLensRhythmboxCollection* self, GList* filters, gint* min_year, gint* max_year);
 
307
static GeeSet* unity_music_lens_rhythmbox_collection_get_genre_filter (UnityMusicLensRhythmboxCollection* self, GList* filters);
 
308
GType unity_music_lens_category_get_type (void) G_GNUC_CONST;
 
309
static gint ____lambda10_ (UnityMusicLensRhythmboxCollection* self, DeeModelIter* a, DeeModelIter* b);
 
310
static gint _____lambda10__gcompare_data_func (gconstpointer a, gconstpointer b, gpointer self);
 
311
GType unity_music_lens_decade_filter_parser_get_type (void) G_GNUC_CONST;
 
312
UnityFilter* unity_music_lens_filter_parser_get_filter (UnityMusicLensFilterParser* self);
 
313
GType unity_music_lens_genre_filter_parser_get_type (void) G_GNUC_CONST;
 
314
UnityMusicLensRhythmboxCollection* unity_music_lens_rhythmbox_collection_new (void);
 
315
UnityMusicLensRhythmboxCollection* unity_music_lens_rhythmbox_collection_construct (GType object_type);
 
316
static GObject * unity_music_lens_rhythmbox_collection_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
 
317
static void _g_variant_unref0_ (gpointer var);
 
318
static void _g_free0_ (gpointer var);
 
319
static void _g_ptr_array_unref0_ (gpointer var);
 
320
static gint _unity_music_lens_rhythmbox_collection___lambda11_ (UnityMusicLensRhythmboxCollection* self, GVariant** row1, int row1_length1, GVariant** row2, int row2_length1);
 
321
static gint __unity_music_lens_rhythmbox_collection___lambda11__dee_compare_row_func (GVariant** row1, GVariant** row2, gpointer self);
 
322
static void _unity_music_lens_rhythmbox_collection___lambda12_ (UnityMusicLensRhythmboxCollection* self, DeeTermList* terms_in, DeeTermList* terms_out);
 
323
static void __unity_music_lens_rhythmbox_collection___lambda12__dee_term_filter_func (DeeTermList* terms_in, DeeTermList* terms_out, gpointer self);
 
324
GType unity_music_lens_genre_get_type (void) G_GNUC_CONST;
 
325
#define UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_XML_PARSER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER, UnityMusicLensRhythmboxCollectionXmlParserPrivate))
 
326
enum  {
 
327
        UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_XML_PARSER_DUMMY_PROPERTY
 
328
};
 
329
UnityMusicLensGenre* unity_music_lens_genre_new (void);
 
330
UnityMusicLensGenre* unity_music_lens_genre_construct (GType object_type);
 
331
static void unity_music_lens_rhythmbox_collection_xml_parser_start_tag (UnityMusicLensRhythmboxCollectionXmlParser* self, GMarkupParseContext* context, const gchar* name, gchar** attr_names, gchar** attr_values, GError** error);
 
332
static void _unity_music_lens_rhythmbox_collection_xml_parser_start_tag_gmarkup_parser_start_element_func (GMarkupParseContext* context, const gchar* element_name, gchar** attribute_names, gchar** attribute_values, gpointer self, GError** error);
 
333
static void unity_music_lens_rhythmbox_collection_xml_parser_end_tag (UnityMusicLensRhythmboxCollectionXmlParser* self, GMarkupParseContext* content, const gchar* name, GError** error);
 
334
static void _unity_music_lens_rhythmbox_collection_xml_parser_end_tag_gmarkup_parser_end_element_func (GMarkupParseContext* context, const gchar* element_name, gpointer self, GError** error);
 
335
static void unity_music_lens_rhythmbox_collection_xml_parser_process_text (UnityMusicLensRhythmboxCollectionXmlParser* self, GMarkupParseContext* context, const gchar* text, gsize text_len, GError** error);
 
336
static void _unity_music_lens_rhythmbox_collection_xml_parser_process_text_gmarkup_parser_text_func (GMarkupParseContext* context, const gchar* text, gsize text_len, gpointer self, GError** error);
 
337
void unity_music_lens_track_set_type_track (UnityMusicLensTrack* self, UnityMusicLensTrackType value);
 
338
gchar* unity_music_lens_genre_get_id_for_genre (UnityMusicLensGenre* self, const gchar* genre);
 
339
static GObject * unity_music_lens_rhythmbox_collection_xml_parser_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
 
340
static void unity_music_lens_rhythmbox_collection_xml_parser_finalize (GObject* obj);
 
341
static void unity_music_lens_rhythmbox_collection_finalize (GObject* obj);
 
342
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
343
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
344
static gint _vala_array_length (gpointer array);
 
345
 
 
346
static const GMarkupParser UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_XML_PARSER_parser = {_unity_music_lens_rhythmbox_collection_xml_parser_start_tag_gmarkup_parser_start_element_func, _unity_music_lens_rhythmbox_collection_xml_parser_end_tag_gmarkup_parser_end_element_func, _unity_music_lens_rhythmbox_collection_xml_parser_process_text_gmarkup_parser_text_func, NULL, NULL};
 
347
 
 
348
GType unity_music_lens_columns_get_type (void) {
 
349
        static volatile gsize unity_music_lens_columns_type_id__volatile = 0;
 
350
        if (g_once_init_enter (&unity_music_lens_columns_type_id__volatile)) {
 
351
                static const GEnumValue values[] = {{UNITY_MUSIC_LENS_COLUMNS_TYPE, "UNITY_MUSIC_LENS_COLUMNS_TYPE", "type"}, {UNITY_MUSIC_LENS_COLUMNS_URI, "UNITY_MUSIC_LENS_COLUMNS_URI", "uri"}, {UNITY_MUSIC_LENS_COLUMNS_TITLE, "UNITY_MUSIC_LENS_COLUMNS_TITLE", "title"}, {UNITY_MUSIC_LENS_COLUMNS_ARTIST, "UNITY_MUSIC_LENS_COLUMNS_ARTIST", "artist"}, {UNITY_MUSIC_LENS_COLUMNS_ALBUM, "UNITY_MUSIC_LENS_COLUMNS_ALBUM", "album"}, {UNITY_MUSIC_LENS_COLUMNS_ARTWORK, "UNITY_MUSIC_LENS_COLUMNS_ARTWORK", "artwork"}, {UNITY_MUSIC_LENS_COLUMNS_MIMETYPE, "UNITY_MUSIC_LENS_COLUMNS_MIMETYPE", "mimetype"}, {UNITY_MUSIC_LENS_COLUMNS_GENRE, "UNITY_MUSIC_LENS_COLUMNS_GENRE", "genre"}, {UNITY_MUSIC_LENS_COLUMNS_ALBUM_ARTIST, "UNITY_MUSIC_LENS_COLUMNS_ALBUM_ARTIST", "album-artist"}, {UNITY_MUSIC_LENS_COLUMNS_TRACK_NUMBER, "UNITY_MUSIC_LENS_COLUMNS_TRACK_NUMBER", "track-number"}, {UNITY_MUSIC_LENS_COLUMNS_YEAR, "UNITY_MUSIC_LENS_COLUMNS_YEAR", "year"}, {UNITY_MUSIC_LENS_COLUMNS_PLAY_COUNT, "UNITY_MUSIC_LENS_COLUMNS_PLAY_COUNT", "play-count"}, {UNITY_MUSIC_LENS_COLUMNS_DURATION, "UNITY_MUSIC_LENS_COLUMNS_DURATION", "duration"}, {UNITY_MUSIC_LENS_COLUMNS_N_COLUMNS, "UNITY_MUSIC_LENS_COLUMNS_N_COLUMNS", "n-columns"}, {0, NULL, NULL}};
 
352
                GType unity_music_lens_columns_type_id;
 
353
                unity_music_lens_columns_type_id = g_enum_register_static ("UnityMusicLensColumns", values);
 
354
                g_once_init_leave (&unity_music_lens_columns_type_id__volatile, unity_music_lens_columns_type_id);
 
355
        }
 
356
        return unity_music_lens_columns_type_id__volatile;
 
357
}
 
358
 
 
359
 
 
360
static GType unity_music_lens_rhythmbox_collection_result_type_get_type (void) {
 
361
        static volatile gsize unity_music_lens_rhythmbox_collection_result_type_type_id__volatile = 0;
 
362
        if (g_once_init_enter (&unity_music_lens_rhythmbox_collection_result_type_type_id__volatile)) {
 
363
                static const GEnumValue values[] = {{UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_ALBUM, "UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_ALBUM", "album"}, {UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_SONG, "UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_SONG", "song"}, {UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_RADIO, "UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_RADIO", "radio"}, {0, NULL, NULL}};
 
364
                GType unity_music_lens_rhythmbox_collection_result_type_type_id;
 
365
                unity_music_lens_rhythmbox_collection_result_type_type_id = g_enum_register_static ("UnityMusicLensRhythmboxCollectionResultType", values);
 
366
                g_once_init_leave (&unity_music_lens_rhythmbox_collection_result_type_type_id__volatile, unity_music_lens_rhythmbox_collection_result_type_type_id);
 
367
        }
 
368
        return unity_music_lens_rhythmbox_collection_result_type_type_id__volatile;
 
369
}
 
370
 
 
371
 
 
372
static gchar* __lambda6_ (UnityMusicLensRhythmboxCollection* self, DeeModel* model, DeeModelIter* iter) {
 
373
        gchar* result = NULL;
 
374
        DeeModel* _tmp0_;
 
375
        DeeModelIter* _tmp1_;
 
376
        const gchar* _tmp2_ = NULL;
 
377
        DeeModel* _tmp3_;
 
378
        DeeModelIter* _tmp4_;
 
379
        const gchar* _tmp5_ = NULL;
 
380
        DeeModel* _tmp6_;
 
381
        DeeModelIter* _tmp7_;
 
382
        const gchar* _tmp8_ = NULL;
 
383
        gchar* _tmp9_ = NULL;
 
384
        gchar* s;
 
385
        g_return_val_if_fail (model != NULL, NULL);
 
386
        g_return_val_if_fail (iter != NULL, NULL);
 
387
        _tmp0_ = model;
 
388
        _tmp1_ = iter;
 
389
        _tmp2_ = dee_model_get_string (_tmp0_, _tmp1_, (guint) UNITY_MUSIC_LENS_COLUMNS_TITLE);
 
390
        _tmp3_ = model;
 
391
        _tmp4_ = iter;
 
392
        _tmp5_ = dee_model_get_string (_tmp3_, _tmp4_, (guint) UNITY_MUSIC_LENS_COLUMNS_ARTIST);
 
393
        _tmp6_ = model;
 
394
        _tmp7_ = iter;
 
395
        _tmp8_ = dee_model_get_string (_tmp6_, _tmp7_, (guint) UNITY_MUSIC_LENS_COLUMNS_ALBUM);
 
396
        _tmp9_ = g_strdup_printf ("%s\n%s\n%s", _tmp2_, _tmp5_, _tmp8_);
 
397
        s = _tmp9_;
 
398
        result = s;
 
399
        return result;
 
400
}
 
401
 
 
402
 
 
403
static gchar* ___lambda6__dee_model_reader_func (DeeModel* model, DeeModelIter* iter, gpointer self) {
 
404
        gchar* result;
 
405
        result = __lambda6_ (self, model, iter);
 
406
        return result;
 
407
}
 
408
 
 
409
 
 
410
static void unity_music_lens_rhythmbox_collection_initialize_index (UnityMusicLensRhythmboxCollection* self) {
 
411
        DeeModelReader _tmp0_ = {0};
 
412
        DeeModelReader reader;
 
413
        DeeSequenceModel* _tmp1_;
 
414
        DeeAnalyzer* _tmp2_;
 
415
        DeeModelReader _tmp3_;
 
416
        DeeTreeIndex* _tmp4_;
 
417
        g_return_if_fail (self != NULL);
 
418
        dee_model_reader_new (___lambda6__dee_model_reader_func, g_object_ref (self), g_object_unref, &_tmp0_);
 
419
        reader = _tmp0_;
 
420
        _tmp1_ = self->priv->all_tracks;
 
421
        _tmp2_ = self->priv->analyzer;
 
422
        _tmp3_ = reader;
 
423
        _tmp4_ = dee_tree_index_new ((DeeModel*) _tmp1_, _tmp2_, &_tmp3_);
 
424
        _g_object_unref0 (self->priv->index);
 
425
        self->priv->index = (DeeIndex*) _tmp4_;
 
426
}
 
427
 
 
428
 
 
429
static guint8* string_get_data (const gchar* self, int* result_length1) {
 
430
        guint8* result;
 
431
        guint8* res;
 
432
        gint res_length1;
 
433
        gint _res_size_;
 
434
        gint _tmp0_;
 
435
        gint _tmp1_;
 
436
        gint _tmp2_;
 
437
        guint8* _tmp3_;
 
438
        gint _tmp3__length1;
 
439
        guint8* _tmp4_;
 
440
        gint _tmp4__length1;
 
441
        g_return_val_if_fail (self != NULL, NULL);
 
442
        res = (guint8*) self;
 
443
        res_length1 = -1;
 
444
        _res_size_ = res_length1;
 
445
        _tmp0_ = strlen (self);
 
446
        _tmp1_ = _tmp0_;
 
447
        res_length1 = (gint) _tmp1_;
 
448
        _tmp2_ = res_length1;
 
449
        _tmp3_ = res;
 
450
        _tmp3__length1 = res_length1;
 
451
        _tmp4_ = _tmp3_;
 
452
        _tmp4__length1 = _tmp3__length1;
 
453
        if (result_length1) {
 
454
                *result_length1 = _tmp4__length1;
 
455
        }
 
456
        result = _tmp4_;
 
457
        return result;
 
458
}
 
459
 
 
460
 
 
461
static gchar* unity_music_lens_rhythmbox_collection_check_album_art_tdb (UnityMusicLensRhythmboxCollection* self, const gchar* artist, const gchar* album) {
 
462
        gchar* result = NULL;
 
463
        TDB_CONTEXT* _tmp0_;
 
464
        guint8 _tmp1_[1] = {0};
 
465
        guint8 null_helper[1];
 
466
        GByteArray* _tmp2_;
 
467
        GByteArray* byte_arr;
 
468
        GByteArray* _tmp3_;
 
469
        guint8* _tmp4_;
 
470
        gint _tmp4__length1;
 
471
        guint8* _tmp5_;
 
472
        gint _tmp5__length1;
 
473
        GByteArray* _tmp6_;
 
474
        GByteArray* _tmp7_;
 
475
        const gchar* _tmp8_;
 
476
        guint8* _tmp9_;
 
477
        gint _tmp9__length1;
 
478
        guint8* _tmp10_;
 
479
        gint _tmp10__length1;
 
480
        GByteArray* _tmp11_;
 
481
        GByteArray* _tmp12_;
 
482
        guint8* _tmp13_;
 
483
        gint _tmp13__length1;
 
484
        guint8* _tmp14_;
 
485
        gint _tmp14__length1;
 
486
        GByteArray* _tmp15_;
 
487
        GByteArray* _tmp16_;
 
488
        const gchar* _tmp17_;
 
489
        guint8* _tmp18_;
 
490
        gint _tmp18__length1;
 
491
        guint8* _tmp19_;
 
492
        gint _tmp19__length1;
 
493
        GByteArray* _tmp20_;
 
494
        TDB_DATA key;
 
495
        GByteArray* _tmp21_;
 
496
        guint8* _tmp22_;
 
497
        gint _tmp22__length1;
 
498
        TDB_CONTEXT* _tmp23_;
 
499
        TDB_DATA _tmp24_;
 
500
        TDB_DATA _tmp25_ = {0};
 
501
        TDB_DATA val;
 
502
        TDB_DATA _tmp26_;
 
503
        guint8* _tmp27_;
 
504
        gint _tmp27__length1;
 
505
        g_return_val_if_fail (self != NULL, NULL);
 
506
        g_return_val_if_fail (artist != NULL, NULL);
 
507
        g_return_val_if_fail (album != NULL, NULL);
 
508
        _tmp0_ = self->priv->album_art_tdb;
 
509
        if (_tmp0_ == NULL) {
 
510
                result = NULL;
 
511
                return result;
 
512
        }
 
513
        _tmp1_[0] = (guint8) 0;
 
514
        memcpy (null_helper, _tmp1_, 1 * sizeof (guint8));
 
515
        _tmp2_ = g_byte_array_new ();
 
516
        byte_arr = _tmp2_;
 
517
        _tmp3_ = byte_arr;
 
518
        _tmp4_ = string_get_data ("album", &_tmp4__length1);
 
519
        _tmp5_ = _tmp4_;
 
520
        _tmp5__length1 = _tmp4__length1;
 
521
        g_byte_array_append (_tmp3_, _tmp5_, _tmp5__length1);
 
522
        _tmp6_ = byte_arr;
 
523
        g_byte_array_append (_tmp6_, null_helper, 1);
 
524
        _tmp7_ = byte_arr;
 
525
        _tmp8_ = album;
 
526
        _tmp9_ = string_get_data (_tmp8_, &_tmp9__length1);
 
527
        _tmp10_ = _tmp9_;
 
528
        _tmp10__length1 = _tmp9__length1;
 
529
        g_byte_array_append (_tmp7_, _tmp10_, _tmp10__length1);
 
530
        _tmp11_ = byte_arr;
 
531
        g_byte_array_append (_tmp11_, null_helper, 1);
 
532
        _tmp12_ = byte_arr;
 
533
        _tmp13_ = string_get_data ("artist", &_tmp13__length1);
 
534
        _tmp14_ = _tmp13_;
 
535
        _tmp14__length1 = _tmp13__length1;
 
536
        g_byte_array_append (_tmp12_, _tmp14_, _tmp14__length1);
 
537
        _tmp15_ = byte_arr;
 
538
        g_byte_array_append (_tmp15_, null_helper, 1);
 
539
        _tmp16_ = byte_arr;
 
540
        _tmp17_ = artist;
 
541
        _tmp18_ = string_get_data (_tmp17_, &_tmp18__length1);
 
542
        _tmp19_ = _tmp18_;
 
543
        _tmp19__length1 = _tmp18__length1;
 
544
        g_byte_array_append (_tmp16_, _tmp19_, _tmp19__length1);
 
545
        _tmp20_ = byte_arr;
 
546
        g_byte_array_append (_tmp20_, null_helper, 1);
 
547
        key = tdb_null;
 
548
        _tmp21_ = byte_arr;
 
549
        _tmp22_ = _tmp21_->data;
 
550
        _tmp22__length1 = (gint) _tmp21_->len;
 
551
        key.dptr = _tmp22_;
 
552
        key.dsize = _tmp22__length1;
 
553
        _tmp23_ = self->priv->album_art_tdb;
 
554
        _tmp24_ = key;
 
555
        _tmp25_ = tdb_fetch (_tmp23_, _tmp24_);
 
556
        val = _tmp25_;
 
557
        _tmp26_ = val;
 
558
        _tmp27_ = _tmp26_.dptr;
 
559
        _tmp27__length1 = (gint) _tmp26_.dsize;
 
560
        if (_tmp27_ != NULL) {
 
561
                GVariantType* _tmp28_;
 
562
                GVariantType* _tmp29_;
 
563
                TDB_DATA _tmp30_;
 
564
                guint8* _tmp31_;
 
565
                gint _tmp31__length1;
 
566
                GVariant* _tmp32_ = NULL;
 
567
                GVariant* _tmp33_;
 
568
                GVariant* _tmp34_;
 
569
                GVariant* v;
 
570
                GVariant* _tmp35_;
 
571
                const GVariantType* _tmp36_;
 
572
                GVariant* _tmp37_ = NULL;
 
573
                GVariant* file_variant;
 
574
                GVariant* _tmp38_;
 
575
                _tmp28_ = g_variant_type_new ("a{sv}");
 
576
                _tmp29_ = _tmp28_;
 
577
                _tmp30_ = val;
 
578
                _tmp31_ = _tmp30_.dptr;
 
579
                _tmp31__length1 = (gint) _tmp30_.dsize;
 
580
                _tmp32_ = g_variant_new_from_data (_tmp29_, _tmp31_, _tmp31__length1, FALSE, NULL, NULL);
 
581
                _tmp33_ = g_variant_ref_sink (_tmp32_);
 
582
                _tmp34_ = _tmp33_;
 
583
                _g_variant_type_free0 (_tmp29_);
 
584
                v = _tmp34_;
 
585
                _tmp35_ = v;
 
586
                _tmp36_ = G_VARIANT_TYPE_STRING;
 
587
                _tmp37_ = g_variant_lookup_value (_tmp35_, "file", _tmp36_);
 
588
                file_variant = _tmp37_;
 
589
                _tmp38_ = file_variant;
 
590
                if (_tmp38_ != NULL) {
 
591
                        GVariant* _tmp39_;
 
592
                        const gchar* _tmp40_ = NULL;
 
593
                        gchar* _tmp41_;
 
594
                        _tmp39_ = file_variant;
 
595
                        _tmp40_ = g_variant_get_string (_tmp39_, NULL);
 
596
                        _tmp41_ = g_strdup (_tmp40_);
 
597
                        result = _tmp41_;
 
598
                        _g_variant_unref0 (file_variant);
 
599
                        _g_variant_unref0 (v);
 
600
                        _g_byte_array_unref0 (byte_arr);
 
601
                        return result;
 
602
                }
 
603
                _g_variant_unref0 (file_variant);
 
604
                _g_variant_unref0 (v);
 
605
        }
 
606
        result = NULL;
 
607
        _g_byte_array_unref0 (byte_arr);
 
608
        return result;
 
609
}
 
610
 
 
611
 
 
612
static gchar* unity_music_lens_rhythmbox_collection_get_albumart (UnityMusicLensRhythmboxCollection* self, UnityMusicLensTrack* track) {
 
613
        gchar* result = NULL;
 
614
        gchar* filename = NULL;
 
615
        UnityMusicLensTrack* _tmp0_;
 
616
        const gchar* _tmp1_;
 
617
        const gchar* _tmp2_;
 
618
        gchar* _tmp3_;
 
619
        gchar* _tmp4_;
 
620
        const gchar* _tmp5_;
 
621
        const gchar* _tmp10_;
 
622
        gchar* _tmp11_;
 
623
        gchar* artist;
 
624
        UnityMusicLensTrack* _tmp12_;
 
625
        const gchar* _tmp13_;
 
626
        const gchar* _tmp14_;
 
627
        gchar* _tmp15_;
 
628
        gchar* album;
 
629
        const gchar* _tmp16_;
 
630
        gchar* _tmp17_ = NULL;
 
631
        gchar* artist_norm;
 
632
        const gchar* _tmp18_;
 
633
        gchar* _tmp19_ = NULL;
 
634
        gchar* album_norm;
 
635
        const gchar* _tmp20_;
 
636
        const gchar* _tmp21_;
 
637
        gchar* _tmp22_ = NULL;
 
638
        const gchar* _tmp23_;
 
639
        const gchar* _tmp29_;
 
640
        gchar* _tmp30_ = NULL;
 
641
        gchar* artist_md5;
 
642
        const gchar* _tmp31_;
 
643
        gchar* _tmp32_ = NULL;
 
644
        gchar* album_md5;
 
645
        const gchar* _tmp33_;
 
646
        const gchar* _tmp34_;
 
647
        const gchar* _tmp35_;
 
648
        gchar* _tmp36_ = NULL;
 
649
        gchar* _tmp37_;
 
650
        gchar* _tmp38_ = NULL;
 
651
        const gchar* _tmp39_;
 
652
        gboolean _tmp40_ = FALSE;
 
653
        const gchar* _tmp41_;
 
654
        const gchar* _tmp42_;
 
655
        gchar* _tmp43_ = NULL;
 
656
        gchar* _tmp44_;
 
657
        gchar* _tmp45_ = NULL;
 
658
        gchar* _tmp46_;
 
659
        gchar* combined;
 
660
        const gchar* _tmp47_;
 
661
        const gchar* _tmp48_;
 
662
        gchar* _tmp49_ = NULL;
 
663
        gchar* _tmp50_;
 
664
        gchar* _tmp51_ = NULL;
 
665
        gchar* _tmp52_;
 
666
        gchar* _tmp53_ = NULL;
 
667
        const gchar* _tmp54_;
 
668
        gboolean _tmp55_ = FALSE;
 
669
        const gchar* _tmp66_ = NULL;
 
670
        UnityMusicLensTrack* _tmp67_;
 
671
        const gchar* _tmp68_;
 
672
        const gchar* _tmp69_;
 
673
        UnityMusicLensTrack* _tmp70_;
 
674
        const gchar* _tmp71_;
 
675
        const gchar* _tmp72_;
 
676
        gchar* _tmp73_ = NULL;
 
677
        gchar* _tmp74_;
 
678
        gchar* _tmp75_ = NULL;
 
679
        gchar* _tmp76_;
 
680
        gchar* artwork;
 
681
        const gchar* _tmp77_;
 
682
        gboolean _tmp78_ = FALSE;
 
683
        GError * _inner_error_ = NULL;
 
684
        g_return_val_if_fail (self != NULL, NULL);
 
685
        g_return_val_if_fail (track != NULL, NULL);
 
686
        _tmp0_ = track;
 
687
        _tmp1_ = unity_music_lens_track_get_album_artist (_tmp0_);
 
688
        _tmp2_ = _tmp1_;
 
689
        _tmp3_ = g_strdup (_tmp2_);
 
690
        _tmp4_ = _tmp3_;
 
691
        _tmp5_ = _tmp4_;
 
692
        if (_tmp5_ == NULL) {
 
693
                UnityMusicLensTrack* _tmp6_;
 
694
                const gchar* _tmp7_;
 
695
                const gchar* _tmp8_;
 
696
                gchar* _tmp9_;
 
697
                _tmp6_ = track;
 
698
                _tmp7_ = unity_music_lens_track_get_artist (_tmp6_);
 
699
                _tmp8_ = _tmp7_;
 
700
                _tmp9_ = g_strdup (_tmp8_);
 
701
                _g_free0 (_tmp4_);
 
702
                _tmp4_ = _tmp9_;
 
703
        }
 
704
        _tmp10_ = _tmp4_;
 
705
        _tmp11_ = g_strdup (_tmp10_);
 
706
        artist = _tmp11_;
 
707
        _tmp12_ = track;
 
708
        _tmp13_ = unity_music_lens_track_get_album (_tmp12_);
 
709
        _tmp14_ = _tmp13_;
 
710
        _tmp15_ = g_strdup (_tmp14_);
 
711
        album = _tmp15_;
 
712
        _tmp16_ = artist;
 
713
        _tmp17_ = g_utf8_normalize (_tmp16_, (gssize) (-1), G_NORMALIZE_NFKD);
 
714
        artist_norm = _tmp17_;
 
715
        _tmp18_ = album;
 
716
        _tmp19_ = g_utf8_normalize (_tmp18_, (gssize) (-1), G_NORMALIZE_NFKD);
 
717
        album_norm = _tmp19_;
 
718
        _tmp20_ = artist;
 
719
        _tmp21_ = album;
 
720
        _tmp22_ = unity_music_lens_rhythmbox_collection_check_album_art_tdb (self, _tmp20_, _tmp21_);
 
721
        _g_free0 (filename);
 
722
        filename = _tmp22_;
 
723
        _tmp23_ = filename;
 
724
        if (_tmp23_ != NULL) {
 
725
                const gchar* _tmp24_ = NULL;
 
726
                const gchar* _tmp25_;
 
727
                gchar* _tmp26_ = NULL;
 
728
                const gchar* _tmp27_;
 
729
                gboolean _tmp28_ = FALSE;
 
730
                _tmp24_ = g_get_user_cache_dir ();
 
731
                _tmp25_ = filename;
 
732
                _tmp26_ = g_build_filename (_tmp24_, "rhythmbox", "album-art", _tmp25_, NULL);
 
733
                _g_free0 (filename);
 
734
                filename = _tmp26_;
 
735
                _tmp27_ = filename;
 
736
                _tmp28_ = g_file_test (_tmp27_, G_FILE_TEST_EXISTS);
 
737
                if (_tmp28_) {
 
738
                        result = filename;
 
739
                        _g_free0 (album_norm);
 
740
                        _g_free0 (artist_norm);
 
741
                        _g_free0 (album);
 
742
                        _g_free0 (artist);
 
743
                        _g_free0 (_tmp4_);
 
744
                        return result;
 
745
                }
 
746
        }
 
747
        _tmp29_ = artist_norm;
 
748
        _tmp30_ = g_compute_checksum_for_string (G_CHECKSUM_MD5, _tmp29_, (gsize) (-1));
 
749
        artist_md5 = _tmp30_;
 
750
        _tmp31_ = album_norm;
 
751
        _tmp32_ = g_compute_checksum_for_string (G_CHECKSUM_MD5, _tmp31_, (gsize) (-1));
 
752
        album_md5 = _tmp32_;
 
753
        _tmp33_ = self->priv->media_art_dir;
 
754
        _tmp34_ = artist_md5;
 
755
        _tmp35_ = album_md5;
 
756
        _tmp36_ = g_strdup_printf ("album-%s-%s", _tmp34_, _tmp35_);
 
757
        _tmp37_ = _tmp36_;
 
758
        _tmp38_ = g_build_filename (_tmp33_, _tmp37_, NULL);
 
759
        _g_free0 (filename);
 
760
        filename = _tmp38_;
 
761
        _g_free0 (_tmp37_);
 
762
        _tmp39_ = filename;
 
763
        _tmp40_ = g_file_test (_tmp39_, G_FILE_TEST_EXISTS);
 
764
        if (_tmp40_) {
 
765
                result = filename;
 
766
                _g_free0 (album_md5);
 
767
                _g_free0 (artist_md5);
 
768
                _g_free0 (album_norm);
 
769
                _g_free0 (artist_norm);
 
770
                _g_free0 (album);
 
771
                _g_free0 (artist);
 
772
                _g_free0 (_tmp4_);
 
773
                return result;
 
774
        }
 
775
        _tmp41_ = artist;
 
776
        _tmp42_ = album;
 
777
        _tmp43_ = g_strdup_printf ("%s\t%s", _tmp41_, _tmp42_);
 
778
        _tmp44_ = _tmp43_;
 
779
        _tmp45_ = g_utf8_normalize (_tmp44_, (gssize) (-1), G_NORMALIZE_NFKD);
 
780
        _tmp46_ = _tmp45_;
 
781
        _g_free0 (_tmp44_);
 
782
        combined = _tmp46_;
 
783
        _tmp47_ = self->priv->media_art_dir;
 
784
        _tmp48_ = combined;
 
785
        _tmp49_ = g_compute_checksum_for_string (G_CHECKSUM_MD5, _tmp48_, (gsize) (-1));
 
786
        _tmp50_ = _tmp49_;
 
787
        _tmp51_ = g_strdup_printf ("album-%s.jpg", _tmp50_);
 
788
        _tmp52_ = _tmp51_;
 
789
        _tmp53_ = g_build_filename (_tmp47_, _tmp52_, NULL);
 
790
        _g_free0 (filename);
 
791
        filename = _tmp53_;
 
792
        _g_free0 (_tmp52_);
 
793
        _g_free0 (_tmp50_);
 
794
        _tmp54_ = filename;
 
795
        _tmp55_ = g_file_test (_tmp54_, G_FILE_TEST_EXISTS);
 
796
        if (_tmp55_) {
 
797
                result = filename;
 
798
                _g_free0 (combined);
 
799
                _g_free0 (album_md5);
 
800
                _g_free0 (artist_md5);
 
801
                _g_free0 (album_norm);
 
802
                _g_free0 (artist_norm);
 
803
                _g_free0 (album);
 
804
                _g_free0 (artist);
 
805
                _g_free0 (_tmp4_);
 
806
                return result;
 
807
        }
 
808
        {
 
809
                UnityMusicLensTrack* _tmp56_;
 
810
                const gchar* _tmp57_;
 
811
                const gchar* _tmp58_;
 
812
                GFile* _tmp59_ = NULL;
 
813
                GFile* artwork_file;
 
814
                GFile* _tmp60_;
 
815
                GFileInfo* _tmp61_ = NULL;
 
816
                GFileInfo* info;
 
817
                GFileInfo* _tmp62_;
 
818
                const gchar* _tmp63_ = NULL;
 
819
                gchar* _tmp64_;
 
820
                gchar* thumbnail_path;
 
821
                const gchar* _tmp65_;
 
822
                _tmp56_ = track;
 
823
                _tmp57_ = unity_music_lens_track_get_uri (_tmp56_);
 
824
                _tmp58_ = _tmp57_;
 
825
                _tmp59_ = g_file_new_for_uri (_tmp58_);
 
826
                artwork_file = _tmp59_;
 
827
                _tmp60_ = artwork_file;
 
828
                _tmp61_ = g_file_query_info (_tmp60_, G_FILE_ATTRIBUTE_THUMBNAIL_PATH, 0, NULL, &_inner_error_);
 
829
                info = _tmp61_;
 
830
                if (_inner_error_ != NULL) {
 
831
                        _g_object_unref0 (artwork_file);
 
832
                        goto __catch10_g_error;
 
833
                }
 
834
                _tmp62_ = info;
 
835
                _tmp63_ = g_file_info_get_attribute_string (_tmp62_, G_FILE_ATTRIBUTE_THUMBNAIL_PATH);
 
836
                _tmp64_ = g_strdup (_tmp63_);
 
837
                thumbnail_path = _tmp64_;
 
838
                _tmp65_ = thumbnail_path;
 
839
                if (_tmp65_ != NULL) {
 
840
                        result = thumbnail_path;
 
841
                        _g_object_unref0 (info);
 
842
                        _g_object_unref0 (artwork_file);
 
843
                        _g_free0 (combined);
 
844
                        _g_free0 (album_md5);
 
845
                        _g_free0 (artist_md5);
 
846
                        _g_free0 (album_norm);
 
847
                        _g_free0 (artist_norm);
 
848
                        _g_free0 (album);
 
849
                        _g_free0 (artist);
 
850
                        _g_free0 (_tmp4_);
 
851
                        _g_free0 (filename);
 
852
                        return result;
 
853
                }
 
854
                _g_free0 (thumbnail_path);
 
855
                _g_object_unref0 (info);
 
856
                _g_object_unref0 (artwork_file);
 
857
        }
 
858
        goto __finally10;
 
859
        __catch10_g_error:
 
860
        {
 
861
                g_clear_error (&_inner_error_);
 
862
                _inner_error_ = NULL;
 
863
        }
 
864
        __finally10:
 
865
        if (_inner_error_ != NULL) {
 
866
                _g_free0 (combined);
 
867
                _g_free0 (album_md5);
 
868
                _g_free0 (artist_md5);
 
869
                _g_free0 (album_norm);
 
870
                _g_free0 (artist_norm);
 
871
                _g_free0 (album);
 
872
                _g_free0 (artist);
 
873
                _g_free0 (_tmp4_);
 
874
                _g_free0 (filename);
 
875
                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);
 
876
                g_clear_error (&_inner_error_);
 
877
                return NULL;
 
878
        }
 
879
        _tmp66_ = g_get_user_cache_dir ();
 
880
        _tmp67_ = track;
 
881
        _tmp68_ = unity_music_lens_track_get_artist (_tmp67_);
 
882
        _tmp69_ = _tmp68_;
 
883
        _tmp70_ = track;
 
884
        _tmp71_ = unity_music_lens_track_get_album (_tmp70_);
 
885
        _tmp72_ = _tmp71_;
 
886
        _tmp73_ = g_strdup_printf ("%s - %s.jpg", _tmp69_, _tmp72_);
 
887
        _tmp74_ = _tmp73_;
 
888
        _tmp75_ = g_build_filename (_tmp66_, "rhythmbox", "covers", _tmp74_, NULL);
 
889
        _tmp76_ = _tmp75_;
 
890
        _g_free0 (_tmp74_);
 
891
        artwork = _tmp76_;
 
892
        _tmp77_ = artwork;
 
893
        _tmp78_ = g_file_test (_tmp77_, G_FILE_TEST_EXISTS);
 
894
        if (_tmp78_) {
 
895
                result = artwork;
 
896
                _g_free0 (combined);
 
897
                _g_free0 (album_md5);
 
898
                _g_free0 (artist_md5);
 
899
                _g_free0 (album_norm);
 
900
                _g_free0 (artist_norm);
 
901
                _g_free0 (album);
 
902
                _g_free0 (artist);
 
903
                _g_free0 (_tmp4_);
 
904
                _g_free0 (filename);
 
905
                return result;
 
906
        }
 
907
        result = NULL;
 
908
        _g_free0 (artwork);
 
909
        _g_free0 (combined);
 
910
        _g_free0 (album_md5);
 
911
        _g_free0 (artist_md5);
 
912
        _g_free0 (album_norm);
 
913
        _g_free0 (artist_norm);
 
914
        _g_free0 (album);
 
915
        _g_free0 (artist);
 
916
        _g_free0 (_tmp4_);
 
917
        _g_free0 (filename);
 
918
        return result;
 
919
}
 
920
 
 
921
 
 
922
static gpointer _g_ptr_array_ref0 (gpointer self) {
 
923
        return self ? g_ptr_array_ref (self) : NULL;
 
924
}
 
925
 
 
926
 
 
927
static gint g_ptr_array_get_length (GPtrArray* self) {
 
928
        gint result;
 
929
        guint _tmp0_;
 
930
        g_return_val_if_fail (self != NULL, 0);
 
931
        _tmp0_ = self->len;
 
932
        result = (gint) _tmp0_;
 
933
        return result;
 
934
}
 
935
 
 
936
 
 
937
static void g_ptr_array_set_length (GPtrArray* self, gint value) {
 
938
        gint _tmp0_;
 
939
        g_return_if_fail (self != NULL);
 
940
        _tmp0_ = value;
 
941
        g_ptr_array_set_size (self, _tmp0_);
 
942
}
 
943
 
 
944
 
 
945
GSList* unity_music_lens_rhythmbox_collection_get_album_tracks (UnityMusicLensRhythmboxCollection* self, const gchar* album_key) {
 
946
        GSList* result = NULL;
 
947
        GSList* results;
 
948
        GHashTable* _tmp0_;
 
949
        const gchar* _tmp1_;
 
950
        gconstpointer _tmp2_ = NULL;
 
951
        GPtrArray* _tmp3_;
 
952
        GPtrArray* iter_arr;
 
953
        GPtrArray* _tmp4_;
 
954
        g_return_val_if_fail (self != NULL, NULL);
 
955
        g_return_val_if_fail (album_key != NULL, NULL);
 
956
        results = NULL;
 
957
        _tmp0_ = self->priv->album_to_tracks_map;
 
958
        _tmp1_ = album_key;
 
959
        _tmp2_ = g_hash_table_lookup (_tmp0_, _tmp1_);
 
960
        _tmp3_ = _g_ptr_array_ref0 ((GPtrArray*) _tmp2_);
 
961
        iter_arr = _tmp3_;
 
962
        _tmp4_ = iter_arr;
 
963
        if (_tmp4_ != NULL) {
 
964
                {
 
965
                        GPtrArray* _tmp5_;
 
966
                        gint _tmp6_;
 
967
                        gint _tmp7_;
 
968
                        gint i;
 
969
                        _tmp5_ = iter_arr;
 
970
                        _tmp6_ = g_ptr_array_get_length (_tmp5_);
 
971
                        _tmp7_ = _tmp6_;
 
972
                        i = _tmp7_ - 1;
 
973
                        {
 
974
                                gboolean _tmp8_;
 
975
                                _tmp8_ = TRUE;
 
976
                                while (TRUE) {
 
977
                                        gboolean _tmp9_;
 
978
                                        gint _tmp11_;
 
979
                                        DeeSequenceModel* _tmp12_;
 
980
                                        GPtrArray* _tmp13_;
 
981
                                        gint _tmp14_;
 
982
                                        gconstpointer _tmp15_ = NULL;
 
983
                                        const gchar* _tmp16_ = NULL;
 
984
                                        _tmp9_ = _tmp8_;
 
985
                                        if (!_tmp9_) {
 
986
                                                gint _tmp10_;
 
987
                                                _tmp10_ = i;
 
988
                                                i = _tmp10_ - 1;
 
989
                                        }
 
990
                                        _tmp8_ = FALSE;
 
991
                                        _tmp11_ = i;
 
992
                                        if (!(_tmp11_ >= 0)) {
 
993
                                                break;
 
994
                                        }
 
995
                                        _tmp12_ = self->priv->all_tracks;
 
996
                                        _tmp13_ = iter_arr;
 
997
                                        _tmp14_ = i;
 
998
                                        _tmp15_ = g_ptr_array_index (_tmp13_, (guint) _tmp14_);
 
999
                                        _tmp16_ = dee_model_get_string ((DeeModel*) _tmp12_, (DeeModelIter*) _tmp15_, (guint) UNITY_MUSIC_LENS_COLUMNS_URI);
 
1000
                                        results = g_slist_prepend (results, _tmp16_);
 
1001
                                }
 
1002
                        }
 
1003
                }
 
1004
        }
 
1005
        result = results;
 
1006
        _g_ptr_array_unref0 (iter_arr);
 
1007
        return result;
 
1008
}
 
1009
 
 
1010
 
 
1011
static UnityMusicLensTrack* unity_music_lens_rhythmbox_collection_get_track (UnityMusicLensRhythmboxCollection* self, DeeModelIter* iter) {
 
1012
        UnityMusicLensTrack* result = NULL;
 
1013
        UnityMusicLensTrack* _tmp0_;
 
1014
        UnityMusicLensTrack* track;
 
1015
        DeeSequenceModel* _tmp1_;
 
1016
        DeeModelIter* _tmp2_;
 
1017
        const gchar* _tmp3_ = NULL;
 
1018
        DeeSequenceModel* _tmp4_;
 
1019
        DeeModelIter* _tmp5_;
 
1020
        const gchar* _tmp6_ = NULL;
 
1021
        DeeSequenceModel* _tmp7_;
 
1022
        DeeModelIter* _tmp8_;
 
1023
        const gchar* _tmp9_ = NULL;
 
1024
        DeeSequenceModel* _tmp10_;
 
1025
        DeeModelIter* _tmp11_;
 
1026
        const gchar* _tmp12_ = NULL;
 
1027
        DeeSequenceModel* _tmp13_;
 
1028
        DeeModelIter* _tmp14_;
 
1029
        const gchar* _tmp15_ = NULL;
 
1030
        DeeSequenceModel* _tmp16_;
 
1031
        DeeModelIter* _tmp17_;
 
1032
        const gchar* _tmp18_ = NULL;
 
1033
        DeeSequenceModel* _tmp19_;
 
1034
        DeeModelIter* _tmp20_;
 
1035
        const gchar* _tmp21_ = NULL;
 
1036
        DeeSequenceModel* _tmp22_;
 
1037
        DeeModelIter* _tmp23_;
 
1038
        const gchar* _tmp24_ = NULL;
 
1039
        DeeSequenceModel* _tmp25_;
 
1040
        DeeModelIter* _tmp26_;
 
1041
        gint32 _tmp27_ = 0;
 
1042
        DeeSequenceModel* _tmp28_;
 
1043
        DeeModelIter* _tmp29_;
 
1044
        gint32 _tmp30_ = 0;
 
1045
        DeeSequenceModel* _tmp31_;
 
1046
        DeeModelIter* _tmp32_;
 
1047
        gint32 _tmp33_ = 0;
 
1048
        DeeSequenceModel* _tmp34_;
 
1049
        DeeModelIter* _tmp35_;
 
1050
        gint32 _tmp36_ = 0;
 
1051
        g_return_val_if_fail (self != NULL, NULL);
 
1052
        g_return_val_if_fail (iter != NULL, NULL);
 
1053
        _tmp0_ = unity_music_lens_track_new ();
 
1054
        track = _tmp0_;
 
1055
        _tmp1_ = self->priv->all_tracks;
 
1056
        _tmp2_ = iter;
 
1057
        _tmp3_ = dee_model_get_string ((DeeModel*) _tmp1_, _tmp2_, (guint) UNITY_MUSIC_LENS_COLUMNS_URI);
 
1058
        unity_music_lens_track_set_uri (track, _tmp3_);
 
1059
        _tmp4_ = self->priv->all_tracks;
 
1060
        _tmp5_ = iter;
 
1061
        _tmp6_ = dee_model_get_string ((DeeModel*) _tmp4_, _tmp5_, (guint) UNITY_MUSIC_LENS_COLUMNS_TITLE);
 
1062
        unity_music_lens_track_set_title (track, _tmp6_);
 
1063
        _tmp7_ = self->priv->all_tracks;
 
1064
        _tmp8_ = iter;
 
1065
        _tmp9_ = dee_model_get_string ((DeeModel*) _tmp7_, _tmp8_, (guint) UNITY_MUSIC_LENS_COLUMNS_ARTIST);
 
1066
        unity_music_lens_track_set_artist (track, _tmp9_);
 
1067
        _tmp10_ = self->priv->all_tracks;
 
1068
        _tmp11_ = iter;
 
1069
        _tmp12_ = dee_model_get_string ((DeeModel*) _tmp10_, _tmp11_, (guint) UNITY_MUSIC_LENS_COLUMNS_ALBUM);
 
1070
        unity_music_lens_track_set_album (track, _tmp12_);
 
1071
        _tmp13_ = self->priv->all_tracks;
 
1072
        _tmp14_ = iter;
 
1073
        _tmp15_ = dee_model_get_string ((DeeModel*) _tmp13_, _tmp14_, (guint) UNITY_MUSIC_LENS_COLUMNS_ARTWORK);
 
1074
        unity_music_lens_track_set_artwork_path (track, _tmp15_);
 
1075
        _tmp16_ = self->priv->all_tracks;
 
1076
        _tmp17_ = iter;
 
1077
        _tmp18_ = dee_model_get_string ((DeeModel*) _tmp16_, _tmp17_, (guint) UNITY_MUSIC_LENS_COLUMNS_MIMETYPE);
 
1078
        unity_music_lens_track_set_mime_type (track, _tmp18_);
 
1079
        _tmp19_ = self->priv->all_tracks;
 
1080
        _tmp20_ = iter;
 
1081
        _tmp21_ = dee_model_get_string ((DeeModel*) _tmp19_, _tmp20_, (guint) UNITY_MUSIC_LENS_COLUMNS_GENRE);
 
1082
        unity_music_lens_track_set_genre (track, _tmp21_);
 
1083
        _tmp22_ = self->priv->all_tracks;
 
1084
        _tmp23_ = iter;
 
1085
        _tmp24_ = dee_model_get_string ((DeeModel*) _tmp22_, _tmp23_, (guint) UNITY_MUSIC_LENS_COLUMNS_ALBUM_ARTIST);
 
1086
        unity_music_lens_track_set_album_artist (track, _tmp24_);
 
1087
        _tmp25_ = self->priv->all_tracks;
 
1088
        _tmp26_ = iter;
 
1089
        _tmp27_ = dee_model_get_int32 ((DeeModel*) _tmp25_, _tmp26_, (guint) UNITY_MUSIC_LENS_COLUMNS_TRACK_NUMBER);
 
1090
        unity_music_lens_track_set_track_number (track, (gint) _tmp27_);
 
1091
        _tmp28_ = self->priv->all_tracks;
 
1092
        _tmp29_ = iter;
 
1093
        _tmp30_ = dee_model_get_int32 ((DeeModel*) _tmp28_, _tmp29_, (guint) UNITY_MUSIC_LENS_COLUMNS_YEAR);
 
1094
        unity_music_lens_track_set_year (track, (gint) _tmp30_);
 
1095
        _tmp31_ = self->priv->all_tracks;
 
1096
        _tmp32_ = iter;
 
1097
        _tmp33_ = dee_model_get_int32 ((DeeModel*) _tmp31_, _tmp32_, (guint) UNITY_MUSIC_LENS_COLUMNS_PLAY_COUNT);
 
1098
        unity_music_lens_track_set_play_count (track, (gint) _tmp33_);
 
1099
        _tmp34_ = self->priv->all_tracks;
 
1100
        _tmp35_ = iter;
 
1101
        _tmp36_ = dee_model_get_int32 ((DeeModel*) _tmp34_, _tmp35_, (guint) UNITY_MUSIC_LENS_COLUMNS_DURATION);
 
1102
        unity_music_lens_track_set_duration (track, (gint) _tmp36_);
 
1103
        result = track;
 
1104
        return result;
 
1105
}
 
1106
 
 
1107
 
 
1108
UnityMusicLensTrack* unity_music_lens_rhythmbox_collection_get_album_track (UnityMusicLensRhythmboxCollection* self, const gchar* uri) {
 
1109
        UnityMusicLensTrack* result = NULL;
 
1110
        DeeSequenceModel* _tmp0_;
 
1111
        DeeModelIter* _tmp1_ = NULL;
 
1112
        DeeModelIter* iter;
 
1113
        DeeSequenceModel* _tmp2_;
 
1114
        DeeModelIter* _tmp3_ = NULL;
 
1115
        DeeModelIter* end_iter;
 
1116
        g_return_val_if_fail (self != NULL, NULL);
 
1117
        g_return_val_if_fail (uri != NULL, NULL);
 
1118
        _tmp0_ = self->priv->all_tracks;
 
1119
        _tmp1_ = dee_model_get_first_iter ((DeeModel*) _tmp0_);
 
1120
        iter = _tmp1_;
 
1121
        _tmp2_ = self->priv->all_tracks;
 
1122
        _tmp3_ = dee_model_get_last_iter ((DeeModel*) _tmp2_);
 
1123
        end_iter = _tmp3_;
 
1124
        while (TRUE) {
 
1125
                DeeModelIter* _tmp4_;
 
1126
                DeeModelIter* _tmp5_;
 
1127
                DeeSequenceModel* _tmp6_;
 
1128
                DeeModelIter* _tmp7_;
 
1129
                const gchar* _tmp8_ = NULL;
 
1130
                const gchar* _tmp9_;
 
1131
                DeeSequenceModel* _tmp12_;
 
1132
                DeeModelIter* _tmp13_;
 
1133
                DeeModelIter* _tmp14_ = NULL;
 
1134
                _tmp4_ = iter;
 
1135
                _tmp5_ = end_iter;
 
1136
                if (!(_tmp4_ != _tmp5_)) {
 
1137
                        break;
 
1138
                }
 
1139
                _tmp6_ = self->priv->all_tracks;
 
1140
                _tmp7_ = iter;
 
1141
                _tmp8_ = dee_model_get_string ((DeeModel*) _tmp6_, _tmp7_, (guint) UNITY_MUSIC_LENS_COLUMNS_URI);
 
1142
                _tmp9_ = uri;
 
1143
                if (g_strcmp0 (_tmp8_, _tmp9_) == 0) {
 
1144
                        DeeModelIter* _tmp10_;
 
1145
                        UnityMusicLensTrack* _tmp11_ = NULL;
 
1146
                        _tmp10_ = iter;
 
1147
                        _tmp11_ = unity_music_lens_rhythmbox_collection_get_track (self, _tmp10_);
 
1148
                        result = _tmp11_;
 
1149
                        return result;
 
1150
                }
 
1151
                _tmp12_ = self->priv->all_tracks;
 
1152
                _tmp13_ = iter;
 
1153
                _tmp14_ = dee_model_next ((DeeModel*) _tmp12_, _tmp13_);
 
1154
                iter = _tmp14_;
 
1155
        }
 
1156
        result = NULL;
 
1157
        return result;
 
1158
}
 
1159
 
 
1160
 
 
1161
static void _g_object_unref0_ (gpointer var) {
 
1162
        (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
 
1163
}
 
1164
 
 
1165
 
 
1166
static void _g_slist_free__g_object_unref0_ (GSList* self) {
 
1167
        g_slist_foreach (self, (GFunc) _g_object_unref0_, NULL);
 
1168
        g_slist_free (self);
 
1169
}
 
1170
 
 
1171
 
 
1172
GSList* unity_music_lens_rhythmbox_collection_get_album_tracks_detailed (UnityMusicLensRhythmboxCollection* self, const gchar* album_key) {
 
1173
        GSList* result = NULL;
 
1174
        GSList* results;
 
1175
        GHashTable* _tmp0_;
 
1176
        const gchar* _tmp1_;
 
1177
        gconstpointer _tmp2_ = NULL;
 
1178
        GPtrArray* _tmp3_;
 
1179
        GPtrArray* iter_arr;
 
1180
        GPtrArray* _tmp4_;
 
1181
        g_return_val_if_fail (self != NULL, NULL);
 
1182
        g_return_val_if_fail (album_key != NULL, NULL);
 
1183
        results = NULL;
 
1184
        _tmp0_ = self->priv->album_to_tracks_map;
 
1185
        _tmp1_ = album_key;
 
1186
        _tmp2_ = g_hash_table_lookup (_tmp0_, _tmp1_);
 
1187
        _tmp3_ = _g_ptr_array_ref0 ((GPtrArray*) _tmp2_);
 
1188
        iter_arr = _tmp3_;
 
1189
        _tmp4_ = iter_arr;
 
1190
        if (_tmp4_ != NULL) {
 
1191
                {
 
1192
                        GPtrArray* _tmp5_;
 
1193
                        gint _tmp6_;
 
1194
                        gint _tmp7_;
 
1195
                        gint i;
 
1196
                        _tmp5_ = iter_arr;
 
1197
                        _tmp6_ = g_ptr_array_get_length (_tmp5_);
 
1198
                        _tmp7_ = _tmp6_;
 
1199
                        i = _tmp7_ - 1;
 
1200
                        {
 
1201
                                gboolean _tmp8_;
 
1202
                                _tmp8_ = TRUE;
 
1203
                                while (TRUE) {
 
1204
                                        gboolean _tmp9_;
 
1205
                                        gint _tmp11_;
 
1206
                                        GPtrArray* _tmp12_;
 
1207
                                        gint _tmp13_;
 
1208
                                        gconstpointer _tmp14_ = NULL;
 
1209
                                        UnityMusicLensTrack* _tmp15_ = NULL;
 
1210
                                        _tmp9_ = _tmp8_;
 
1211
                                        if (!_tmp9_) {
 
1212
                                                gint _tmp10_;
 
1213
                                                _tmp10_ = i;
 
1214
                                                i = _tmp10_ - 1;
 
1215
                                        }
 
1216
                                        _tmp8_ = FALSE;
 
1217
                                        _tmp11_ = i;
 
1218
                                        if (!(_tmp11_ >= 0)) {
 
1219
                                                break;
 
1220
                                        }
 
1221
                                        _tmp12_ = iter_arr;
 
1222
                                        _tmp13_ = i;
 
1223
                                        _tmp14_ = g_ptr_array_index (_tmp12_, (guint) _tmp13_);
 
1224
                                        _tmp15_ = unity_music_lens_rhythmbox_collection_get_track (self, (DeeModelIter*) _tmp14_);
 
1225
                                        results = g_slist_prepend (results, _tmp15_);
 
1226
                                }
 
1227
                        }
 
1228
                }
 
1229
        }
 
1230
        result = results;
 
1231
        _g_ptr_array_unref0 (iter_arr);
 
1232
        return result;
 
1233
}
 
1234
 
 
1235
 
 
1236
static gpointer _g_variant_ref0 (gpointer self) {
 
1237
        return self ? g_variant_ref (self) : NULL;
 
1238
}
 
1239
 
 
1240
 
 
1241
static GVariant* unity_music_lens_rhythmbox_collection_cached_variant_for_string (UnityMusicLensRhythmboxCollection* self, const gchar* input) {
 
1242
        GVariant* result = NULL;
 
1243
        const gchar* _tmp0_ = NULL;
 
1244
        const gchar* _tmp1_;
 
1245
        const gchar* _tmp3_;
 
1246
        const gchar* text;
 
1247
        GHashTable* _tmp4_;
 
1248
        const gchar* _tmp5_;
 
1249
        gconstpointer _tmp6_ = NULL;
 
1250
        GVariant* _tmp7_;
 
1251
        GVariant* v;
 
1252
        GVariant* _tmp8_;
 
1253
        const gchar* _tmp9_;
 
1254
        GVariant* _tmp10_;
 
1255
        GVariant* _tmp11_;
 
1256
        GHashTable* _tmp12_;
 
1257
        GVariant* _tmp13_;
 
1258
        const gchar* _tmp14_ = NULL;
 
1259
        GVariant* _tmp15_;
 
1260
        GVariant* _tmp16_;
 
1261
        g_return_val_if_fail (self != NULL, NULL);
 
1262
        _tmp1_ = input;
 
1263
        if (_tmp1_ != NULL) {
 
1264
                const gchar* _tmp2_;
 
1265
                _tmp2_ = input;
 
1266
                _tmp0_ = _tmp2_;
 
1267
        } else {
 
1268
                _tmp0_ = "";
 
1269
        }
 
1270
        _tmp3_ = _tmp0_;
 
1271
        text = _tmp3_;
 
1272
        _tmp4_ = self->priv->variant_store;
 
1273
        _tmp5_ = text;
 
1274
        _tmp6_ = g_hash_table_lookup (_tmp4_, _tmp5_);
 
1275
        _tmp7_ = _g_variant_ref0 ((GVariant*) _tmp6_);
 
1276
        v = _tmp7_;
 
1277
        _tmp8_ = v;
 
1278
        if (_tmp8_ != NULL) {
 
1279
                result = v;
 
1280
                return result;
 
1281
        }
 
1282
        _tmp9_ = text;
 
1283
        _tmp10_ = g_variant_new_string (_tmp9_);
 
1284
        _tmp11_ = g_variant_ref_sink (_tmp10_);
 
1285
        _g_variant_unref0 (v);
 
1286
        v = _tmp11_;
 
1287
        _tmp12_ = self->priv->variant_store;
 
1288
        _tmp13_ = v;
 
1289
        _tmp14_ = g_variant_get_string (_tmp13_, NULL);
 
1290
        _tmp15_ = v;
 
1291
        _tmp16_ = _g_variant_ref0 (_tmp15_);
 
1292
        g_hash_table_insert (_tmp12_, _tmp14_, _tmp16_);
 
1293
        result = v;
 
1294
        return result;
 
1295
}
 
1296
 
 
1297
 
 
1298
static GVariant* unity_music_lens_rhythmbox_collection_cached_variant_for_int (UnityMusicLensRhythmboxCollection* self, gint input) {
 
1299
        GVariant* result = NULL;
 
1300
        GHashTable* _tmp0_;
 
1301
        gint _tmp1_;
 
1302
        gconstpointer _tmp2_ = NULL;
 
1303
        GVariant* _tmp3_;
 
1304
        GVariant* v;
 
1305
        GVariant* _tmp4_;
 
1306
        gint _tmp5_;
 
1307
        GVariant* _tmp6_;
 
1308
        GVariant* _tmp7_;
 
1309
        gint _tmp8_;
 
1310
        g_return_val_if_fail (self != NULL, NULL);
 
1311
        _tmp0_ = self->priv->int_variant_store;
 
1312
        _tmp1_ = input;
 
1313
        _tmp2_ = g_hash_table_lookup (_tmp0_, GINT_TO_POINTER (_tmp1_));
 
1314
        _tmp3_ = _g_variant_ref0 ((GVariant*) _tmp2_);
 
1315
        v = _tmp3_;
 
1316
        _tmp4_ = v;
 
1317
        if (_tmp4_ != NULL) {
 
1318
                result = v;
 
1319
                return result;
 
1320
        }
 
1321
        _tmp5_ = input;
 
1322
        _tmp6_ = g_variant_new_int32 ((gint32) _tmp5_);
 
1323
        _tmp7_ = g_variant_ref_sink (_tmp6_);
 
1324
        _g_variant_unref0 (v);
 
1325
        v = _tmp7_;
 
1326
        _tmp8_ = input;
 
1327
        if (_tmp8_ < 128) {
 
1328
                GHashTable* _tmp9_;
 
1329
                gint _tmp10_;
 
1330
                GVariant* _tmp11_;
 
1331
                GVariant* _tmp12_;
 
1332
                _tmp9_ = self->priv->int_variant_store;
 
1333
                _tmp10_ = input;
 
1334
                _tmp11_ = v;
 
1335
                _tmp12_ = _g_variant_ref0 (_tmp11_);
 
1336
                g_hash_table_insert (_tmp9_, GINT_TO_POINTER (_tmp10_), _tmp12_);
 
1337
        }
 
1338
        result = v;
 
1339
        return result;
 
1340
}
 
1341
 
 
1342
 
 
1343
static void unity_music_lens_rhythmbox_collection_prepare_row_buffer (UnityMusicLensRhythmboxCollection* self, UnityMusicLensTrack* track) {
 
1344
        UnityMusicLensTrack* _tmp0_;
 
1345
        UnityMusicLensTrackType _tmp1_;
 
1346
        UnityMusicLensTrackType _tmp2_;
 
1347
        GVariant* _tmp3_ = NULL;
 
1348
        GVariant* type;
 
1349
        UnityMusicLensTrack* _tmp4_;
 
1350
        const gchar* _tmp5_;
 
1351
        const gchar* _tmp6_;
 
1352
        GVariant* _tmp7_;
 
1353
        GVariant* _tmp8_;
 
1354
        GVariant* uri;
 
1355
        UnityMusicLensTrack* _tmp9_;
 
1356
        const gchar* _tmp10_;
 
1357
        const gchar* _tmp11_;
 
1358
        GVariant* _tmp12_;
 
1359
        GVariant* _tmp13_;
 
1360
        GVariant* title;
 
1361
        UnityMusicLensTrack* _tmp14_;
 
1362
        const gchar* _tmp15_;
 
1363
        const gchar* _tmp16_;
 
1364
        GVariant* _tmp17_ = NULL;
 
1365
        GVariant* artist;
 
1366
        UnityMusicLensTrack* _tmp18_;
 
1367
        const gchar* _tmp19_;
 
1368
        const gchar* _tmp20_;
 
1369
        GVariant* _tmp21_ = NULL;
 
1370
        GVariant* album_artist;
 
1371
        UnityMusicLensTrack* _tmp22_;
 
1372
        const gchar* _tmp23_;
 
1373
        const gchar* _tmp24_;
 
1374
        GVariant* _tmp25_ = NULL;
 
1375
        GVariant* album;
 
1376
        UnityMusicLensTrack* _tmp26_;
 
1377
        const gchar* _tmp27_;
 
1378
        const gchar* _tmp28_;
 
1379
        GVariant* _tmp29_ = NULL;
 
1380
        GVariant* mime_type;
 
1381
        UnityMusicLensTrack* _tmp30_;
 
1382
        const gchar* _tmp31_;
 
1383
        const gchar* _tmp32_;
 
1384
        GVariant* _tmp33_ = NULL;
 
1385
        GVariant* artwork;
 
1386
        UnityMusicLensTrack* _tmp34_;
 
1387
        const gchar* _tmp35_;
 
1388
        const gchar* _tmp36_;
 
1389
        GVariant* _tmp37_ = NULL;
 
1390
        GVariant* genre;
 
1391
        UnityMusicLensTrack* _tmp38_;
 
1392
        gint _tmp39_;
 
1393
        gint _tmp40_;
 
1394
        GVariant* _tmp41_ = NULL;
 
1395
        GVariant* track_number;
 
1396
        UnityMusicLensTrack* _tmp42_;
 
1397
        gint _tmp43_;
 
1398
        gint _tmp44_;
 
1399
        GVariant* _tmp45_ = NULL;
 
1400
        GVariant* year;
 
1401
        UnityMusicLensTrack* _tmp46_;
 
1402
        gint _tmp47_;
 
1403
        gint _tmp48_;
 
1404
        GVariant* _tmp49_ = NULL;
 
1405
        GVariant* play_count;
 
1406
        UnityMusicLensTrack* _tmp50_;
 
1407
        gint _tmp51_;
 
1408
        gint _tmp52_;
 
1409
        GVariant* _tmp53_ = NULL;
 
1410
        GVariant* duration;
 
1411
        GVariant* _tmp54_;
 
1412
        GVariant* _tmp55_;
 
1413
        GVariant* _tmp56_;
 
1414
        GVariant* _tmp57_;
 
1415
        GVariant* _tmp58_;
 
1416
        GVariant* _tmp59_;
 
1417
        GVariant* _tmp60_;
 
1418
        GVariant* _tmp61_;
 
1419
        GVariant* _tmp62_;
 
1420
        GVariant* _tmp63_;
 
1421
        GVariant* _tmp64_;
 
1422
        GVariant* _tmp65_;
 
1423
        GVariant* _tmp66_;
 
1424
        GVariant* _tmp67_;
 
1425
        GVariant* _tmp68_;
 
1426
        GVariant* _tmp69_;
 
1427
        GVariant* _tmp70_;
 
1428
        GVariant* _tmp71_;
 
1429
        GVariant* _tmp72_;
 
1430
        GVariant* _tmp73_;
 
1431
        GVariant* _tmp74_;
 
1432
        GVariant* _tmp75_;
 
1433
        GVariant* _tmp76_;
 
1434
        GVariant* _tmp77_;
 
1435
        GVariant* _tmp78_;
 
1436
        GVariant* _tmp79_;
 
1437
        g_return_if_fail (self != NULL);
 
1438
        g_return_if_fail (track != NULL);
 
1439
        _tmp0_ = track;
 
1440
        _tmp1_ = unity_music_lens_track_get_type_track (_tmp0_);
 
1441
        _tmp2_ = _tmp1_;
 
1442
        _tmp3_ = unity_music_lens_rhythmbox_collection_cached_variant_for_int (self, (gint) _tmp2_);
 
1443
        type = _tmp3_;
 
1444
        _tmp4_ = track;
 
1445
        _tmp5_ = unity_music_lens_track_get_uri (_tmp4_);
 
1446
        _tmp6_ = _tmp5_;
 
1447
        _tmp7_ = g_variant_new_string (_tmp6_);
 
1448
        _tmp8_ = g_variant_ref_sink (_tmp7_);
 
1449
        uri = _tmp8_;
 
1450
        _tmp9_ = track;
 
1451
        _tmp10_ = unity_music_lens_track_get_title (_tmp9_);
 
1452
        _tmp11_ = _tmp10_;
 
1453
        _tmp12_ = g_variant_new_string (_tmp11_);
 
1454
        _tmp13_ = g_variant_ref_sink (_tmp12_);
 
1455
        title = _tmp13_;
 
1456
        _tmp14_ = track;
 
1457
        _tmp15_ = unity_music_lens_track_get_artist (_tmp14_);
 
1458
        _tmp16_ = _tmp15_;
 
1459
        _tmp17_ = unity_music_lens_rhythmbox_collection_cached_variant_for_string (self, _tmp16_);
 
1460
        artist = _tmp17_;
 
1461
        _tmp18_ = track;
 
1462
        _tmp19_ = unity_music_lens_track_get_album_artist (_tmp18_);
 
1463
        _tmp20_ = _tmp19_;
 
1464
        _tmp21_ = unity_music_lens_rhythmbox_collection_cached_variant_for_string (self, _tmp20_);
 
1465
        album_artist = _tmp21_;
 
1466
        _tmp22_ = track;
 
1467
        _tmp23_ = unity_music_lens_track_get_album (_tmp22_);
 
1468
        _tmp24_ = _tmp23_;
 
1469
        _tmp25_ = unity_music_lens_rhythmbox_collection_cached_variant_for_string (self, _tmp24_);
 
1470
        album = _tmp25_;
 
1471
        _tmp26_ = track;
 
1472
        _tmp27_ = unity_music_lens_track_get_mime_type (_tmp26_);
 
1473
        _tmp28_ = _tmp27_;
 
1474
        _tmp29_ = unity_music_lens_rhythmbox_collection_cached_variant_for_string (self, _tmp28_);
 
1475
        mime_type = _tmp29_;
 
1476
        _tmp30_ = track;
 
1477
        _tmp31_ = unity_music_lens_track_get_artwork_path (_tmp30_);
 
1478
        _tmp32_ = _tmp31_;
 
1479
        _tmp33_ = unity_music_lens_rhythmbox_collection_cached_variant_for_string (self, _tmp32_);
 
1480
        artwork = _tmp33_;
 
1481
        _tmp34_ = track;
 
1482
        _tmp35_ = unity_music_lens_track_get_genre (_tmp34_);
 
1483
        _tmp36_ = _tmp35_;
 
1484
        _tmp37_ = unity_music_lens_rhythmbox_collection_cached_variant_for_string (self, _tmp36_);
 
1485
        genre = _tmp37_;
 
1486
        _tmp38_ = track;
 
1487
        _tmp39_ = unity_music_lens_track_get_track_number (_tmp38_);
 
1488
        _tmp40_ = _tmp39_;
 
1489
        _tmp41_ = unity_music_lens_rhythmbox_collection_cached_variant_for_int (self, _tmp40_);
 
1490
        track_number = _tmp41_;
 
1491
        _tmp42_ = track;
 
1492
        _tmp43_ = unity_music_lens_track_get_year (_tmp42_);
 
1493
        _tmp44_ = _tmp43_;
 
1494
        _tmp45_ = unity_music_lens_rhythmbox_collection_cached_variant_for_int (self, _tmp44_);
 
1495
        year = _tmp45_;
 
1496
        _tmp46_ = track;
 
1497
        _tmp47_ = unity_music_lens_track_get_play_count (_tmp46_);
 
1498
        _tmp48_ = _tmp47_;
 
1499
        _tmp49_ = unity_music_lens_rhythmbox_collection_cached_variant_for_int (self, _tmp48_);
 
1500
        play_count = _tmp49_;
 
1501
        _tmp50_ = track;
 
1502
        _tmp51_ = unity_music_lens_track_get_duration (_tmp50_);
 
1503
        _tmp52_ = _tmp51_;
 
1504
        _tmp53_ = unity_music_lens_rhythmbox_collection_cached_variant_for_int (self, _tmp52_);
 
1505
        duration = _tmp53_;
 
1506
        _tmp54_ = _g_variant_ref0 (type);
 
1507
        _g_variant_unref0 (self->priv->row_buffer[0]);
 
1508
        self->priv->row_buffer[0] = _tmp54_;
 
1509
        _tmp55_ = self->priv->row_buffer[0];
 
1510
        _tmp56_ = _g_variant_ref0 (uri);
 
1511
        _g_variant_unref0 (self->priv->row_buffer[1]);
 
1512
        self->priv->row_buffer[1] = _tmp56_;
 
1513
        _tmp57_ = self->priv->row_buffer[1];
 
1514
        _tmp58_ = _g_variant_ref0 (title);
 
1515
        _g_variant_unref0 (self->priv->row_buffer[2]);
 
1516
        self->priv->row_buffer[2] = _tmp58_;
 
1517
        _tmp59_ = self->priv->row_buffer[2];
 
1518
        _tmp60_ = _g_variant_ref0 (artist);
 
1519
        _g_variant_unref0 (self->priv->row_buffer[3]);
 
1520
        self->priv->row_buffer[3] = _tmp60_;
 
1521
        _tmp61_ = self->priv->row_buffer[3];
 
1522
        _tmp62_ = _g_variant_ref0 (album);
 
1523
        _g_variant_unref0 (self->priv->row_buffer[4]);
 
1524
        self->priv->row_buffer[4] = _tmp62_;
 
1525
        _tmp63_ = self->priv->row_buffer[4];
 
1526
        _tmp64_ = _g_variant_ref0 (artwork);
 
1527
        _g_variant_unref0 (self->priv->row_buffer[5]);
 
1528
        self->priv->row_buffer[5] = _tmp64_;
 
1529
        _tmp65_ = self->priv->row_buffer[5];
 
1530
        _tmp66_ = _g_variant_ref0 (mime_type);
 
1531
        _g_variant_unref0 (self->priv->row_buffer[6]);
 
1532
        self->priv->row_buffer[6] = _tmp66_;
 
1533
        _tmp67_ = self->priv->row_buffer[6];
 
1534
        _tmp68_ = _g_variant_ref0 (genre);
 
1535
        _g_variant_unref0 (self->priv->row_buffer[7]);
 
1536
        self->priv->row_buffer[7] = _tmp68_;
 
1537
        _tmp69_ = self->priv->row_buffer[7];
 
1538
        _tmp70_ = _g_variant_ref0 (album_artist);
 
1539
        _g_variant_unref0 (self->priv->row_buffer[8]);
 
1540
        self->priv->row_buffer[8] = _tmp70_;
 
1541
        _tmp71_ = self->priv->row_buffer[8];
 
1542
        _tmp72_ = _g_variant_ref0 (track_number);
 
1543
        _g_variant_unref0 (self->priv->row_buffer[9]);
 
1544
        self->priv->row_buffer[9] = _tmp72_;
 
1545
        _tmp73_ = self->priv->row_buffer[9];
 
1546
        _tmp74_ = _g_variant_ref0 (year);
 
1547
        _g_variant_unref0 (self->priv->row_buffer[10]);
 
1548
        self->priv->row_buffer[10] = _tmp74_;
 
1549
        _tmp75_ = self->priv->row_buffer[10];
 
1550
        _tmp76_ = _g_variant_ref0 (play_count);
 
1551
        _g_variant_unref0 (self->priv->row_buffer[11]);
 
1552
        self->priv->row_buffer[11] = _tmp76_;
 
1553
        _tmp77_ = self->priv->row_buffer[11];
 
1554
        _tmp78_ = _g_variant_ref0 (duration);
 
1555
        _g_variant_unref0 (self->priv->row_buffer[12]);
 
1556
        self->priv->row_buffer[12] = _tmp78_;
 
1557
        _tmp79_ = self->priv->row_buffer[12];
 
1558
        _g_variant_unref0 (duration);
 
1559
        _g_variant_unref0 (play_count);
 
1560
        _g_variant_unref0 (year);
 
1561
        _g_variant_unref0 (track_number);
 
1562
        _g_variant_unref0 (genre);
 
1563
        _g_variant_unref0 (artwork);
 
1564
        _g_variant_unref0 (mime_type);
 
1565
        _g_variant_unref0 (album);
 
1566
        _g_variant_unref0 (album_artist);
 
1567
        _g_variant_unref0 (artist);
 
1568
        _g_variant_unref0 (title);
 
1569
        _g_variant_unref0 (uri);
 
1570
        _g_variant_unref0 (type);
 
1571
}
 
1572
 
 
1573
 
 
1574
static Block2Data* block2_data_ref (Block2Data* _data2_) {
 
1575
        g_atomic_int_inc (&_data2_->_ref_count_);
 
1576
        return _data2_;
 
1577
}
 
1578
 
 
1579
 
 
1580
static void block2_data_unref (void * _userdata_) {
 
1581
        Block2Data* _data2_;
 
1582
        _data2_ = (Block2Data*) _userdata_;
 
1583
        if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
 
1584
                UnityMusicLensRhythmboxCollection * self;
 
1585
                self = _data2_->self;
 
1586
                _g_free0 (_data2_->path);
 
1587
                _g_object_unref0 (self);
 
1588
                g_slice_free (Block2Data, _data2_);
 
1589
        }
 
1590
}
 
1591
 
 
1592
 
 
1593
static void ____lambda7_ (Block2Data* _data2_) {
 
1594
        UnityMusicLensRhythmboxCollection * self;
 
1595
        TDB_CONTEXT* _tmp0_;
 
1596
        self = _data2_->self;
 
1597
        _tmp0_ = self->priv->album_art_tdb;
 
1598
        if (_tmp0_ == NULL) {
 
1599
                const gchar* _tmp1_;
 
1600
                _tmp1_ = _data2_->path;
 
1601
                unity_music_lens_rhythmbox_collection_parse_metadata_file (self, _tmp1_);
 
1602
        } else {
 
1603
                gint _tmp2_;
 
1604
                _tmp2_ = self->priv->current_album_art_tag;
 
1605
                self->priv->current_album_art_tag = _tmp2_ + 1;
 
1606
        }
 
1607
}
 
1608
 
 
1609
 
 
1610
static void _____lambda7__g_file_monitor_changed (GFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self) {
 
1611
        ____lambda7_ (self);
 
1612
}
 
1613
 
 
1614
 
 
1615
void unity_music_lens_rhythmbox_collection_parse_metadata_file (UnityMusicLensRhythmboxCollection* self, const gchar* path) {
 
1616
        Block2Data* _data2_;
 
1617
        const gchar* _tmp0_;
 
1618
        gchar* _tmp1_;
 
1619
        TDB_CONTEXT* _tmp2_;
 
1620
        GFileMonitor* _tmp3_;
 
1621
        int flags;
 
1622
        const gchar* _tmp12_;
 
1623
        int _tmp13_;
 
1624
        TDB_CONTEXT* _tmp14_;
 
1625
        TDB_CONTEXT* _tmp15_;
 
1626
        GError * _inner_error_ = NULL;
 
1627
        g_return_if_fail (self != NULL);
 
1628
        g_return_if_fail (path != NULL);
 
1629
        _data2_ = g_slice_new0 (Block2Data);
 
1630
        _data2_->_ref_count_ = 1;
 
1631
        _data2_->self = g_object_ref (self);
 
1632
        _tmp0_ = path;
 
1633
        _tmp1_ = g_strdup (_tmp0_);
 
1634
        _data2_->path = _tmp1_;
 
1635
        _tmp2_ = self->priv->album_art_tdb;
 
1636
        if (_tmp2_ != NULL) {
 
1637
                block2_data_unref (_data2_);
 
1638
                _data2_ = NULL;
 
1639
                return;
 
1640
        }
 
1641
        _tmp3_ = self->priv->tdb_monitor;
 
1642
        if (_tmp3_ == NULL) {
 
1643
                const gchar* _tmp4_;
 
1644
                GFile* _tmp5_ = NULL;
 
1645
                GFile* tdb_file;
 
1646
                _tmp4_ = _data2_->path;
 
1647
                _tmp5_ = g_file_new_for_path (_tmp4_);
 
1648
                tdb_file = _tmp5_;
 
1649
                {
 
1650
                        GFile* _tmp6_;
 
1651
                        GFileMonitor* _tmp7_ = NULL;
 
1652
                        GFileMonitor* _tmp8_;
 
1653
                        GFileMonitor* _tmp9_;
 
1654
                        _tmp6_ = tdb_file;
 
1655
                        _tmp7_ = g_file_monitor (_tmp6_, G_FILE_MONITOR_NONE, NULL, &_inner_error_);
 
1656
                        _tmp8_ = _tmp7_;
 
1657
                        if (_inner_error_ != NULL) {
 
1658
                                goto __catch11_g_error;
 
1659
                        }
 
1660
                        _g_object_unref0 (self->priv->tdb_monitor);
 
1661
                        self->priv->tdb_monitor = _tmp8_;
 
1662
                        _tmp9_ = self->priv->tdb_monitor;
 
1663
                        g_signal_connect_data (_tmp9_, "changed", (GCallback) _____lambda7__g_file_monitor_changed, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
 
1664
                }
 
1665
                goto __finally11;
 
1666
                __catch11_g_error:
 
1667
                {
 
1668
                        GError* err = NULL;
 
1669
                        GError* _tmp10_;
 
1670
                        const gchar* _tmp11_;
 
1671
                        err = _inner_error_;
 
1672
                        _inner_error_ = NULL;
 
1673
                        _tmp10_ = err;
 
1674
                        _tmp11_ = _tmp10_->message;
 
1675
                        g_warning ("rhythmbox-collection.vala:495: %s", _tmp11_);
 
1676
                        _g_error_free0 (err);
 
1677
                }
 
1678
                __finally11:
 
1679
                if (_inner_error_ != NULL) {
 
1680
                        _g_object_unref0 (tdb_file);
 
1681
                        block2_data_unref (_data2_);
 
1682
                        _data2_ = NULL;
 
1683
                        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);
 
1684
                        g_clear_error (&_inner_error_);
 
1685
                        return;
 
1686
                }
 
1687
                _g_object_unref0 (tdb_file);
 
1688
        }
 
1689
        flags = (TDB_INCOMPATIBLE_HASH | TDB_SEQNUM) | TDB_NOLOCK;
 
1690
        _tmp12_ = _data2_->path;
 
1691
        _tmp13_ = flags;
 
1692
        _tmp14_ = tdb_open (_tmp12_, 999, _tmp13_, O_RDONLY, (mode_t) 0600);
 
1693
        _tdb_close0 (self->priv->album_art_tdb);
 
1694
        self->priv->album_art_tdb = _tmp14_;
 
1695
        _tmp15_ = self->priv->album_art_tdb;
 
1696
        if (_tmp15_ == NULL) {
 
1697
                g_warning ("rhythmbox-collection.vala:504: Unable to open album-art DB!");
 
1698
                block2_data_unref (_data2_);
 
1699
                _data2_ = NULL;
 
1700
                return;
 
1701
        }
 
1702
        block2_data_unref (_data2_);
 
1703
        _data2_ = NULL;
 
1704
}
 
1705
 
 
1706
 
 
1707
static void __lambda8_ (UnityMusicLensRhythmboxCollection* self, UnityMusicLensTrack* track) {
 
1708
        UnityMusicLensTrack* _tmp0_;
 
1709
        gchar* _tmp1_ = NULL;
 
1710
        gchar* albumart;
 
1711
        const gchar* _tmp2_;
 
1712
        UnityMusicLensTrack* _tmp6_;
 
1713
        DeeSequenceModel* _tmp7_;
 
1714
        DeeModelIter* _tmp8_ = NULL;
 
1715
        DeeModelIter* iter;
 
1716
        gboolean _tmp9_ = FALSE;
 
1717
        UnityMusicLensTrack* _tmp10_;
 
1718
        const gchar* _tmp11_;
 
1719
        const gchar* _tmp12_;
 
1720
        gboolean _tmp16_;
 
1721
        const gchar* _tmp17_ = NULL;
 
1722
        UnityMusicLensTrack* _tmp18_;
 
1723
        const gchar* _tmp19_;
 
1724
        const gchar* _tmp20_;
 
1725
        UnityMusicLensTrack* _tmp27_;
 
1726
        const gchar* _tmp28_;
 
1727
        const gchar* _tmp29_;
 
1728
        const gchar* _tmp30_;
 
1729
        gchar* _tmp31_ = NULL;
 
1730
        gchar* album_key;
 
1731
        GHashTable* _tmp32_;
 
1732
        const gchar* _tmp33_;
 
1733
        gconstpointer _tmp34_ = NULL;
 
1734
        GPtrArray* _tmp35_;
 
1735
        GPtrArray* arr;
 
1736
        GPtrArray* _tmp36_;
 
1737
        GPtrArray* _tmp43_;
 
1738
        DeeModelIter* _tmp44_;
 
1739
        g_return_if_fail (track != NULL);
 
1740
        _tmp0_ = track;
 
1741
        _tmp1_ = unity_music_lens_rhythmbox_collection_get_albumart (self, _tmp0_);
 
1742
        albumart = _tmp1_;
 
1743
        _tmp2_ = albumart;
 
1744
        if (_tmp2_ != NULL) {
 
1745
                UnityMusicLensTrack* _tmp3_;
 
1746
                const gchar* _tmp4_;
 
1747
                _tmp3_ = track;
 
1748
                _tmp4_ = albumart;
 
1749
                unity_music_lens_track_set_artwork_path (_tmp3_, _tmp4_);
 
1750
        } else {
 
1751
                UnityMusicLensTrack* _tmp5_;
 
1752
                _tmp5_ = track;
 
1753
                unity_music_lens_track_set_artwork_path (_tmp5_, "audio-x-generic");
 
1754
        }
 
1755
        _tmp6_ = track;
 
1756
        unity_music_lens_rhythmbox_collection_prepare_row_buffer (self, _tmp6_);
 
1757
        _tmp7_ = self->priv->all_tracks;
 
1758
        _tmp8_ = dee_model_append_row ((DeeModel*) _tmp7_, self->priv->row_buffer);
 
1759
        iter = _tmp8_;
 
1760
        _tmp10_ = track;
 
1761
        _tmp11_ = unity_music_lens_track_get_album (_tmp10_);
 
1762
        _tmp12_ = _tmp11_;
 
1763
        if (g_strcmp0 (_tmp12_, "") == 0) {
 
1764
                _tmp9_ = TRUE;
 
1765
        } else {
 
1766
                UnityMusicLensTrack* _tmp13_;
 
1767
                const gchar* _tmp14_;
 
1768
                const gchar* _tmp15_;
 
1769
                _tmp13_ = track;
 
1770
                _tmp14_ = unity_music_lens_track_get_album (_tmp13_);
 
1771
                _tmp15_ = _tmp14_;
 
1772
                _tmp9_ = g_strcmp0 (_tmp15_, UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_UNKNOWN_ALBUM) == 0;
 
1773
        }
 
1774
        _tmp16_ = _tmp9_;
 
1775
        if (_tmp16_) {
 
1776
                _g_free0 (albumart);
 
1777
                return;
 
1778
        }
 
1779
        _tmp18_ = track;
 
1780
        _tmp19_ = unity_music_lens_track_get_album_artist (_tmp18_);
 
1781
        _tmp20_ = _tmp19_;
 
1782
        if (_tmp20_ != NULL) {
 
1783
                UnityMusicLensTrack* _tmp21_;
 
1784
                const gchar* _tmp22_;
 
1785
                const gchar* _tmp23_;
 
1786
                _tmp21_ = track;
 
1787
                _tmp22_ = unity_music_lens_track_get_album_artist (_tmp21_);
 
1788
                _tmp23_ = _tmp22_;
 
1789
                _tmp17_ = _tmp23_;
 
1790
        } else {
 
1791
                UnityMusicLensTrack* _tmp24_;
 
1792
                const gchar* _tmp25_;
 
1793
                const gchar* _tmp26_;
 
1794
                _tmp24_ = track;
 
1795
                _tmp25_ = unity_music_lens_track_get_artist (_tmp24_);
 
1796
                _tmp26_ = _tmp25_;
 
1797
                _tmp17_ = _tmp26_;
 
1798
        }
 
1799
        _tmp27_ = track;
 
1800
        _tmp28_ = unity_music_lens_track_get_album (_tmp27_);
 
1801
        _tmp29_ = _tmp28_;
 
1802
        _tmp30_ = _tmp17_;
 
1803
        _tmp31_ = g_strdup_printf ("%s - %s", _tmp29_, _tmp30_);
 
1804
        album_key = _tmp31_;
 
1805
        _tmp32_ = self->priv->album_to_tracks_map;
 
1806
        _tmp33_ = album_key;
 
1807
        _tmp34_ = g_hash_table_lookup (_tmp32_, _tmp33_);
 
1808
        _tmp35_ = _g_ptr_array_ref0 ((GPtrArray*) _tmp34_);
 
1809
        arr = _tmp35_;
 
1810
        _tmp36_ = arr;
 
1811
        if (_tmp36_ == NULL) {
 
1812
                GPtrArray* _tmp37_;
 
1813
                GHashTable* _tmp38_;
 
1814
                const gchar* _tmp39_;
 
1815
                gchar* _tmp40_;
 
1816
                GPtrArray* _tmp41_;
 
1817
                GPtrArray* _tmp42_;
 
1818
                _tmp37_ = g_ptr_array_new_with_free_func (NULL);
 
1819
                _g_ptr_array_unref0 (arr);
 
1820
                arr = _tmp37_;
 
1821
                _tmp38_ = self->priv->album_to_tracks_map;
 
1822
                _tmp39_ = album_key;
 
1823
                _tmp40_ = g_strdup (_tmp39_);
 
1824
                _tmp41_ = arr;
 
1825
                _tmp42_ = _g_ptr_array_ref0 (_tmp41_);
 
1826
                g_hash_table_insert (_tmp38_, _tmp40_, _tmp42_);
 
1827
        }
 
1828
        _tmp43_ = arr;
 
1829
        _tmp44_ = iter;
 
1830
        g_ptr_array_add (_tmp43_, _tmp44_);
 
1831
        _g_ptr_array_unref0 (arr);
 
1832
        _g_free0 (album_key);
 
1833
        _g_free0 (albumart);
 
1834
}
 
1835
 
 
1836
 
 
1837
static void ___lambda8__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready (UnityMusicLensRhythmboxCollectionXmlParser* _sender, UnityMusicLensTrack* track, gpointer self) {
 
1838
        __lambda8_ (self, track);
 
1839
}
 
1840
 
 
1841
 
 
1842
static Block3Data* block3_data_ref (Block3Data* _data3_) {
 
1843
        g_atomic_int_inc (&_data3_->_ref_count_);
 
1844
        return _data3_;
 
1845
}
 
1846
 
 
1847
 
 
1848
static void block3_data_unref (void * _userdata_) {
 
1849
        Block3Data* _data3_;
 
1850
        _data3_ = (Block3Data*) _userdata_;
 
1851
        if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
 
1852
                GPtrArray * self;
 
1853
                self = _data3_->self;
 
1854
                _g_ptr_array_unref0 (self);
 
1855
                g_slice_free (Block3Data, _data3_);
 
1856
        }
 
1857
}
 
1858
 
 
1859
 
 
1860
static gint __lambda1_ (Block3Data* _data3_, gconstpointer** a, gconstpointer** b) {
 
1861
        GPtrArray * self;
 
1862
        gint result = 0;
 
1863
        GCompareDataFunc _tmp0_;
 
1864
        void* _tmp0__target;
 
1865
        gconstpointer** _tmp1_;
 
1866
        gconstpointer** _tmp2_;
 
1867
        gint _tmp3_ = 0;
 
1868
        self = _data3_->self;
 
1869
        _tmp0_ = _data3_->compare_func;
 
1870
        _tmp0__target = _data3_->compare_func_target;
 
1871
        _tmp1_ = a;
 
1872
        _tmp2_ = b;
 
1873
        _tmp3_ = _tmp0_ ((gconstpointer**) (*_tmp1_), (gconstpointer**) (*_tmp2_), _tmp0__target);
 
1874
        result = _tmp3_;
 
1875
        return result;
 
1876
}
 
1877
 
 
1878
 
 
1879
static gint ___lambda1__gcompare_data_func (gconstpointer a, gconstpointer b, gpointer self) {
 
1880
        gint result;
 
1881
        result = __lambda1_ (self, a, b);
 
1882
        return result;
 
1883
}
 
1884
 
 
1885
 
 
1886
static void vala_g_ptr_array_sort_with_data (GPtrArray* self, GCompareDataFunc compare_func, void* compare_func_target) {
 
1887
        Block3Data* _data3_;
 
1888
        GCompareDataFunc _tmp0_;
 
1889
        void* _tmp0__target;
 
1890
        g_return_if_fail (self != NULL);
 
1891
        _data3_ = g_slice_new0 (Block3Data);
 
1892
        _data3_->_ref_count_ = 1;
 
1893
        _data3_->self = g_ptr_array_ref (self);
 
1894
        _tmp0_ = compare_func;
 
1895
        _tmp0__target = compare_func_target;
 
1896
        _data3_->compare_func = _tmp0_;
 
1897
        _data3_->compare_func_target = _tmp0__target;
 
1898
        g_ptr_array_sort_with_data (self, ___lambda1__gcompare_data_func, _data3_);
 
1899
        block3_data_unref (_data3_);
 
1900
        _data3_ = NULL;
 
1901
}
 
1902
 
 
1903
 
 
1904
static gint ____lambda9_ (UnityMusicLensRhythmboxCollection* self, DeeModelIter* a, DeeModelIter* b) {
 
1905
        gint result = 0;
 
1906
        DeeSequenceModel* _tmp0_;
 
1907
        DeeModelIter* _tmp1_;
 
1908
        gint32 _tmp2_ = 0;
 
1909
        gint32 trackno1;
 
1910
        DeeSequenceModel* _tmp3_;
 
1911
        DeeModelIter* _tmp4_;
 
1912
        gint32 _tmp5_ = 0;
 
1913
        gint32 trackno2;
 
1914
        g_return_val_if_fail (a != NULL, 0);
 
1915
        g_return_val_if_fail (b != NULL, 0);
 
1916
        _tmp0_ = self->priv->all_tracks;
 
1917
        _tmp1_ = a;
 
1918
        _tmp2_ = dee_model_get_int32 ((DeeModel*) _tmp0_, _tmp1_, (guint) UNITY_MUSIC_LENS_COLUMNS_TRACK_NUMBER);
 
1919
        trackno1 = _tmp2_;
 
1920
        _tmp3_ = self->priv->all_tracks;
 
1921
        _tmp4_ = b;
 
1922
        _tmp5_ = dee_model_get_int32 ((DeeModel*) _tmp3_, _tmp4_, (guint) UNITY_MUSIC_LENS_COLUMNS_TRACK_NUMBER);
 
1923
        trackno2 = _tmp5_;
 
1924
        result = (gint) (trackno1 - trackno2);
 
1925
        return result;
 
1926
}
 
1927
 
 
1928
 
 
1929
static gint _____lambda9__gcompare_data_func (gconstpointer a, gconstpointer b, gpointer self) {
 
1930
        gint result;
 
1931
        result = ____lambda9_ (self, a, b);
 
1932
        return result;
 
1933
}
 
1934
 
 
1935
 
 
1936
void unity_music_lens_rhythmbox_collection_parse_file (UnityMusicLensRhythmboxCollection* self, const gchar* path) {
 
1937
        DeeSequenceModel* _tmp0_;
 
1938
        GHashTable* _tmp1_;
 
1939
        UnityMusicLensRhythmboxCollectionXmlParser* _tmp2_;
 
1940
        UnityMusicLensRhythmboxCollectionXmlParser* parser;
 
1941
        UnityMusicLensRhythmboxCollectionXmlParser* _tmp3_;
 
1942
        const gchar* _tmp4_;
 
1943
        GFile* _tmp5_ = NULL;
 
1944
        GFile* file;
 
1945
        GHashTable* _tmp16_;
 
1946
        GList* _tmp17_ = NULL;
 
1947
        GList* all_albums;
 
1948
        GList* _tmp18_;
 
1949
        GError * _inner_error_ = NULL;
 
1950
        g_return_if_fail (self != NULL);
 
1951
        g_return_if_fail (path != NULL);
 
1952
        _g_object_unref0 (self->priv->index);
 
1953
        self->priv->index = NULL;
 
1954
        _tmp0_ = self->priv->all_tracks;
 
1955
        dee_model_clear ((DeeModel*) _tmp0_);
 
1956
        unity_music_lens_rhythmbox_collection_initialize_index (self);
 
1957
        self->priv->current_album_art_tag = 0;
 
1958
        _tmp1_ = self->priv->album_to_tracks_map;
 
1959
        g_hash_table_remove_all (_tmp1_);
 
1960
        _tmp2_ = unity_music_lens_rhythmbox_collection_xml_parser_new ();
 
1961
        parser = _tmp2_;
 
1962
        _tmp3_ = parser;
 
1963
        g_signal_connect_object (_tmp3_, "track-info-ready", (GCallback) ___lambda8__unity_music_lens_rhythmbox_collection_xml_parser_track_info_ready, self, 0);
 
1964
        _tmp4_ = path;
 
1965
        _tmp5_ = g_file_new_for_path (_tmp4_);
 
1966
        file = _tmp5_;
 
1967
        {
 
1968
                GFile* _tmp6_;
 
1969
                GFileInputStream* _tmp7_ = NULL;
 
1970
                GFileInputStream* stream;
 
1971
                guint8 buffer[65536] = {0};
 
1972
                gsize bytes_read = 0UL;
 
1973
                _tmp6_ = file;
 
1974
                _tmp7_ = g_file_read (_tmp6_, NULL, &_inner_error_);
 
1975
                stream = _tmp7_;
 
1976
                if (_inner_error_ != NULL) {
 
1977
                        goto __catch12_g_error;
 
1978
                }
 
1979
                while (TRUE) {
 
1980
                        GFileInputStream* _tmp8_;
 
1981
                        gssize _tmp9_ = 0L;
 
1982
                        gssize _tmp10_;
 
1983
                        gsize _tmp11_;
 
1984
                        UnityMusicLensRhythmboxCollectionXmlParser* _tmp12_;
 
1985
                        gsize _tmp13_;
 
1986
                        _tmp8_ = stream;
 
1987
                        _tmp9_ = g_input_stream_read ((GInputStream*) _tmp8_, buffer, (gsize) 65536, NULL, &_inner_error_);
 
1988
                        _tmp10_ = _tmp9_;
 
1989
                        if (_inner_error_ != NULL) {
 
1990
                                _g_object_unref0 (stream);
 
1991
                                goto __catch12_g_error;
 
1992
                        }
 
1993
                        bytes_read = (gsize) _tmp10_;
 
1994
                        _tmp11_ = bytes_read;
 
1995
                        if (!(_tmp11_ > ((gsize) 0))) {
 
1996
                                break;
 
1997
                        }
 
1998
                        _tmp12_ = parser;
 
1999
                        _tmp13_ = bytes_read;
 
2000
                        unity_music_lens_rhythmbox_collection_xml_parser_parse (_tmp12_, (const gchar*) buffer, _tmp13_, &_inner_error_);
 
2001
                        if (_inner_error_ != NULL) {
 
2002
                                _g_object_unref0 (stream);
 
2003
                                goto __catch12_g_error;
 
2004
                        }
 
2005
                }
 
2006
                _g_object_unref0 (stream);
 
2007
        }
 
2008
        goto __finally12;
 
2009
        __catch12_g_error:
 
2010
        {
 
2011
                GError* err = NULL;
 
2012
                GError* _tmp14_;
 
2013
                const gchar* _tmp15_;
 
2014
                err = _inner_error_;
 
2015
                _inner_error_ = NULL;
 
2016
                _tmp14_ = err;
 
2017
                _tmp15_ = _tmp14_->message;
 
2018
                g_warning ("rhythmbox-collection.vala:570: Error while parsing rhythmbox DB: %s", _tmp15_);
 
2019
                _g_error_free0 (err);
 
2020
        }
 
2021
        __finally12:
 
2022
        if (_inner_error_ != NULL) {
 
2023
                _g_object_unref0 (file);
 
2024
                _g_object_unref0 (parser);
 
2025
                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);
 
2026
                g_clear_error (&_inner_error_);
 
2027
                return;
 
2028
        }
 
2029
        _tmp16_ = self->priv->album_to_tracks_map;
 
2030
        _tmp17_ = g_hash_table_get_keys (_tmp16_);
 
2031
        all_albums = _tmp17_;
 
2032
        _tmp18_ = all_albums;
 
2033
        {
 
2034
                GList* s_collection = NULL;
 
2035
                GList* s_it = NULL;
 
2036
                s_collection = _tmp18_;
 
2037
                for (s_it = s_collection; s_it != NULL; s_it = s_it->next) {
 
2038
                        const gchar* s = NULL;
 
2039
                        s = (const gchar*) s_it->data;
 
2040
                        {
 
2041
                                GHashTable* _tmp19_;
 
2042
                                const gchar* _tmp20_;
 
2043
                                gconstpointer _tmp21_ = NULL;
 
2044
                                _tmp19_ = self->priv->album_to_tracks_map;
 
2045
                                _tmp20_ = s;
 
2046
                                _tmp21_ = g_hash_table_lookup (_tmp19_, _tmp20_);
 
2047
                                vala_g_ptr_array_sort_with_data ((GPtrArray*) _tmp21_, _____lambda9__gcompare_data_func, self);
 
2048
                        }
 
2049
                }
 
2050
        }
 
2051
        _g_list_free0 (all_albums);
 
2052
        _g_object_unref0 (file);
 
2053
        _g_object_unref0 (parser);
 
2054
}
 
2055
 
 
2056
 
 
2057
static void unity_music_lens_rhythmbox_collection_add_result (UnityMusicLensRhythmboxCollection* self, DeeModel* results_model, DeeModel* model, DeeModelIter* iter, UnityMusicLensRhythmboxCollectionResultType result_type, guint category_id) {
 
2058
        DeeModelTag* _tmp0_;
 
2059
        DeeModel* _tmp1_;
 
2060
        DeeModelIter* _tmp2_;
 
2061
        gconstpointer _tmp3_ = NULL;
 
2062
        gint tag;
 
2063
        gint _tmp4_;
 
2064
        gint _tmp5_;
 
2065
        UnityMusicLensColumns _tmp42_ = 0;
 
2066
        gboolean _tmp43_ = FALSE;
 
2067
        UnityMusicLensRhythmboxCollectionResultType _tmp44_;
 
2068
        gboolean _tmp46_;
 
2069
        UnityMusicLensColumns _tmp47_;
 
2070
        UnityMusicLensColumns title_col;
 
2071
        DeeModel* _tmp48_;
 
2072
        DeeModelIter* _tmp49_;
 
2073
        UnityMusicLensColumns _tmp50_;
 
2074
        const gchar* _tmp51_ = NULL;
 
2075
        const gchar* title;
 
2076
        DeeModel* _tmp52_;
 
2077
        DeeModelIter* _tmp53_;
 
2078
        const gchar* _tmp54_ = NULL;
 
2079
        gchar* _tmp55_;
 
2080
        gchar* uri;
 
2081
        DeeModel* _tmp56_;
 
2082
        DeeModelIter* _tmp57_;
 
2083
        const gchar* _tmp58_ = NULL;
 
2084
        gchar* _tmp59_;
 
2085
        gchar* dnd_uri;
 
2086
        UnityMusicLensRhythmboxCollectionResultType _tmp60_;
 
2087
        DeeModel* _tmp84_;
 
2088
        const gchar* _tmp85_;
 
2089
        DeeModel* _tmp86_;
 
2090
        DeeModelIter* _tmp87_;
 
2091
        const gchar* _tmp88_ = NULL;
 
2092
        guint _tmp89_;
 
2093
        DeeModel* _tmp90_;
 
2094
        DeeModelIter* _tmp91_;
 
2095
        const gchar* _tmp92_ = NULL;
 
2096
        const gchar* _tmp93_;
 
2097
        DeeModel* _tmp94_;
 
2098
        DeeModelIter* _tmp95_;
 
2099
        const gchar* _tmp96_ = NULL;
 
2100
        const gchar* _tmp97_;
 
2101
        g_return_if_fail (self != NULL);
 
2102
        g_return_if_fail (results_model != NULL);
 
2103
        g_return_if_fail (model != NULL);
 
2104
        g_return_if_fail (iter != NULL);
 
2105
        _tmp0_ = self->priv->album_art_tag;
 
2106
        _tmp1_ = model;
 
2107
        _tmp2_ = iter;
 
2108
        _tmp3_ = dee_model_get_tag (_tmp1_, _tmp2_, _tmp0_);
 
2109
        tag = GPOINTER_TO_INT (_tmp3_);
 
2110
        _tmp4_ = tag;
 
2111
        _tmp5_ = self->priv->current_album_art_tag;
 
2112
        if (_tmp4_ < _tmp5_) {
 
2113
                DeeModel* _tmp6_;
 
2114
                DeeModelIter* _tmp7_;
 
2115
                const gchar* _tmp8_ = NULL;
 
2116
                const gchar* album;
 
2117
                DeeModel* _tmp9_;
 
2118
                DeeModelIter* _tmp10_;
 
2119
                const gchar* _tmp11_ = NULL;
 
2120
                const gchar* artist;
 
2121
                const gchar* _tmp12_;
 
2122
                const gchar* _tmp16_;
 
2123
                const gchar* _tmp17_;
 
2124
                gchar* _tmp18_ = NULL;
 
2125
                gchar* album_art_string;
 
2126
                const gchar* _tmp19_;
 
2127
                DeeModelTag* _tmp38_;
 
2128
                DeeModel* _tmp39_;
 
2129
                DeeModelIter* _tmp40_;
 
2130
                gint _tmp41_;
 
2131
                _tmp6_ = model;
 
2132
                _tmp7_ = iter;
 
2133
                _tmp8_ = dee_model_get_string (_tmp6_, _tmp7_, (guint) UNITY_MUSIC_LENS_COLUMNS_ALBUM);
 
2134
                album = _tmp8_;
 
2135
                _tmp9_ = model;
 
2136
                _tmp10_ = iter;
 
2137
                _tmp11_ = dee_model_get_string (_tmp9_, _tmp10_, (guint) UNITY_MUSIC_LENS_COLUMNS_ALBUM_ARTIST);
 
2138
                artist = _tmp11_;
 
2139
                _tmp12_ = artist;
 
2140
                if (g_strcmp0 (_tmp12_, "") == 0) {
 
2141
                        DeeModel* _tmp13_;
 
2142
                        DeeModelIter* _tmp14_;
 
2143
                        const gchar* _tmp15_ = NULL;
 
2144
                        _tmp13_ = model;
 
2145
                        _tmp14_ = iter;
 
2146
                        _tmp15_ = dee_model_get_string (_tmp13_, _tmp14_, (guint) UNITY_MUSIC_LENS_COLUMNS_ARTIST);
 
2147
                        artist = _tmp15_;
 
2148
                }
 
2149
                _tmp16_ = artist;
 
2150
                _tmp17_ = album;
 
2151
                _tmp18_ = unity_music_lens_rhythmbox_collection_check_album_art_tdb (self, _tmp16_, _tmp17_);
 
2152
                album_art_string = _tmp18_;
 
2153
                _tmp19_ = album_art_string;
 
2154
                if (_tmp19_ != NULL) {
 
2155
                        gchar* filename = NULL;
 
2156
                        const gchar* _tmp20_ = NULL;
 
2157
                        const gchar* _tmp21_;
 
2158
                        gchar* _tmp22_ = NULL;
 
2159
                        const gchar* _tmp23_ = NULL;
 
2160
                        const gchar* _tmp24_;
 
2161
                        gboolean _tmp25_ = FALSE;
 
2162
                        const gchar* _tmp27_;
 
2163
                        gchar* _tmp28_;
 
2164
                        const gchar* _tmp29_;
 
2165
                        DeeModel* _tmp30_;
 
2166
                        DeeModelIter* _tmp31_;
 
2167
                        const gchar* _tmp32_ = NULL;
 
2168
                        _tmp20_ = g_get_user_cache_dir ();
 
2169
                        _tmp21_ = album_art_string;
 
2170
                        _tmp22_ = g_build_filename (_tmp20_, "rhythmbox", "album-art", _tmp21_, NULL);
 
2171
                        _g_free0 (filename);
 
2172
                        filename = _tmp22_;
 
2173
                        _tmp24_ = filename;
 
2174
                        _tmp25_ = g_file_test (_tmp24_, G_FILE_TEST_EXISTS);
 
2175
                        if (_tmp25_) {
 
2176
                                const gchar* _tmp26_;
 
2177
                                _tmp26_ = filename;
 
2178
                                _tmp23_ = _tmp26_;
 
2179
                        } else {
 
2180
                                _tmp23_ = "audio-x-generic";
 
2181
                        }
 
2182
                        _tmp27_ = _tmp23_;
 
2183
                        _tmp28_ = g_strdup (_tmp27_);
 
2184
                        _g_free0 (album_art_string);
 
2185
                        album_art_string = _tmp28_;
 
2186
                        _tmp29_ = album_art_string;
 
2187
                        _tmp30_ = model;
 
2188
                        _tmp31_ = iter;
 
2189
                        _tmp32_ = dee_model_get_string (_tmp30_, _tmp31_, (guint) UNITY_MUSIC_LENS_COLUMNS_ARTWORK);
 
2190
                        if (g_strcmp0 (_tmp29_, _tmp32_) != 0) {
 
2191
                                DeeModel* _tmp33_;
 
2192
                                DeeModelIter* _tmp34_;
 
2193
                                const gchar* _tmp35_;
 
2194
                                GVariant* _tmp36_ = NULL;
 
2195
                                GVariant* _tmp37_;
 
2196
                                _tmp33_ = model;
 
2197
                                _tmp34_ = iter;
 
2198
                                _tmp35_ = album_art_string;
 
2199
                                _tmp36_ = unity_music_lens_rhythmbox_collection_cached_variant_for_string (self, _tmp35_);
 
2200
                                _tmp37_ = _tmp36_;
 
2201
                                dee_model_set_value (_tmp33_, _tmp34_, (guint) UNITY_MUSIC_LENS_COLUMNS_ARTWORK, _tmp37_);
 
2202
                                _g_variant_unref0 (_tmp37_);
 
2203
                        }
 
2204
                        _g_free0 (filename);
 
2205
                }
 
2206
                _tmp38_ = self->priv->album_art_tag;
 
2207
                _tmp39_ = model;
 
2208
                _tmp40_ = iter;
 
2209
                _tmp41_ = self->priv->current_album_art_tag;
 
2210
                dee_model_set_tag (_tmp39_, _tmp40_, _tmp38_, GINT_TO_POINTER (_tmp41_));
 
2211
                _g_free0 (album_art_string);
 
2212
        }
 
2213
        _tmp44_ = result_type;
 
2214
        if (_tmp44_ == UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_SONG) {
 
2215
                _tmp43_ = TRUE;
 
2216
        } else {
 
2217
                UnityMusicLensRhythmboxCollectionResultType _tmp45_;
 
2218
                _tmp45_ = result_type;
 
2219
                _tmp43_ = _tmp45_ == UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_RADIO;
 
2220
        }
 
2221
        _tmp46_ = _tmp43_;
 
2222
        if (_tmp46_) {
 
2223
                _tmp42_ = UNITY_MUSIC_LENS_COLUMNS_TITLE;
 
2224
        } else {
 
2225
                _tmp42_ = UNITY_MUSIC_LENS_COLUMNS_ALBUM;
 
2226
        }
 
2227
        _tmp47_ = _tmp42_;
 
2228
        title_col = _tmp47_;
 
2229
        _tmp48_ = model;
 
2230
        _tmp49_ = iter;
 
2231
        _tmp50_ = title_col;
 
2232
        _tmp51_ = dee_model_get_string (_tmp48_, _tmp49_, (guint) _tmp50_);
 
2233
        title = _tmp51_;
 
2234
        _tmp52_ = model;
 
2235
        _tmp53_ = iter;
 
2236
        _tmp54_ = dee_model_get_string (_tmp52_, _tmp53_, (guint) UNITY_MUSIC_LENS_COLUMNS_URI);
 
2237
        _tmp55_ = g_strdup (_tmp54_);
 
2238
        uri = _tmp55_;
 
2239
        _tmp56_ = model;
 
2240
        _tmp57_ = iter;
 
2241
        _tmp58_ = dee_model_get_string (_tmp56_, _tmp57_, (guint) UNITY_MUSIC_LENS_COLUMNS_URI);
 
2242
        _tmp59_ = g_strdup (_tmp58_);
 
2243
        dnd_uri = _tmp59_;
 
2244
        _tmp60_ = result_type;
 
2245
        if (_tmp60_ == UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_ALBUM) {
 
2246
                gboolean _tmp61_ = FALSE;
 
2247
                const gchar* _tmp62_;
 
2248
                gboolean _tmp64_;
 
2249
                DeeModel* _tmp65_;
 
2250
                DeeModelIter* _tmp66_;
 
2251
                const gchar* _tmp67_ = NULL;
 
2252
                const gchar* artist;
 
2253
                const gchar* _tmp68_;
 
2254
                const gchar* _tmp72_;
 
2255
                const gchar* _tmp73_;
 
2256
                gchar* _tmp74_ = NULL;
 
2257
                gchar* album_key;
 
2258
                GString* _tmp75_;
 
2259
                GString* sb;
 
2260
                const gchar* _tmp76_;
 
2261
                GSList* _tmp77_ = NULL;
 
2262
                GString* _tmp80_;
 
2263
                gchar* _tmp81_;
 
2264
                const gchar* _tmp82_;
 
2265
                gchar* _tmp83_ = NULL;
 
2266
                _tmp62_ = title;
 
2267
                if (g_strcmp0 (_tmp62_, "") == 0) {
 
2268
                        _tmp61_ = TRUE;
 
2269
                } else {
 
2270
                        const gchar* _tmp63_;
 
2271
                        _tmp63_ = title;
 
2272
                        _tmp61_ = g_strcmp0 (_tmp63_, UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_UNKNOWN_ALBUM) == 0;
 
2273
                }
 
2274
                _tmp64_ = _tmp61_;
 
2275
                if (_tmp64_) {
 
2276
                        _g_free0 (dnd_uri);
 
2277
                        _g_free0 (uri);
 
2278
                        return;
 
2279
                }
 
2280
                _tmp65_ = model;
 
2281
                _tmp66_ = iter;
 
2282
                _tmp67_ = dee_model_get_string (_tmp65_, _tmp66_, (guint) UNITY_MUSIC_LENS_COLUMNS_ALBUM_ARTIST);
 
2283
                artist = _tmp67_;
 
2284
                _tmp68_ = artist;
 
2285
                if (g_strcmp0 (_tmp68_, "") == 0) {
 
2286
                        DeeModel* _tmp69_;
 
2287
                        DeeModelIter* _tmp70_;
 
2288
                        const gchar* _tmp71_ = NULL;
 
2289
                        _tmp69_ = model;
 
2290
                        _tmp70_ = iter;
 
2291
                        _tmp71_ = dee_model_get_string (_tmp69_, _tmp70_, (guint) UNITY_MUSIC_LENS_COLUMNS_ARTIST);
 
2292
                        artist = _tmp71_;
 
2293
                }
 
2294
                _tmp72_ = title;
 
2295
                _tmp73_ = artist;
 
2296
                _tmp74_ = g_strdup_printf ("%s - %s", _tmp72_, _tmp73_);
 
2297
                album_key = _tmp74_;
 
2298
                _tmp75_ = g_string_new ("");
 
2299
                sb = _tmp75_;
 
2300
                _tmp76_ = album_key;
 
2301
                _tmp77_ = unity_music_lens_rhythmbox_collection_get_album_tracks (self, _tmp76_);
 
2302
                {
 
2303
                        GSList* track_uri_collection = NULL;
 
2304
                        GSList* track_uri_it = NULL;
 
2305
                        track_uri_collection = _tmp77_;
 
2306
                        for (track_uri_it = track_uri_collection; track_uri_it != NULL; track_uri_it = track_uri_it->next) {
 
2307
                                const gchar* track_uri = NULL;
 
2308
                                track_uri = (const gchar*) track_uri_it->data;
 
2309
                                {
 
2310
                                        GString* _tmp78_;
 
2311
                                        const gchar* _tmp79_;
 
2312
                                        _tmp78_ = sb;
 
2313
                                        _tmp79_ = track_uri;
 
2314
                                        g_string_append_printf (_tmp78_, "%s\r\n", _tmp79_);
 
2315
                                }
 
2316
                        }
 
2317
                        _g_slist_free0 (track_uri_collection);
 
2318
                }
 
2319
                _tmp80_ = sb;
 
2320
                _tmp81_ = _tmp80_->str;
 
2321
                _tmp80_->str = NULL;
 
2322
                _g_free0 (dnd_uri);
 
2323
                dnd_uri = _tmp81_;
 
2324
                _tmp82_ = album_key;
 
2325
                _tmp83_ = g_strdup_printf ("album://%s", _tmp82_);
 
2326
                _g_free0 (uri);
 
2327
                uri = _tmp83_;
 
2328
                _g_string_free0 (sb);
 
2329
                _g_free0 (album_key);
 
2330
        }
 
2331
        _tmp84_ = results_model;
 
2332
        _tmp85_ = uri;
 
2333
        _tmp86_ = model;
 
2334
        _tmp87_ = iter;
 
2335
        _tmp88_ = dee_model_get_string (_tmp86_, _tmp87_, (guint) UNITY_MUSIC_LENS_COLUMNS_ARTWORK);
 
2336
        _tmp89_ = category_id;
 
2337
        _tmp90_ = model;
 
2338
        _tmp91_ = iter;
 
2339
        _tmp92_ = dee_model_get_string (_tmp90_, _tmp91_, (guint) UNITY_MUSIC_LENS_COLUMNS_MIMETYPE);
 
2340
        _tmp93_ = title;
 
2341
        _tmp94_ = model;
 
2342
        _tmp95_ = iter;
 
2343
        _tmp96_ = dee_model_get_string (_tmp94_, _tmp95_, (guint) UNITY_MUSIC_LENS_COLUMNS_ARTIST);
 
2344
        _tmp97_ = dnd_uri;
 
2345
        dee_model_append (_tmp84_, _tmp85_, _tmp88_, _tmp89_, _tmp92_, _tmp93_, _tmp96_, _tmp97_, NULL);
 
2346
        _g_free0 (dnd_uri);
 
2347
        _g_free0 (uri);
 
2348
}
 
2349
 
 
2350
 
 
2351
static gchar* string_strip (const gchar* self) {
 
2352
        gchar* result = NULL;
 
2353
        gchar* _tmp0_ = NULL;
 
2354
        gchar* _result_;
 
2355
        const gchar* _tmp1_;
 
2356
        g_return_val_if_fail (self != NULL, NULL);
 
2357
        _tmp0_ = g_strdup (self);
 
2358
        _result_ = _tmp0_;
 
2359
        _tmp1_ = _result_;
 
2360
        g_strstrip (_tmp1_);
 
2361
        result = _result_;
 
2362
        return result;
 
2363
}
 
2364
 
 
2365
 
 
2366
static gpointer _g_object_ref0 (gpointer self) {
 
2367
        return self ? g_object_ref (self) : NULL;
 
2368
}
 
2369
 
 
2370
 
 
2371
static gint ____lambda10_ (UnityMusicLensRhythmboxCollection* self, DeeModelIter* a, DeeModelIter* b) {
 
2372
        gint result = 0;
 
2373
        gint _tmp0_ = 0;
 
2374
        DeeModelIter* _tmp1_;
 
2375
        DeeModelIter* _tmp2_;
 
2376
        gint _tmp7_;
 
2377
        g_return_val_if_fail (a != NULL, 0);
 
2378
        g_return_val_if_fail (b != NULL, 0);
 
2379
        _tmp1_ = a;
 
2380
        _tmp2_ = b;
 
2381
        if (_tmp1_ == _tmp2_) {
 
2382
                _tmp0_ = 0;
 
2383
        } else {
 
2384
                gint _tmp3_ = 0;
 
2385
                DeeModelIter* _tmp4_;
 
2386
                DeeModelIter* _tmp5_;
 
2387
                gint _tmp6_;
 
2388
                _tmp4_ = a;
 
2389
                _tmp5_ = b;
 
2390
                if (((void*) _tmp4_) > ((void*) _tmp5_)) {
 
2391
                        _tmp3_ = 1;
 
2392
                } else {
 
2393
                        _tmp3_ = -1;
 
2394
                }
 
2395
                _tmp6_ = _tmp3_;
 
2396
                _tmp0_ = _tmp6_;
 
2397
        }
 
2398
        _tmp7_ = _tmp0_;
 
2399
        result = _tmp7_;
 
2400
        return result;
 
2401
}
 
2402
 
 
2403
 
 
2404
static gint _____lambda10__gcompare_data_func (gconstpointer a, gconstpointer b, gpointer self) {
 
2405
        gint result;
 
2406
        result = ____lambda10_ (self, a, b);
 
2407
        return result;
 
2408
}
 
2409
 
 
2410
 
 
2411
void unity_music_lens_rhythmbox_collection_search (UnityMusicLensRhythmboxCollection* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, gint category_override) {
 
2412
        gint num_results;
 
2413
        UnityLensSearch* _tmp0_;
 
2414
        const gchar* _tmp1_;
 
2415
        const gchar* _tmp2_;
 
2416
        gchar* _tmp3_ = NULL;
 
2417
        gchar* _tmp4_;
 
2418
        gboolean _tmp5_;
 
2419
        gboolean empty_search;
 
2420
        gint min_year = 0;
 
2421
        gint max_year = 0;
 
2422
        gint category_id = 0;
 
2423
        UnityMusicLensRhythmboxCollectionResultType result_type = 0;
 
2424
        DeeSequenceModel* _tmp6_;
 
2425
        DeeModel* _tmp7_;
 
2426
        DeeModel* model;
 
2427
        GList* _tmp8_;
 
2428
        gint _tmp9_ = 0;
 
2429
        gint _tmp10_ = 0;
 
2430
        GList* _tmp11_;
 
2431
        GeeSet* _tmp12_ = NULL;
 
2432
        GeeSet* active_genres;
 
2433
        UnityLensSearch* _tmp13_;
 
2434
        DeeSerializableModel* _tmp14_;
 
2435
        DeeSerializableModel* _tmp15_;
 
2436
        DeeSerializableModel* _tmp16_;
 
2437
        DeeSerializableModel* helper_model;
 
2438
        gint _tmp17_;
 
2439
        gboolean _tmp25_;
 
2440
        GObject* _tmp95_ = NULL;
 
2441
        GObject* _tmp96_;
 
2442
        DeeTermList* term_list;
 
2443
        DeeAnalyzer* _tmp97_;
 
2444
        DeeICUTermFilter* _tmp98_;
 
2445
        UnityLensSearch* _tmp99_;
 
2446
        const gchar* _tmp100_;
 
2447
        const gchar* _tmp101_;
 
2448
        gchar* _tmp102_ = NULL;
 
2449
        gchar* _tmp103_;
 
2450
        DeeTermList* _tmp104_;
 
2451
        GSequence* _tmp105_;
 
2452
        GSequence* matches;
 
2453
        gboolean first_pass;
 
2454
        GSequence* _tmp145_;
 
2455
        GSequenceIter* _tmp146_ = NULL;
 
2456
        GSequenceIter* seq_iter;
 
2457
        GSequence* _tmp147_;
 
2458
        GSequenceIter* _tmp148_ = NULL;
 
2459
        GSequenceIter* seq_end_iter;
 
2460
        GeeHashSet* _tmp149_;
 
2461
        GeeHashSet* albums_list;
 
2462
        DeeSerializableModel* _tmp213_;
 
2463
        UnityLensSearch* _tmp214_;
 
2464
        DeeSerializableModel* _tmp215_;
 
2465
        DeeSerializableModel* _tmp216_;
 
2466
        DeeSerializableModel* _tmp217_;
 
2467
        DeeModelIter* _tmp218_ = NULL;
 
2468
        DeeModelIter* iter;
 
2469
        DeeSerializableModel* _tmp219_;
 
2470
        DeeModelIter* _tmp220_ = NULL;
 
2471
        DeeModelIter* last;
 
2472
        g_return_if_fail (self != NULL);
 
2473
        g_return_if_fail (search != NULL);
 
2474
        num_results = 0;
 
2475
        _tmp0_ = search;
 
2476
        _tmp1_ = unity_lens_search_get_search_string (_tmp0_);
 
2477
        _tmp2_ = _tmp1_;
 
2478
        _tmp3_ = string_strip (_tmp2_);
 
2479
        _tmp4_ = _tmp3_;
 
2480
        _tmp5_ = g_strcmp0 (_tmp4_, "") == 0;
 
2481
        _g_free0 (_tmp4_);
 
2482
        empty_search = _tmp5_;
 
2483
        _tmp6_ = self->priv->all_tracks;
 
2484
        _tmp7_ = _g_object_ref0 ((DeeModel*) _tmp6_);
 
2485
        model = _tmp7_;
 
2486
        _tmp8_ = filters;
 
2487
        unity_music_lens_rhythmbox_collection_get_decade_filter (self, _tmp8_, &_tmp9_, &_tmp10_);
 
2488
        min_year = _tmp9_;
 
2489
        max_year = _tmp10_;
 
2490
        _tmp11_ = filters;
 
2491
        _tmp12_ = unity_music_lens_rhythmbox_collection_get_genre_filter (self, _tmp11_);
 
2492
        active_genres = _tmp12_;
 
2493
        _tmp13_ = search;
 
2494
        _tmp14_ = unity_lens_search_get_results_model (_tmp13_);
 
2495
        _tmp15_ = _tmp14_;
 
2496
        _tmp16_ = _g_object_ref0 (_tmp15_);
 
2497
        helper_model = _tmp16_;
 
2498
        _tmp17_ = category_override;
 
2499
        if (_tmp17_ >= 0) {
 
2500
                DeeSequenceModel* _tmp18_;
 
2501
                DeeSerializableModel* _tmp19_;
 
2502
                UnityLensSearch* _tmp20_;
 
2503
                DeeSerializableModel* _tmp21_;
 
2504
                DeeSerializableModel* _tmp22_;
 
2505
                guint _tmp23_;
 
2506
                gchar** _tmp24_ = NULL;
 
2507
                _tmp18_ = (DeeSequenceModel*) dee_sequence_model_new ();
 
2508
                _g_object_unref0 (helper_model);
 
2509
                helper_model = (DeeSerializableModel*) _tmp18_;
 
2510
                _tmp19_ = helper_model;
 
2511
                _tmp20_ = search;
 
2512
                _tmp21_ = unity_lens_search_get_results_model (_tmp20_);
 
2513
                _tmp22_ = _tmp21_;
 
2514
                _tmp24_ = dee_model_get_schema ((DeeModel*) _tmp22_, &_tmp23_);
 
2515
                dee_model_set_schema_full ((DeeModel*) _tmp19_, _tmp24_, (guint) _tmp23_);
 
2516
        }
 
2517
        _tmp25_ = empty_search;
 
2518
        if (_tmp25_) {
 
2519
                DeeFilterModel* _tmp26_;
 
2520
                DeeModel* _tmp27_;
 
2521
                DeeModel* _tmp28_;
 
2522
                DeeModelIter* _tmp29_ = NULL;
 
2523
                DeeModelIter* iter;
 
2524
                DeeModel* _tmp30_;
 
2525
                DeeModelIter* _tmp31_ = NULL;
 
2526
                DeeModelIter* end_iter;
 
2527
                GeeHashSet* _tmp32_;
 
2528
                GeeHashSet* albums_list_nosearch;
 
2529
                _tmp26_ = self->priv->tracks_by_play_count;
 
2530
                _tmp27_ = _g_object_ref0 ((DeeModel*) _tmp26_);
 
2531
                _g_object_unref0 (model);
 
2532
                model = _tmp27_;
 
2533
                _tmp28_ = model;
 
2534
                _tmp29_ = dee_model_get_first_iter (_tmp28_);
 
2535
                iter = _tmp29_;
 
2536
                _tmp30_ = model;
 
2537
                _tmp31_ = dee_model_get_last_iter (_tmp30_);
 
2538
                end_iter = _tmp31_;
 
2539
                _tmp32_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
 
2540
                albums_list_nosearch = _tmp32_;
 
2541
                while (TRUE) {
 
2542
                        DeeModelIter* _tmp33_;
 
2543
                        DeeModelIter* _tmp34_;
 
2544
                        DeeModel* _tmp35_;
 
2545
                        DeeModelIter* _tmp36_;
 
2546
                        gint32 _tmp37_ = 0;
 
2547
                        gint year;
 
2548
                        DeeModel* _tmp38_;
 
2549
                        DeeModelIter* _tmp39_;
 
2550
                        const gchar* _tmp40_ = NULL;
 
2551
                        const gchar* genre;
 
2552
                        gboolean _tmp41_ = FALSE;
 
2553
                        gint _tmp42_;
 
2554
                        gint _tmp43_;
 
2555
                        gboolean _tmp46_;
 
2556
                        GeeSet* _tmp50_;
 
2557
                        DeeModel* _tmp57_;
 
2558
                        DeeModelIter* _tmp58_;
 
2559
                        gint32 _tmp59_ = 0;
 
2560
                        gint _tmp79_;
 
2561
                        DeeSerializableModel* _tmp81_;
 
2562
                        DeeModel* _tmp82_;
 
2563
                        DeeModelIter* _tmp83_;
 
2564
                        UnityMusicLensRhythmboxCollectionResultType _tmp84_;
 
2565
                        gint _tmp85_;
 
2566
                        gint _tmp86_;
 
2567
                        gboolean _tmp87_ = FALSE;
 
2568
                        gint _tmp88_;
 
2569
                        gboolean _tmp91_;
 
2570
                        DeeModel* _tmp92_;
 
2571
                        DeeModelIter* _tmp93_;
 
2572
                        DeeModelIter* _tmp94_ = NULL;
 
2573
                        _tmp33_ = iter;
 
2574
                        _tmp34_ = end_iter;
 
2575
                        if (!(_tmp33_ != _tmp34_)) {
 
2576
                                break;
 
2577
                        }
 
2578
                        _tmp35_ = model;
 
2579
                        _tmp36_ = iter;
 
2580
                        _tmp37_ = dee_model_get_int32 (_tmp35_, _tmp36_, (guint) UNITY_MUSIC_LENS_COLUMNS_YEAR);
 
2581
                        year = (gint) _tmp37_;
 
2582
                        _tmp38_ = model;
 
2583
                        _tmp39_ = iter;
 
2584
                        _tmp40_ = dee_model_get_string (_tmp38_, _tmp39_, (guint) UNITY_MUSIC_LENS_COLUMNS_GENRE);
 
2585
                        genre = _tmp40_;
 
2586
                        _tmp42_ = year;
 
2587
                        _tmp43_ = min_year;
 
2588
                        if (_tmp42_ < _tmp43_) {
 
2589
                                _tmp41_ = TRUE;
 
2590
                        } else {
 
2591
                                gint _tmp44_;
 
2592
                                gint _tmp45_;
 
2593
                                _tmp44_ = year;
 
2594
                                _tmp45_ = max_year;
 
2595
                                _tmp41_ = _tmp44_ > _tmp45_;
 
2596
                        }
 
2597
                        _tmp46_ = _tmp41_;
 
2598
                        if (_tmp46_) {
 
2599
                                DeeModel* _tmp47_;
 
2600
                                DeeModelIter* _tmp48_;
 
2601
                                DeeModelIter* _tmp49_ = NULL;
 
2602
                                _tmp47_ = model;
 
2603
                                _tmp48_ = iter;
 
2604
                                _tmp49_ = dee_model_next (_tmp47_, _tmp48_);
 
2605
                                iter = _tmp49_;
 
2606
                                continue;
 
2607
                        }
 
2608
                        _tmp50_ = active_genres;
 
2609
                        if (_tmp50_ != NULL) {
 
2610
                                GeeSet* _tmp51_;
 
2611
                                const gchar* _tmp52_;
 
2612
                                gboolean _tmp53_ = FALSE;
 
2613
                                _tmp51_ = active_genres;
 
2614
                                _tmp52_ = genre;
 
2615
                                _tmp53_ = gee_collection_contains ((GeeCollection*) _tmp51_, _tmp52_);
 
2616
                                if (!_tmp53_) {
 
2617
                                        DeeModel* _tmp54_;
 
2618
                                        DeeModelIter* _tmp55_;
 
2619
                                        DeeModelIter* _tmp56_ = NULL;
 
2620
                                        _tmp54_ = model;
 
2621
                                        _tmp55_ = iter;
 
2622
                                        _tmp56_ = dee_model_next (_tmp54_, _tmp55_);
 
2623
                                        iter = _tmp56_;
 
2624
                                        continue;
 
2625
                                }
 
2626
                        }
 
2627
                        _tmp57_ = model;
 
2628
                        _tmp58_ = iter;
 
2629
                        _tmp59_ = dee_model_get_int32 (_tmp57_, _tmp58_, (guint) UNITY_MUSIC_LENS_COLUMNS_TYPE);
 
2630
                        if (_tmp59_ == ((gint32) UNITY_MUSIC_LENS_TRACK_TYPE_SONG)) {
 
2631
                                DeeModel* _tmp60_;
 
2632
                                DeeModelIter* _tmp61_;
 
2633
                                const gchar* _tmp62_ = NULL;
 
2634
                                const gchar* album;
 
2635
                                GeeHashSet* _tmp63_;
 
2636
                                const gchar* _tmp64_;
 
2637
                                gboolean _tmp65_ = FALSE;
 
2638
                                gboolean first_track_from_album;
 
2639
                                GeeHashSet* _tmp66_;
 
2640
                                const gchar* _tmp67_;
 
2641
                                gboolean _tmp68_;
 
2642
                                _tmp60_ = model;
 
2643
                                _tmp61_ = iter;
 
2644
                                _tmp62_ = dee_model_get_string (_tmp60_, _tmp61_, (guint) UNITY_MUSIC_LENS_COLUMNS_ALBUM);
 
2645
                                album = _tmp62_;
 
2646
                                _tmp63_ = albums_list_nosearch;
 
2647
                                _tmp64_ = album;
 
2648
                                _tmp65_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp63_, _tmp64_);
 
2649
                                first_track_from_album = !_tmp65_;
 
2650
                                _tmp66_ = albums_list_nosearch;
 
2651
                                _tmp67_ = album;
 
2652
                                gee_abstract_collection_add ((GeeAbstractCollection*) _tmp66_, _tmp67_);
 
2653
                                _tmp68_ = first_track_from_album;
 
2654
                                if (_tmp68_) {
 
2655
                                        gint _tmp69_ = 0;
 
2656
                                        gint _tmp70_;
 
2657
                                        gint _tmp72_;
 
2658
                                        UnityLensSearch* _tmp73_;
 
2659
                                        DeeSerializableModel* _tmp74_;
 
2660
                                        DeeSerializableModel* _tmp75_;
 
2661
                                        DeeModel* _tmp76_;
 
2662
                                        DeeModelIter* _tmp77_;
 
2663
                                        gint _tmp78_;
 
2664
                                        _tmp70_ = category_override;
 
2665
                                        if (_tmp70_ >= 0) {
 
2666
                                                gint _tmp71_;
 
2667
                                                _tmp71_ = category_override;
 
2668
                                                _tmp69_ = _tmp71_;
 
2669
                                        } else {
 
2670
                                                _tmp69_ = (gint) UNITY_MUSIC_LENS_CATEGORY_ALBUMS;
 
2671
                                        }
 
2672
                                        _tmp72_ = _tmp69_;
 
2673
                                        category_id = _tmp72_;
 
2674
                                        _tmp73_ = search;
 
2675
                                        _tmp74_ = unity_lens_search_get_results_model (_tmp73_);
 
2676
                                        _tmp75_ = _tmp74_;
 
2677
                                        _tmp76_ = model;
 
2678
                                        _tmp77_ = iter;
 
2679
                                        _tmp78_ = category_id;
 
2680
                                        unity_music_lens_rhythmbox_collection_add_result (self, (DeeModel*) _tmp75_, _tmp76_, _tmp77_, UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_ALBUM, (guint) _tmp78_);
 
2681
                                }
 
2682
                                category_id = (gint) UNITY_MUSIC_LENS_CATEGORY_SONGS;
 
2683
                                result_type = UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_SONG;
 
2684
                        } else {
 
2685
                                category_id = (gint) UNITY_MUSIC_LENS_CATEGORY_RADIOS;
 
2686
                                result_type = UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_RADIO;
 
2687
                        }
 
2688
                        _tmp79_ = category_override;
 
2689
                        if (_tmp79_ >= 0) {
 
2690
                                gint _tmp80_;
 
2691
                                _tmp80_ = category_override;
 
2692
                                category_id = _tmp80_;
 
2693
                        }
 
2694
                        _tmp81_ = helper_model;
 
2695
                        _tmp82_ = model;
 
2696
                        _tmp83_ = iter;
 
2697
                        _tmp84_ = result_type;
 
2698
                        _tmp85_ = category_id;
 
2699
                        unity_music_lens_rhythmbox_collection_add_result (self, (DeeModel*) _tmp81_, _tmp82_, _tmp83_, _tmp84_, (guint) _tmp85_);
 
2700
                        _tmp86_ = num_results;
 
2701
                        num_results = _tmp86_ + 1;
 
2702
                        _tmp88_ = max_results;
 
2703
                        if (_tmp88_ >= 0) {
 
2704
                                gint _tmp89_;
 
2705
                                gint _tmp90_;
 
2706
                                _tmp89_ = num_results;
 
2707
                                _tmp90_ = max_results;
 
2708
                                _tmp87_ = _tmp89_ >= _tmp90_;
 
2709
                        } else {
 
2710
                                _tmp87_ = FALSE;
 
2711
                        }
 
2712
                        _tmp91_ = _tmp87_;
 
2713
                        if (_tmp91_) {
 
2714
                                break;
 
2715
                        }
 
2716
                        _tmp92_ = model;
 
2717
                        _tmp93_ = iter;
 
2718
                        _tmp94_ = dee_model_next (_tmp92_, _tmp93_);
 
2719
                        iter = _tmp94_;
 
2720
                }
 
2721
                _g_object_unref0 (albums_list_nosearch);
 
2722
                _g_object_unref0 (helper_model);
 
2723
                _g_object_unref0 (active_genres);
 
2724
                _g_object_unref0 (model);
 
2725
                return;
 
2726
        }
 
2727
        _tmp95_ = g_object_new (dee_term_list_get_type (), NULL);
 
2728
        _tmp96_ = G_IS_INITIALLY_UNOWNED (_tmp95_) ? g_object_ref_sink (_tmp95_) : _tmp95_;
 
2729
        term_list = DEE_IS_TERM_LIST (_tmp96_) ? ((DeeTermList*) _tmp96_) : NULL;
 
2730
        _tmp97_ = self->priv->analyzer;
 
2731
        _tmp98_ = self->priv->ascii_filter;
 
2732
        _tmp99_ = search;
 
2733
        _tmp100_ = unity_lens_search_get_search_string (_tmp99_);
 
2734
        _tmp101_ = _tmp100_;
 
2735
        _tmp102_ = dee_icu_term_filter_apply (_tmp98_, _tmp101_);
 
2736
        _tmp103_ = _tmp102_;
 
2737
        _tmp104_ = term_list;
 
2738
        dee_analyzer_tokenize (_tmp97_, _tmp103_, _tmp104_);
 
2739
        _g_free0 (_tmp103_);
 
2740
        _tmp105_ = g_sequence_new (NULL);
 
2741
        matches = _tmp105_;
 
2742
        first_pass = TRUE;
 
2743
        {
 
2744
                DeeTermList* _tmp106_;
 
2745
                DeeTermList* _tmp107_;
 
2746
                DeeTermList* _term_list;
 
2747
                DeeTermList* _tmp108_;
 
2748
                guint _tmp109_;
 
2749
                guint _tmp110_;
 
2750
                guint _term_size;
 
2751
                gint _term_index;
 
2752
                _tmp106_ = term_list;
 
2753
                _tmp107_ = _g_object_ref0 (_tmp106_);
 
2754
                _term_list = _tmp107_;
 
2755
                _tmp108_ = _term_list;
 
2756
                _tmp109_ = dee_term_list_num_terms (_tmp108_);
 
2757
                _tmp110_ = _tmp109_;
 
2758
                _term_size = _tmp110_;
 
2759
                _term_index = -1;
 
2760
                while (TRUE) {
 
2761
                        gint _tmp111_;
 
2762
                        gint _tmp112_;
 
2763
                        guint _tmp113_;
 
2764
                        DeeTermList* _tmp114_;
 
2765
                        gint _tmp115_;
 
2766
                        const gchar* _tmp116_ = NULL;
 
2767
                        const gchar* term;
 
2768
                        DeeIndex* _tmp117_;
 
2769
                        const gchar* _tmp118_;
 
2770
                        DeeResultSet* _tmp119_ = NULL;
 
2771
                        DeeResultSet* result_set;
 
2772
                        GCompareDataFunc cmp_func;
 
2773
                        void* cmp_func_target;
 
2774
                        GDestroyNotify cmp_func_target_destroy_notify;
 
2775
                        GSequence* _tmp120_;
 
2776
                        GSequence* remaining;
 
2777
                        gboolean _tmp139_;
 
2778
                        GSequence* _tmp141_;
 
2779
                        GSequenceIter* _tmp142_ = NULL;
 
2780
                        GSequence* _tmp143_;
 
2781
                        GSequenceIter* _tmp144_ = NULL;
 
2782
                        _tmp111_ = _term_index;
 
2783
                        _term_index = _tmp111_ + 1;
 
2784
                        _tmp112_ = _term_index;
 
2785
                        _tmp113_ = _term_size;
 
2786
                        if (!(((guint) _tmp112_) < _tmp113_)) {
 
2787
                                break;
 
2788
                        }
 
2789
                        _tmp114_ = _term_list;
 
2790
                        _tmp115_ = _term_index;
 
2791
                        _tmp116_ = dee_term_list_get_term (_tmp114_, (guint) _tmp115_);
 
2792
                        term = _tmp116_;
 
2793
                        _tmp117_ = self->priv->index;
 
2794
                        _tmp118_ = term;
 
2795
                        _tmp119_ = dee_index_lookup (_tmp117_, _tmp118_, DEE_TERM_MATCH_PREFIX);
 
2796
                        result_set = _tmp119_;
 
2797
                        cmp_func = _____lambda10__gcompare_data_func;
 
2798
                        cmp_func_target = g_object_ref (self);
 
2799
                        cmp_func_target_destroy_notify = g_object_unref;
 
2800
                        _tmp120_ = g_sequence_new (NULL);
 
2801
                        remaining = _tmp120_;
 
2802
                        {
 
2803
                                DeeResultSet* _tmp121_;
 
2804
                                DeeResultSet* _tmp122_ = NULL;
 
2805
                                DeeResultSet* _item_it;
 
2806
                                DeeModelIter* item = NULL;
 
2807
                                _tmp121_ = result_set;
 
2808
                                _tmp122_ = _vala_dee_result_set_iterator (_tmp121_);
 
2809
                                _item_it = _tmp122_;
 
2810
                                while (TRUE) {
 
2811
                                        DeeResultSet* _tmp123_;
 
2812
                                        DeeModelIter* _tmp124_ = NULL;
 
2813
                                        DeeModelIter* _tmp125_;
 
2814
                                        gboolean _tmp126_;
 
2815
                                        _tmp123_ = _item_it;
 
2816
                                        _tmp124_ = _vala_dee_result_set_next_value (_tmp123_);
 
2817
                                        item = _tmp124_;
 
2818
                                        _tmp125_ = item;
 
2819
                                        if (!(_tmp125_ != NULL)) {
 
2820
                                                break;
 
2821
                                        }
 
2822
                                        _tmp126_ = first_pass;
 
2823
                                        if (_tmp126_) {
 
2824
                                                GSequence* _tmp127_;
 
2825
                                                DeeModelIter* _tmp128_;
 
2826
                                                GCompareDataFunc _tmp129_;
 
2827
                                                void* _tmp129__target;
 
2828
                                                GSequenceIter* _tmp130_ = NULL;
 
2829
                                                _tmp127_ = matches;
 
2830
                                                _tmp128_ = item;
 
2831
                                                _tmp129_ = cmp_func;
 
2832
                                                _tmp129__target = cmp_func_target;
 
2833
                                                _tmp130_ = g_sequence_insert_sorted (_tmp127_, _tmp128_, _tmp129_, _tmp129__target);
 
2834
                                        } else {
 
2835
                                                GSequence* _tmp131_;
 
2836
                                                DeeModelIter* _tmp132_;
 
2837
                                                GCompareDataFunc _tmp133_;
 
2838
                                                void* _tmp133__target;
 
2839
                                                GSequenceIter* _tmp134_ = NULL;
 
2840
                                                _tmp131_ = matches;
 
2841
                                                _tmp132_ = item;
 
2842
                                                _tmp133_ = cmp_func;
 
2843
                                                _tmp133__target = cmp_func_target;
 
2844
                                                _tmp134_ = g_sequence_lookup (_tmp131_, _tmp132_, _tmp133_, _tmp133__target);
 
2845
                                                if (_tmp134_ != NULL) {
 
2846
                                                        GSequence* _tmp135_;
 
2847
                                                        DeeModelIter* _tmp136_;
 
2848
                                                        GCompareDataFunc _tmp137_;
 
2849
                                                        void* _tmp137__target;
 
2850
                                                        GSequenceIter* _tmp138_ = NULL;
 
2851
                                                        _tmp135_ = remaining;
 
2852
                                                        _tmp136_ = item;
 
2853
                                                        _tmp137_ = cmp_func;
 
2854
                                                        _tmp137__target = cmp_func_target;
 
2855
                                                        _tmp138_ = g_sequence_insert_sorted (_tmp135_, _tmp136_, _tmp137_, _tmp137__target);
 
2856
                                                }
 
2857
                                        }
 
2858
                                }
 
2859
                                _g_object_unref0 (_item_it);
 
2860
                        }
 
2861
                        _tmp139_ = first_pass;
 
2862
                        if (!_tmp139_) {
 
2863
                                GSequence* _tmp140_;
 
2864
                                _tmp140_ = remaining;
 
2865
                                remaining = NULL;
 
2866
                                _g_sequence_free0 (matches);
 
2867
                                matches = _tmp140_;
 
2868
                        }
 
2869
                        _tmp141_ = matches;
 
2870
                        _tmp142_ = g_sequence_get_begin_iter (_tmp141_);
 
2871
                        _tmp143_ = matches;
 
2872
                        _tmp144_ = g_sequence_get_end_iter (_tmp143_);
 
2873
                        if (_tmp142_ == _tmp144_) {
 
2874
                                _g_sequence_free0 (remaining);
 
2875
                                (cmp_func_target_destroy_notify == NULL) ? NULL : (cmp_func_target_destroy_notify (cmp_func_target), NULL);
 
2876
                                cmp_func = NULL;
 
2877
                                cmp_func_target = NULL;
 
2878
                                cmp_func_target_destroy_notify = NULL;
 
2879
                                _g_object_unref0 (result_set);
 
2880
                                break;
 
2881
                        }
 
2882
                        first_pass = FALSE;
 
2883
                        _g_sequence_free0 (remaining);
 
2884
                        (cmp_func_target_destroy_notify == NULL) ? NULL : (cmp_func_target_destroy_notify (cmp_func_target), NULL);
 
2885
                        cmp_func = NULL;
 
2886
                        cmp_func_target = NULL;
 
2887
                        cmp_func_target_destroy_notify = NULL;
 
2888
                        _g_object_unref0 (result_set);
 
2889
                }
 
2890
                _g_object_unref0 (_term_list);
 
2891
        }
 
2892
        _tmp145_ = matches;
 
2893
        _tmp146_ = g_sequence_get_begin_iter (_tmp145_);
 
2894
        seq_iter = _tmp146_;
 
2895
        _tmp147_ = matches;
 
2896
        _tmp148_ = g_sequence_get_end_iter (_tmp147_);
 
2897
        seq_end_iter = _tmp148_;
 
2898
        _tmp149_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
 
2899
        albums_list = _tmp149_;
 
2900
        while (TRUE) {
 
2901
                GSequenceIter* _tmp150_;
 
2902
                GSequenceIter* _tmp151_;
 
2903
                GSequenceIter* _tmp152_;
 
2904
                gconstpointer _tmp153_ = NULL;
 
2905
                DeeModelIter* model_iter;
 
2906
                DeeModel* _tmp154_;
 
2907
                DeeModelIter* _tmp155_;
 
2908
                gint32 _tmp156_ = 0;
 
2909
                gint year;
 
2910
                DeeModel* _tmp157_;
 
2911
                DeeModelIter* _tmp158_;
 
2912
                const gchar* _tmp159_ = NULL;
 
2913
                gchar* _tmp160_;
 
2914
                gchar* genre;
 
2915
                gboolean _tmp161_ = FALSE;
 
2916
                gint _tmp162_;
 
2917
                gint _tmp163_;
 
2918
                gboolean _tmp166_;
 
2919
                GeeSet* _tmp169_;
 
2920
                DeeModel* _tmp176_;
 
2921
                DeeModelIter* _tmp177_;
 
2922
                gint32 _tmp178_ = 0;
 
2923
                gint _tmp198_;
 
2924
                DeeSerializableModel* _tmp200_;
 
2925
                DeeModel* _tmp201_;
 
2926
                DeeModelIter* _tmp202_;
 
2927
                UnityMusicLensRhythmboxCollectionResultType _tmp203_;
 
2928
                gint _tmp204_;
 
2929
                gint _tmp205_;
 
2930
                gboolean _tmp206_ = FALSE;
 
2931
                gint _tmp207_;
 
2932
                gboolean _tmp210_;
 
2933
                GSequenceIter* _tmp211_;
 
2934
                GSequenceIter* _tmp212_ = NULL;
 
2935
                _tmp150_ = seq_iter;
 
2936
                _tmp151_ = seq_end_iter;
 
2937
                if (!(_tmp150_ != _tmp151_)) {
 
2938
                        break;
 
2939
                }
 
2940
                _tmp152_ = seq_iter;
 
2941
                _tmp153_ = g_sequence_get (_tmp152_);
 
2942
                model_iter = (DeeModelIter*) _tmp153_;
 
2943
                _tmp154_ = model;
 
2944
                _tmp155_ = model_iter;
 
2945
                _tmp156_ = dee_model_get_int32 (_tmp154_, _tmp155_, (guint) UNITY_MUSIC_LENS_COLUMNS_YEAR);
 
2946
                year = (gint) _tmp156_;
 
2947
                _tmp157_ = model;
 
2948
                _tmp158_ = model_iter;
 
2949
                _tmp159_ = dee_model_get_string (_tmp157_, _tmp158_, (guint) UNITY_MUSIC_LENS_COLUMNS_GENRE);
 
2950
                _tmp160_ = g_strdup (_tmp159_);
 
2951
                genre = _tmp160_;
 
2952
                _tmp162_ = year;
 
2953
                _tmp163_ = min_year;
 
2954
                if (_tmp162_ < _tmp163_) {
 
2955
                        _tmp161_ = TRUE;
 
2956
                } else {
 
2957
                        gint _tmp164_;
 
2958
                        gint _tmp165_;
 
2959
                        _tmp164_ = year;
 
2960
                        _tmp165_ = max_year;
 
2961
                        _tmp161_ = _tmp164_ > _tmp165_;
 
2962
                }
 
2963
                _tmp166_ = _tmp161_;
 
2964
                if (_tmp166_) {
 
2965
                        GSequenceIter* _tmp167_;
 
2966
                        GSequenceIter* _tmp168_ = NULL;
 
2967
                        _tmp167_ = seq_iter;
 
2968
                        _tmp168_ = g_sequence_iter_next (_tmp167_);
 
2969
                        seq_iter = _tmp168_;
 
2970
                        _g_free0 (genre);
 
2971
                        continue;
 
2972
                }
 
2973
                _tmp169_ = active_genres;
 
2974
                if (_tmp169_ != NULL) {
 
2975
                        GeeSet* _tmp170_;
 
2976
                        const gchar* _tmp171_;
 
2977
                        gboolean _tmp172_ = FALSE;
 
2978
                        gboolean genre_match;
 
2979
                        gboolean _tmp173_;
 
2980
                        _tmp170_ = active_genres;
 
2981
                        _tmp171_ = genre;
 
2982
                        _tmp172_ = gee_collection_contains ((GeeCollection*) _tmp170_, _tmp171_);
 
2983
                        genre_match = _tmp172_;
 
2984
                        _tmp173_ = genre_match;
 
2985
                        if (!_tmp173_) {
 
2986
                                GSequenceIter* _tmp174_;
 
2987
                                GSequenceIter* _tmp175_ = NULL;
 
2988
                                _tmp174_ = seq_iter;
 
2989
                                _tmp175_ = g_sequence_iter_next (_tmp174_);
 
2990
                                seq_iter = _tmp175_;
 
2991
                                _g_free0 (genre);
 
2992
                                continue;
 
2993
                        }
 
2994
                }
 
2995
                _tmp176_ = model;
 
2996
                _tmp177_ = model_iter;
 
2997
                _tmp178_ = dee_model_get_int32 (_tmp176_, _tmp177_, (guint) UNITY_MUSIC_LENS_COLUMNS_TYPE);
 
2998
                if (_tmp178_ == ((gint32) UNITY_MUSIC_LENS_TRACK_TYPE_SONG)) {
 
2999
                        DeeModel* _tmp179_;
 
3000
                        DeeModelIter* _tmp180_;
 
3001
                        const gchar* _tmp181_ = NULL;
 
3002
                        const gchar* album;
 
3003
                        GeeHashSet* _tmp182_;
 
3004
                        const gchar* _tmp183_;
 
3005
                        gboolean _tmp184_ = FALSE;
 
3006
                        gboolean first_track_from_album;
 
3007
                        GeeHashSet* _tmp185_;
 
3008
                        const gchar* _tmp186_;
 
3009
                        gboolean _tmp187_;
 
3010
                        _tmp179_ = model;
 
3011
                        _tmp180_ = model_iter;
 
3012
                        _tmp181_ = dee_model_get_string (_tmp179_, _tmp180_, (guint) UNITY_MUSIC_LENS_COLUMNS_ALBUM);
 
3013
                        album = _tmp181_;
 
3014
                        _tmp182_ = albums_list;
 
3015
                        _tmp183_ = album;
 
3016
                        _tmp184_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp182_, _tmp183_);
 
3017
                        first_track_from_album = !_tmp184_;
 
3018
                        _tmp185_ = albums_list;
 
3019
                        _tmp186_ = album;
 
3020
                        gee_abstract_collection_add ((GeeAbstractCollection*) _tmp185_, _tmp186_);
 
3021
                        _tmp187_ = first_track_from_album;
 
3022
                        if (_tmp187_) {
 
3023
                                gint _tmp188_ = 0;
 
3024
                                gint _tmp189_;
 
3025
                                gint _tmp191_;
 
3026
                                UnityLensSearch* _tmp192_;
 
3027
                                DeeSerializableModel* _tmp193_;
 
3028
                                DeeSerializableModel* _tmp194_;
 
3029
                                DeeModel* _tmp195_;
 
3030
                                DeeModelIter* _tmp196_;
 
3031
                                gint _tmp197_;
 
3032
                                _tmp189_ = category_override;
 
3033
                                if (_tmp189_ >= 0) {
 
3034
                                        gint _tmp190_;
 
3035
                                        _tmp190_ = category_override;
 
3036
                                        _tmp188_ = _tmp190_;
 
3037
                                } else {
 
3038
                                        _tmp188_ = (gint) UNITY_MUSIC_LENS_CATEGORY_ALBUMS;
 
3039
                                }
 
3040
                                _tmp191_ = _tmp188_;
 
3041
                                category_id = _tmp191_;
 
3042
                                _tmp192_ = search;
 
3043
                                _tmp193_ = unity_lens_search_get_results_model (_tmp192_);
 
3044
                                _tmp194_ = _tmp193_;
 
3045
                                _tmp195_ = model;
 
3046
                                _tmp196_ = model_iter;
 
3047
                                _tmp197_ = category_id;
 
3048
                                unity_music_lens_rhythmbox_collection_add_result (self, (DeeModel*) _tmp194_, _tmp195_, _tmp196_, UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_ALBUM, (guint) _tmp197_);
 
3049
                        }
 
3050
                        category_id = (gint) UNITY_MUSIC_LENS_CATEGORY_SONGS;
 
3051
                        result_type = UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_SONG;
 
3052
                } else {
 
3053
                        category_id = (gint) UNITY_MUSIC_LENS_CATEGORY_RADIOS;
 
3054
                        result_type = UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_RESULT_TYPE_RADIO;
 
3055
                }
 
3056
                _tmp198_ = category_override;
 
3057
                if (_tmp198_ >= 0) {
 
3058
                        gint _tmp199_;
 
3059
                        _tmp199_ = category_override;
 
3060
                        category_id = _tmp199_;
 
3061
                }
 
3062
                _tmp200_ = helper_model;
 
3063
                _tmp201_ = model;
 
3064
                _tmp202_ = model_iter;
 
3065
                _tmp203_ = result_type;
 
3066
                _tmp204_ = category_id;
 
3067
                unity_music_lens_rhythmbox_collection_add_result (self, (DeeModel*) _tmp200_, _tmp201_, _tmp202_, _tmp203_, (guint) _tmp204_);
 
3068
                _tmp205_ = num_results;
 
3069
                num_results = _tmp205_ + 1;
 
3070
                _tmp207_ = max_results;
 
3071
                if (_tmp207_ >= 0) {
 
3072
                        gint _tmp208_;
 
3073
                        gint _tmp209_;
 
3074
                        _tmp208_ = num_results;
 
3075
                        _tmp209_ = max_results;
 
3076
                        _tmp206_ = _tmp208_ >= _tmp209_;
 
3077
                } else {
 
3078
                        _tmp206_ = FALSE;
 
3079
                }
 
3080
                _tmp210_ = _tmp206_;
 
3081
                if (_tmp210_) {
 
3082
                        _g_free0 (genre);
 
3083
                        break;
 
3084
                }
 
3085
                _tmp211_ = seq_iter;
 
3086
                _tmp212_ = g_sequence_iter_next (_tmp211_);
 
3087
                seq_iter = _tmp212_;
 
3088
                _g_free0 (genre);
 
3089
        }
 
3090
        _tmp213_ = helper_model;
 
3091
        _tmp214_ = search;
 
3092
        _tmp215_ = unity_lens_search_get_results_model (_tmp214_);
 
3093
        _tmp216_ = _tmp215_;
 
3094
        if (_tmp213_ == _tmp216_) {
 
3095
                _g_object_unref0 (albums_list);
 
3096
                _g_sequence_free0 (matches);
 
3097
                _g_object_unref0 (term_list);
 
3098
                _g_object_unref0 (helper_model);
 
3099
                _g_object_unref0 (active_genres);
 
3100
                _g_object_unref0 (model);
 
3101
                return;
 
3102
        }
 
3103
        _tmp217_ = helper_model;
 
3104
        _tmp218_ = dee_model_get_first_iter ((DeeModel*) _tmp217_);
 
3105
        iter = _tmp218_;
 
3106
        _tmp219_ = helper_model;
 
3107
        _tmp220_ = dee_model_get_last_iter ((DeeModel*) _tmp219_);
 
3108
        last = _tmp220_;
 
3109
        while (TRUE) {
 
3110
                DeeModelIter* _tmp221_;
 
3111
                DeeModelIter* _tmp222_;
 
3112
                DeeSerializableModel* _tmp223_;
 
3113
                DeeModelIter* _tmp224_;
 
3114
                GVariant** _tmp225_;
 
3115
                GVariant** _tmp226_ = NULL;
 
3116
                GVariant** row;
 
3117
                gint row_length1;
 
3118
                gint _row_size_;
 
3119
                UnityLensSearch* _tmp227_;
 
3120
                DeeSerializableModel* _tmp228_;
 
3121
                DeeSerializableModel* _tmp229_;
 
3122
                GVariant** _tmp230_;
 
3123
                gint _tmp230__length1;
 
3124
                DeeSerializableModel* _tmp231_;
 
3125
                DeeModelIter* _tmp232_;
 
3126
                DeeModelIter* _tmp233_ = NULL;
 
3127
                _tmp221_ = iter;
 
3128
                _tmp222_ = last;
 
3129
                if (!(_tmp221_ != _tmp222_)) {
 
3130
                        break;
 
3131
                }
 
3132
                _tmp223_ = helper_model;
 
3133
                _tmp224_ = iter;
 
3134
                _tmp226_ = _tmp225_ = dee_model_get_row ((DeeModel*) _tmp223_, _tmp224_, NULL);
 
3135
                row = _tmp226_;
 
3136
                row_length1 = _vala_array_length (_tmp225_);
 
3137
                _row_size_ = row_length1;
 
3138
                _tmp227_ = search;
 
3139
                _tmp228_ = unity_lens_search_get_results_model (_tmp227_);
 
3140
                _tmp229_ = _tmp228_;
 
3141
                _tmp230_ = row;
 
3142
                _tmp230__length1 = row_length1;
 
3143
                dee_model_append_row ((DeeModel*) _tmp229_, _tmp230_);
 
3144
                _tmp231_ = helper_model;
 
3145
                _tmp232_ = iter;
 
3146
                _tmp233_ = dee_model_next ((DeeModel*) _tmp231_, _tmp232_);
 
3147
                iter = _tmp233_;
 
3148
                row = (_vala_array_free (row, row_length1, (GDestroyNotify) g_variant_unref), NULL);
 
3149
        }
 
3150
        _g_object_unref0 (albums_list);
 
3151
        _g_sequence_free0 (matches);
 
3152
        _g_object_unref0 (term_list);
 
3153
        _g_object_unref0 (helper_model);
 
3154
        _g_object_unref0 (active_genres);
 
3155
        _g_object_unref0 (model);
 
3156
}
 
3157
 
 
3158
 
 
3159
static void unity_music_lens_rhythmbox_collection_get_decade_filter (UnityMusicLensRhythmboxCollection* self, GList* filters, gint* min_year, gint* max_year) {
 
3160
        gint _vala_min_year = 0;
 
3161
        gint _vala_max_year = 0;
 
3162
        UnityFilter* filter;
 
3163
        GList* _tmp0_;
 
3164
        gboolean _tmp7_ = FALSE;
 
3165
        UnityFilter* _tmp8_;
 
3166
        gboolean _tmp12_;
 
3167
        UnityFilter* _tmp14_;
 
3168
        UnityMultiRangeFilter* _tmp15_;
 
3169
        UnityMultiRangeFilter* mrf;
 
3170
        UnityMultiRangeFilter* _tmp16_;
 
3171
        UnityFilterOption* _tmp17_ = NULL;
 
3172
        UnityFilterOption* _tmp18_;
 
3173
        const gchar* _tmp19_;
 
3174
        const gchar* _tmp20_;
 
3175
        gint _tmp21_ = 0;
 
3176
        UnityMultiRangeFilter* _tmp22_;
 
3177
        UnityFilterOption* _tmp23_ = NULL;
 
3178
        UnityFilterOption* _tmp24_;
 
3179
        const gchar* _tmp25_;
 
3180
        const gchar* _tmp26_;
 
3181
        gint _tmp27_ = 0;
 
3182
        g_return_if_fail (self != NULL);
 
3183
        filter = NULL;
 
3184
        _tmp0_ = filters;
 
3185
        {
 
3186
                GList* parser_collection = NULL;
 
3187
                GList* parser_it = NULL;
 
3188
                parser_collection = _tmp0_;
 
3189
                for (parser_it = parser_collection; parser_it != NULL; parser_it = parser_it->next) {
 
3190
                        UnityMusicLensFilterParser* _tmp1_;
 
3191
                        UnityMusicLensFilterParser* parser = NULL;
 
3192
                        _tmp1_ = _g_object_ref0 ((UnityMusicLensFilterParser*) parser_it->data);
 
3193
                        parser = _tmp1_;
 
3194
                        {
 
3195
                                UnityMusicLensFilterParser* _tmp2_;
 
3196
                                _tmp2_ = parser;
 
3197
                                if (UNITY_MUSIC_LENS_IS_DECADE_FILTER_PARSER (_tmp2_)) {
 
3198
                                        UnityMusicLensFilterParser* _tmp3_;
 
3199
                                        UnityFilter* _tmp4_;
 
3200
                                        UnityFilter* _tmp5_;
 
3201
                                        UnityFilter* _tmp6_;
 
3202
                                        _tmp3_ = parser;
 
3203
                                        _tmp4_ = unity_music_lens_filter_parser_get_filter (_tmp3_);
 
3204
                                        _tmp5_ = _tmp4_;
 
3205
                                        _tmp6_ = _g_object_ref0 (_tmp5_);
 
3206
                                        _g_object_unref0 (filter);
 
3207
                                        filter = _tmp6_;
 
3208
                                }
 
3209
                                _g_object_unref0 (parser);
 
3210
                        }
 
3211
                }
 
3212
        }
 
3213
        _tmp8_ = filter;
 
3214
        if (_tmp8_ == NULL) {
 
3215
                _tmp7_ = TRUE;
 
3216
        } else {
 
3217
                UnityFilter* _tmp9_;
 
3218
                gboolean _tmp10_;
 
3219
                gboolean _tmp11_;
 
3220
                _tmp9_ = filter;
 
3221
                _tmp10_ = unity_filter_get_filtering (_tmp9_);
 
3222
                _tmp11_ = _tmp10_;
 
3223
                _tmp7_ = !_tmp11_;
 
3224
        }
 
3225
        _tmp12_ = _tmp7_;
 
3226
        if (_tmp12_) {
 
3227
                gint _tmp13_;
 
3228
                _vala_min_year = 0;
 
3229
                _tmp13_ = G_MAXINT;
 
3230
                _vala_max_year = _tmp13_;
 
3231
                _g_object_unref0 (filter);
 
3232
                if (min_year) {
 
3233
                        *min_year = _vala_min_year;
 
3234
                }
 
3235
                if (max_year) {
 
3236
                        *max_year = _vala_max_year;
 
3237
                }
 
3238
                return;
 
3239
        }
 
3240
        _tmp14_ = filter;
 
3241
        _tmp15_ = _g_object_ref0 (UNITY_IS_MULTI_RANGE_FILTER (_tmp14_) ? ((UnityMultiRangeFilter*) _tmp14_) : NULL);
 
3242
        mrf = _tmp15_;
 
3243
        _tmp16_ = mrf;
 
3244
        _tmp17_ = unity_multi_range_filter_get_first_active (_tmp16_);
 
3245
        _tmp18_ = _tmp17_;
 
3246
        _tmp19_ = unity_filter_option_get_id (_tmp18_);
 
3247
        _tmp20_ = _tmp19_;
 
3248
        _tmp21_ = atoi (_tmp20_);
 
3249
        _vala_min_year = _tmp21_;
 
3250
        _g_object_unref0 (_tmp18_);
 
3251
        _tmp22_ = mrf;
 
3252
        _tmp23_ = unity_multi_range_filter_get_last_active (_tmp22_);
 
3253
        _tmp24_ = _tmp23_;
 
3254
        _tmp25_ = unity_filter_option_get_id (_tmp24_);
 
3255
        _tmp26_ = _tmp25_;
 
3256
        _tmp27_ = atoi (_tmp26_);
 
3257
        _vala_max_year = _tmp27_ + 9;
 
3258
        _g_object_unref0 (_tmp24_);
 
3259
        _g_object_unref0 (mrf);
 
3260
        _g_object_unref0 (filter);
 
3261
        if (min_year) {
 
3262
                *min_year = _vala_min_year;
 
3263
        }
 
3264
        if (max_year) {
 
3265
                *max_year = _vala_max_year;
 
3266
        }
 
3267
}
 
3268
 
 
3269
 
 
3270
static GeeSet* unity_music_lens_rhythmbox_collection_get_genre_filter (UnityMusicLensRhythmboxCollection* self, GList* filters) {
 
3271
        GeeSet* result = NULL;
 
3272
        UnityFilter* filter;
 
3273
        GList* _tmp0_;
 
3274
        gboolean _tmp7_ = FALSE;
 
3275
        UnityFilter* _tmp8_;
 
3276
        gboolean _tmp12_;
 
3277
        GeeHashSet* _tmp13_;
 
3278
        GeeHashSet* active_genres;
 
3279
        UnityFilter* _tmp14_;
 
3280
        UnityCheckOptionFilterCompact* _tmp15_;
 
3281
        UnityCheckOptionFilterCompact* all_genres;
 
3282
        UnityCheckOptionFilterCompact* _tmp16_;
 
3283
        GList* _tmp17_;
 
3284
        g_return_val_if_fail (self != NULL, NULL);
 
3285
        filter = NULL;
 
3286
        _tmp0_ = filters;
 
3287
        {
 
3288
                GList* parser_collection = NULL;
 
3289
                GList* parser_it = NULL;
 
3290
                parser_collection = _tmp0_;
 
3291
                for (parser_it = parser_collection; parser_it != NULL; parser_it = parser_it->next) {
 
3292
                        UnityMusicLensFilterParser* _tmp1_;
 
3293
                        UnityMusicLensFilterParser* parser = NULL;
 
3294
                        _tmp1_ = _g_object_ref0 ((UnityMusicLensFilterParser*) parser_it->data);
 
3295
                        parser = _tmp1_;
 
3296
                        {
 
3297
                                UnityMusicLensFilterParser* _tmp2_;
 
3298
                                _tmp2_ = parser;
 
3299
                                if (UNITY_MUSIC_LENS_IS_GENRE_FILTER_PARSER (_tmp2_)) {
 
3300
                                        UnityMusicLensFilterParser* _tmp3_;
 
3301
                                        UnityFilter* _tmp4_;
 
3302
                                        UnityFilter* _tmp5_;
 
3303
                                        UnityFilter* _tmp6_;
 
3304
                                        _tmp3_ = parser;
 
3305
                                        _tmp4_ = unity_music_lens_filter_parser_get_filter (_tmp3_);
 
3306
                                        _tmp5_ = _tmp4_;
 
3307
                                        _tmp6_ = _g_object_ref0 (_tmp5_);
 
3308
                                        _g_object_unref0 (filter);
 
3309
                                        filter = _tmp6_;
 
3310
                                }
 
3311
                                _g_object_unref0 (parser);
 
3312
                        }
 
3313
                }
 
3314
        }
 
3315
        _tmp8_ = filter;
 
3316
        if (_tmp8_ == NULL) {
 
3317
                _tmp7_ = TRUE;
 
3318
        } else {
 
3319
                UnityFilter* _tmp9_;
 
3320
                gboolean _tmp10_;
 
3321
                gboolean _tmp11_;
 
3322
                _tmp9_ = filter;
 
3323
                _tmp10_ = unity_filter_get_filtering (_tmp9_);
 
3324
                _tmp11_ = _tmp10_;
 
3325
                _tmp7_ = !_tmp11_;
 
3326
        }
 
3327
        _tmp12_ = _tmp7_;
 
3328
        if (_tmp12_) {
 
3329
                result = NULL;
 
3330
                _g_object_unref0 (filter);
 
3331
                return result;
 
3332
        }
 
3333
        _tmp13_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
 
3334
        active_genres = _tmp13_;
 
3335
        _tmp14_ = filter;
 
3336
        _tmp15_ = _g_object_ref0 (UNITY_IS_CHECK_OPTION_FILTER_COMPACT (_tmp14_) ? ((UnityCheckOptionFilterCompact*) _tmp14_) : NULL);
 
3337
        all_genres = _tmp15_;
 
3338
        _tmp16_ = all_genres;
 
3339
        _tmp17_ = ((UnityOptionsFilter*) _tmp16_)->options;
 
3340
        {
 
3341
                GList* option_collection = NULL;
 
3342
                GList* option_it = NULL;
 
3343
                option_collection = _tmp17_;
 
3344
                for (option_it = option_collection; option_it != NULL; option_it = option_it->next) {
 
3345
                        UnityFilterOption* _tmp18_;
 
3346
                        UnityFilterOption* option = NULL;
 
3347
                        _tmp18_ = _g_object_ref0 ((UnityFilterOption*) option_it->data);
 
3348
                        option = _tmp18_;
 
3349
                        {
 
3350
                                gboolean _tmp19_ = FALSE;
 
3351
                                UnityFilterOption* _tmp20_;
 
3352
                                const gchar* _tmp21_;
 
3353
                                const gchar* _tmp22_;
 
3354
                                gboolean _tmp26_;
 
3355
                                GeeHashSet* _tmp27_;
 
3356
                                UnityFilterOption* _tmp28_;
 
3357
                                const gchar* _tmp29_;
 
3358
                                const gchar* _tmp30_;
 
3359
                                _tmp20_ = option;
 
3360
                                _tmp21_ = unity_filter_option_get_id (_tmp20_);
 
3361
                                _tmp22_ = _tmp21_;
 
3362
                                if (_tmp22_ == NULL) {
 
3363
                                        _tmp19_ = TRUE;
 
3364
                                } else {
 
3365
                                        UnityFilterOption* _tmp23_;
 
3366
                                        gboolean _tmp24_;
 
3367
                                        gboolean _tmp25_;
 
3368
                                        _tmp23_ = option;
 
3369
                                        _tmp24_ = unity_filter_option_get_active (_tmp23_);
 
3370
                                        _tmp25_ = _tmp24_;
 
3371
                                        _tmp19_ = !_tmp25_;
 
3372
                                }
 
3373
                                _tmp26_ = _tmp19_;
 
3374
                                if (_tmp26_) {
 
3375
                                        _g_object_unref0 (option);
 
3376
                                        continue;
 
3377
                                }
 
3378
                                _tmp27_ = active_genres;
 
3379
                                _tmp28_ = option;
 
3380
                                _tmp29_ = unity_filter_option_get_id (_tmp28_);
 
3381
                                _tmp30_ = _tmp29_;
 
3382
                                gee_abstract_collection_add ((GeeAbstractCollection*) _tmp27_, _tmp30_);
 
3383
                                _g_object_unref0 (option);
 
3384
                        }
 
3385
                }
 
3386
        }
 
3387
        result = (GeeSet*) active_genres;
 
3388
        _g_object_unref0 (all_genres);
 
3389
        _g_object_unref0 (filter);
 
3390
        return result;
 
3391
}
 
3392
 
 
3393
 
 
3394
UnityMusicLensRhythmboxCollection* unity_music_lens_rhythmbox_collection_construct (GType object_type) {
 
3395
        UnityMusicLensRhythmboxCollection * self = NULL;
 
3396
        self = (UnityMusicLensRhythmboxCollection*) g_object_new (object_type, NULL);
 
3397
        return self;
 
3398
}
 
3399
 
 
3400
 
 
3401
UnityMusicLensRhythmboxCollection* unity_music_lens_rhythmbox_collection_new (void) {
 
3402
        return unity_music_lens_rhythmbox_collection_construct (UNITY_MUSIC_LENS_TYPE_RHYTHMBOX_COLLECTION);
 
3403
}
 
3404
 
 
3405
 
 
3406
static void _g_variant_unref0_ (gpointer var) {
 
3407
        (var == NULL) ? NULL : (var = (g_variant_unref (var), NULL));
 
3408
}
 
3409
 
 
3410
 
 
3411
static void _g_free0_ (gpointer var) {
 
3412
        var = (g_free (var), NULL);
 
3413
}
 
3414
 
 
3415
 
 
3416
static void _g_ptr_array_unref0_ (gpointer var) {
 
3417
        (var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL));
 
3418
}
 
3419
 
 
3420
 
 
3421
static gint _unity_music_lens_rhythmbox_collection___lambda11_ (UnityMusicLensRhythmboxCollection* self, GVariant** row1, int row1_length1, GVariant** row2, int row2_length1) {
 
3422
        gint result = 0;
 
3423
        GVariant** _tmp0_;
 
3424
        gint _tmp0__length1;
 
3425
        GVariant* _tmp1_;
 
3426
        gint32 _tmp2_ = 0;
 
3427
        gint a;
 
3428
        GVariant** _tmp3_;
 
3429
        gint _tmp3__length1;
 
3430
        GVariant* _tmp4_;
 
3431
        gint32 _tmp5_ = 0;
 
3432
        gint b;
 
3433
        gint _tmp6_;
 
3434
        gint _tmp7_;
 
3435
        _tmp0_ = row1;
 
3436
        _tmp0__length1 = row1_length1;
 
3437
        _tmp1_ = _tmp0_[UNITY_MUSIC_LENS_COLUMNS_PLAY_COUNT];
 
3438
        _tmp2_ = g_variant_get_int32 (_tmp1_);
 
3439
        a = (gint) _tmp2_;
 
3440
        _tmp3_ = row2;
 
3441
        _tmp3__length1 = row2_length1;
 
3442
        _tmp4_ = _tmp3_[UNITY_MUSIC_LENS_COLUMNS_PLAY_COUNT];
 
3443
        _tmp5_ = g_variant_get_int32 (_tmp4_);
 
3444
        b = (gint) _tmp5_;
 
3445
        _tmp6_ = b;
 
3446
        _tmp7_ = a;
 
3447
        result = _tmp6_ - _tmp7_;
 
3448
        return result;
 
3449
}
 
3450
 
 
3451
 
 
3452
static gint __unity_music_lens_rhythmbox_collection___lambda11__dee_compare_row_func (GVariant** row1, GVariant** row2, gpointer self) {
 
3453
        gint result;
 
3454
        result = _unity_music_lens_rhythmbox_collection___lambda11_ (self, row1, -1, row2, -1);
 
3455
        return result;
 
3456
}
 
3457
 
 
3458
 
 
3459
static void _unity_music_lens_rhythmbox_collection___lambda12_ (UnityMusicLensRhythmboxCollection* self, DeeTermList* terms_in, DeeTermList* terms_out) {
 
3460
        g_return_if_fail (terms_in != NULL);
 
3461
        g_return_if_fail (terms_out != NULL);
 
3462
        {
 
3463
                DeeTermList* _tmp0_;
 
3464
                DeeTermList* _tmp1_;
 
3465
                DeeTermList* _term_list;
 
3466
                DeeTermList* _tmp2_;
 
3467
                guint _tmp3_;
 
3468
                guint _tmp4_;
 
3469
                guint _term_size;
 
3470
                gint _term_index;
 
3471
                _tmp0_ = terms_in;
 
3472
                _tmp1_ = _g_object_ref0 (_tmp0_);
 
3473
                _term_list = _tmp1_;
 
3474
                _tmp2_ = _term_list;
 
3475
                _tmp3_ = dee_term_list_num_terms (_tmp2_);
 
3476
                _tmp4_ = _tmp3_;
 
3477
                _term_size = _tmp4_;
 
3478
                _term_index = -1;
 
3479
                while (TRUE) {
 
3480
                        gint _tmp5_;
 
3481
                        gint _tmp6_;
 
3482
                        guint _tmp7_;
 
3483
                        DeeTermList* _tmp8_;
 
3484
                        gint _tmp9_;
 
3485
                        const gchar* _tmp10_ = NULL;
 
3486
                        const gchar* term;
 
3487
                        DeeICUTermFilter* _tmp11_;
 
3488
                        const gchar* _tmp12_;
 
3489
                        gchar* _tmp13_ = NULL;
 
3490
                        gchar* folded;
 
3491
                        DeeTermList* _tmp14_;
 
3492
                        const gchar* _tmp15_;
 
3493
                        const gchar* _tmp16_;
 
3494
                        const gchar* _tmp17_;
 
3495
                        _tmp5_ = _term_index;
 
3496
                        _term_index = _tmp5_ + 1;
 
3497
                        _tmp6_ = _term_index;
 
3498
                        _tmp7_ = _term_size;
 
3499
                        if (!(((guint) _tmp6_) < _tmp7_)) {
 
3500
                                break;
 
3501
                        }
 
3502
                        _tmp8_ = _term_list;
 
3503
                        _tmp9_ = _term_index;
 
3504
                        _tmp10_ = dee_term_list_get_term (_tmp8_, (guint) _tmp9_);
 
3505
                        term = _tmp10_;
 
3506
                        _tmp11_ = self->priv->ascii_filter;
 
3507
                        _tmp12_ = term;
 
3508
                        _tmp13_ = dee_icu_term_filter_apply (_tmp11_, _tmp12_);
 
3509
                        folded = _tmp13_;
 
3510
                        _tmp14_ = terms_out;
 
3511
                        _tmp15_ = term;
 
3512
                        dee_term_list_add_term (_tmp14_, _tmp15_);
 
3513
                        _tmp16_ = folded;
 
3514
                        _tmp17_ = term;
 
3515
                        if (g_strcmp0 (_tmp16_, _tmp17_) != 0) {
 
3516
                                DeeTermList* _tmp18_;
 
3517
                                const gchar* _tmp19_;
 
3518
                                _tmp18_ = terms_out;
 
3519
                                _tmp19_ = folded;
 
3520
                                dee_term_list_add_term (_tmp18_, _tmp19_);
 
3521
                        }
 
3522
                        _g_free0 (folded);
 
3523
                }
 
3524
                _g_object_unref0 (_term_list);
 
3525
        }
 
3526
}
 
3527
 
 
3528
 
 
3529
static void __unity_music_lens_rhythmbox_collection___lambda12__dee_term_filter_func (DeeTermList* terms_in, DeeTermList* terms_out, gpointer self) {
 
3530
        _unity_music_lens_rhythmbox_collection___lambda12_ (self, terms_in, terms_out);
 
3531
}
 
3532
 
 
3533
 
 
3534
static GObject * unity_music_lens_rhythmbox_collection_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
 
3535
        GObject * obj;
 
3536
        GObjectClass * parent_class;
 
3537
        UnityMusicLensRhythmboxCollection * self;
 
3538
        const gchar* _tmp0_ = NULL;
 
3539
        gchar* _tmp1_ = NULL;
 
3540
        GHashFunc _tmp2_;
 
3541
        GEqualFunc _tmp3_;
 
3542
        GHashTable* _tmp4_;
 
3543
        GHashFunc _tmp5_;
 
3544
        GEqualFunc _tmp6_;
 
3545
        GHashTable* _tmp7_;
 
3546
        DeeSequenceModel* _tmp8_;
 
3547
        DeeSequenceModel* _tmp9_;
 
3548
        DeeSequenceModel* _tmp10_;
 
3549
        guint _tmp11_;
 
3550
        gchar** _tmp12_ = NULL;
 
3551
        DeeSequenceModel* _tmp13_;
 
3552
        DeeModelTag* _tmp14_;
 
3553
        GHashFunc _tmp15_;
 
3554
        GEqualFunc _tmp16_;
 
3555
        GHashTable* _tmp17_;
 
3556
        DeeFilter _tmp18_ = {0};
 
3557
        DeeFilter filter;
 
3558
        DeeSequenceModel* _tmp19_;
 
3559
        DeeFilter _tmp20_;
 
3560
        DeeFilterModel* _tmp21_;
 
3561
        DeeICUTermFilter* _tmp22_;
 
3562
        DeeTextAnalyzer* _tmp23_;
 
3563
        DeeAnalyzer* _tmp24_;
 
3564
        parent_class = G_OBJECT_CLASS (unity_music_lens_rhythmbox_collection_parent_class);
 
3565
        obj = parent_class->constructor (type, n_construct_properties, construct_properties);
 
3566
        self = UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION (obj);
 
3567
        G_STATIC_ASSERT (13 == ((gint) UNITY_MUSIC_LENS_COLUMNS_N_COLUMNS));
 
3568
        _tmp0_ = g_get_user_cache_dir ();
 
3569
        _tmp1_ = g_build_filename (_tmp0_, "media-art", NULL);
 
3570
        _g_free0 (self->priv->media_art_dir);
 
3571
        self->priv->media_art_dir = _tmp1_;
 
3572
        _tmp2_ = g_str_hash;
 
3573
        _tmp3_ = g_str_equal;
 
3574
        _tmp4_ = g_hash_table_new_full (_tmp2_, _tmp3_, NULL, _g_variant_unref0_);
 
3575
        _g_hash_table_unref0 (self->priv->variant_store);
 
3576
        self->priv->variant_store = _tmp4_;
 
3577
        _tmp5_ = g_direct_hash;
 
3578
        _tmp6_ = g_direct_equal;
 
3579
        _tmp7_ = g_hash_table_new_full (_tmp5_, _tmp6_, NULL, _g_variant_unref0_);
 
3580
        _g_hash_table_unref0 (self->priv->int_variant_store);
 
3581
        self->priv->int_variant_store = _tmp7_;
 
3582
        _tmp8_ = (DeeSequenceModel*) dee_sequence_model_new ();
 
3583
        _g_object_unref0 (self->priv->all_tracks);
 
3584
        self->priv->all_tracks = _tmp8_;
 
3585
        _tmp9_ = self->priv->all_tracks;
 
3586
        dee_model_set_schema ((DeeModel*) _tmp9_, "i", "s", "s", "s", "s", "s", "s", "s", "s", "i", "i", "i", "i", NULL);
 
3587
        _tmp10_ = self->priv->all_tracks;
 
3588
        _tmp12_ = dee_model_get_schema ((DeeModel*) _tmp10_, &_tmp11_);
 
3589
        g_assert (_tmp11_ == ((gint) UNITY_MUSIC_LENS_COLUMNS_N_COLUMNS));
 
3590
        _tmp13_ = self->priv->all_tracks;
 
3591
        _tmp14_ = dee_model_register_tag ((DeeModel*) _tmp13_, NULL);
 
3592
        self->priv->album_art_tag = _tmp14_;
 
3593
        _tmp15_ = g_str_hash;
 
3594
        _tmp16_ = g_str_equal;
 
3595
        _tmp17_ = g_hash_table_new_full (_tmp15_, _tmp16_, _g_free0_, _g_ptr_array_unref0_);
 
3596
        _g_hash_table_unref0 (self->priv->album_to_tracks_map);
 
3597
        self->priv->album_to_tracks_map = _tmp17_;
 
3598
        dee_filter_new_sort (__unity_music_lens_rhythmbox_collection___lambda11__dee_compare_row_func, g_object_ref (self), g_object_unref, &_tmp18_);
 
3599
        filter = _tmp18_;
 
3600
        _tmp19_ = self->priv->all_tracks;
 
3601
        _tmp20_ = filter;
 
3602
        _tmp21_ = (DeeFilterModel*) dee_filter_model_new ((DeeModel*) _tmp19_, &_tmp20_);
 
3603
        _g_object_unref0 (self->priv->tracks_by_play_count);
 
3604
        self->priv->tracks_by_play_count = _tmp21_;
 
3605
        _tmp22_ = dee_icu_term_filter_new_ascii_folder ();
 
3606
        _dee_icu_term_filter_destroy0 (self->priv->ascii_filter);
 
3607
        self->priv->ascii_filter = _tmp22_;
 
3608
        _tmp23_ = dee_text_analyzer_new ();
 
3609
        _g_object_unref0 (self->priv->analyzer);
 
3610
        self->priv->analyzer = (DeeAnalyzer*) _tmp23_;
 
3611
        _tmp24_ = self->priv->analyzer;
 
3612
        dee_analyzer_add_term_filter (_tmp24_, __unity_music_lens_rhythmbox_collection___lambda12__dee_term_filter_func, g_object_ref (self), g_object_unref);
 
3613
        unity_music_lens_rhythmbox_collection_initialize_index (self);
 
3614
        return obj;
 
3615
}
 
3616
 
 
3617
 
 
3618
static void _unity_music_lens_rhythmbox_collection_xml_parser_start_tag_gmarkup_parser_start_element_func (GMarkupParseContext* context, const gchar* element_name, gchar** attribute_names, gchar** attribute_values, gpointer self, GError** error) {
 
3619
        unity_music_lens_rhythmbox_collection_xml_parser_start_tag (self, context, element_name, attribute_names, attribute_values, error);
 
3620
}
 
3621
 
 
3622
 
 
3623
static void _unity_music_lens_rhythmbox_collection_xml_parser_end_tag_gmarkup_parser_end_element_func (GMarkupParseContext* context, const gchar* element_name, gpointer self, GError** error) {
 
3624
        unity_music_lens_rhythmbox_collection_xml_parser_end_tag (self, context, element_name, error);
 
3625
}
 
3626
 
 
3627
 
 
3628
static void _unity_music_lens_rhythmbox_collection_xml_parser_process_text_gmarkup_parser_text_func (GMarkupParseContext* context, const gchar* text, gsize text_len, gpointer self, GError** error) {
 
3629
        unity_music_lens_rhythmbox_collection_xml_parser_process_text (self, context, text, text_len, error);
 
3630
}
 
3631
 
 
3632
 
 
3633
gboolean unity_music_lens_rhythmbox_collection_xml_parser_parse (UnityMusicLensRhythmboxCollectionXmlParser* self, const gchar* content, gsize len, GError** error) {
 
3634
        gboolean result = FALSE;
 
3635
        GMarkupParseContext* _tmp0_;
 
3636
        const gchar* _tmp1_;
 
3637
        gsize _tmp2_;
 
3638
        gboolean _tmp3_ = FALSE;
 
3639
        gboolean _tmp4_;
 
3640
        GError * _inner_error_ = NULL;
 
3641
        g_return_val_if_fail (self != NULL, FALSE);
 
3642
        g_return_val_if_fail (content != NULL, FALSE);
 
3643
        _tmp0_ = self->priv->context;
 
3644
        _tmp1_ = content;
 
3645
        _tmp2_ = len;
 
3646
        _tmp3_ = g_markup_parse_context_parse (_tmp0_, _tmp1_, (gssize) _tmp2_, &_inner_error_);
 
3647
        _tmp4_ = _tmp3_;
 
3648
        if (_inner_error_ != NULL) {
 
3649
                if (_inner_error_->domain == G_MARKUP_ERROR) {
 
3650
                        g_propagate_error (error, _inner_error_);
 
3651
                        return FALSE;
 
3652
                } else {
 
3653
                        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);
 
3654
                        g_clear_error (&_inner_error_);
 
3655
                        return FALSE;
 
3656
                }
 
3657
        }
 
3658
        result = _tmp4_;
 
3659
        return result;
 
3660
}
 
3661
 
 
3662
 
 
3663
static void unity_music_lens_rhythmbox_collection_xml_parser_start_tag (UnityMusicLensRhythmboxCollectionXmlParser* self, GMarkupParseContext* context, const gchar* name, gchar** attr_names, gchar** attr_values, GError** error) {
 
3664
        gboolean _tmp0_;
 
3665
        g_return_if_fail (self != NULL);
 
3666
        g_return_if_fail (context != NULL);
 
3667
        g_return_if_fail (name != NULL);
 
3668
        _tmp0_ = self->priv->processing_track;
 
3669
        if (!_tmp0_) {
 
3670
                const gchar* _tmp1_;
 
3671
                const gchar* _tmp2_;
 
3672
                GQuark _tmp4_ = 0U;
 
3673
                static GQuark _tmp3_label0 = 0;
 
3674
                static GQuark _tmp3_label1 = 0;
 
3675
                _tmp1_ = name;
 
3676
                _tmp2_ = _tmp1_;
 
3677
                _tmp4_ = (NULL == _tmp2_) ? 0 : g_quark_from_string (_tmp2_);
 
3678
                if (_tmp4_ == ((0 != _tmp3_label0) ? _tmp3_label0 : (_tmp3_label0 = g_quark_from_static_string ("rhythmdb")))) {
 
3679
                        switch (0) {
 
3680
                                default:
 
3681
                                {
 
3682
                                        self->priv->is_rhythmdb_xml = TRUE;
 
3683
                                        break;
 
3684
                                }
 
3685
                        }
 
3686
                } else if (_tmp4_ == ((0 != _tmp3_label1) ? _tmp3_label1 : (_tmp3_label1 = g_quark_from_static_string ("entry")))) {
 
3687
                        switch (0) {
 
3688
                                default:
 
3689
                                {
 
3690
                                        gchar* accepted_element_name;
 
3691
                                        const gchar* _tmp28_;
 
3692
                                        UnityMusicLensTrack* _tmp29_;
 
3693
                                        UnityMusicLensTrackType _tmp30_ = 0;
 
3694
                                        const gchar* _tmp31_;
 
3695
                                        UnityMusicLensTrack* _tmp32_;
 
3696
                                        UnityMusicLensTrackType _tmp33_;
 
3697
                                        accepted_element_name = NULL;
 
3698
                                        {
 
3699
                                                gint i;
 
3700
                                                i = 0;
 
3701
                                                {
 
3702
                                                        gboolean _tmp5_;
 
3703
                                                        _tmp5_ = TRUE;
 
3704
                                                        while (TRUE) {
 
3705
                                                                gboolean _tmp6_;
 
3706
                                                                gchar** _tmp8_;
 
3707
                                                                gint _tmp8__length1;
 
3708
                                                                gint _tmp9_;
 
3709
                                                                const gchar* _tmp10_;
 
3710
                                                                gboolean _tmp11_ = FALSE;
 
3711
                                                                gchar** _tmp12_;
 
3712
                                                                gint _tmp12__length1;
 
3713
                                                                gint _tmp13_;
 
3714
                                                                const gchar* _tmp14_;
 
3715
                                                                gboolean _tmp23_;
 
3716
                                                                _tmp6_ = _tmp5_;
 
3717
                                                                if (!_tmp6_) {
 
3718
                                                                        gint _tmp7_;
 
3719
                                                                        _tmp7_ = i;
 
3720
                                                                        i = _tmp7_ + 1;
 
3721
                                                                }
 
3722
                                                                _tmp5_ = FALSE;
 
3723
                                                                _tmp8_ = attr_names;
 
3724
                                                                _tmp8__length1 = _vala_array_length (attr_names);
 
3725
                                                                _tmp9_ = i;
 
3726
                                                                _tmp10_ = _tmp8_[_tmp9_];
 
3727
                                                                if (!(_tmp10_ != NULL)) {
 
3728
                                                                        break;
 
3729
                                                                }
 
3730
                                                                _tmp12_ = attr_names;
 
3731
                                                                _tmp12__length1 = _vala_array_length (attr_names);
 
3732
                                                                _tmp13_ = i;
 
3733
                                                                _tmp14_ = _tmp12_[_tmp13_];
 
3734
                                                                if (g_strcmp0 (_tmp14_, "type") == 0) {
 
3735
                                                                        gboolean _tmp15_ = FALSE;
 
3736
                                                                        gchar** _tmp16_;
 
3737
                                                                        gint _tmp16__length1;
 
3738
                                                                        gint _tmp17_;
 
3739
                                                                        const gchar* _tmp18_;
 
3740
                                                                        gboolean _tmp22_;
 
3741
                                                                        _tmp16_ = attr_values;
 
3742
                                                                        _tmp16__length1 = _vala_array_length (attr_values);
 
3743
                                                                        _tmp17_ = i;
 
3744
                                                                        _tmp18_ = _tmp16_[_tmp17_];
 
3745
                                                                        if (g_strcmp0 (_tmp18_, "song") == 0) {
 
3746
                                                                                _tmp15_ = TRUE;
 
3747
                                                                        } else {
 
3748
                                                                                gchar** _tmp19_;
 
3749
                                                                                gint _tmp19__length1;
 
3750
                                                                                gint _tmp20_;
 
3751
                                                                                const gchar* _tmp21_;
 
3752
                                                                                _tmp19_ = attr_values;
 
3753
                                                                                _tmp19__length1 = _vala_array_length (attr_values);
 
3754
                                                                                _tmp20_ = i;
 
3755
                                                                                _tmp21_ = _tmp19_[_tmp20_];
 
3756
                                                                                _tmp15_ = g_strcmp0 (_tmp21_, "iradio") == 0;
 
3757
                                                                        }
 
3758
                                                                        _tmp22_ = _tmp15_;
 
3759
                                                                        _tmp11_ = _tmp22_;
 
3760
                                                                } else {
 
3761
                                                                        _tmp11_ = FALSE;
 
3762
                                                                }
 
3763
                                                                _tmp23_ = _tmp11_;
 
3764
                                                                if (_tmp23_) {
 
3765
                                                                        gchar** _tmp24_;
 
3766
                                                                        gint _tmp24__length1;
 
3767
                                                                        gint _tmp25_;
 
3768
                                                                        const gchar* _tmp26_;
 
3769
                                                                        gchar* _tmp27_;
 
3770
                                                                        _tmp24_ = attr_values;
 
3771
                                                                        _tmp24__length1 = _vala_array_length (attr_values);
 
3772
                                                                        _tmp25_ = i;
 
3773
                                                                        _tmp26_ = _tmp24_[_tmp25_];
 
3774
                                                                        _tmp27_ = g_strdup (_tmp26_);
 
3775
                                                                        _g_free0 (accepted_element_name);
 
3776
                                                                        accepted_element_name = _tmp27_;
 
3777
                                                                }
 
3778
                                                        }
 
3779
                                                }
 
3780
                                        }
 
3781
                                        _tmp28_ = accepted_element_name;
 
3782
                                        if (_tmp28_ == NULL) {
 
3783
                                                _g_free0 (accepted_element_name);
 
3784
                                                return;
 
3785
                                        }
 
3786
                                        self->priv->processing_track = TRUE;
 
3787
                                        _tmp29_ = unity_music_lens_track_new ();
 
3788
                                        _g_object_unref0 (self->priv->current_track);
 
3789
                                        self->priv->current_track = _tmp29_;
 
3790
                                        _tmp31_ = accepted_element_name;
 
3791
                                        if (g_strcmp0 (_tmp31_, "song") == 0) {
 
3792
                                                _tmp30_ = UNITY_MUSIC_LENS_TRACK_TYPE_SONG;
 
3793
                                        } else {
 
3794
                                                _tmp30_ = UNITY_MUSIC_LENS_TRACK_TYPE_RADIO;
 
3795
                                        }
 
3796
                                        _tmp32_ = self->priv->current_track;
 
3797
                                        _tmp33_ = _tmp30_;
 
3798
                                        unity_music_lens_track_set_type_track (_tmp32_, _tmp33_);
 
3799
                                        _g_free0 (accepted_element_name);
 
3800
                                        break;
 
3801
                                }
 
3802
                        }
 
3803
                }
 
3804
        } else {
 
3805
                const gchar* _tmp34_;
 
3806
                const gchar* _tmp35_;
 
3807
                GQuark _tmp37_ = 0U;
 
3808
                static GQuark _tmp36_label0 = 0;
 
3809
                static GQuark _tmp36_label1 = 0;
 
3810
                static GQuark _tmp36_label2 = 0;
 
3811
                static GQuark _tmp36_label3 = 0;
 
3812
                static GQuark _tmp36_label4 = 0;
 
3813
                static GQuark _tmp36_label5 = 0;
 
3814
                static GQuark _tmp36_label6 = 0;
 
3815
                static GQuark _tmp36_label7 = 0;
 
3816
                static GQuark _tmp36_label8 = 0;
 
3817
                static GQuark _tmp36_label9 = 0;
 
3818
                static GQuark _tmp36_label10 = 0;
 
3819
                _tmp34_ = name;
 
3820
                _tmp35_ = _tmp34_;
 
3821
                _tmp37_ = (NULL == _tmp35_) ? 0 : g_quark_from_string (_tmp35_);
 
3822
                if (_tmp37_ == ((0 != _tmp36_label0) ? _tmp36_label0 : (_tmp36_label0 = g_quark_from_static_string ("location")))) {
 
3823
                        switch (0) {
 
3824
                                default:
 
3825
                                {
 
3826
                                        self->priv->current_data = (gint) UNITY_MUSIC_LENS_COLUMNS_URI;
 
3827
                                        break;
 
3828
                                }
 
3829
                        }
 
3830
                } else if (_tmp37_ == ((0 != _tmp36_label1) ? _tmp36_label1 : (_tmp36_label1 = g_quark_from_static_string ("title")))) {
 
3831
                        switch (0) {
 
3832
                                default:
 
3833
                                {
 
3834
                                        self->priv->current_data = (gint) UNITY_MUSIC_LENS_COLUMNS_TITLE;
 
3835
                                        break;
 
3836
                                }
 
3837
                        }
 
3838
                } else if (_tmp37_ == ((0 != _tmp36_label2) ? _tmp36_label2 : (_tmp36_label2 = g_quark_from_static_string ("duration")))) {
 
3839
                        switch (0) {
 
3840
                                default:
 
3841
                                {
 
3842
                                        self->priv->current_data = (gint) UNITY_MUSIC_LENS_COLUMNS_DURATION;
 
3843
                                        break;
 
3844
                                }
 
3845
                        }
 
3846
                } else if (_tmp37_ == ((0 != _tmp36_label3) ? _tmp36_label3 : (_tmp36_label3 = g_quark_from_static_string ("artist")))) {
 
3847
                        switch (0) {
 
3848
                                default:
 
3849
                                {
 
3850
                                        self->priv->current_data = (gint) UNITY_MUSIC_LENS_COLUMNS_ARTIST;
 
3851
                                        break;
 
3852
                                }
 
3853
                        }
 
3854
                } else if (_tmp37_ == ((0 != _tmp36_label4) ? _tmp36_label4 : (_tmp36_label4 = g_quark_from_static_string ("album")))) {
 
3855
                        switch (0) {
 
3856
                                default:
 
3857
                                {
 
3858
                                        self->priv->current_data = (gint) UNITY_MUSIC_LENS_COLUMNS_ALBUM;
 
3859
                                        break;
 
3860
                                }
 
3861
                        }
 
3862
                } else if (_tmp37_ == ((0 != _tmp36_label5) ? _tmp36_label5 : (_tmp36_label5 = g_quark_from_static_string ("genre")))) {
 
3863
                        switch (0) {
 
3864
                                default:
 
3865
                                {
 
3866
                                        self->priv->current_data = (gint) UNITY_MUSIC_LENS_COLUMNS_GENRE;
 
3867
                                        break;
 
3868
                                }
 
3869
                        }
 
3870
                } else if (_tmp37_ == ((0 != _tmp36_label6) ? _tmp36_label6 : (_tmp36_label6 = g_quark_from_static_string ("track-number")))) {
 
3871
                        switch (0) {
 
3872
                                default:
 
3873
                                {
 
3874
                                        self->priv->current_data = (gint) UNITY_MUSIC_LENS_COLUMNS_TRACK_NUMBER;
 
3875
                                        break;
 
3876
                                }
 
3877
                        }
 
3878
                } else if (_tmp37_ == ((0 != _tmp36_label7) ? _tmp36_label7 : (_tmp36_label7 = g_quark_from_static_string ("play-count")))) {
 
3879
                        switch (0) {
 
3880
                                default:
 
3881
                                {
 
3882
                                        self->priv->current_data = (gint) UNITY_MUSIC_LENS_COLUMNS_PLAY_COUNT;
 
3883
                                        break;
 
3884
                                }
 
3885
                        }
 
3886
                } else if (_tmp37_ == ((0 != _tmp36_label8) ? _tmp36_label8 : (_tmp36_label8 = g_quark_from_static_string ("date")))) {
 
3887
                        switch (0) {
 
3888
                                default:
 
3889
                                {
 
3890
                                        self->priv->current_data = (gint) UNITY_MUSIC_LENS_COLUMNS_YEAR;
 
3891
                                        break;
 
3892
                                }
 
3893
                        }
 
3894
                } else if (_tmp37_ == ((0 != _tmp36_label9) ? _tmp36_label9 : (_tmp36_label9 = g_quark_from_static_string ("media-type")))) {
 
3895
                        switch (0) {
 
3896
                                default:
 
3897
                                {
 
3898
                                        self->priv->current_data = (gint) UNITY_MUSIC_LENS_COLUMNS_MIMETYPE;
 
3899
                                        break;
 
3900
                                }
 
3901
                        }
 
3902
                } else if (_tmp37_ == ((0 != _tmp36_label10) ? _tmp36_label10 : (_tmp36_label10 = g_quark_from_static_string ("album-artist")))) {
 
3903
                        switch (0) {
 
3904
                                default:
 
3905
                                {
 
3906
                                        self->priv->current_data = (gint) UNITY_MUSIC_LENS_COLUMNS_ALBUM_ARTIST;
 
3907
                                        break;
 
3908
                                }
 
3909
                        }
 
3910
                } else {
 
3911
                        switch (0) {
 
3912
                                default:
 
3913
                                {
 
3914
                                        self->priv->current_data = -1;
 
3915
                                        break;
 
3916
                                }
 
3917
                        }
 
3918
                }
 
3919
        }
 
3920
}
 
3921
 
 
3922
 
 
3923
static void unity_music_lens_rhythmbox_collection_xml_parser_end_tag (UnityMusicLensRhythmboxCollectionXmlParser* self, GMarkupParseContext* content, const gchar* name, GError** error) {
 
3924
        const gchar* _tmp0_;
 
3925
        const gchar* _tmp1_;
 
3926
        GQuark _tmp3_ = 0U;
 
3927
        static GQuark _tmp2_label0 = 0;
 
3928
        static GQuark _tmp2_label1 = 0;
 
3929
        static GQuark _tmp2_label2 = 0;
 
3930
        static GQuark _tmp2_label3 = 0;
 
3931
        static GQuark _tmp2_label4 = 0;
 
3932
        static GQuark _tmp2_label5 = 0;
 
3933
        static GQuark _tmp2_label6 = 0;
 
3934
        static GQuark _tmp2_label7 = 0;
 
3935
        static GQuark _tmp2_label8 = 0;
 
3936
        static GQuark _tmp2_label9 = 0;
 
3937
        static GQuark _tmp2_label10 = 0;
 
3938
        static GQuark _tmp2_label11 = 0;
 
3939
        static GQuark _tmp2_label12 = 0;
 
3940
        g_return_if_fail (self != NULL);
 
3941
        g_return_if_fail (content != NULL);
 
3942
        g_return_if_fail (name != NULL);
 
3943
        _tmp0_ = name;
 
3944
        _tmp1_ = _tmp0_;
 
3945
        _tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
 
3946
        if (((((((((((_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("location")))) || (_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("title"))))) || (_tmp3_ == ((0 != _tmp2_label2) ? _tmp2_label2 : (_tmp2_label2 = g_quark_from_static_string ("duration"))))) || (_tmp3_ == ((0 != _tmp2_label3) ? _tmp2_label3 : (_tmp2_label3 = g_quark_from_static_string ("artist"))))) || (_tmp3_ == ((0 != _tmp2_label4) ? _tmp2_label4 : (_tmp2_label4 = g_quark_from_static_string ("album"))))) || (_tmp3_ == ((0 != _tmp2_label5) ? _tmp2_label5 : (_tmp2_label5 = g_quark_from_static_string ("genre"))))) || (_tmp3_ == ((0 != _tmp2_label6) ? _tmp2_label6 : (_tmp2_label6 = g_quark_from_static_string ("track-number"))))) || (_tmp3_ == ((0 != _tmp2_label7) ? _tmp2_label7 : (_tmp2_label7 = g_quark_from_static_string ("play-count"))))) || (_tmp3_ == ((0 != _tmp2_label8) ? _tmp2_label8 : (_tmp2_label8 = g_quark_from_static_string ("date"))))) || (_tmp3_ == ((0 != _tmp2_label9) ? _tmp2_label9 : (_tmp2_label9 = g_quark_from_static_string ("media-type"))))) || (_tmp3_ == ((0 != _tmp2_label10) ? _tmp2_label10 : (_tmp2_label10 = g_quark_from_static_string ("album-artist"))))) {
 
3947
                switch (0) {
 
3948
                        default:
 
3949
                        {
 
3950
                                gint _tmp4_;
 
3951
                                _tmp4_ = self->priv->current_data;
 
3952
                                if (_tmp4_ >= 0) {
 
3953
                                        self->priv->current_data = -1;
 
3954
                                }
 
3955
                                break;
 
3956
                        }
 
3957
                }
 
3958
        } else if (_tmp3_ == ((0 != _tmp2_label11) ? _tmp2_label11 : (_tmp2_label11 = g_quark_from_static_string ("hidden")))) {
 
3959
                switch (0) {
 
3960
                        default:
 
3961
                        {
 
3962
                                gboolean _tmp5_;
 
3963
                                _tmp5_ = self->priv->processing_track;
 
3964
                                if (_tmp5_) {
 
3965
                                        self->priv->processing_track = FALSE;
 
3966
                                }
 
3967
                                break;
 
3968
                        }
 
3969
                }
 
3970
        } else if (_tmp3_ == ((0 != _tmp2_label12) ? _tmp2_label12 : (_tmp2_label12 = g_quark_from_static_string ("entry")))) {
 
3971
                switch (0) {
 
3972
                        default:
 
3973
                        {
 
3974
                                gboolean _tmp6_ = FALSE;
 
3975
                                gboolean _tmp7_;
 
3976
                                gboolean _tmp9_;
 
3977
                                _tmp7_ = self->priv->processing_track;
 
3978
                                if (_tmp7_) {
 
3979
                                        UnityMusicLensTrack* _tmp8_;
 
3980
                                        _tmp8_ = self->priv->current_track;
 
3981
                                        _tmp6_ = _tmp8_ != NULL;
 
3982
                                } else {
 
3983
                                        _tmp6_ = FALSE;
 
3984
                                }
 
3985
                                _tmp9_ = _tmp6_;
 
3986
                                if (_tmp9_) {
 
3987
                                        UnityMusicLensTrack* _tmp10_;
 
3988
                                        _tmp10_ = self->priv->current_track;
 
3989
                                        g_signal_emit_by_name (self, "track-info-ready", _tmp10_);
 
3990
                                }
 
3991
                                self->priv->processing_track = FALSE;
 
3992
                                break;
 
3993
                        }
 
3994
                }
 
3995
        }
 
3996
}
 
3997
 
 
3998
 
 
3999
static void unity_music_lens_rhythmbox_collection_xml_parser_process_text (UnityMusicLensRhythmboxCollectionXmlParser* self, GMarkupParseContext* context, const gchar* text, gsize text_len, GError** error) {
 
4000
        gboolean _tmp0_ = FALSE;
 
4001
        gboolean _tmp1_;
 
4002
        gboolean _tmp3_;
 
4003
        gint _tmp4_;
 
4004
        g_return_if_fail (self != NULL);
 
4005
        g_return_if_fail (context != NULL);
 
4006
        g_return_if_fail (text != NULL);
 
4007
        _tmp1_ = self->priv->processing_track;
 
4008
        if (!_tmp1_) {
 
4009
                _tmp0_ = TRUE;
 
4010
        } else {
 
4011
                gint _tmp2_;
 
4012
                _tmp2_ = self->priv->current_data;
 
4013
                _tmp0_ = _tmp2_ < 0;
 
4014
        }
 
4015
        _tmp3_ = _tmp0_;
 
4016
        if (_tmp3_) {
 
4017
                return;
 
4018
        }
 
4019
        _tmp4_ = self->priv->current_data;
 
4020
        switch (_tmp4_) {
 
4021
                case UNITY_MUSIC_LENS_COLUMNS_URI:
 
4022
                {
 
4023
                        UnityMusicLensTrack* _tmp5_;
 
4024
                        const gchar* _tmp6_;
 
4025
                        _tmp5_ = self->priv->current_track;
 
4026
                        _tmp6_ = text;
 
4027
                        unity_music_lens_track_set_uri (_tmp5_, _tmp6_);
 
4028
                        break;
 
4029
                }
 
4030
                case UNITY_MUSIC_LENS_COLUMNS_TITLE:
 
4031
                {
 
4032
                        UnityMusicLensTrack* _tmp7_;
 
4033
                        const gchar* _tmp8_;
 
4034
                        _tmp7_ = self->priv->current_track;
 
4035
                        _tmp8_ = text;
 
4036
                        unity_music_lens_track_set_title (_tmp7_, _tmp8_);
 
4037
                        break;
 
4038
                }
 
4039
                case UNITY_MUSIC_LENS_COLUMNS_ARTIST:
 
4040
                {
 
4041
                        UnityMusicLensTrack* _tmp9_;
 
4042
                        const gchar* _tmp10_;
 
4043
                        _tmp9_ = self->priv->current_track;
 
4044
                        _tmp10_ = text;
 
4045
                        unity_music_lens_track_set_artist (_tmp9_, _tmp10_);
 
4046
                        break;
 
4047
                }
 
4048
                case UNITY_MUSIC_LENS_COLUMNS_ALBUM:
 
4049
                {
 
4050
                        UnityMusicLensTrack* _tmp11_;
 
4051
                        const gchar* _tmp12_;
 
4052
                        _tmp11_ = self->priv->current_track;
 
4053
                        _tmp12_ = text;
 
4054
                        unity_music_lens_track_set_album (_tmp11_, _tmp12_);
 
4055
                        break;
 
4056
                }
 
4057
                case UNITY_MUSIC_LENS_COLUMNS_ALBUM_ARTIST:
 
4058
                {
 
4059
                        UnityMusicLensTrack* _tmp13_;
 
4060
                        const gchar* _tmp14_;
 
4061
                        _tmp13_ = self->priv->current_track;
 
4062
                        _tmp14_ = text;
 
4063
                        unity_music_lens_track_set_album_artist (_tmp13_, _tmp14_);
 
4064
                        break;
 
4065
                }
 
4066
                case UNITY_MUSIC_LENS_COLUMNS_GENRE:
 
4067
                {
 
4068
                        UnityMusicLensTrack* _tmp15_;
 
4069
                        UnityMusicLensGenre* _tmp16_;
 
4070
                        const gchar* _tmp17_;
 
4071
                        gchar* _tmp18_ = NULL;
 
4072
                        gchar* _tmp19_;
 
4073
                        gchar* _tmp20_ = NULL;
 
4074
                        gchar* _tmp21_;
 
4075
                        _tmp15_ = self->priv->current_track;
 
4076
                        _tmp16_ = self->priv->genre;
 
4077
                        _tmp17_ = text;
 
4078
                        _tmp18_ = g_utf8_strdown (_tmp17_, (gssize) (-1));
 
4079
                        _tmp19_ = _tmp18_;
 
4080
                        _tmp20_ = unity_music_lens_genre_get_id_for_genre (_tmp16_, _tmp19_);
 
4081
                        _tmp21_ = _tmp20_;
 
4082
                        unity_music_lens_track_set_genre (_tmp15_, _tmp21_);
 
4083
                        _g_free0 (_tmp21_);
 
4084
                        _g_free0 (_tmp19_);
 
4085
                        break;
 
4086
                }
 
4087
                case UNITY_MUSIC_LENS_COLUMNS_MIMETYPE:
 
4088
                {
 
4089
                        UnityMusicLensTrack* _tmp22_;
 
4090
                        const gchar* _tmp23_;
 
4091
                        _tmp22_ = self->priv->current_track;
 
4092
                        _tmp23_ = text;
 
4093
                        unity_music_lens_track_set_mime_type (_tmp22_, _tmp23_);
 
4094
                        break;
 
4095
                }
 
4096
                case UNITY_MUSIC_LENS_COLUMNS_YEAR:
 
4097
                {
 
4098
                        UnityMusicLensTrack* _tmp24_;
 
4099
                        const gchar* _tmp25_;
 
4100
                        gint _tmp26_ = 0;
 
4101
                        _tmp24_ = self->priv->current_track;
 
4102
                        _tmp25_ = text;
 
4103
                        _tmp26_ = atoi (_tmp25_);
 
4104
                        unity_music_lens_track_set_year (_tmp24_, _tmp26_ / 365);
 
4105
                        break;
 
4106
                }
 
4107
                case UNITY_MUSIC_LENS_COLUMNS_PLAY_COUNT:
 
4108
                {
 
4109
                        UnityMusicLensTrack* _tmp27_;
 
4110
                        const gchar* _tmp28_;
 
4111
                        gint _tmp29_ = 0;
 
4112
                        _tmp27_ = self->priv->current_track;
 
4113
                        _tmp28_ = text;
 
4114
                        _tmp29_ = atoi (_tmp28_);
 
4115
                        unity_music_lens_track_set_play_count (_tmp27_, _tmp29_);
 
4116
                        break;
 
4117
                }
 
4118
                case UNITY_MUSIC_LENS_COLUMNS_TRACK_NUMBER:
 
4119
                {
 
4120
                        UnityMusicLensTrack* _tmp30_;
 
4121
                        const gchar* _tmp31_;
 
4122
                        gint _tmp32_ = 0;
 
4123
                        _tmp30_ = self->priv->current_track;
 
4124
                        _tmp31_ = text;
 
4125
                        _tmp32_ = atoi (_tmp31_);
 
4126
                        unity_music_lens_track_set_track_number (_tmp30_, _tmp32_);
 
4127
                        break;
 
4128
                }
 
4129
                case UNITY_MUSIC_LENS_COLUMNS_DURATION:
 
4130
                {
 
4131
                        UnityMusicLensTrack* _tmp33_;
 
4132
                        const gchar* _tmp34_;
 
4133
                        gint _tmp35_ = 0;
 
4134
                        _tmp33_ = self->priv->current_track;
 
4135
                        _tmp34_ = text;
 
4136
                        _tmp35_ = atoi (_tmp34_);
 
4137
                        unity_music_lens_track_set_duration (_tmp33_, _tmp35_);
 
4138
                        break;
 
4139
                }
 
4140
                default:
 
4141
                break;
 
4142
        }
 
4143
}
 
4144
 
 
4145
 
 
4146
UnityMusicLensRhythmboxCollectionXmlParser* unity_music_lens_rhythmbox_collection_xml_parser_construct (GType object_type) {
 
4147
        UnityMusicLensRhythmboxCollectionXmlParser * self = NULL;
 
4148
        self = (UnityMusicLensRhythmboxCollectionXmlParser*) g_object_new (object_type, NULL);
 
4149
        return self;
 
4150
}
 
4151
 
 
4152
 
 
4153
UnityMusicLensRhythmboxCollectionXmlParser* unity_music_lens_rhythmbox_collection_xml_parser_new (void) {
 
4154
        return unity_music_lens_rhythmbox_collection_xml_parser_construct (UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER);
 
4155
}
 
4156
 
 
4157
 
 
4158
static GObject * unity_music_lens_rhythmbox_collection_xml_parser_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
 
4159
        GObject * obj;
 
4160
        GObjectClass * parent_class;
 
4161
        UnityMusicLensRhythmboxCollectionXmlParser * self;
 
4162
        GMarkupParseContext* _tmp0_;
 
4163
        parent_class = G_OBJECT_CLASS (unity_music_lens_rhythmbox_collection_xml_parser_parent_class);
 
4164
        obj = parent_class->constructor (type, n_construct_properties, construct_properties);
 
4165
        self = UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_XML_PARSER (obj);
 
4166
        _tmp0_ = g_markup_parse_context_new (&UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_XML_PARSER_parser, 0, self, NULL);
 
4167
        _g_markup_parse_context_free0 (self->priv->context);
 
4168
        self->priv->context = _tmp0_;
 
4169
        return obj;
 
4170
}
 
4171
 
 
4172
 
 
4173
static void unity_music_lens_rhythmbox_collection_xml_parser_class_init (UnityMusicLensRhythmboxCollectionXmlParserClass * klass) {
 
4174
        unity_music_lens_rhythmbox_collection_xml_parser_parent_class = g_type_class_peek_parent (klass);
 
4175
        g_type_class_add_private (klass, sizeof (UnityMusicLensRhythmboxCollectionXmlParserPrivate));
 
4176
        G_OBJECT_CLASS (klass)->constructor = unity_music_lens_rhythmbox_collection_xml_parser_constructor;
 
4177
        G_OBJECT_CLASS (klass)->finalize = unity_music_lens_rhythmbox_collection_xml_parser_finalize;
 
4178
        g_signal_new ("track_info_ready", UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_TYPE_XML_PARSER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, UNITY_MUSIC_LENS_TYPE_TRACK);
 
4179
}
 
4180
 
 
4181
 
 
4182
static void unity_music_lens_rhythmbox_collection_xml_parser_instance_init (UnityMusicLensRhythmboxCollectionXmlParser * self) {
 
4183
        UnityMusicLensGenre* _tmp0_;
 
4184
        self->priv = UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_XML_PARSER_GET_PRIVATE (self);
 
4185
        _tmp0_ = unity_music_lens_genre_new ();
 
4186
        self->priv->genre = _tmp0_;
 
4187
        self->priv->is_rhythmdb_xml = FALSE;
 
4188
        self->priv->current_data = -1;
 
4189
}
 
4190
 
 
4191
 
 
4192
static void unity_music_lens_rhythmbox_collection_xml_parser_finalize (GObject* obj) {
 
4193
        UnityMusicLensRhythmboxCollectionXmlParser * self;
 
4194
        self = UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_XML_PARSER (obj);
 
4195
        _g_object_unref0 (self->priv->genre);
 
4196
        _g_markup_parse_context_free0 (self->priv->context);
 
4197
        _g_object_unref0 (self->priv->current_track);
 
4198
        G_OBJECT_CLASS (unity_music_lens_rhythmbox_collection_xml_parser_parent_class)->finalize (obj);
 
4199
}
 
4200
 
 
4201
 
 
4202
GType unity_music_lens_rhythmbox_collection_xml_parser_get_type (void) {
 
4203
        static volatile gsize unity_music_lens_rhythmbox_collection_xml_parser_type_id__volatile = 0;
 
4204
        if (g_once_init_enter (&unity_music_lens_rhythmbox_collection_xml_parser_type_id__volatile)) {
 
4205
                static const GTypeInfo g_define_type_info = { sizeof (UnityMusicLensRhythmboxCollectionXmlParserClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_music_lens_rhythmbox_collection_xml_parser_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMusicLensRhythmboxCollectionXmlParser), 0, (GInstanceInitFunc) unity_music_lens_rhythmbox_collection_xml_parser_instance_init, NULL };
 
4206
                GType unity_music_lens_rhythmbox_collection_xml_parser_type_id;
 
4207
                unity_music_lens_rhythmbox_collection_xml_parser_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityMusicLensRhythmboxCollectionXmlParser", &g_define_type_info, 0);
 
4208
                g_once_init_leave (&unity_music_lens_rhythmbox_collection_xml_parser_type_id__volatile, unity_music_lens_rhythmbox_collection_xml_parser_type_id);
 
4209
        }
 
4210
        return unity_music_lens_rhythmbox_collection_xml_parser_type_id__volatile;
 
4211
}
 
4212
 
 
4213
 
 
4214
static void unity_music_lens_rhythmbox_collection_class_init (UnityMusicLensRhythmboxCollectionClass * klass) {
 
4215
        unity_music_lens_rhythmbox_collection_parent_class = g_type_class_peek_parent (klass);
 
4216
        g_type_class_add_private (klass, sizeof (UnityMusicLensRhythmboxCollectionPrivate));
 
4217
        G_OBJECT_CLASS (klass)->constructor = unity_music_lens_rhythmbox_collection_constructor;
 
4218
        G_OBJECT_CLASS (klass)->finalize = unity_music_lens_rhythmbox_collection_finalize;
 
4219
}
 
4220
 
 
4221
 
 
4222
static void unity_music_lens_rhythmbox_collection_instance_init (UnityMusicLensRhythmboxCollection * self) {
 
4223
        self->priv = UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION_GET_PRIVATE (self);
 
4224
}
 
4225
 
 
4226
 
 
4227
static void unity_music_lens_rhythmbox_collection_finalize (GObject* obj) {
 
4228
        UnityMusicLensRhythmboxCollection * self;
 
4229
        self = UNITY_MUSIC_LENS_RHYTHMBOX_COLLECTION (obj);
 
4230
        _g_object_unref0 (self->priv->all_tracks);
 
4231
        _g_object_unref0 (self->priv->tracks_by_play_count);
 
4232
        _g_hash_table_unref0 (self->priv->album_to_tracks_map);
 
4233
        _tdb_close0 (self->priv->album_art_tdb);
 
4234
        _g_object_unref0 (self->priv->tdb_monitor);
 
4235
        _g_hash_table_unref0 (self->priv->variant_store);
 
4236
        _g_hash_table_unref0 (self->priv->int_variant_store);
 
4237
        _vala_array_destroy (self->priv->row_buffer, 13, (GDestroyNotify) g_variant_unref);
 
4238
        _g_object_unref0 (self->priv->analyzer);
 
4239
        _g_object_unref0 (self->priv->index);
 
4240
        _dee_icu_term_filter_destroy0 (self->priv->ascii_filter);
 
4241
        _g_free0 (self->priv->media_art_dir);
 
4242
        G_OBJECT_CLASS (unity_music_lens_rhythmbox_collection_parent_class)->finalize (obj);
 
4243
}
 
4244
 
 
4245
 
 
4246
GType unity_music_lens_rhythmbox_collection_get_type (void) {
 
4247
        static volatile gsize unity_music_lens_rhythmbox_collection_type_id__volatile = 0;
 
4248
        if (g_once_init_enter (&unity_music_lens_rhythmbox_collection_type_id__volatile)) {
 
4249
                static const GTypeInfo g_define_type_info = { sizeof (UnityMusicLensRhythmboxCollectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_music_lens_rhythmbox_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMusicLensRhythmboxCollection), 0, (GInstanceInitFunc) unity_music_lens_rhythmbox_collection_instance_init, NULL };
 
4250
                GType unity_music_lens_rhythmbox_collection_type_id;
 
4251
                unity_music_lens_rhythmbox_collection_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityMusicLensRhythmboxCollection", &g_define_type_info, 0);
 
4252
                g_once_init_leave (&unity_music_lens_rhythmbox_collection_type_id__volatile, unity_music_lens_rhythmbox_collection_type_id);
 
4253
        }
 
4254
        return unity_music_lens_rhythmbox_collection_type_id__volatile;
 
4255
}
 
4256
 
 
4257
 
 
4258
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
4259
        if ((array != NULL) && (destroy_func != NULL)) {
 
4260
                int i;
 
4261
                for (i = 0; i < array_length; i = i + 1) {
 
4262
                        if (((gpointer*) array)[i] != NULL) {
 
4263
                                destroy_func (((gpointer*) array)[i]);
 
4264
                        }
 
4265
                }
 
4266
        }
 
4267
}
 
4268
 
 
4269
 
 
4270
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
4271
        _vala_array_destroy (array, array_length, destroy_func);
 
4272
        g_free (array);
 
4273
}
 
4274
 
 
4275
 
 
4276
static gint _vala_array_length (gpointer array) {
 
4277
        int length;
 
4278
        length = 0;
 
4279
        if (array) {
 
4280
                while (((gpointer*) array)[length]) {
 
4281
                        length++;
 
4282
                }
 
4283
        }
 
4284
        return length;
 
4285
}
 
4286
 
 
4287
 
 
4288