91
95
struct _UnityMusicLensSimpleScopeClass {
92
96
GObjectClass parent_class;
93
void (*perform_search) (UnityMusicLensSimpleScope* self, UnityLensSearch* search, DeeModel* results_model, GList* filters, gint max_results);
97
void (*perform_search) (UnityMusicLensSimpleScope* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GAsyncReadyCallback _callback_, gpointer _user_data_);
98
void (*perform_search_finish) (UnityMusicLensSimpleScope* self, GAsyncResult* _res_);
94
99
gint (*get_num_results_without_search) (UnityMusicLensSimpleScope* self);
95
100
gint (*get_num_results_global_search) (UnityMusicLensSimpleScope* self);
96
101
gint (*get_num_results_lens_search) (UnityMusicLensSimpleScope* self);
113
118
UNITY_MUSIC_LENS_DATABASE_ERROR_FAILED_TO_OPEN
114
119
} UnityMusicLensDatabaseError;
115
120
#define UNITY_MUSIC_LENS_DATABASE_ERROR unity_music_lens_database_error_quark ()
122
UNITY_MUSIC_LENS_CATEGORY_SONGS,
123
UNITY_MUSIC_LENS_CATEGORY_ALBUMS,
124
UNITY_MUSIC_LENS_CATEGORY_PURCHASE,
125
UNITY_MUSIC_LENS_CATEGORY_MUSIC
126
} UnityMusicLensCategory;
128
struct _UnityMusicLensBansheeScopeProxyPerformSearchData {
130
GObject* _source_object_;
132
GSimpleAsyncResult* _async_result;
133
UnityMusicLensBansheeScopeProxy* self;
134
UnityLensSearch* search;
135
UnitySearchType search_type;
138
gint category_override;
139
UnitySearchType _tmp0_;
140
UnityLensSearch* _tmp1_;
142
UnityMusicLensBansheeCollection* _tmp3_;
143
UnityLensSearch* _tmp4_;
144
UnitySearchType _tmp5_;
117
151
static gpointer unity_music_lens_banshee_scope_proxy_parent_class = NULL;
147
181
static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* value);
148
182
static void _vala_array_add2 (gchar*** array, int* length, int* size, gchar* value);
149
183
static void _vala_array_add3 (gchar*** array, int* length, int* size, gchar* value);
150
static void unity_music_lens_banshee_scope_proxy_real_perform_search (UnityMusicLensSimpleScope* base, UnityLensSearch* search, DeeModel* results_model, GList* filters, gint max_results);
151
void unity_music_lens_banshee_collection_search (UnityMusicLensBansheeCollection* self, UnityLensSearch* search, DeeModel* results_model, GList* filters, gint max_results);
184
static void _g_object_unref0_ (gpointer var);
185
static void _g_list_free__g_object_unref0_ (GList* self);
186
static void unity_music_lens_banshee_scope_proxy_real_perform_search_data_free (gpointer _data);
187
static void unity_music_lens_banshee_scope_proxy_real_perform_search (UnityMusicLensSimpleScope* base, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GAsyncReadyCallback _callback_, gpointer _user_data_);
188
static gboolean unity_music_lens_banshee_scope_proxy_real_perform_search_co (UnityMusicLensBansheeScopeProxyPerformSearchData* _data_);
189
GType unity_music_lens_category_get_type (void) G_GNUC_CONST;
190
gboolean unity_music_lens_simple_scope_is_search_empty (UnityMusicLensSimpleScope* self, UnityLensSearch* search);
191
void unity_music_lens_banshee_collection_search (UnityMusicLensBansheeCollection* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, gint category_override);
152
192
static void unity_music_lens_banshee_scope_proxy_finalize (GObject* obj);
153
193
gint unity_music_lens_simple_scope_get_num_results_without_search (UnityMusicLensSimpleScope* self);
154
194
gint unity_music_lens_simple_scope_get_num_results_global_search (UnityMusicLensSimpleScope* self);
469
static void unity_music_lens_banshee_scope_proxy_real_perform_search (UnityMusicLensSimpleScope* base, UnityLensSearch* search, DeeModel* results_model, GList* filters, gint max_results) {
509
static void _g_object_unref0_ (gpointer var) {
510
(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
514
static void _g_list_free__g_object_unref0_ (GList* self) {
515
g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
520
static void unity_music_lens_banshee_scope_proxy_real_perform_search_data_free (gpointer _data) {
521
UnityMusicLensBansheeScopeProxyPerformSearchData* _data_;
523
_g_object_unref0 (_data_->search);
524
__g_list_free__g_object_unref0_0 (_data_->filters);
525
_g_object_unref0 (_data_->self);
526
g_slice_free (UnityMusicLensBansheeScopeProxyPerformSearchData, _data_);
530
static gpointer _g_object_ref0 (gpointer self) {
531
return self ? g_object_ref (self) : NULL;
535
static void unity_music_lens_banshee_scope_proxy_real_perform_search (UnityMusicLensSimpleScope* base, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GAsyncReadyCallback _callback_, gpointer _user_data_) {
470
536
UnityMusicLensBansheeScopeProxy * self;
471
UnityMusicLensBansheeCollection* _tmp0_;
537
UnityMusicLensBansheeScopeProxyPerformSearchData* _data_;
538
UnityMusicLensBansheeScopeProxy* _tmp0_;
472
539
UnityLensSearch* _tmp1_;
540
UnityLensSearch* _tmp2_;
541
UnitySearchType _tmp3_;
476
544
self = (UnityMusicLensBansheeScopeProxy*) base;
477
g_return_if_fail (results_model != NULL);
478
_tmp0_ = self->priv->collection;
545
_data_ = g_slice_new0 (UnityMusicLensBansheeScopeProxyPerformSearchData);
546
_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_music_lens_banshee_scope_proxy_real_perform_search);
547
g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_music_lens_banshee_scope_proxy_real_perform_search_data_free);
548
_tmp0_ = _g_object_ref0 (self);
549
_data_->self = _tmp0_;
480
_tmp2_ = results_model;
482
_tmp4_ = max_results;
483
unity_music_lens_banshee_collection_search (_tmp0_, _tmp1_, _tmp2_, _tmp3_, _tmp4_);
551
_tmp2_ = _g_object_ref0 (_tmp1_);
552
_data_->search = _tmp2_;
553
_tmp3_ = search_type;
554
_data_->search_type = _tmp3_;
556
__g_list_free__g_object_unref0_0 (_data_->filters);
557
_data_->filters = _tmp4_;
558
_tmp5_ = max_results;
559
_data_->max_results = _tmp5_;
560
unity_music_lens_banshee_scope_proxy_real_perform_search_co (_data_);
564
static void unity_music_lens_banshee_scope_proxy_real_perform_search_finish (UnityMusicLensSimpleScope* base, GAsyncResult* _res_) {
565
UnityMusicLensBansheeScopeProxyPerformSearchData* _data_;
566
_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
570
static gboolean unity_music_lens_banshee_scope_proxy_real_perform_search_co (UnityMusicLensBansheeScopeProxyPerformSearchData* _data_) {
571
switch (_data_->_state_) {
575
g_assert_not_reached ();
578
_data_->category_override = -1;
579
_data_->_tmp0_ = _data_->search_type;
580
if (_data_->_tmp0_ == UNITY_SEARCH_TYPE_GLOBAL) {
581
_data_->category_override = (gint) UNITY_MUSIC_LENS_CATEGORY_MUSIC;
582
_data_->_tmp1_ = _data_->search;
583
_data_->_tmp2_ = FALSE;
584
_data_->_tmp2_ = unity_music_lens_simple_scope_is_search_empty ((UnityMusicLensSimpleScope*) _data_->self, _data_->_tmp1_);
585
if (_data_->_tmp2_) {
586
__g_list_free__g_object_unref0_0 (_data_->filters);
587
if (_data_->_state_ == 0) {
588
g_simple_async_result_complete_in_idle (_data_->_async_result);
590
g_simple_async_result_complete (_data_->_async_result);
592
g_object_unref (_data_->_async_result);
596
_data_->_tmp3_ = _data_->self->priv->collection;
597
_data_->_tmp4_ = _data_->search;
598
_data_->_tmp5_ = _data_->search_type;
599
_data_->_tmp6_ = _data_->filters;
600
_data_->_tmp7_ = _data_->max_results;
601
_data_->_tmp8_ = _data_->category_override;
602
unity_music_lens_banshee_collection_search (_data_->_tmp3_, _data_->_tmp4_, _data_->_tmp5_, _data_->_tmp6_, _data_->_tmp7_, _data_->_tmp8_);
603
__g_list_free__g_object_unref0_0 (_data_->filters);
604
if (_data_->_state_ == 0) {
605
g_simple_async_result_complete_in_idle (_data_->_async_result);
607
g_simple_async_result_complete (_data_->_async_result);
609
g_object_unref (_data_->_async_result);