~ricmm/+junk/unity-lens_music-sc

« back to all changes in this revision

Viewing changes to src/simple-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
/* simple-scope.c generated by valac 0.16.1, the Vala compiler
 
2
 * generated from simple-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 <dee.h>
 
30
#include <glib/gi18n-lib.h>
 
31
 
 
32
 
 
33
#define UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE (unity_music_lens_simple_scope_get_type ())
 
34
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScope))
 
35
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))
 
36
#define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))
 
37
#define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))
 
38
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))
 
39
 
 
40
typedef struct _UnityMusicLensSimpleScope UnityMusicLensSimpleScope;
 
41
typedef struct _UnityMusicLensSimpleScopeClass UnityMusicLensSimpleScopeClass;
 
42
typedef struct _UnityMusicLensSimpleScopePrivate UnityMusicLensSimpleScopePrivate;
 
43
 
 
44
#define UNITY_MUSIC_LENS_TYPE_FILTER_PARSER (unity_music_lens_filter_parser_get_type ())
 
45
#define UNITY_MUSIC_LENS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParser))
 
46
#define UNITY_MUSIC_LENS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
 
47
#define UNITY_MUSIC_LENS_IS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
 
48
#define UNITY_MUSIC_LENS_IS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
 
49
#define UNITY_MUSIC_LENS_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
 
50
 
 
51
typedef struct _UnityMusicLensFilterParser UnityMusicLensFilterParser;
 
52
typedef struct _UnityMusicLensFilterParserClass UnityMusicLensFilterParserClass;
 
53
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 
54
#define _g_free0(var) (var = (g_free (var), NULL))
 
55
typedef struct _UnityMusicLensSimpleScopeUpdateSearchAsyncData UnityMusicLensSimpleScopeUpdateSearchAsyncData;
 
56
 
 
57
#define UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER (unity_music_lens_genre_filter_parser_get_type ())
 
58
#define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParser))
 
59
#define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParserClass))
 
60
#define UNITY_MUSIC_LENS_IS_GENRE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER))
 
61
#define UNITY_MUSIC_LENS_IS_GENRE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER))
 
62
#define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParserClass))
 
63
 
 
64
typedef struct _UnityMusicLensGenreFilterParser UnityMusicLensGenreFilterParser;
 
65
typedef struct _UnityMusicLensGenreFilterParserClass UnityMusicLensGenreFilterParserClass;
 
66
 
 
67
#define UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER (unity_music_lens_decade_filter_parser_get_type ())
 
68
#define UNITY_MUSIC_LENS_DECADE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER, UnityMusicLensDecadeFilterParser))
 
69
#define UNITY_MUSIC_LENS_DECADE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER, UnityMusicLensDecadeFilterParserClass))
 
70
#define UNITY_MUSIC_LENS_IS_DECADE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER))
 
71
#define UNITY_MUSIC_LENS_IS_DECADE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER))
 
72
#define UNITY_MUSIC_LENS_DECADE_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER, UnityMusicLensDecadeFilterParserClass))
 
73
 
 
74
typedef struct _UnityMusicLensDecadeFilterParser UnityMusicLensDecadeFilterParser;
 
75
typedef struct _UnityMusicLensDecadeFilterParserClass UnityMusicLensDecadeFilterParserClass;
 
76
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
 
77
typedef struct _UnityMusicLensSimpleScopePrepareSearchData UnityMusicLensSimpleScopePrepareSearchData;
 
78
 
 
79
struct _UnityMusicLensSimpleScope {
 
80
        GObject parent_instance;
 
81
        UnityMusicLensSimpleScopePrivate * priv;
 
82
};
 
83
 
 
84
struct _UnityMusicLensSimpleScopeClass {
 
85
        GObjectClass parent_class;
 
86
        void (*perform_search) (UnityMusicLensSimpleScope* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
87
        void (*perform_search_finish) (UnityMusicLensSimpleScope* self, GAsyncResult* _res_);
 
88
        gint (*get_num_results_without_search) (UnityMusicLensSimpleScope* self);
 
89
        gint (*get_num_results_global_search) (UnityMusicLensSimpleScope* self);
 
90
        gint (*get_num_results_lens_search) (UnityMusicLensSimpleScope* self);
 
91
};
 
92
 
 
93
struct _UnityMusicLensSimpleScopePrivate {
 
94
        UnityScope* _scope;
 
95
};
 
96
 
 
97
struct _UnityMusicLensSimpleScopeUpdateSearchAsyncData {
 
98
        int _state_;
 
99
        GObject* _source_object_;
 
100
        GAsyncResult* _res_;
 
101
        GSimpleAsyncResult* _async_result;
 
102
        UnityMusicLensSimpleScope* self;
 
103
        UnityLensSearch* search;
 
104
        UnitySearchType search_type;
 
105
        GCancellable* cancellable;
 
106
        gint max_results;
 
107
        UnitySearchType _tmp0_;
 
108
        gint _tmp1_;
 
109
        gint _tmp2_;
 
110
        UnityLensSearch* _tmp3_;
 
111
        gboolean _tmp4_;
 
112
        gint _tmp5_;
 
113
        gint _tmp6_;
 
114
        gint _tmp7_;
 
115
        gint _tmp8_;
 
116
        UnityLensSearch* _tmp9_;
 
117
        UnitySearchType _tmp10_;
 
118
        gint _tmp11_;
 
119
        GCancellable* _tmp12_;
 
120
};
 
121
 
 
122
struct _UnityMusicLensSimpleScopePrepareSearchData {
 
123
        int _state_;
 
124
        GObject* _source_object_;
 
125
        GAsyncResult* _res_;
 
126
        GSimpleAsyncResult* _async_result;
 
127
        UnityMusicLensSimpleScope* self;
 
128
        UnityLensSearch* search;
 
129
        UnitySearchType search_type;
 
130
        gint max_results;
 
131
        GCancellable* cancellable;
 
132
        UnityLensSearch* _tmp0_;
 
133
        DeeSerializableModel* _tmp1_;
 
134
        DeeSerializableModel* _tmp2_;
 
135
        DeeSerializableModel* _tmp3_;
 
136
        DeeSerializableModel* results_model;
 
137
        GList* filters;
 
138
        UnitySearchType _tmp4_;
 
139
        UnityScope* _tmp5_;
 
140
        UnityFilter* _tmp6_;
 
141
        UnityFilter* filter;
 
142
        UnityFilter* _tmp7_;
 
143
        gboolean _tmp8_;
 
144
        gboolean _tmp9_;
 
145
        UnityFilter* _tmp10_;
 
146
        UnityMusicLensGenreFilterParser* _tmp11_;
 
147
        UnityScope* _tmp12_;
 
148
        UnityFilter* _tmp13_;
 
149
        UnityFilter* _tmp14_;
 
150
        gboolean _tmp15_;
 
151
        gboolean _tmp16_;
 
152
        UnityFilter* _tmp17_;
 
153
        UnityMusicLensDecadeFilterParser* _tmp18_;
 
154
        DeeSerializableModel* _tmp19_;
 
155
        gboolean _tmp20_;
 
156
        UnityScope* _tmp21_;
 
157
        UnityOptionsFilter* _tmp22_;
 
158
        UnityOptionsFilter* _tmp23_;
 
159
        GList* _tmp24_;
 
160
        guint _tmp25_;
 
161
        UnityScope* _tmp26_;
 
162
        UnityOptionsFilter* _tmp27_;
 
163
        UnityOptionsFilter* _tmp28_;
 
164
        gboolean _tmp29_;
 
165
        gboolean _tmp30_;
 
166
        gboolean _tmp31_;
 
167
        gboolean any_active;
 
168
        UnityScope* _tmp32_;
 
169
        UnityOptionsFilter* _tmp33_;
 
170
        UnityOptionsFilter* _tmp34_;
 
171
        GList* _tmp35_;
 
172
        GList* source_collection;
 
173
        GList* source_it;
 
174
        UnityFilterOption* _tmp36_;
 
175
        UnityFilterOption* source;
 
176
        UnityFilterOption* _tmp37_;
 
177
        gboolean _tmp38_;
 
178
        gboolean _tmp39_;
 
179
        gboolean _tmp40_;
 
180
        UnityLensSearch* _tmp41_;
 
181
        UnityLensSearch* _tmp42_;
 
182
        UnitySearchType _tmp43_;
 
183
        GList* _tmp44_;
 
184
        gint _tmp45_;
 
185
        GCancellable* _tmp46_;
 
186
        DeeSerializableModel* _tmp47_;
 
187
        guint _tmp48_;
 
188
        UnityLensSearch* _tmp49_;
 
189
        const gchar* _tmp50_;
 
190
        GVariant* _tmp51_;
 
191
        UnityLensSearch* _tmp52_;
 
192
};
 
193
 
 
194
 
 
195
static gpointer unity_music_lens_simple_scope_parent_class = NULL;
 
196
 
 
197
GType unity_music_lens_simple_scope_get_type (void) G_GNUC_CONST;
 
198
GType unity_music_lens_filter_parser_get_type (void) G_GNUC_CONST;
 
199
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopePrivate))
 
200
enum  {
 
201
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_DUMMY_PROPERTY,
 
202
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_SCOPE,
 
203
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_NUM_RESULTS_WITHOUT_SEARCH,
 
204
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_NUM_RESULTS_GLOBAL_SEARCH,
 
205
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_NUM_RESULTS_LENS_SEARCH
 
206
};
 
207
void unity_music_lens_simple_scope_perform_search (UnityMusicLensSimpleScope* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
208
void unity_music_lens_simple_scope_perform_search_finish (UnityMusicLensSimpleScope* self, GAsyncResult* _res_);
 
209
UnityMusicLensSimpleScope* unity_music_lens_simple_scope_construct (GType object_type);
 
210
void unity_music_lens_simple_scope_initialize (UnityMusicLensSimpleScope* self);
 
211
UnityScope* unity_music_lens_simple_scope_get_scope (UnityMusicLensSimpleScope* self);
 
212
static void __lambda2_ (UnityMusicLensSimpleScope* self);
 
213
static void ___lambda2__unity_scope_filters_changed (UnityScope* _sender, gpointer self);
 
214
static void __lambda3_ (UnityMusicLensSimpleScope* self);
 
215
static void ___lambda3__unity_scope_active_sources_changed (UnityScope* _sender, gchar** active_ids, int active_ids_length1, gpointer self);
 
216
static gchar* __lambda4_ (UnityMusicLensSimpleScope* self, UnityLensSearch* lens_search);
 
217
static gchar* ___lambda4__unity_scope_generate_search_key (UnityScope* _sender, UnityLensSearch* search, gpointer self);
 
218
static void __lambda5_ (UnityMusicLensSimpleScope* self, UnityLensSearch* search, UnitySearchType search_type, GCancellable* cancellable);
 
219
static void unity_music_lens_simple_scope_update_search_async (UnityMusicLensSimpleScope* self, UnityLensSearch* search, UnitySearchType search_type, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
220
static void unity_music_lens_simple_scope_update_search_finish (UnityMusicLensSimpleScope* self, GAsyncResult* _res_);
 
221
static void ___lambda5__unity_scope_search_changed (UnityScope* _sender, UnityLensSearch* search, UnitySearchType search_type, GCancellable* cancellable, gpointer self);
 
222
static void unity_music_lens_simple_scope_update_search_async_data_free (gpointer _data);
 
223
static gboolean unity_music_lens_simple_scope_update_search_async_co (UnityMusicLensSimpleScopeUpdateSearchAsyncData* _data_);
 
224
gint unity_music_lens_simple_scope_get_num_results_global_search (UnityMusicLensSimpleScope* self);
 
225
gboolean unity_music_lens_simple_scope_is_search_empty (UnityMusicLensSimpleScope* self, UnityLensSearch* search);
 
226
gint unity_music_lens_simple_scope_get_num_results_without_search (UnityMusicLensSimpleScope* self);
 
227
gint unity_music_lens_simple_scope_get_num_results_lens_search (UnityMusicLensSimpleScope* self);
 
228
static void unity_music_lens_simple_scope_prepare_search (UnityMusicLensSimpleScope* self, UnityLensSearch* search, UnitySearchType search_type, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
229
static void unity_music_lens_simple_scope_prepare_search_finish (UnityMusicLensSimpleScope* self, GAsyncResult* _res_);
 
230
static void unity_music_lens_simple_scope_update_search_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
 
231
static void unity_music_lens_simple_scope_prepare_search_data_free (gpointer _data);
 
232
static gboolean unity_music_lens_simple_scope_prepare_search_co (UnityMusicLensSimpleScopePrepareSearchData* _data_);
 
233
UnityMusicLensGenreFilterParser* unity_music_lens_genre_filter_parser_new (UnityCheckOptionFilterCompact* filter);
 
234
UnityMusicLensGenreFilterParser* unity_music_lens_genre_filter_parser_construct (GType object_type, UnityCheckOptionFilterCompact* filter);
 
235
GType unity_music_lens_genre_filter_parser_get_type (void) G_GNUC_CONST;
 
236
UnityMusicLensDecadeFilterParser* unity_music_lens_decade_filter_parser_new (UnityMultiRangeFilter* filter);
 
237
UnityMusicLensDecadeFilterParser* unity_music_lens_decade_filter_parser_construct (GType object_type, UnityMultiRangeFilter* filter);
 
238
GType unity_music_lens_decade_filter_parser_get_type (void) G_GNUC_CONST;
 
239
static void _g_object_unref0_ (gpointer var);
 
240
static void _g_list_free__g_object_unref0_ (GList* self);
 
241
static void unity_music_lens_simple_scope_prepare_search_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
 
242
static GVariant* _variant_new1 (const gchar* value);
 
243
void unity_music_lens_simple_scope_set_scope (UnityMusicLensSimpleScope* self, UnityScope* value);
 
244
static void unity_music_lens_simple_scope_finalize (GObject* obj);
 
245
static void _vala_unity_music_lens_simple_scope_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
 
246
static void _vala_unity_music_lens_simple_scope_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
 
247
 
 
248
 
 
249
void unity_music_lens_simple_scope_perform_search (UnityMusicLensSimpleScope* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
250
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_CLASS (self)->perform_search (self, search, search_type, filters, max_results, cancellable, _callback_, _user_data_);
 
251
}
 
252
 
 
253
 
 
254
void unity_music_lens_simple_scope_perform_search_finish (UnityMusicLensSimpleScope* self, GAsyncResult* _res_) {
 
255
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_CLASS (self)->perform_search_finish (self, _res_);
 
256
}
 
257
 
 
258
 
 
259
UnityMusicLensSimpleScope* unity_music_lens_simple_scope_construct (GType object_type) {
 
260
        UnityMusicLensSimpleScope * self = NULL;
 
261
        self = (UnityMusicLensSimpleScope*) g_object_new (object_type, NULL);
 
262
        return self;
 
263
}
 
264
 
 
265
 
 
266
static void __lambda2_ (UnityMusicLensSimpleScope* self) {
 
267
        UnityScope* _tmp0_;
 
268
        _tmp0_ = self->priv->_scope;
 
269
        unity_scope_queue_search_changed (_tmp0_, UNITY_SEARCH_TYPE_DEFAULT);
 
270
}
 
271
 
 
272
 
 
273
static void ___lambda2__unity_scope_filters_changed (UnityScope* _sender, gpointer self) {
 
274
        __lambda2_ (self);
 
275
}
 
276
 
 
277
 
 
278
static void __lambda3_ (UnityMusicLensSimpleScope* self) {
 
279
        UnityScope* _tmp0_;
 
280
        _tmp0_ = self->priv->_scope;
 
281
        unity_scope_queue_search_changed (_tmp0_, UNITY_SEARCH_TYPE_DEFAULT);
 
282
}
 
283
 
 
284
 
 
285
static void ___lambda3__unity_scope_active_sources_changed (UnityScope* _sender, gchar** active_ids, int active_ids_length1, gpointer self) {
 
286
        __lambda3_ (self);
 
287
}
 
288
 
 
289
 
 
290
static gchar* string_strip (const gchar* self) {
 
291
        gchar* result = NULL;
 
292
        gchar* _tmp0_ = NULL;
 
293
        gchar* _result_;
 
294
        const gchar* _tmp1_;
 
295
        g_return_val_if_fail (self != NULL, NULL);
 
296
        _tmp0_ = g_strdup (self);
 
297
        _result_ = _tmp0_;
 
298
        _tmp1_ = _result_;
 
299
        g_strstrip (_tmp1_);
 
300
        result = _result_;
 
301
        return result;
 
302
}
 
303
 
 
304
 
 
305
static gchar* __lambda4_ (UnityMusicLensSimpleScope* self, UnityLensSearch* lens_search) {
 
306
        gchar* result = NULL;
 
307
        UnityLensSearch* _tmp0_;
 
308
        const gchar* _tmp1_;
 
309
        const gchar* _tmp2_;
 
310
        gchar* _tmp3_ = NULL;
 
311
        g_return_val_if_fail (lens_search != NULL, NULL);
 
312
        _tmp0_ = lens_search;
 
313
        _tmp1_ = unity_lens_search_get_search_string (_tmp0_);
 
314
        _tmp2_ = _tmp1_;
 
315
        _tmp3_ = string_strip (_tmp2_);
 
316
        result = _tmp3_;
 
317
        return result;
 
318
}
 
319
 
 
320
 
 
321
static gchar* ___lambda4__unity_scope_generate_search_key (UnityScope* _sender, UnityLensSearch* search, gpointer self) {
 
322
        gchar* result;
 
323
        result = __lambda4_ (self, search);
 
324
        return result;
 
325
}
 
326
 
 
327
 
 
328
static void __lambda5_ (UnityMusicLensSimpleScope* self, UnityLensSearch* search, UnitySearchType search_type, GCancellable* cancellable) {
 
329
        UnityLensSearch* _tmp0_;
 
330
        UnitySearchType _tmp1_;
 
331
        GCancellable* _tmp2_;
 
332
        g_return_if_fail (search != NULL);
 
333
        g_return_if_fail (cancellable != NULL);
 
334
        _tmp0_ = search;
 
335
        _tmp1_ = search_type;
 
336
        _tmp2_ = cancellable;
 
337
        unity_music_lens_simple_scope_update_search_async (self, _tmp0_, _tmp1_, _tmp2_, NULL, NULL);
 
338
}
 
339
 
 
340
 
 
341
static void ___lambda5__unity_scope_search_changed (UnityScope* _sender, UnityLensSearch* search, UnitySearchType search_type, GCancellable* cancellable, gpointer self) {
 
342
        __lambda5_ (self, search, search_type, cancellable);
 
343
}
 
344
 
 
345
 
 
346
void unity_music_lens_simple_scope_initialize (UnityMusicLensSimpleScope* self) {
 
347
        UnityScope* _tmp0_;
 
348
        UnityScope* _tmp1_;
 
349
        UnityScope* _tmp2_;
 
350
        UnityScope* _tmp3_;
 
351
        g_return_if_fail (self != NULL);
 
352
        _tmp0_ = self->priv->_scope;
 
353
        g_signal_connect_object (_tmp0_, "filters-changed", (GCallback) ___lambda2__unity_scope_filters_changed, self, 0);
 
354
        _tmp1_ = self->priv->_scope;
 
355
        g_signal_connect_object (_tmp1_, "active-sources-changed", (GCallback) ___lambda3__unity_scope_active_sources_changed, self, 0);
 
356
        _tmp2_ = self->priv->_scope;
 
357
        g_signal_connect_object (_tmp2_, "generate-search-key", (GCallback) ___lambda4__unity_scope_generate_search_key, self, 0);
 
358
        _tmp3_ = self->priv->_scope;
 
359
        g_signal_connect_object (_tmp3_, "search-changed", (GCallback) ___lambda5__unity_scope_search_changed, self, 0);
 
360
}
 
361
 
 
362
 
 
363
static void unity_music_lens_simple_scope_update_search_async_data_free (gpointer _data) {
 
364
        UnityMusicLensSimpleScopeUpdateSearchAsyncData* _data_;
 
365
        _data_ = _data;
 
366
        _g_object_unref0 (_data_->search);
 
367
        _g_object_unref0 (_data_->cancellable);
 
368
        _g_object_unref0 (_data_->self);
 
369
        g_slice_free (UnityMusicLensSimpleScopeUpdateSearchAsyncData, _data_);
 
370
}
 
371
 
 
372
 
 
373
static gpointer _g_object_ref0 (gpointer self) {
 
374
        return self ? g_object_ref (self) : NULL;
 
375
}
 
376
 
 
377
 
 
378
static void unity_music_lens_simple_scope_update_search_async (UnityMusicLensSimpleScope* self, UnityLensSearch* search, UnitySearchType search_type, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
379
        UnityMusicLensSimpleScopeUpdateSearchAsyncData* _data_;
 
380
        UnityMusicLensSimpleScope* _tmp0_;
 
381
        UnityLensSearch* _tmp1_;
 
382
        UnityLensSearch* _tmp2_;
 
383
        UnitySearchType _tmp3_;
 
384
        GCancellable* _tmp4_;
 
385
        GCancellable* _tmp5_;
 
386
        _data_ = g_slice_new0 (UnityMusicLensSimpleScopeUpdateSearchAsyncData);
 
387
        _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_music_lens_simple_scope_update_search_async);
 
388
        g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_music_lens_simple_scope_update_search_async_data_free);
 
389
        _tmp0_ = _g_object_ref0 (self);
 
390
        _data_->self = _tmp0_;
 
391
        _tmp1_ = search;
 
392
        _tmp2_ = _g_object_ref0 (_tmp1_);
 
393
        _data_->search = _tmp2_;
 
394
        _tmp3_ = search_type;
 
395
        _data_->search_type = _tmp3_;
 
396
        _tmp4_ = cancellable;
 
397
        _tmp5_ = _g_object_ref0 (_tmp4_);
 
398
        _data_->cancellable = _tmp5_;
 
399
        unity_music_lens_simple_scope_update_search_async_co (_data_);
 
400
}
 
401
 
 
402
 
 
403
static void unity_music_lens_simple_scope_update_search_finish (UnityMusicLensSimpleScope* self, GAsyncResult* _res_) {
 
404
        UnityMusicLensSimpleScopeUpdateSearchAsyncData* _data_;
 
405
        _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
 
406
}
 
407
 
 
408
 
 
409
static void unity_music_lens_simple_scope_update_search_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
 
410
        UnityMusicLensSimpleScopeUpdateSearchAsyncData* _data_;
 
411
        _data_ = _user_data_;
 
412
        _data_->_source_object_ = source_object;
 
413
        _data_->_res_ = _res_;
 
414
        unity_music_lens_simple_scope_update_search_async_co (_data_);
 
415
}
 
416
 
 
417
 
 
418
static gboolean unity_music_lens_simple_scope_update_search_async_co (UnityMusicLensSimpleScopeUpdateSearchAsyncData* _data_) {
 
419
        switch (_data_->_state_) {
 
420
                case 0:
 
421
                goto _state_0;
 
422
                case 1:
 
423
                goto _state_1;
 
424
                default:
 
425
                g_assert_not_reached ();
 
426
        }
 
427
        _state_0:
 
428
        _data_->_tmp0_ = _data_->search_type;
 
429
        if (_data_->_tmp0_ == UNITY_SEARCH_TYPE_GLOBAL) {
 
430
                _data_->_tmp1_ = unity_music_lens_simple_scope_get_num_results_global_search (_data_->self);
 
431
                _data_->_tmp2_ = _data_->_tmp1_;
 
432
                _data_->max_results = _data_->_tmp2_;
 
433
        } else {
 
434
                _data_->_tmp3_ = _data_->search;
 
435
                _data_->_tmp4_ = FALSE;
 
436
                _data_->_tmp4_ = unity_music_lens_simple_scope_is_search_empty (_data_->self, _data_->_tmp3_);
 
437
                if (_data_->_tmp4_) {
 
438
                        _data_->_tmp5_ = unity_music_lens_simple_scope_get_num_results_without_search (_data_->self);
 
439
                        _data_->_tmp6_ = _data_->_tmp5_;
 
440
                        _data_->max_results = _data_->_tmp6_;
 
441
                } else {
 
442
                        _data_->_tmp7_ = unity_music_lens_simple_scope_get_num_results_lens_search (_data_->self);
 
443
                        _data_->_tmp8_ = _data_->_tmp7_;
 
444
                        _data_->max_results = _data_->_tmp8_;
 
445
                }
 
446
        }
 
447
        _data_->_tmp9_ = _data_->search;
 
448
        _data_->_tmp10_ = _data_->search_type;
 
449
        _data_->_tmp11_ = _data_->max_results;
 
450
        _data_->_tmp12_ = _data_->cancellable;
 
451
        _data_->_state_ = 1;
 
452
        unity_music_lens_simple_scope_prepare_search (_data_->self, _data_->_tmp9_, _data_->_tmp10_, _data_->_tmp11_, _data_->_tmp12_, unity_music_lens_simple_scope_update_search_async_ready, _data_);
 
453
        return FALSE;
 
454
        _state_1:
 
455
        unity_music_lens_simple_scope_prepare_search_finish (_data_->self, _data_->_res_);
 
456
        if (_data_->_state_ == 0) {
 
457
                g_simple_async_result_complete_in_idle (_data_->_async_result);
 
458
        } else {
 
459
                g_simple_async_result_complete (_data_->_async_result);
 
460
        }
 
461
        g_object_unref (_data_->_async_result);
 
462
        return FALSE;
 
463
}
 
464
 
 
465
 
 
466
static void unity_music_lens_simple_scope_prepare_search_data_free (gpointer _data) {
 
467
        UnityMusicLensSimpleScopePrepareSearchData* _data_;
 
468
        _data_ = _data;
 
469
        _g_object_unref0 (_data_->search);
 
470
        _g_object_unref0 (_data_->cancellable);
 
471
        _g_object_unref0 (_data_->self);
 
472
        g_slice_free (UnityMusicLensSimpleScopePrepareSearchData, _data_);
 
473
}
 
474
 
 
475
 
 
476
static void unity_music_lens_simple_scope_prepare_search (UnityMusicLensSimpleScope* self, UnityLensSearch* search, UnitySearchType search_type, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
477
        UnityMusicLensSimpleScopePrepareSearchData* _data_;
 
478
        UnityMusicLensSimpleScope* _tmp0_;
 
479
        UnityLensSearch* _tmp1_;
 
480
        UnityLensSearch* _tmp2_;
 
481
        UnitySearchType _tmp3_;
 
482
        gint _tmp4_;
 
483
        GCancellable* _tmp5_;
 
484
        GCancellable* _tmp6_;
 
485
        _data_ = g_slice_new0 (UnityMusicLensSimpleScopePrepareSearchData);
 
486
        _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_music_lens_simple_scope_prepare_search);
 
487
        g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_music_lens_simple_scope_prepare_search_data_free);
 
488
        _tmp0_ = _g_object_ref0 (self);
 
489
        _data_->self = _tmp0_;
 
490
        _tmp1_ = search;
 
491
        _tmp2_ = _g_object_ref0 (_tmp1_);
 
492
        _data_->search = _tmp2_;
 
493
        _tmp3_ = search_type;
 
494
        _data_->search_type = _tmp3_;
 
495
        _tmp4_ = max_results;
 
496
        _data_->max_results = _tmp4_;
 
497
        _tmp5_ = cancellable;
 
498
        _tmp6_ = _g_object_ref0 (_tmp5_);
 
499
        _data_->cancellable = _tmp6_;
 
500
        unity_music_lens_simple_scope_prepare_search_co (_data_);
 
501
}
 
502
 
 
503
 
 
504
static void unity_music_lens_simple_scope_prepare_search_finish (UnityMusicLensSimpleScope* self, GAsyncResult* _res_) {
 
505
        UnityMusicLensSimpleScopePrepareSearchData* _data_;
 
506
        _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
 
507
}
 
508
 
 
509
 
 
510
static void _g_object_unref0_ (gpointer var) {
 
511
        (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
 
512
}
 
513
 
 
514
 
 
515
static void _g_list_free__g_object_unref0_ (GList* self) {
 
516
        g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
 
517
        g_list_free (self);
 
518
}
 
519
 
 
520
 
 
521
static void unity_music_lens_simple_scope_prepare_search_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
 
522
        UnityMusicLensSimpleScopePrepareSearchData* _data_;
 
523
        _data_ = _user_data_;
 
524
        _data_->_source_object_ = source_object;
 
525
        _data_->_res_ = _res_;
 
526
        unity_music_lens_simple_scope_prepare_search_co (_data_);
 
527
}
 
528
 
 
529
 
 
530
static GVariant* _variant_new1 (const gchar* value) {
 
531
        return g_variant_ref_sink (g_variant_new_string (value));
 
532
}
 
533
 
 
534
 
 
535
static gboolean unity_music_lens_simple_scope_prepare_search_co (UnityMusicLensSimpleScopePrepareSearchData* _data_) {
 
536
        switch (_data_->_state_) {
 
537
                case 0:
 
538
                goto _state_0;
 
539
                case 1:
 
540
                goto _state_1;
 
541
                default:
 
542
                g_assert_not_reached ();
 
543
        }
 
544
        _state_0:
 
545
        _data_->_tmp0_ = _data_->search;
 
546
        _data_->_tmp1_ = unity_lens_search_get_results_model (_data_->_tmp0_);
 
547
        _data_->_tmp2_ = _data_->_tmp1_;
 
548
        _data_->_tmp3_ = _g_object_ref0 (_data_->_tmp2_);
 
549
        _data_->results_model = _data_->_tmp3_;
 
550
        _data_->filters = NULL;
 
551
        _data_->_tmp4_ = _data_->search_type;
 
552
        if (_data_->_tmp4_ != UNITY_SEARCH_TYPE_GLOBAL) {
 
553
                _data_->_tmp5_ = _data_->self->priv->_scope;
 
554
                _data_->_tmp6_ = NULL;
 
555
                _data_->_tmp6_ = unity_scope_get_filter (_data_->_tmp5_, "genre");
 
556
                _data_->filter = _data_->_tmp6_;
 
557
                _data_->_tmp7_ = _data_->filter;
 
558
                _data_->_tmp8_ = unity_filter_get_filtering (_data_->_tmp7_);
 
559
                _data_->_tmp9_ = _data_->_tmp8_;
 
560
                if (_data_->_tmp9_) {
 
561
                        _data_->_tmp10_ = _data_->filter;
 
562
                        _data_->_tmp11_ = unity_music_lens_genre_filter_parser_new (UNITY_IS_CHECK_OPTION_FILTER_COMPACT (_data_->_tmp10_) ? ((UnityCheckOptionFilterCompact*) _data_->_tmp10_) : NULL);
 
563
                        _data_->filters = g_list_append (_data_->filters, (UnityMusicLensFilterParser*) _data_->_tmp11_);
 
564
                }
 
565
                _data_->_tmp12_ = _data_->self->priv->_scope;
 
566
                _data_->_tmp13_ = NULL;
 
567
                _data_->_tmp13_ = unity_scope_get_filter (_data_->_tmp12_, "decade");
 
568
                _g_object_unref0 (_data_->filter);
 
569
                _data_->filter = _data_->_tmp13_;
 
570
                _data_->_tmp14_ = _data_->filter;
 
571
                _data_->_tmp15_ = unity_filter_get_filtering (_data_->_tmp14_);
 
572
                _data_->_tmp16_ = _data_->_tmp15_;
 
573
                if (_data_->_tmp16_) {
 
574
                        _data_->_tmp17_ = _data_->filter;
 
575
                        _data_->_tmp18_ = unity_music_lens_decade_filter_parser_new (UNITY_IS_MULTI_RANGE_FILTER (_data_->_tmp17_) ? ((UnityMultiRangeFilter*) _data_->_tmp17_) : NULL);
 
576
                        _data_->filters = g_list_append (_data_->filters, (UnityMusicLensFilterParser*) _data_->_tmp18_);
 
577
                }
 
578
                _g_object_unref0 (_data_->filter);
 
579
        }
 
580
        _data_->_tmp19_ = _data_->results_model;
 
581
        dee_model_clear ((DeeModel*) _data_->_tmp19_);
 
582
        _data_->_tmp21_ = _data_->self->priv->_scope;
 
583
        _data_->_tmp22_ = unity_scope_get_sources (_data_->_tmp21_);
 
584
        _data_->_tmp23_ = _data_->_tmp22_;
 
585
        _data_->_tmp24_ = _data_->_tmp23_->options;
 
586
        _data_->_tmp25_ = 0U;
 
587
        _data_->_tmp25_ = g_list_length (_data_->_tmp24_);
 
588
        if (_data_->_tmp25_ > ((guint) 0)) {
 
589
                _data_->_tmp26_ = _data_->self->priv->_scope;
 
590
                _data_->_tmp27_ = unity_scope_get_sources (_data_->_tmp26_);
 
591
                _data_->_tmp28_ = _data_->_tmp27_;
 
592
                _data_->_tmp29_ = unity_filter_get_filtering ((UnityFilter*) _data_->_tmp28_);
 
593
                _data_->_tmp30_ = _data_->_tmp29_;
 
594
                _data_->_tmp20_ = _data_->_tmp30_;
 
595
        } else {
 
596
                _data_->_tmp20_ = FALSE;
 
597
        }
 
598
        _data_->_tmp31_ = _data_->_tmp20_;
 
599
        if (_data_->_tmp31_) {
 
600
                _data_->any_active = FALSE;
 
601
                _data_->_tmp32_ = _data_->self->priv->_scope;
 
602
                _data_->_tmp33_ = unity_scope_get_sources (_data_->_tmp32_);
 
603
                _data_->_tmp34_ = _data_->_tmp33_;
 
604
                _data_->_tmp35_ = _data_->_tmp34_->options;
 
605
                {
 
606
                        _data_->source_collection = _data_->_tmp35_;
 
607
                        for (_data_->source_it = _data_->source_collection; _data_->source_it != NULL; _data_->source_it = _data_->source_it->next) {
 
608
                                _data_->_tmp36_ = _g_object_ref0 ((UnityFilterOption*) _data_->source_it->data);
 
609
                                _data_->source = _data_->_tmp36_;
 
610
                                {
 
611
                                        _data_->_tmp37_ = _data_->source;
 
612
                                        _data_->_tmp38_ = unity_filter_option_get_active (_data_->_tmp37_);
 
613
                                        _data_->_tmp39_ = _data_->_tmp38_;
 
614
                                        if (_data_->_tmp39_) {
 
615
                                                _data_->any_active = TRUE;
 
616
                                        }
 
617
                                        _g_object_unref0 (_data_->source);
 
618
                                }
 
619
                        }
 
620
                }
 
621
                _data_->_tmp40_ = _data_->any_active;
 
622
                if (!_data_->_tmp40_) {
 
623
                        _data_->_tmp41_ = _data_->search;
 
624
                        g_signal_emit_by_name (_data_->_tmp41_, "finished");
 
625
                        __g_list_free__g_object_unref0_0 (_data_->filters);
 
626
                        _g_object_unref0 (_data_->results_model);
 
627
                        if (_data_->_state_ == 0) {
 
628
                                g_simple_async_result_complete_in_idle (_data_->_async_result);
 
629
                        } else {
 
630
                                g_simple_async_result_complete (_data_->_async_result);
 
631
                        }
 
632
                        g_object_unref (_data_->_async_result);
 
633
                        return FALSE;
 
634
                }
 
635
        }
 
636
        _data_->_tmp42_ = _data_->search;
 
637
        _data_->_tmp43_ = _data_->search_type;
 
638
        _data_->_tmp44_ = _data_->filters;
 
639
        _data_->filters = NULL;
 
640
        _data_->_tmp45_ = _data_->max_results;
 
641
        _data_->_tmp46_ = _data_->cancellable;
 
642
        _data_->_state_ = 1;
 
643
        unity_music_lens_simple_scope_perform_search (_data_->self, _data_->_tmp42_, _data_->_tmp43_, _data_->_tmp44_, _data_->_tmp45_, _data_->_tmp46_, unity_music_lens_simple_scope_prepare_search_ready, _data_);
 
644
        return FALSE;
 
645
        _state_1:
 
646
        unity_music_lens_simple_scope_perform_search_finish (_data_->self, _data_->_res_);
 
647
        _data_->_tmp47_ = _data_->results_model;
 
648
        _data_->_tmp48_ = 0U;
 
649
        _data_->_tmp48_ = dee_model_get_n_rows ((DeeModel*) _data_->_tmp47_);
 
650
        if (_data_->_tmp48_ == ((guint) 0)) {
 
651
                _data_->_tmp49_ = _data_->search;
 
652
                _data_->_tmp50_ = NULL;
 
653
                _data_->_tmp50_ = _ ("Sorry, there is no music that matches your search.");
 
654
                _data_->_tmp51_ = _variant_new1 (_data_->_tmp50_);
 
655
                unity_lens_search_set_reply_hint (_data_->_tmp49_, "no-results-hint", _data_->_tmp51_);
 
656
        }
 
657
        _data_->_tmp52_ = _data_->search;
 
658
        g_signal_emit_by_name (_data_->_tmp52_, "finished");
 
659
        __g_list_free__g_object_unref0_0 (_data_->filters);
 
660
        _g_object_unref0 (_data_->results_model);
 
661
        if (_data_->_state_ == 0) {
 
662
                g_simple_async_result_complete_in_idle (_data_->_async_result);
 
663
        } else {
 
664
                g_simple_async_result_complete (_data_->_async_result);
 
665
        }
 
666
        g_object_unref (_data_->_async_result);
 
667
        return FALSE;
 
668
}
 
669
 
 
670
 
 
671
gboolean unity_music_lens_simple_scope_is_search_empty (UnityMusicLensSimpleScope* self, UnityLensSearch* search) {
 
672
        gboolean result = FALSE;
 
673
        UnityLensSearch* _tmp0_;
 
674
        const gchar* _tmp1_;
 
675
        const gchar* _tmp2_;
 
676
        UnityLensSearch* _tmp3_;
 
677
        const gchar* _tmp4_;
 
678
        const gchar* _tmp5_;
 
679
        gchar* _tmp6_ = NULL;
 
680
        gchar* _tmp7_;
 
681
        gboolean _tmp8_;
 
682
        g_return_val_if_fail (self != NULL, FALSE);
 
683
        g_return_val_if_fail (search != NULL, FALSE);
 
684
        _tmp0_ = search;
 
685
        _tmp1_ = unity_lens_search_get_search_string (_tmp0_);
 
686
        _tmp2_ = _tmp1_;
 
687
        g_return_val_if_fail (_tmp2_ != NULL, FALSE);
 
688
        _tmp3_ = search;
 
689
        _tmp4_ = unity_lens_search_get_search_string (_tmp3_);
 
690
        _tmp5_ = _tmp4_;
 
691
        _tmp6_ = string_strip (_tmp5_);
 
692
        _tmp7_ = _tmp6_;
 
693
        _tmp8_ = g_strcmp0 (_tmp7_, "") == 0;
 
694
        _g_free0 (_tmp7_);
 
695
        result = _tmp8_;
 
696
        return result;
 
697
}
 
698
 
 
699
 
 
700
UnityScope* unity_music_lens_simple_scope_get_scope (UnityMusicLensSimpleScope* self) {
 
701
        UnityScope* result;
 
702
        UnityScope* _tmp0_;
 
703
        g_return_val_if_fail (self != NULL, NULL);
 
704
        _tmp0_ = self->priv->_scope;
 
705
        result = _tmp0_;
 
706
        return result;
 
707
}
 
708
 
 
709
 
 
710
void unity_music_lens_simple_scope_set_scope (UnityMusicLensSimpleScope* self, UnityScope* value) {
 
711
        UnityScope* _tmp0_;
 
712
        UnityScope* _tmp1_;
 
713
        g_return_if_fail (self != NULL);
 
714
        _tmp0_ = value;
 
715
        _tmp1_ = _g_object_ref0 (_tmp0_);
 
716
        _g_object_unref0 (self->priv->_scope);
 
717
        self->priv->_scope = _tmp1_;
 
718
        g_object_notify ((GObject *) self, "scope");
 
719
}
 
720
 
 
721
 
 
722
gint unity_music_lens_simple_scope_get_num_results_without_search (UnityMusicLensSimpleScope* self) {
 
723
        g_return_val_if_fail (self != NULL, 0);
 
724
        return UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_CLASS (self)->get_num_results_without_search (self);
 
725
}
 
726
 
 
727
 
 
728
gint unity_music_lens_simple_scope_get_num_results_global_search (UnityMusicLensSimpleScope* self) {
 
729
        g_return_val_if_fail (self != NULL, 0);
 
730
        return UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_CLASS (self)->get_num_results_global_search (self);
 
731
}
 
732
 
 
733
 
 
734
gint unity_music_lens_simple_scope_get_num_results_lens_search (UnityMusicLensSimpleScope* self) {
 
735
        g_return_val_if_fail (self != NULL, 0);
 
736
        return UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_CLASS (self)->get_num_results_lens_search (self);
 
737
}
 
738
 
 
739
 
 
740
static void unity_music_lens_simple_scope_class_init (UnityMusicLensSimpleScopeClass * klass) {
 
741
        unity_music_lens_simple_scope_parent_class = g_type_class_peek_parent (klass);
 
742
        g_type_class_add_private (klass, sizeof (UnityMusicLensSimpleScopePrivate));
 
743
        G_OBJECT_CLASS (klass)->get_property = _vala_unity_music_lens_simple_scope_get_property;
 
744
        G_OBJECT_CLASS (klass)->set_property = _vala_unity_music_lens_simple_scope_set_property;
 
745
        G_OBJECT_CLASS (klass)->finalize = unity_music_lens_simple_scope_finalize;
 
746
        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_SIMPLE_SCOPE_SCOPE, g_param_spec_object ("scope", "scope", "scope", UNITY_TYPE_SCOPE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
 
747
        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_SIMPLE_SCOPE_NUM_RESULTS_WITHOUT_SEARCH, g_param_spec_int ("num-results-without-search", "num-results-without-search", "num-results-without-search", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 
748
        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_SIMPLE_SCOPE_NUM_RESULTS_GLOBAL_SEARCH, g_param_spec_int ("num-results-global-search", "num-results-global-search", "num-results-global-search", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 
749
        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_SIMPLE_SCOPE_NUM_RESULTS_LENS_SEARCH, g_param_spec_int ("num-results-lens-search", "num-results-lens-search", "num-results-lens-search", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 
750
}
 
751
 
 
752
 
 
753
static void unity_music_lens_simple_scope_instance_init (UnityMusicLensSimpleScope * self) {
 
754
        self->priv = UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_PRIVATE (self);
 
755
}
 
756
 
 
757
 
 
758
static void unity_music_lens_simple_scope_finalize (GObject* obj) {
 
759
        UnityMusicLensSimpleScope * self;
 
760
        self = UNITY_MUSIC_LENS_SIMPLE_SCOPE (obj);
 
761
        _g_object_unref0 (self->priv->_scope);
 
762
        G_OBJECT_CLASS (unity_music_lens_simple_scope_parent_class)->finalize (obj);
 
763
}
 
764
 
 
765
 
 
766
GType unity_music_lens_simple_scope_get_type (void) {
 
767
        static volatile gsize unity_music_lens_simple_scope_type_id__volatile = 0;
 
768
        if (g_once_init_enter (&unity_music_lens_simple_scope_type_id__volatile)) {
 
769
                static const GTypeInfo g_define_type_info = { sizeof (UnityMusicLensSimpleScopeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_music_lens_simple_scope_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMusicLensSimpleScope), 0, (GInstanceInitFunc) unity_music_lens_simple_scope_instance_init, NULL };
 
770
                GType unity_music_lens_simple_scope_type_id;
 
771
                unity_music_lens_simple_scope_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityMusicLensSimpleScope", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
 
772
                g_once_init_leave (&unity_music_lens_simple_scope_type_id__volatile, unity_music_lens_simple_scope_type_id);
 
773
        }
 
774
        return unity_music_lens_simple_scope_type_id__volatile;
 
775
}
 
776
 
 
777
 
 
778
static void _vala_unity_music_lens_simple_scope_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
 
779
        UnityMusicLensSimpleScope * self;
 
780
        self = UNITY_MUSIC_LENS_SIMPLE_SCOPE (object);
 
781
        switch (property_id) {
 
782
                case UNITY_MUSIC_LENS_SIMPLE_SCOPE_SCOPE:
 
783
                g_value_set_object (value, unity_music_lens_simple_scope_get_scope (self));
 
784
                break;
 
785
                default:
 
786
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
787
                break;
 
788
        }
 
789
}
 
790
 
 
791
 
 
792
static void _vala_unity_music_lens_simple_scope_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
 
793
        UnityMusicLensSimpleScope * self;
 
794
        self = UNITY_MUSIC_LENS_SIMPLE_SCOPE (object);
 
795
        switch (property_id) {
 
796
                case UNITY_MUSIC_LENS_SIMPLE_SCOPE_SCOPE:
 
797
                unity_music_lens_simple_scope_set_scope (self, g_value_get_object (value));
 
798
                break;
 
799
                default:
 
800
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
801
                break;
 
802
        }
 
803
}
 
804
 
 
805
 
 
806