1
/* simple-scope.c generated by valac 0.16.1, the Vala compiler
2
* generated from simple-scope.vala, do not modify */
5
* Copyright (C) 2011 Canonical Ltd
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.
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.
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/>.
19
* Authored by Alex Launi <alex.launi@canonical.com>
24
#include <glib-object.h>
30
#include <glib/gi18n-lib.h>
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))
40
typedef struct _UnityMusicLensSimpleScope UnityMusicLensSimpleScope;
41
typedef struct _UnityMusicLensSimpleScopeClass UnityMusicLensSimpleScopeClass;
42
typedef struct _UnityMusicLensSimpleScopePrivate UnityMusicLensSimpleScopePrivate;
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))
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;
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))
64
typedef struct _UnityMusicLensGenreFilterParser UnityMusicLensGenreFilterParser;
65
typedef struct _UnityMusicLensGenreFilterParserClass UnityMusicLensGenreFilterParserClass;
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))
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;
79
struct _UnityMusicLensSimpleScope {
80
GObject parent_instance;
81
UnityMusicLensSimpleScopePrivate * priv;
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);
93
struct _UnityMusicLensSimpleScopePrivate {
97
struct _UnityMusicLensSimpleScopeUpdateSearchAsyncData {
99
GObject* _source_object_;
101
GSimpleAsyncResult* _async_result;
102
UnityMusicLensSimpleScope* self;
103
UnityLensSearch* search;
104
UnitySearchType search_type;
105
GCancellable* cancellable;
107
UnitySearchType _tmp0_;
110
UnityLensSearch* _tmp3_;
116
UnityLensSearch* _tmp9_;
117
UnitySearchType _tmp10_;
119
GCancellable* _tmp12_;
122
struct _UnityMusicLensSimpleScopePrepareSearchData {
124
GObject* _source_object_;
126
GSimpleAsyncResult* _async_result;
127
UnityMusicLensSimpleScope* self;
128
UnityLensSearch* search;
129
UnitySearchType search_type;
131
GCancellable* cancellable;
132
UnityLensSearch* _tmp0_;
133
DeeSerializableModel* _tmp1_;
134
DeeSerializableModel* _tmp2_;
135
DeeSerializableModel* _tmp3_;
136
DeeSerializableModel* results_model;
138
UnitySearchType _tmp4_;
145
UnityFilter* _tmp10_;
146
UnityMusicLensGenreFilterParser* _tmp11_;
148
UnityFilter* _tmp13_;
149
UnityFilter* _tmp14_;
152
UnityFilter* _tmp17_;
153
UnityMusicLensDecadeFilterParser* _tmp18_;
154
DeeSerializableModel* _tmp19_;
157
UnityOptionsFilter* _tmp22_;
158
UnityOptionsFilter* _tmp23_;
162
UnityOptionsFilter* _tmp27_;
163
UnityOptionsFilter* _tmp28_;
169
UnityOptionsFilter* _tmp33_;
170
UnityOptionsFilter* _tmp34_;
172
GList* source_collection;
174
UnityFilterOption* _tmp36_;
175
UnityFilterOption* source;
176
UnityFilterOption* _tmp37_;
180
UnityLensSearch* _tmp41_;
181
UnityLensSearch* _tmp42_;
182
UnitySearchType _tmp43_;
185
GCancellable* _tmp46_;
186
DeeSerializableModel* _tmp47_;
188
UnityLensSearch* _tmp49_;
189
const gchar* _tmp50_;
191
UnityLensSearch* _tmp52_;
195
static gpointer unity_music_lens_simple_scope_parent_class = NULL;
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))
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
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);
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_);
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_);
259
UnityMusicLensSimpleScope* unity_music_lens_simple_scope_construct (GType object_type) {
260
UnityMusicLensSimpleScope * self = NULL;
261
self = (UnityMusicLensSimpleScope*) g_object_new (object_type, NULL);
266
static void __lambda2_ (UnityMusicLensSimpleScope* self) {
268
_tmp0_ = self->priv->_scope;
269
unity_scope_queue_search_changed (_tmp0_, UNITY_SEARCH_TYPE_DEFAULT);
273
static void ___lambda2__unity_scope_filters_changed (UnityScope* _sender, gpointer self) {
278
static void __lambda3_ (UnityMusicLensSimpleScope* self) {
280
_tmp0_ = self->priv->_scope;
281
unity_scope_queue_search_changed (_tmp0_, UNITY_SEARCH_TYPE_DEFAULT);
285
static void ___lambda3__unity_scope_active_sources_changed (UnityScope* _sender, gchar** active_ids, int active_ids_length1, gpointer self) {
290
static gchar* string_strip (const gchar* self) {
291
gchar* result = NULL;
292
gchar* _tmp0_ = NULL;
295
g_return_val_if_fail (self != NULL, NULL);
296
_tmp0_ = g_strdup (self);
305
static gchar* __lambda4_ (UnityMusicLensSimpleScope* self, UnityLensSearch* lens_search) {
306
gchar* result = NULL;
307
UnityLensSearch* _tmp0_;
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_);
315
_tmp3_ = string_strip (_tmp2_);
321
static gchar* ___lambda4__unity_scope_generate_search_key (UnityScope* _sender, UnityLensSearch* search, gpointer self) {
323
result = __lambda4_ (self, search);
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);
335
_tmp1_ = search_type;
336
_tmp2_ = cancellable;
337
unity_music_lens_simple_scope_update_search_async (self, _tmp0_, _tmp1_, _tmp2_, NULL, NULL);
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);
346
void unity_music_lens_simple_scope_initialize (UnityMusicLensSimpleScope* self) {
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);
363
static void unity_music_lens_simple_scope_update_search_async_data_free (gpointer _data) {
364
UnityMusicLensSimpleScopeUpdateSearchAsyncData* _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_);
373
static gpointer _g_object_ref0 (gpointer self) {
374
return self ? g_object_ref (self) : NULL;
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_;
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_);
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_));
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_);
418
static gboolean unity_music_lens_simple_scope_update_search_async_co (UnityMusicLensSimpleScopeUpdateSearchAsyncData* _data_) {
419
switch (_data_->_state_) {
425
g_assert_not_reached ();
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_;
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_;
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_;
447
_data_->_tmp9_ = _data_->search;
448
_data_->_tmp10_ = _data_->search_type;
449
_data_->_tmp11_ = _data_->max_results;
450
_data_->_tmp12_ = _data_->cancellable;
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_);
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);
459
g_simple_async_result_complete (_data_->_async_result);
461
g_object_unref (_data_->_async_result);
466
static void unity_music_lens_simple_scope_prepare_search_data_free (gpointer _data) {
467
UnityMusicLensSimpleScopePrepareSearchData* _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_);
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_;
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_;
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_);
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_));
510
static void _g_object_unref0_ (gpointer var) {
511
(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
515
static void _g_list_free__g_object_unref0_ (GList* self) {
516
g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
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_);
530
static GVariant* _variant_new1 (const gchar* value) {
531
return g_variant_ref_sink (g_variant_new_string (value));
535
static gboolean unity_music_lens_simple_scope_prepare_search_co (UnityMusicLensSimpleScopePrepareSearchData* _data_) {
536
switch (_data_->_state_) {
542
g_assert_not_reached ();
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_);
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_);
578
_g_object_unref0 (_data_->filter);
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_;
596
_data_->_tmp20_ = FALSE;
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;
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_;
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;
617
_g_object_unref0 (_data_->source);
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);
630
g_simple_async_result_complete (_data_->_async_result);
632
g_object_unref (_data_->_async_result);
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;
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_);
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_);
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);
664
g_simple_async_result_complete (_data_->_async_result);
666
g_object_unref (_data_->_async_result);
671
gboolean unity_music_lens_simple_scope_is_search_empty (UnityMusicLensSimpleScope* self, UnityLensSearch* search) {
672
gboolean result = FALSE;
673
UnityLensSearch* _tmp0_;
676
UnityLensSearch* _tmp3_;
679
gchar* _tmp6_ = NULL;
682
g_return_val_if_fail (self != NULL, FALSE);
683
g_return_val_if_fail (search != NULL, FALSE);
685
_tmp1_ = unity_lens_search_get_search_string (_tmp0_);
687
g_return_val_if_fail (_tmp2_ != NULL, FALSE);
689
_tmp4_ = unity_lens_search_get_search_string (_tmp3_);
691
_tmp6_ = string_strip (_tmp5_);
693
_tmp8_ = g_strcmp0 (_tmp7_, "") == 0;
700
UnityScope* unity_music_lens_simple_scope_get_scope (UnityMusicLensSimpleScope* self) {
703
g_return_val_if_fail (self != NULL, NULL);
704
_tmp0_ = self->priv->_scope;
710
void unity_music_lens_simple_scope_set_scope (UnityMusicLensSimpleScope* self, UnityScope* value) {
713
g_return_if_fail (self != NULL);
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");
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);
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);
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);
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));
753
static void unity_music_lens_simple_scope_instance_init (UnityMusicLensSimpleScope * self) {
754
self->priv = UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_PRIVATE (self);
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);
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);
774
return unity_music_lens_simple_scope_type_id__volatile;
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));
786
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
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));
800
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);