~ricmm/+junk/unity-lens_music-sc

« back to all changes in this revision

Viewing changes to src/banshee-scope.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
/* banshee-scope.c generated by valac 0.16.1, the Vala compiler
 
2
 * generated from banshee-scope.vala, do not modify */
 
3
 
 
4
/*
 
5
 * Copyright (C) 2011 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 Alex Launi <alex.launi@canonical.com>
 
20
 *
 
21
 */
 
22
 
 
23
#include <glib.h>
 
24
#include <glib-object.h>
 
25
#include <gio/gio.h>
 
26
#include <unity.h>
 
27
#include <stdlib.h>
 
28
#include <string.h>
 
29
#include <glib/gi18n-lib.h>
 
30
 
 
31
 
 
32
#define UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE (unity_music_lens_simple_scope_get_type ())
 
33
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScope))
 
34
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))
 
35
#define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))
 
36
#define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))
 
37
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))
 
38
 
 
39
typedef struct _UnityMusicLensSimpleScope UnityMusicLensSimpleScope;
 
40
typedef struct _UnityMusicLensSimpleScopeClass UnityMusicLensSimpleScopeClass;
 
41
typedef struct _UnityMusicLensSimpleScopePrivate UnityMusicLensSimpleScopePrivate;
 
42
 
 
43
#define UNITY_MUSIC_LENS_TYPE_FILTER_PARSER (unity_music_lens_filter_parser_get_type ())
 
44
#define UNITY_MUSIC_LENS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParser))
 
45
#define UNITY_MUSIC_LENS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
 
46
#define UNITY_MUSIC_LENS_IS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
 
47
#define UNITY_MUSIC_LENS_IS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
 
48
#define UNITY_MUSIC_LENS_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
 
49
 
 
50
typedef struct _UnityMusicLensFilterParser UnityMusicLensFilterParser;
 
51
typedef struct _UnityMusicLensFilterParserClass UnityMusicLensFilterParserClass;
 
52
 
 
53
#define UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY (unity_music_lens_banshee_scope_proxy_get_type ())
 
54
#define UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY, UnityMusicLensBansheeScopeProxy))
 
55
#define UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY, UnityMusicLensBansheeScopeProxyClass))
 
56
#define UNITY_MUSIC_LENS_IS_BANSHEE_SCOPE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY))
 
57
#define UNITY_MUSIC_LENS_IS_BANSHEE_SCOPE_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY))
 
58
#define UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY, UnityMusicLensBansheeScopeProxyClass))
 
59
 
 
60
typedef struct _UnityMusicLensBansheeScopeProxy UnityMusicLensBansheeScopeProxy;
 
61
typedef struct _UnityMusicLensBansheeScopeProxyClass UnityMusicLensBansheeScopeProxyClass;
 
62
typedef struct _UnityMusicLensBansheeScopeProxyPrivate UnityMusicLensBansheeScopeProxyPrivate;
 
63
 
 
64
#define UNITY_MUSIC_LENS_TYPE_BANSHEE_COLLECTION (unity_music_lens_banshee_collection_get_type ())
 
65
#define UNITY_MUSIC_LENS_BANSHEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_COLLECTION, UnityMusicLensBansheeCollection))
 
66
#define UNITY_MUSIC_LENS_BANSHEE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_COLLECTION, UnityMusicLensBansheeCollectionClass))
 
67
#define UNITY_MUSIC_LENS_IS_BANSHEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_COLLECTION))
 
68
#define UNITY_MUSIC_LENS_IS_BANSHEE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_COLLECTION))
 
69
#define UNITY_MUSIC_LENS_BANSHEE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_COLLECTION, UnityMusicLensBansheeCollectionClass))
 
70
 
 
71
typedef struct _UnityMusicLensBansheeCollection UnityMusicLensBansheeCollection;
 
72
typedef struct _UnityMusicLensBansheeCollectionClass UnityMusicLensBansheeCollectionClass;
 
73
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 
74
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 
75
#define _g_free0(var) (var = (g_free (var), NULL))
 
76
 
 
77
#define UNITY_MUSIC_LENS_TYPE_TRACK (unity_music_lens_track_get_type ())
 
78
#define UNITY_MUSIC_LENS_TRACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrack))
 
79
#define UNITY_MUSIC_LENS_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrackClass))
 
80
#define UNITY_MUSIC_LENS_IS_TRACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_TRACK))
 
81
#define UNITY_MUSIC_LENS_IS_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_TRACK))
 
82
#define UNITY_MUSIC_LENS_TRACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrackClass))
 
83
 
 
84
typedef struct _UnityMusicLensTrack UnityMusicLensTrack;
 
85
typedef struct _UnityMusicLensTrackClass UnityMusicLensTrackClass;
 
86
#define __g_slist_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_slist_free__g_object_unref0_ (var), NULL)))
 
87
 
 
88
#define UNITY_MUSIC_LENS_TYPE_ALBUM (unity_music_lens_album_get_type ())
 
89
#define UNITY_MUSIC_LENS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbum))
 
90
#define UNITY_MUSIC_LENS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbumClass))
 
91
#define UNITY_MUSIC_LENS_IS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM))
 
92
#define UNITY_MUSIC_LENS_IS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_ALBUM))
 
93
#define UNITY_MUSIC_LENS_ALBUM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbumClass))
 
94
 
 
95
typedef struct _UnityMusicLensAlbum UnityMusicLensAlbum;
 
96
typedef struct _UnityMusicLensAlbumClass UnityMusicLensAlbumClass;
 
97
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
 
98
 
 
99
#define UNITY_MUSIC_LENS_TYPE_CATEGORY (unity_music_lens_category_get_type ())
 
100
typedef struct _UnityMusicLensBansheeScopeProxyPerformSearchData UnityMusicLensBansheeScopeProxyPerformSearchData;
 
101
 
 
102
struct _UnityMusicLensSimpleScope {
 
103
        GObject parent_instance;
 
104
        UnityMusicLensSimpleScopePrivate * priv;
 
105
};
 
106
 
 
107
struct _UnityMusicLensSimpleScopeClass {
 
108
        GObjectClass parent_class;
 
109
        void (*perform_search) (UnityMusicLensSimpleScope* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
110
        void (*perform_search_finish) (UnityMusicLensSimpleScope* self, GAsyncResult* _res_);
 
111
        gint (*get_num_results_without_search) (UnityMusicLensSimpleScope* self);
 
112
        gint (*get_num_results_global_search) (UnityMusicLensSimpleScope* self);
 
113
        gint (*get_num_results_lens_search) (UnityMusicLensSimpleScope* self);
 
114
};
 
115
 
 
116
struct _UnityMusicLensBansheeScopeProxy {
 
117
        UnityMusicLensSimpleScope parent_instance;
 
118
        UnityMusicLensBansheeScopeProxyPrivate * priv;
 
119
};
 
120
 
 
121
struct _UnityMusicLensBansheeScopeProxyClass {
 
122
        UnityMusicLensSimpleScopeClass parent_class;
 
123
};
 
124
 
 
125
struct _UnityMusicLensBansheeScopeProxyPrivate {
 
126
        UnityMusicLensBansheeCollection* collection;
 
127
};
 
128
 
 
129
typedef enum  {
 
130
        UNITY_MUSIC_LENS_DATABASE_ERROR_FAILED_TO_OPEN
 
131
} UnityMusicLensDatabaseError;
 
132
#define UNITY_MUSIC_LENS_DATABASE_ERROR unity_music_lens_database_error_quark ()
 
133
typedef enum  {
 
134
        UNITY_MUSIC_LENS_CATEGORY_SONGS,
 
135
        UNITY_MUSIC_LENS_CATEGORY_ALBUMS,
 
136
        UNITY_MUSIC_LENS_CATEGORY_PURCHASE,
 
137
        UNITY_MUSIC_LENS_CATEGORY_MUSIC,
 
138
        UNITY_MUSIC_LENS_CATEGORY_RADIOS
 
139
} UnityMusicLensCategory;
 
140
 
 
141
struct _UnityMusicLensBansheeScopeProxyPerformSearchData {
 
142
        int _state_;
 
143
        GObject* _source_object_;
 
144
        GAsyncResult* _res_;
 
145
        GSimpleAsyncResult* _async_result;
 
146
        UnityMusicLensBansheeScopeProxy* self;
 
147
        UnityLensSearch* search;
 
148
        UnitySearchType search_type;
 
149
        GList* filters;
 
150
        gint max_results;
 
151
        GCancellable* cancellable;
 
152
        gint category_override;
 
153
        UnitySearchType _tmp0_;
 
154
        UnityLensSearch* _tmp1_;
 
155
        gboolean _tmp2_;
 
156
        UnityMusicLensBansheeCollection* _tmp3_;
 
157
        UnityLensSearch* _tmp4_;
 
158
        UnitySearchType _tmp5_;
 
159
        GList* _tmp6_;
 
160
        gint _tmp7_;
 
161
        gint _tmp8_;
 
162
};
 
163
 
 
164
 
 
165
static gpointer unity_music_lens_banshee_scope_proxy_parent_class = NULL;
 
166
 
 
167
GType unity_music_lens_simple_scope_get_type (void) G_GNUC_CONST;
 
168
GType unity_music_lens_filter_parser_get_type (void) G_GNUC_CONST;
 
169
GType unity_music_lens_banshee_scope_proxy_get_type (void) G_GNUC_CONST;
 
170
GType unity_music_lens_banshee_collection_get_type (void) G_GNUC_CONST;
 
171
#define UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY, UnityMusicLensBansheeScopeProxyPrivate))
 
172
enum  {
 
173
        UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_DUMMY_PROPERTY,
 
174
        UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_NUM_RESULTS_WITHOUT_SEARCH,
 
175
        UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_NUM_RESULTS_GLOBAL_SEARCH,
 
176
        UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_NUM_RESULTS_LENS_SEARCH
 
177
};
 
178
UnityMusicLensBansheeScopeProxy* unity_music_lens_banshee_scope_proxy_new (void);
 
179
UnityMusicLensBansheeScopeProxy* unity_music_lens_banshee_scope_proxy_construct (GType object_type);
 
180
UnityMusicLensSimpleScope* unity_music_lens_simple_scope_construct (GType object_type);
 
181
void unity_music_lens_simple_scope_set_scope (UnityMusicLensSimpleScope* self, UnityScope* value);
 
182
UnityScope* unity_music_lens_simple_scope_get_scope (UnityMusicLensSimpleScope* self);
 
183
UnityActivationResponse* unity_music_lens_banshee_scope_proxy_activate (UnityMusicLensBansheeScopeProxy* self, const gchar* uri);
 
184
static UnityActivationResponse* _unity_music_lens_banshee_scope_proxy_activate_unity_scope_activate_uri (UnityScope* _sender, const gchar* uri, gpointer self);
 
185
UnityPreview* unity_music_lens_banshee_scope_proxy_preview (UnityMusicLensBansheeScopeProxy* self, const gchar* uri);
 
186
static UnityPreview* _unity_music_lens_banshee_scope_proxy_preview_unity_scope_preview_uri (UnityScope* _sender, const gchar* uri, gpointer self);
 
187
void unity_music_lens_simple_scope_initialize (UnityMusicLensSimpleScope* self);
 
188
GQuark unity_music_lens_database_error_quark (void);
 
189
UnityMusicLensBansheeCollection* unity_music_lens_banshee_collection_new (GError** error);
 
190
UnityMusicLensBansheeCollection* unity_music_lens_banshee_collection_construct (GType object_type, GError** error);
 
191
GType unity_music_lens_track_get_type (void) G_GNUC_CONST;
 
192
GSList* unity_music_lens_banshee_collection_get_album_tracks_detailed (UnityMusicLensBansheeCollection* self, const gchar* album_title, const gchar* album_artist);
 
193
const gchar* unity_music_lens_track_get_artwork_path (UnityMusicLensTrack* self);
 
194
const gchar* unity_music_lens_track_get_uri (UnityMusicLensTrack* self);
 
195
gint unity_music_lens_track_get_track_number (UnityMusicLensTrack* self);
 
196
const gchar* unity_music_lens_track_get_title (UnityMusicLensTrack* self);
 
197
gint unity_music_lens_track_get_duration (UnityMusicLensTrack* self);
 
198
static void _g_object_unref0_ (gpointer var);
 
199
static void _g_slist_free__g_object_unref0_ (GSList* self);
 
200
UnityMusicLensTrack* unity_music_lens_banshee_collection_get_album_track (UnityMusicLensBansheeCollection* self, const gchar* uri);
 
201
const gchar* unity_music_lens_track_get_artist (UnityMusicLensTrack* self);
 
202
UnityMusicLensAlbum* unity_music_lens_album_new (void);
 
203
UnityMusicLensAlbum* unity_music_lens_album_construct (GType object_type);
 
204
GType unity_music_lens_album_get_type (void) G_GNUC_CONST;
 
205
void unity_music_lens_album_set_artist (UnityMusicLensAlbum* self, const gchar* value);
 
206
void unity_music_lens_album_set_title (UnityMusicLensAlbum* self, const gchar* value);
 
207
gchar** unity_music_lens_banshee_collection_get_track_uris (UnityMusicLensBansheeCollection* self, UnityMusicLensAlbum* album, int* result_length1);
 
208
static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* value);
 
209
static void _vala_array_add2 (gchar*** array, int* length, int* size, gchar* value);
 
210
static void _vala_array_add3 (gchar*** array, int* length, int* size, gchar* value);
 
211
static void _g_list_free__g_object_unref0_ (GList* self);
 
212
static void unity_music_lens_banshee_scope_proxy_real_perform_search_data_free (gpointer _data);
 
213
static void unity_music_lens_banshee_scope_proxy_real_perform_search (UnityMusicLensSimpleScope* base, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
214
static gboolean unity_music_lens_banshee_scope_proxy_real_perform_search_co (UnityMusicLensBansheeScopeProxyPerformSearchData* _data_);
 
215
GType unity_music_lens_category_get_type (void) G_GNUC_CONST;
 
216
gboolean unity_music_lens_simple_scope_is_search_empty (UnityMusicLensSimpleScope* self, UnityLensSearch* search);
 
217
void unity_music_lens_banshee_collection_search (UnityMusicLensBansheeCollection* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, gint category_override);
 
218
static void unity_music_lens_banshee_scope_proxy_finalize (GObject* obj);
 
219
gint unity_music_lens_simple_scope_get_num_results_without_search (UnityMusicLensSimpleScope* self);
 
220
gint unity_music_lens_simple_scope_get_num_results_global_search (UnityMusicLensSimpleScope* self);
 
221
gint unity_music_lens_simple_scope_get_num_results_lens_search (UnityMusicLensSimpleScope* self);
 
222
static void _vala_unity_music_lens_banshee_scope_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
 
223
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
224
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
225
static gint _vala_array_length (gpointer array);
 
226
 
 
227
 
 
228
static UnityActivationResponse* _unity_music_lens_banshee_scope_proxy_activate_unity_scope_activate_uri (UnityScope* _sender, const gchar* uri, gpointer self) {
 
229
        UnityActivationResponse* result;
 
230
        result = unity_music_lens_banshee_scope_proxy_activate (self, uri);
 
231
        return result;
 
232
}
 
233
 
 
234
 
 
235
static UnityPreview* _unity_music_lens_banshee_scope_proxy_preview_unity_scope_preview_uri (UnityScope* _sender, const gchar* uri, gpointer self) {
 
236
        UnityPreview* result;
 
237
        result = unity_music_lens_banshee_scope_proxy_preview (self, uri);
 
238
        return result;
 
239
}
 
240
 
 
241
 
 
242
UnityMusicLensBansheeScopeProxy* unity_music_lens_banshee_scope_proxy_construct (GType object_type) {
 
243
        UnityMusicLensBansheeScopeProxy * self = NULL;
 
244
        UnityScope* _tmp0_;
 
245
        UnityScope* _tmp1_;
 
246
        UnityScope* _tmp2_;
 
247
        UnityScope* _tmp3_;
 
248
        UnityScope* _tmp4_;
 
249
        UnityScope* _tmp5_;
 
250
        UnityScope* _tmp6_;
 
251
        UnityScope* _tmp7_;
 
252
        UnityScope* _tmp8_;
 
253
        UnityScope* _tmp9_;
 
254
        UnityOptionsFilter* _tmp10_;
 
255
        UnityOptionsFilter* _tmp11_;
 
256
        const gchar* _tmp12_ = NULL;
 
257
        UnityFilterOption* _tmp13_ = NULL;
 
258
        UnityFilterOption* _tmp14_;
 
259
        GError * _inner_error_ = NULL;
 
260
        self = (UnityMusicLensBansheeScopeProxy*) unity_music_lens_simple_scope_construct (object_type);
 
261
        _tmp0_ = unity_scope_new ("/com/canonical/unity/scope/banshee");
 
262
        _tmp1_ = _tmp0_;
 
263
        unity_music_lens_simple_scope_set_scope ((UnityMusicLensSimpleScope*) self, _tmp1_);
 
264
        _g_object_unref0 (_tmp1_);
 
265
        _tmp2_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) self);
 
266
        _tmp3_ = _tmp2_;
 
267
        unity_scope_set_search_in_global (_tmp3_, TRUE);
 
268
        _tmp4_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) self);
 
269
        _tmp5_ = _tmp4_;
 
270
        g_signal_connect_object (_tmp5_, "activate-uri", (GCallback) _unity_music_lens_banshee_scope_proxy_activate_unity_scope_activate_uri, self, 0);
 
271
        _tmp6_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) self);
 
272
        _tmp7_ = _tmp6_;
 
273
        g_signal_connect_object (_tmp7_, "preview-uri", (GCallback) _unity_music_lens_banshee_scope_proxy_preview_unity_scope_preview_uri, self, 0);
 
274
        _tmp8_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) self);
 
275
        _tmp9_ = _tmp8_;
 
276
        _tmp10_ = unity_scope_get_sources (_tmp9_);
 
277
        _tmp11_ = _tmp10_;
 
278
        _tmp12_ = _ ("Banshee");
 
279
        _tmp13_ = unity_options_filter_add_option (_tmp11_, "banshee", _tmp12_, NULL);
 
280
        _tmp14_ = _tmp13_;
 
281
        _g_object_unref0 (_tmp14_);
 
282
        unity_music_lens_simple_scope_initialize (UNITY_MUSIC_LENS_SIMPLE_SCOPE (self));
 
283
        {
 
284
                UnityMusicLensBansheeCollection* _tmp15_;
 
285
                UnityMusicLensBansheeCollection* _tmp16_;
 
286
                _tmp15_ = unity_music_lens_banshee_collection_new (&_inner_error_);
 
287
                _tmp16_ = _tmp15_;
 
288
                if (_inner_error_ != NULL) {
 
289
                        if (_inner_error_->domain == UNITY_MUSIC_LENS_DATABASE_ERROR) {
 
290
                                goto __catch0_unity_music_lens_database_error;
 
291
                        }
 
292
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
293
                        g_clear_error (&_inner_error_);
 
294
                        return NULL;
 
295
                }
 
296
                _g_object_unref0 (self->priv->collection);
 
297
                self->priv->collection = _tmp16_;
 
298
        }
 
299
        goto __finally0;
 
300
        __catch0_unity_music_lens_database_error:
 
301
        {
 
302
                GError* _error_ = NULL;
 
303
                _error_ = _inner_error_;
 
304
                _inner_error_ = NULL;
 
305
                g_printerr ("Failed to open the Banshee collection database\n");
 
306
                _g_error_free0 (_error_);
 
307
                return self;
 
308
        }
 
309
        __finally0:
 
310
        if (_inner_error_ != NULL) {
 
311
                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);
 
312
                g_clear_error (&_inner_error_);
 
313
                return NULL;
 
314
        }
 
315
        return self;
 
316
}
 
317
 
 
318
 
 
319
UnityMusicLensBansheeScopeProxy* unity_music_lens_banshee_scope_proxy_new (void) {
 
320
        return unity_music_lens_banshee_scope_proxy_construct (UNITY_MUSIC_LENS_TYPE_BANSHEE_SCOPE_PROXY);
 
321
}
 
322
 
 
323
 
 
324
static void _g_object_unref0_ (gpointer var) {
 
325
        (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
 
326
}
 
327
 
 
328
 
 
329
static void _g_slist_free__g_object_unref0_ (GSList* self) {
 
330
        g_slist_foreach (self, (GFunc) _g_object_unref0_, NULL);
 
331
        g_slist_free (self);
 
332
}
 
333
 
 
334
 
 
335
UnityPreview* unity_music_lens_banshee_scope_proxy_preview (UnityMusicLensBansheeScopeProxy* self, const gchar* uri) {
 
336
        UnityPreview* result = NULL;
 
337
        UnityMusicPreview* preview;
 
338
        GThemedIcon* icon_file;
 
339
        const gchar* _tmp0_;
 
340
        gchar* _tmp1_ = NULL;
 
341
        gchar* _tmp2_;
 
342
        gboolean _tmp3_;
 
343
        g_return_val_if_fail (self != NULL, NULL);
 
344
        g_return_val_if_fail (uri != NULL, NULL);
 
345
        preview = NULL;
 
346
        icon_file = NULL;
 
347
        _tmp0_ = uri;
 
348
        _tmp1_ = g_uri_parse_scheme (_tmp0_);
 
349
        _tmp2_ = _tmp1_;
 
350
        _tmp3_ = g_strcmp0 (_tmp2_, "album") == 0;
 
351
        _g_free0 (_tmp2_);
 
352
        if (_tmp3_) {
 
353
                const gchar* _tmp4_;
 
354
                gchar** _tmp5_;
 
355
                gchar** _tmp6_ = NULL;
 
356
                gchar** split;
 
357
                gint split_length1;
 
358
                gint _split_size_;
 
359
                gchar** _tmp7_;
 
360
                gint _tmp7__length1;
 
361
                const gchar* _tmp8_;
 
362
                gchar* _tmp9_;
 
363
                gchar* artist;
 
364
                gchar** _tmp10_;
 
365
                gint _tmp10__length1;
 
366
                const gchar* _tmp11_;
 
367
                gchar* _tmp12_;
 
368
                gchar* title;
 
369
                UnityMusicLensBansheeCollection* _tmp13_;
 
370
                const gchar* _tmp14_;
 
371
                const gchar* _tmp15_;
 
372
                GSList* _tmp16_ = NULL;
 
373
                _tmp4_ = uri;
 
374
                _tmp6_ = _tmp5_ = g_strsplit (_tmp4_, "/", 0);
 
375
                split = _tmp6_;
 
376
                split_length1 = _vala_array_length (_tmp5_);
 
377
                _split_size_ = split_length1;
 
378
                _tmp7_ = split;
 
379
                _tmp7__length1 = split_length1;
 
380
                _tmp8_ = _tmp7_[2];
 
381
                _tmp9_ = g_strdup (_tmp8_);
 
382
                artist = _tmp9_;
 
383
                _tmp10_ = split;
 
384
                _tmp10__length1 = split_length1;
 
385
                _tmp11_ = _tmp10_[3];
 
386
                _tmp12_ = g_strdup (_tmp11_);
 
387
                title = _tmp12_;
 
388
                _tmp13_ = self->priv->collection;
 
389
                _tmp14_ = title;
 
390
                _tmp15_ = artist;
 
391
                _tmp16_ = unity_music_lens_banshee_collection_get_album_tracks_detailed (_tmp13_, _tmp14_, _tmp15_);
 
392
                {
 
393
                        GSList* track_collection = NULL;
 
394
                        GSList* track_it = NULL;
 
395
                        track_collection = _tmp16_;
 
396
                        for (track_it = track_collection; track_it != NULL; track_it = track_it->next) {
 
397
                                UnityMusicLensTrack* track = NULL;
 
398
                                track = (UnityMusicLensTrack*) track_it->data;
 
399
                                {
 
400
                                        UnityMusicPreview* _tmp17_;
 
401
                                        UnityTrackMetadata* _tmp29_;
 
402
                                        UnityTrackMetadata* tm;
 
403
                                        UnityTrackMetadata* _tmp30_;
 
404
                                        UnityMusicLensTrack* _tmp31_;
 
405
                                        const gchar* _tmp32_;
 
406
                                        const gchar* _tmp33_;
 
407
                                        UnityTrackMetadata* _tmp34_;
 
408
                                        UnityMusicLensTrack* _tmp35_;
 
409
                                        gint _tmp36_;
 
410
                                        gint _tmp37_;
 
411
                                        UnityMusicLensTrack* _tmp38_;
 
412
                                        const gchar* _tmp39_;
 
413
                                        const gchar* _tmp40_;
 
414
                                        gchar* _tmp41_;
 
415
                                        gchar* _tmp42_;
 
416
                                        const gchar* _tmp43_;
 
417
                                        UnityTrackMetadata* _tmp45_;
 
418
                                        const gchar* _tmp46_;
 
419
                                        UnityTrackMetadata* _tmp47_;
 
420
                                        UnityMusicLensTrack* _tmp48_;
 
421
                                        gint _tmp49_;
 
422
                                        gint _tmp50_;
 
423
                                        UnityMusicPreview* _tmp51_;
 
424
                                        UnityTrackMetadata* _tmp52_;
 
425
                                        _tmp17_ = preview;
 
426
                                        if (_tmp17_ == NULL) {
 
427
                                                UnityMusicLensTrack* _tmp18_;
 
428
                                                const gchar* _tmp19_;
 
429
                                                const gchar* _tmp20_;
 
430
                                                const gchar* _tmp25_;
 
431
                                                const gchar* _tmp26_;
 
432
                                                GThemedIcon* _tmp27_;
 
433
                                                UnityMusicPreview* _tmp28_;
 
434
                                                _tmp18_ = track;
 
435
                                                _tmp19_ = unity_music_lens_track_get_artwork_path (_tmp18_);
 
436
                                                _tmp20_ = _tmp19_;
 
437
                                                if (_tmp20_ != NULL) {
 
438
                                                        UnityMusicLensTrack* _tmp21_;
 
439
                                                        const gchar* _tmp22_;
 
440
                                                        const gchar* _tmp23_;
 
441
                                                        GThemedIcon* _tmp24_;
 
442
                                                        _tmp21_ = track;
 
443
                                                        _tmp22_ = unity_music_lens_track_get_artwork_path (_tmp21_);
 
444
                                                        _tmp23_ = _tmp22_;
 
445
                                                        _tmp24_ = (GThemedIcon*) g_themed_icon_new (_tmp23_);
 
446
                                                        _g_object_unref0 (icon_file);
 
447
                                                        icon_file = _tmp24_;
 
448
                                                }
 
449
                                                _tmp25_ = title;
 
450
                                                _tmp26_ = artist;
 
451
                                                _tmp27_ = icon_file;
 
452
                                                _tmp28_ = unity_music_preview_new (_tmp25_, _tmp26_, (GIcon*) _tmp27_);
 
453
                                                _g_object_unref0 (preview);
 
454
                                                preview = _tmp28_;
 
455
                                        }
 
456
                                        _tmp29_ = unity_track_metadata_new ();
 
457
                                        tm = _tmp29_;
 
458
                                        _tmp30_ = tm;
 
459
                                        _tmp31_ = track;
 
460
                                        _tmp32_ = unity_music_lens_track_get_uri (_tmp31_);
 
461
                                        _tmp33_ = _tmp32_;
 
462
                                        unity_track_metadata_set_uri (_tmp30_, _tmp33_);
 
463
                                        _tmp34_ = tm;
 
464
                                        _tmp35_ = track;
 
465
                                        _tmp36_ = unity_music_lens_track_get_track_number (_tmp35_);
 
466
                                        _tmp37_ = _tmp36_;
 
467
                                        unity_track_metadata_set_track_no (_tmp34_, _tmp37_);
 
468
                                        _tmp38_ = track;
 
469
                                        _tmp39_ = unity_music_lens_track_get_title (_tmp38_);
 
470
                                        _tmp40_ = _tmp39_;
 
471
                                        _tmp41_ = g_strdup (_tmp40_);
 
472
                                        _tmp42_ = _tmp41_;
 
473
                                        _tmp43_ = _tmp42_;
 
474
                                        if (_tmp43_ == NULL) {
 
475
                                                gchar* _tmp44_;
 
476
                                                _tmp44_ = g_strdup ("");
 
477
                                                _g_free0 (_tmp42_);
 
478
                                                _tmp42_ = _tmp44_;
 
479
                                        }
 
480
                                        _tmp45_ = tm;
 
481
                                        _tmp46_ = _tmp42_;
 
482
                                        unity_track_metadata_set_title (_tmp45_, _tmp46_);
 
483
                                        _tmp47_ = tm;
 
484
                                        _tmp48_ = track;
 
485
                                        _tmp49_ = unity_music_lens_track_get_duration (_tmp48_);
 
486
                                        _tmp50_ = _tmp49_;
 
487
                                        unity_track_metadata_set_length (_tmp47_, (guint) _tmp50_);
 
488
                                        _tmp51_ = preview;
 
489
                                        _tmp52_ = tm;
 
490
                                        unity_music_preview_add_track (_tmp51_, _tmp52_);
 
491
                                        _g_free0 (_tmp42_);
 
492
                                        _g_object_unref0 (tm);
 
493
                                }
 
494
                        }
 
495
                        __g_slist_free__g_object_unref0_0 (track_collection);
 
496
                }
 
497
                _g_free0 (title);
 
498
                _g_free0 (artist);
 
499
                split = (_vala_array_free (split, split_length1, (GDestroyNotify) g_free), NULL);
 
500
        } else {
 
501
                UnityMusicLensBansheeCollection* _tmp53_;
 
502
                const gchar* _tmp54_;
 
503
                UnityMusicLensTrack* _tmp55_ = NULL;
 
504
                UnityMusicLensTrack* track;
 
505
                UnityMusicLensTrack* _tmp56_;
 
506
                _tmp53_ = self->priv->collection;
 
507
                _tmp54_ = uri;
 
508
                _tmp55_ = unity_music_lens_banshee_collection_get_album_track (_tmp53_, _tmp54_);
 
509
                track = _tmp55_;
 
510
                _tmp56_ = track;
 
511
                if (_tmp56_ != NULL) {
 
512
                        UnityMusicLensTrack* _tmp57_;
 
513
                        const gchar* _tmp58_;
 
514
                        const gchar* _tmp59_;
 
515
                        UnityMusicLensTrack* _tmp64_;
 
516
                        const gchar* _tmp65_;
 
517
                        const gchar* _tmp66_;
 
518
                        UnityMusicLensTrack* _tmp67_;
 
519
                        const gchar* _tmp68_;
 
520
                        const gchar* _tmp69_;
 
521
                        GThemedIcon* _tmp70_;
 
522
                        UnityMusicPreview* _tmp71_;
 
523
                        UnityTrackMetadata* _tmp72_;
 
524
                        UnityTrackMetadata* tm;
 
525
                        UnityTrackMetadata* _tmp73_;
 
526
                        UnityMusicLensTrack* _tmp74_;
 
527
                        const gchar* _tmp75_;
 
528
                        const gchar* _tmp76_;
 
529
                        UnityTrackMetadata* _tmp77_;
 
530
                        UnityMusicLensTrack* _tmp78_;
 
531
                        gint _tmp79_;
 
532
                        gint _tmp80_;
 
533
                        UnityMusicLensTrack* _tmp81_;
 
534
                        const gchar* _tmp82_;
 
535
                        const gchar* _tmp83_;
 
536
                        gchar* _tmp84_;
 
537
                        gchar* _tmp85_;
 
538
                        const gchar* _tmp86_;
 
539
                        UnityTrackMetadata* _tmp88_;
 
540
                        const gchar* _tmp89_;
 
541
                        UnityTrackMetadata* _tmp90_;
 
542
                        UnityMusicLensTrack* _tmp91_;
 
543
                        gint _tmp92_;
 
544
                        gint _tmp93_;
 
545
                        UnityMusicPreview* _tmp94_;
 
546
                        UnityTrackMetadata* _tmp95_;
 
547
                        _tmp57_ = track;
 
548
                        _tmp58_ = unity_music_lens_track_get_artwork_path (_tmp57_);
 
549
                        _tmp59_ = _tmp58_;
 
550
                        if (_tmp59_ != NULL) {
 
551
                                UnityMusicLensTrack* _tmp60_;
 
552
                                const gchar* _tmp61_;
 
553
                                const gchar* _tmp62_;
 
554
                                GThemedIcon* _tmp63_;
 
555
                                _tmp60_ = track;
 
556
                                _tmp61_ = unity_music_lens_track_get_artwork_path (_tmp60_);
 
557
                                _tmp62_ = _tmp61_;
 
558
                                _tmp63_ = (GThemedIcon*) g_themed_icon_new (_tmp62_);
 
559
                                _g_object_unref0 (icon_file);
 
560
                                icon_file = _tmp63_;
 
561
                        }
 
562
                        _tmp64_ = track;
 
563
                        _tmp65_ = unity_music_lens_track_get_title (_tmp64_);
 
564
                        _tmp66_ = _tmp65_;
 
565
                        _tmp67_ = track;
 
566
                        _tmp68_ = unity_music_lens_track_get_artist (_tmp67_);
 
567
                        _tmp69_ = _tmp68_;
 
568
                        _tmp70_ = icon_file;
 
569
                        _tmp71_ = unity_music_preview_new (_tmp66_, _tmp69_, (GIcon*) _tmp70_);
 
570
                        _g_object_unref0 (preview);
 
571
                        preview = _tmp71_;
 
572
                        _tmp72_ = unity_track_metadata_new ();
 
573
                        tm = _tmp72_;
 
574
                        _tmp73_ = tm;
 
575
                        _tmp74_ = track;
 
576
                        _tmp75_ = unity_music_lens_track_get_uri (_tmp74_);
 
577
                        _tmp76_ = _tmp75_;
 
578
                        unity_track_metadata_set_uri (_tmp73_, _tmp76_);
 
579
                        _tmp77_ = tm;
 
580
                        _tmp78_ = track;
 
581
                        _tmp79_ = unity_music_lens_track_get_track_number (_tmp78_);
 
582
                        _tmp80_ = _tmp79_;
 
583
                        unity_track_metadata_set_track_no (_tmp77_, _tmp80_);
 
584
                        _tmp81_ = track;
 
585
                        _tmp82_ = unity_music_lens_track_get_title (_tmp81_);
 
586
                        _tmp83_ = _tmp82_;
 
587
                        _tmp84_ = g_strdup (_tmp83_);
 
588
                        _tmp85_ = _tmp84_;
 
589
                        _tmp86_ = _tmp85_;
 
590
                        if (_tmp86_ == NULL) {
 
591
                                gchar* _tmp87_;
 
592
                                _tmp87_ = g_strdup ("");
 
593
                                _g_free0 (_tmp85_);
 
594
                                _tmp85_ = _tmp87_;
 
595
                        }
 
596
                        _tmp88_ = tm;
 
597
                        _tmp89_ = _tmp85_;
 
598
                        unity_track_metadata_set_title (_tmp88_, _tmp89_);
 
599
                        _tmp90_ = tm;
 
600
                        _tmp91_ = track;
 
601
                        _tmp92_ = unity_music_lens_track_get_duration (_tmp91_);
 
602
                        _tmp93_ = _tmp92_;
 
603
                        unity_track_metadata_set_length (_tmp90_, (guint) _tmp93_);
 
604
                        _tmp94_ = preview;
 
605
                        _tmp95_ = tm;
 
606
                        unity_music_preview_add_track (_tmp94_, _tmp95_);
 
607
                        _g_free0 (_tmp85_);
 
608
                        _g_object_unref0 (tm);
 
609
                }
 
610
                _g_object_unref0 (track);
 
611
        }
 
612
        result = (UnityPreview*) preview;
 
613
        _g_object_unref0 (icon_file);
 
614
        return result;
 
615
}
 
616
 
 
617
 
 
618
/**
 
619
     * Tells banshee to play the selected uri(s)
 
620
     */
 
621
static const gchar* string_to_string (const gchar* self) {
 
622
        const gchar* result = NULL;
 
623
        g_return_val_if_fail (self != NULL, NULL);
 
624
        result = self;
 
625
        return result;
 
626
}
 
627
 
 
628
 
 
629
static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* value) {
 
630
        if ((*length) == (*size)) {
 
631
                *size = (*size) ? (2 * (*size)) : 4;
 
632
                *array = g_renew (gchar*, *array, (*size) + 1);
 
633
        }
 
634
        (*array)[(*length)++] = value;
 
635
        (*array)[*length] = NULL;
 
636
}
 
637
 
 
638
 
 
639
static void _vala_array_add2 (gchar*** array, int* length, int* size, gchar* value) {
 
640
        if ((*length) == (*size)) {
 
641
                *size = (*size) ? (2 * (*size)) : 4;
 
642
                *array = g_renew (gchar*, *array, (*size) + 1);
 
643
        }
 
644
        (*array)[(*length)++] = value;
 
645
        (*array)[*length] = NULL;
 
646
}
 
647
 
 
648
 
 
649
static void _vala_array_add3 (gchar*** array, int* length, int* size, gchar* value) {
 
650
        if ((*length) == (*size)) {
 
651
                *size = (*size) ? (2 * (*size)) : 4;
 
652
                *array = g_renew (gchar*, *array, (*size) + 1);
 
653
        }
 
654
        (*array)[(*length)++] = value;
 
655
        (*array)[*length] = NULL;
 
656
}
 
657
 
 
658
 
 
659
UnityActivationResponse* unity_music_lens_banshee_scope_proxy_activate (UnityMusicLensBansheeScopeProxy* self, const gchar* uri) {
 
660
        UnityActivationResponse* result = NULL;
 
661
        gchar* _tmp0_;
 
662
        gchar* _tmp1_;
 
663
        gchar** _tmp2_ = NULL;
 
664
        gchar** exec;
 
665
        gint exec_length1;
 
666
        gint _exec_size_;
 
667
        GError * _inner_error_ = NULL;
 
668
        g_return_val_if_fail (self != NULL, NULL);
 
669
        g_return_val_if_fail (uri != NULL, NULL);
 
670
        _tmp0_ = g_strdup ("banshee");
 
671
        _tmp1_ = g_strdup ("--play-enqueued");
 
672
        _tmp2_ = g_new0 (gchar*, 2 + 1);
 
673
        _tmp2_[0] = _tmp0_;
 
674
        _tmp2_[1] = _tmp1_;
 
675
        exec = _tmp2_;
 
676
        exec_length1 = 2;
 
677
        _exec_size_ = exec_length1;
 
678
        {
 
679
                const gchar* _tmp3_;
 
680
                gchar* _tmp4_ = NULL;
 
681
                gchar* _tmp5_;
 
682
                gboolean _tmp6_;
 
683
                gchar** _tmp36_;
 
684
                gint _tmp36__length1;
 
685
                gchar** _tmp37_;
 
686
                gint _tmp37__length1;
 
687
                gchar* _tmp38_ = NULL;
 
688
                gchar* _tmp39_;
 
689
                gchar** _tmp40_;
 
690
                gint _tmp40__length1;
 
691
                UnityActivationResponse* _tmp41_;
 
692
                UnityActivationResponse* _tmp42_;
 
693
                _tmp3_ = uri;
 
694
                _tmp4_ = g_uri_parse_scheme (_tmp3_);
 
695
                _tmp5_ = _tmp4_;
 
696
                _tmp6_ = g_strcmp0 (_tmp5_, "album") == 0;
 
697
                _g_free0 (_tmp5_);
 
698
                if (_tmp6_) {
 
699
                        const gchar* _tmp7_;
 
700
                        const gchar* _tmp8_ = NULL;
 
701
                        gchar* _tmp9_ = NULL;
 
702
                        gchar* _tmp10_;
 
703
                        const gchar* _tmp11_;
 
704
                        gchar** _tmp12_;
 
705
                        gchar** _tmp13_ = NULL;
 
706
                        gchar** split;
 
707
                        gint split_length1;
 
708
                        gint _split_size_;
 
709
                        gchar** _tmp14_;
 
710
                        gint _tmp14__length1;
 
711
                        const gchar* _tmp15_;
 
712
                        gchar* _tmp16_;
 
713
                        gchar* artist;
 
714
                        gchar** _tmp17_;
 
715
                        gint _tmp17__length1;
 
716
                        const gchar* _tmp18_;
 
717
                        gchar* _tmp19_;
 
718
                        gchar* title;
 
719
                        UnityMusicLensAlbum* _tmp20_;
 
720
                        UnityMusicLensAlbum* album;
 
721
                        UnityMusicLensAlbum* _tmp21_;
 
722
                        const gchar* _tmp22_;
 
723
                        UnityMusicLensAlbum* _tmp23_;
 
724
                        const gchar* _tmp24_;
 
725
                        UnityMusicLensBansheeCollection* _tmp25_;
 
726
                        UnityMusicLensAlbum* _tmp26_;
 
727
                        gint _tmp27_ = 0;
 
728
                        gchar** _tmp28_ = NULL;
 
729
                        _tmp7_ = uri;
 
730
                        _tmp8_ = string_to_string (_tmp7_);
 
731
                        _tmp9_ = g_strconcat ("searching for tracks for ", _tmp8_, NULL);
 
732
                        _tmp10_ = _tmp9_;
 
733
                        g_debug ("banshee-scope.vala:113: %s", _tmp10_);
 
734
                        _g_free0 (_tmp10_);
 
735
                        _tmp11_ = uri;
 
736
                        _tmp13_ = _tmp12_ = g_strsplit (_tmp11_, "/", 0);
 
737
                        split = _tmp13_;
 
738
                        split_length1 = _vala_array_length (_tmp12_);
 
739
                        _split_size_ = split_length1;
 
740
                        _tmp14_ = split;
 
741
                        _tmp14__length1 = split_length1;
 
742
                        _tmp15_ = _tmp14_[2];
 
743
                        _tmp16_ = g_strdup (_tmp15_);
 
744
                        artist = _tmp16_;
 
745
                        _tmp17_ = split;
 
746
                        _tmp17__length1 = split_length1;
 
747
                        _tmp18_ = _tmp17_[3];
 
748
                        _tmp19_ = g_strdup (_tmp18_);
 
749
                        title = _tmp19_;
 
750
                        _tmp20_ = unity_music_lens_album_new ();
 
751
                        album = _tmp20_;
 
752
                        _tmp21_ = album;
 
753
                        _tmp22_ = artist;
 
754
                        unity_music_lens_album_set_artist (_tmp21_, _tmp22_);
 
755
                        _tmp23_ = album;
 
756
                        _tmp24_ = title;
 
757
                        unity_music_lens_album_set_title (_tmp23_, _tmp24_);
 
758
                        _tmp25_ = self->priv->collection;
 
759
                        _tmp26_ = album;
 
760
                        _tmp28_ = unity_music_lens_banshee_collection_get_track_uris (_tmp25_, _tmp26_, &_tmp27_);
 
761
                        {
 
762
                                gchar** track_collection = NULL;
 
763
                                gint track_collection_length1 = 0;
 
764
                                gint _track_collection_size_ = 0;
 
765
                                gint track_it = 0;
 
766
                                track_collection = _tmp28_;
 
767
                                track_collection_length1 = _tmp27_;
 
768
                                for (track_it = 0; track_it < _tmp27_; track_it = track_it + 1) {
 
769
                                        gchar* _tmp29_;
 
770
                                        gchar* track = NULL;
 
771
                                        _tmp29_ = g_strdup (track_collection[track_it]);
 
772
                                        track = _tmp29_;
 
773
                                        {
 
774
                                                gchar** _tmp30_;
 
775
                                                gint _tmp30__length1;
 
776
                                                const gchar* _tmp31_;
 
777
                                                gchar* _tmp32_;
 
778
                                                _tmp30_ = exec;
 
779
                                                _tmp30__length1 = exec_length1;
 
780
                                                _tmp31_ = track;
 
781
                                                _tmp32_ = g_strdup (_tmp31_);
 
782
                                                _vala_array_add1 (&exec, &exec_length1, &_exec_size_, _tmp32_);
 
783
                                                _g_free0 (track);
 
784
                                        }
 
785
                                }
 
786
                                track_collection = (_vala_array_free (track_collection, track_collection_length1, (GDestroyNotify) g_free), NULL);
 
787
                        }
 
788
                        _g_object_unref0 (album);
 
789
                        _g_free0 (title);
 
790
                        _g_free0 (artist);
 
791
                        split = (_vala_array_free (split, split_length1, (GDestroyNotify) g_free), NULL);
 
792
                } else {
 
793
                        gchar** _tmp33_;
 
794
                        gint _tmp33__length1;
 
795
                        const gchar* _tmp34_;
 
796
                        gchar* _tmp35_;
 
797
                        _tmp33_ = exec;
 
798
                        _tmp33__length1 = exec_length1;
 
799
                        _tmp34_ = uri;
 
800
                        _tmp35_ = g_strdup (_tmp34_);
 
801
                        _vala_array_add2 (&exec, &exec_length1, &_exec_size_, _tmp35_);
 
802
                }
 
803
                _tmp36_ = exec;
 
804
                _tmp36__length1 = exec_length1;
 
805
                _vala_array_add3 (&exec, &exec_length1, &_exec_size_, NULL);
 
806
                _tmp37_ = exec;
 
807
                _tmp37__length1 = exec_length1;
 
808
                _tmp38_ = g_strjoinv (" ", _tmp37_);
 
809
                _tmp39_ = _tmp38_;
 
810
                g_debug ("banshee-scope.vala:132: Spawning banshee '%s'", _tmp39_);
 
811
                _g_free0 (_tmp39_);
 
812
                _tmp40_ = exec;
 
813
                _tmp40__length1 = exec_length1;
 
814
                g_spawn_async (NULL, _tmp40_, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &_inner_error_);
 
815
                if (_inner_error_ != NULL) {
 
816
                        if (_inner_error_->domain == G_SPAWN_ERROR) {
 
817
                                goto __catch1_g_spawn_error;
 
818
                        }
 
819
                        exec = (_vala_array_free (exec, exec_length1, (GDestroyNotify) g_free), NULL);
 
820
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
821
                        g_clear_error (&_inner_error_);
 
822
                        return NULL;
 
823
                }
 
824
                _tmp41_ = unity_activation_response_new (UNITY_HANDLED_TYPE_HIDE_DASH, "");
 
825
                _tmp42_ = g_object_ref_sink (_tmp41_);
 
826
                result = _tmp42_;
 
827
                exec = (_vala_array_free (exec, exec_length1, (GDestroyNotify) g_free), NULL);
 
828
                return result;
 
829
        }
 
830
        goto __finally1;
 
831
        __catch1_g_spawn_error:
 
832
        {
 
833
                GError* _error_ = NULL;
 
834
                const gchar* _tmp43_;
 
835
                UnityActivationResponse* _tmp44_;
 
836
                UnityActivationResponse* _tmp45_;
 
837
                _error_ = _inner_error_;
 
838
                _inner_error_ = NULL;
 
839
                _tmp43_ = uri;
 
840
                g_warning ("banshee-scope.vala:142: Failed to launch URI %s", _tmp43_);
 
841
                _tmp44_ = unity_activation_response_new (UNITY_HANDLED_TYPE_NOT_HANDLED, "");
 
842
                _tmp45_ = g_object_ref_sink (_tmp44_);
 
843
                result = _tmp45_;
 
844
                _g_error_free0 (_error_);
 
845
                exec = (_vala_array_free (exec, exec_length1, (GDestroyNotify) g_free), NULL);
 
846
                return result;
 
847
        }
 
848
        __finally1:
 
849
        exec = (_vala_array_free (exec, exec_length1, (GDestroyNotify) g_free), NULL);
 
850
        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);
 
851
        g_clear_error (&_inner_error_);
 
852
        return NULL;
 
853
}
 
854
 
 
855
 
 
856
static void _g_list_free__g_object_unref0_ (GList* self) {
 
857
        g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
 
858
        g_list_free (self);
 
859
}
 
860
 
 
861
 
 
862
static void unity_music_lens_banshee_scope_proxy_real_perform_search_data_free (gpointer _data) {
 
863
        UnityMusicLensBansheeScopeProxyPerformSearchData* _data_;
 
864
        _data_ = _data;
 
865
        _g_object_unref0 (_data_->search);
 
866
        __g_list_free__g_object_unref0_0 (_data_->filters);
 
867
        _g_object_unref0 (_data_->cancellable);
 
868
        _g_object_unref0 (_data_->self);
 
869
        g_slice_free (UnityMusicLensBansheeScopeProxyPerformSearchData, _data_);
 
870
}
 
871
 
 
872
 
 
873
static gpointer _g_object_ref0 (gpointer self) {
 
874
        return self ? g_object_ref (self) : NULL;
 
875
}
 
876
 
 
877
 
 
878
static void unity_music_lens_banshee_scope_proxy_real_perform_search (UnityMusicLensSimpleScope* base, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
879
        UnityMusicLensBansheeScopeProxy * self;
 
880
        UnityMusicLensBansheeScopeProxyPerformSearchData* _data_;
 
881
        UnityMusicLensBansheeScopeProxy* _tmp0_;
 
882
        UnityLensSearch* _tmp1_;
 
883
        UnityLensSearch* _tmp2_;
 
884
        UnitySearchType _tmp3_;
 
885
        GList* _tmp4_;
 
886
        gint _tmp5_;
 
887
        GCancellable* _tmp6_;
 
888
        GCancellable* _tmp7_;
 
889
        self = (UnityMusicLensBansheeScopeProxy*) base;
 
890
        _data_ = g_slice_new0 (UnityMusicLensBansheeScopeProxyPerformSearchData);
 
891
        _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_music_lens_banshee_scope_proxy_real_perform_search);
 
892
        g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_music_lens_banshee_scope_proxy_real_perform_search_data_free);
 
893
        _tmp0_ = _g_object_ref0 (self);
 
894
        _data_->self = _tmp0_;
 
895
        _tmp1_ = search;
 
896
        _tmp2_ = _g_object_ref0 (_tmp1_);
 
897
        _data_->search = _tmp2_;
 
898
        _tmp3_ = search_type;
 
899
        _data_->search_type = _tmp3_;
 
900
        _tmp4_ = filters;
 
901
        __g_list_free__g_object_unref0_0 (_data_->filters);
 
902
        _data_->filters = _tmp4_;
 
903
        _tmp5_ = max_results;
 
904
        _data_->max_results = _tmp5_;
 
905
        _tmp6_ = cancellable;
 
906
        _tmp7_ = _g_object_ref0 (_tmp6_);
 
907
        _data_->cancellable = _tmp7_;
 
908
        unity_music_lens_banshee_scope_proxy_real_perform_search_co (_data_);
 
909
}
 
910
 
 
911
 
 
912
static void unity_music_lens_banshee_scope_proxy_real_perform_search_finish (UnityMusicLensSimpleScope* base, GAsyncResult* _res_) {
 
913
        UnityMusicLensBansheeScopeProxyPerformSearchData* _data_;
 
914
        _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
 
915
}
 
916
 
 
917
 
 
918
static gboolean unity_music_lens_banshee_scope_proxy_real_perform_search_co (UnityMusicLensBansheeScopeProxyPerformSearchData* _data_) {
 
919
        switch (_data_->_state_) {
 
920
                case 0:
 
921
                goto _state_0;
 
922
                default:
 
923
                g_assert_not_reached ();
 
924
        }
 
925
        _state_0:
 
926
        _data_->category_override = -1;
 
927
        _data_->_tmp0_ = _data_->search_type;
 
928
        if (_data_->_tmp0_ == UNITY_SEARCH_TYPE_GLOBAL) {
 
929
                _data_->category_override = (gint) UNITY_MUSIC_LENS_CATEGORY_MUSIC;
 
930
                _data_->_tmp1_ = _data_->search;
 
931
                _data_->_tmp2_ = FALSE;
 
932
                _data_->_tmp2_ = unity_music_lens_simple_scope_is_search_empty ((UnityMusicLensSimpleScope*) _data_->self, _data_->_tmp1_);
 
933
                if (_data_->_tmp2_) {
 
934
                        __g_list_free__g_object_unref0_0 (_data_->filters);
 
935
                        if (_data_->_state_ == 0) {
 
936
                                g_simple_async_result_complete_in_idle (_data_->_async_result);
 
937
                        } else {
 
938
                                g_simple_async_result_complete (_data_->_async_result);
 
939
                        }
 
940
                        g_object_unref (_data_->_async_result);
 
941
                        return FALSE;
 
942
                }
 
943
        }
 
944
        _data_->_tmp3_ = _data_->self->priv->collection;
 
945
        _data_->_tmp4_ = _data_->search;
 
946
        _data_->_tmp5_ = _data_->search_type;
 
947
        _data_->_tmp6_ = _data_->filters;
 
948
        _data_->_tmp7_ = _data_->max_results;
 
949
        _data_->_tmp8_ = _data_->category_override;
 
950
        unity_music_lens_banshee_collection_search (_data_->_tmp3_, _data_->_tmp4_, _data_->_tmp5_, _data_->_tmp6_, _data_->_tmp7_, _data_->_tmp8_);
 
951
        __g_list_free__g_object_unref0_0 (_data_->filters);
 
952
        if (_data_->_state_ == 0) {
 
953
                g_simple_async_result_complete_in_idle (_data_->_async_result);
 
954
        } else {
 
955
                g_simple_async_result_complete (_data_->_async_result);
 
956
        }
 
957
        g_object_unref (_data_->_async_result);
 
958
        return FALSE;
 
959
}
 
960
 
 
961
 
 
962
static gint unity_music_lens_banshee_scope_proxy_real_get_num_results_without_search (UnityMusicLensSimpleScope* base) {
 
963
        gint result;
 
964
        UnityMusicLensBansheeScopeProxy* self;
 
965
        self = (UnityMusicLensBansheeScopeProxy*) base;
 
966
        result = 100;
 
967
        return result;
 
968
}
 
969
 
 
970
 
 
971
static gint unity_music_lens_banshee_scope_proxy_real_get_num_results_global_search (UnityMusicLensSimpleScope* base) {
 
972
        gint result;
 
973
        UnityMusicLensBansheeScopeProxy* self;
 
974
        self = (UnityMusicLensBansheeScopeProxy*) base;
 
975
        result = 20;
 
976
        return result;
 
977
}
 
978
 
 
979
 
 
980
static gint unity_music_lens_banshee_scope_proxy_real_get_num_results_lens_search (UnityMusicLensSimpleScope* base) {
 
981
        gint result;
 
982
        UnityMusicLensBansheeScopeProxy* self;
 
983
        self = (UnityMusicLensBansheeScopeProxy*) base;
 
984
        result = 50;
 
985
        return result;
 
986
}
 
987
 
 
988
 
 
989
static void unity_music_lens_banshee_scope_proxy_class_init (UnityMusicLensBansheeScopeProxyClass * klass) {
 
990
        unity_music_lens_banshee_scope_proxy_parent_class = g_type_class_peek_parent (klass);
 
991
        g_type_class_add_private (klass, sizeof (UnityMusicLensBansheeScopeProxyPrivate));
 
992
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->perform_search = unity_music_lens_banshee_scope_proxy_real_perform_search;
 
993
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->perform_search_finish = unity_music_lens_banshee_scope_proxy_real_perform_search_finish;
 
994
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_without_search = unity_music_lens_banshee_scope_proxy_real_get_num_results_without_search;
 
995
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_global_search = unity_music_lens_banshee_scope_proxy_real_get_num_results_global_search;
 
996
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_lens_search = unity_music_lens_banshee_scope_proxy_real_get_num_results_lens_search;
 
997
        G_OBJECT_CLASS (klass)->get_property = _vala_unity_music_lens_banshee_scope_proxy_get_property;
 
998
        G_OBJECT_CLASS (klass)->finalize = unity_music_lens_banshee_scope_proxy_finalize;
 
999
        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_NUM_RESULTS_WITHOUT_SEARCH, g_param_spec_int ("num-results-without-search", "num-results-without-search", "num-results-without-search", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 
1000
        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_NUM_RESULTS_GLOBAL_SEARCH, g_param_spec_int ("num-results-global-search", "num-results-global-search", "num-results-global-search", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 
1001
        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_NUM_RESULTS_LENS_SEARCH, g_param_spec_int ("num-results-lens-search", "num-results-lens-search", "num-results-lens-search", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 
1002
}
 
1003
 
 
1004
 
 
1005
static void unity_music_lens_banshee_scope_proxy_instance_init (UnityMusicLensBansheeScopeProxy * self) {
 
1006
        self->priv = UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_GET_PRIVATE (self);
 
1007
}
 
1008
 
 
1009
 
 
1010
static void unity_music_lens_banshee_scope_proxy_finalize (GObject* obj) {
 
1011
        UnityMusicLensBansheeScopeProxy * self;
 
1012
        self = UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY (obj);
 
1013
        _g_object_unref0 (self->priv->collection);
 
1014
        G_OBJECT_CLASS (unity_music_lens_banshee_scope_proxy_parent_class)->finalize (obj);
 
1015
}
 
1016
 
 
1017
 
 
1018
GType unity_music_lens_banshee_scope_proxy_get_type (void) {
 
1019
        static volatile gsize unity_music_lens_banshee_scope_proxy_type_id__volatile = 0;
 
1020
        if (g_once_init_enter (&unity_music_lens_banshee_scope_proxy_type_id__volatile)) {
 
1021
                static const GTypeInfo g_define_type_info = { sizeof (UnityMusicLensBansheeScopeProxyClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_music_lens_banshee_scope_proxy_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMusicLensBansheeScopeProxy), 0, (GInstanceInitFunc) unity_music_lens_banshee_scope_proxy_instance_init, NULL };
 
1022
                GType unity_music_lens_banshee_scope_proxy_type_id;
 
1023
                unity_music_lens_banshee_scope_proxy_type_id = g_type_register_static (UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, "UnityMusicLensBansheeScopeProxy", &g_define_type_info, 0);
 
1024
                g_once_init_leave (&unity_music_lens_banshee_scope_proxy_type_id__volatile, unity_music_lens_banshee_scope_proxy_type_id);
 
1025
        }
 
1026
        return unity_music_lens_banshee_scope_proxy_type_id__volatile;
 
1027
}
 
1028
 
 
1029
 
 
1030
static void _vala_unity_music_lens_banshee_scope_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
 
1031
        UnityMusicLensBansheeScopeProxy * self;
 
1032
        self = UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY (object);
 
1033
        switch (property_id) {
 
1034
                case UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_NUM_RESULTS_WITHOUT_SEARCH:
 
1035
                g_value_set_int (value, unity_music_lens_simple_scope_get_num_results_without_search ((UnityMusicLensSimpleScope*) self));
 
1036
                break;
 
1037
                case UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_NUM_RESULTS_GLOBAL_SEARCH:
 
1038
                g_value_set_int (value, unity_music_lens_simple_scope_get_num_results_global_search ((UnityMusicLensSimpleScope*) self));
 
1039
                break;
 
1040
                case UNITY_MUSIC_LENS_BANSHEE_SCOPE_PROXY_NUM_RESULTS_LENS_SEARCH:
 
1041
                g_value_set_int (value, unity_music_lens_simple_scope_get_num_results_lens_search ((UnityMusicLensSimpleScope*) self));
 
1042
                break;
 
1043
                default:
 
1044
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
1045
                break;
 
1046
        }
 
1047
}
 
1048
 
 
1049
 
 
1050
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
1051
        if ((array != NULL) && (destroy_func != NULL)) {
 
1052
                int i;
 
1053
                for (i = 0; i < array_length; i = i + 1) {
 
1054
                        if (((gpointer*) array)[i] != NULL) {
 
1055
                                destroy_func (((gpointer*) array)[i]);
 
1056
                        }
 
1057
                }
 
1058
        }
 
1059
}
 
1060
 
 
1061
 
 
1062
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
1063
        _vala_array_destroy (array, array_length, destroy_func);
 
1064
        g_free (array);
 
1065
}
 
1066
 
 
1067
 
 
1068
static gint _vala_array_length (gpointer array) {
 
1069
        int length;
 
1070
        length = 0;
 
1071
        if (array) {
 
1072
                while (((gpointer*) array)[length]) {
 
1073
                        length++;
 
1074
                }
 
1075
        }
 
1076
        return length;
 
1077
}
 
1078
 
 
1079
 
 
1080