~ubuntu-branches/ubuntu/precise/unity-lens-music/precise

« back to all changes in this revision

Viewing changes to src/musicstore-scope.c

  • Committer: Package Import Robot
  • Author(s): Didier Roche
  • Date: 2012-02-03 11:33:57 UTC
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: package-import@ubuntu.com-20120203113357-yop2ipbkuwiizbih
Tags: upstream-5.2.0
ImportĀ upstreamĀ versionĀ 5.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* musicstore-scope.c generated by valac 0.15.0, the Vala compiler
 
1
/* musicstore-scope.c generated by valac 0.14.1, the Vala compiler
2
2
 * generated from musicstore-scope.vala, do not modify */
3
3
 
4
4
/*
22
22
 
23
23
#include <glib.h>
24
24
#include <glib-object.h>
 
25
#include <gio/gio.h>
25
26
#include <unity.h>
26
 
#include <dee.h>
27
27
#include <stdlib.h>
28
28
#include <string.h>
29
 
#include <gio/gio.h>
30
29
#include <stdio.h>
 
30
#include <dee.h>
31
31
 
32
32
 
33
33
#define UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE (unity_music_lens_simple_scope_get_type ())
73
73
typedef struct _UnityMusicLensMusicStoreCollectionClass UnityMusicLensMusicStoreCollectionClass;
74
74
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
75
75
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 
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 _UnityMusicLensMusicStoreScopeProxyPerformSearchData UnityMusicLensMusicStoreScopeProxyPerformSearchData;
76
78
 
77
79
struct _UnityMusicLensSimpleScope {
78
80
        GObject parent_instance;
81
83
 
82
84
struct _UnityMusicLensSimpleScopeClass {
83
85
        GObjectClass parent_class;
84
 
        void (*perform_search) (UnityMusicLensSimpleScope* self, UnityLensSearch* search, DeeModel* results_model, GList* filters, gint max_results);
 
86
        void (*perform_search) (UnityMusicLensSimpleScope* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
87
        void (*perform_search_finish) (UnityMusicLensSimpleScope* self, GAsyncResult* _res_);
85
88
        gint (*get_num_results_without_search) (UnityMusicLensSimpleScope* self);
86
89
        gint (*get_num_results_global_search) (UnityMusicLensSimpleScope* self);
87
90
        gint (*get_num_results_lens_search) (UnityMusicLensSimpleScope* self);
100
103
        UnityMusicLensMusicStoreCollection* collection;
101
104
};
102
105
 
 
106
struct _UnityMusicLensMusicStoreScopeProxyPerformSearchData {
 
107
        int _state_;
 
108
        GObject* _source_object_;
 
109
        GAsyncResult* _res_;
 
110
        GSimpleAsyncResult* _async_result;
 
111
        UnityMusicLensMusicStoreScopeProxy* self;
 
112
        UnityLensSearch* search;
 
113
        UnitySearchType search_type;
 
114
        GList* filters;
 
115
        gint max_results;
 
116
        UnityLensSearch* _tmp0_;
 
117
        gboolean _tmp1_;
 
118
        UnityLensSearch* _tmp2_;
 
119
        DeeSerializableModel* _tmp3_;
 
120
        DeeSerializableModel* _tmp4_;
 
121
        guint _tmp5_;
 
122
        UnityMusicLensMusicStoreCollection* _tmp6_;
 
123
        UnityLensSearch* _tmp7_;
 
124
        UnitySearchType _tmp8_;
 
125
        GList* _tmp9_;
 
126
        gint _tmp10_;
 
127
        UnityLensSearch* _tmp11_;
 
128
        DeeSerializableModel* _tmp12_;
 
129
        DeeSerializableModel* _tmp13_;
 
130
        guint _tmp14_;
 
131
        GError* e;
 
132
        UnityLensSearch* _tmp15_;
 
133
        const gchar* _tmp16_;
 
134
        const gchar* _tmp17_;
 
135
        GError* _tmp18_;
 
136
        const gchar* _tmp19_;
 
137
        GError * _inner_error_;
 
138
};
 
139
 
103
140
 
104
141
static gpointer unity_music_lens_music_store_scope_proxy_parent_class = NULL;
105
142
 
124
161
void unity_music_lens_simple_scope_initialize (UnityMusicLensSimpleScope* self);
125
162
UnityMusicLensMusicStoreCollection* unity_music_lens_music_store_collection_new (void);
126
163
UnityMusicLensMusicStoreCollection* unity_music_lens_music_store_collection_construct (GType object_type);
127
 
static void unity_music_lens_music_store_scope_proxy_real_perform_search (UnityMusicLensSimpleScope* base, UnityLensSearch* search, DeeModel* results_model, GList* filters, gint max_results);
128
 
gboolean unity_music_lens_simple_scope_search_is_invalid (UnityMusicLensSimpleScope* self, UnityLensSearch* search);
129
 
void unity_music_lens_music_store_collection_search (UnityMusicLensMusicStoreCollection* self, UnityLensSearch* search, DeeModel* results_model, GList* filters, gint max_results, GError** error);
 
164
static void _g_object_unref0_ (gpointer var);
 
165
static void _g_list_free__g_object_unref0_ (GList* self);
 
166
static void unity_music_lens_music_store_scope_proxy_real_perform_search_data_free (gpointer _data);
 
167
static void unity_music_lens_music_store_scope_proxy_real_perform_search (UnityMusicLensSimpleScope* base, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
168
static gboolean unity_music_lens_music_store_scope_proxy_real_perform_search_co (UnityMusicLensMusicStoreScopeProxyPerformSearchData* _data_);
 
169
gboolean unity_music_lens_simple_scope_is_search_empty (UnityMusicLensSimpleScope* self, UnityLensSearch* search);
 
170
void unity_music_lens_music_store_collection_search (UnityMusicLensMusicStoreCollection* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
171
void unity_music_lens_music_store_collection_search_finish (UnityMusicLensMusicStoreCollection* self, GAsyncResult* _res_, GError** error);
 
172
static void unity_music_lens_music_store_scope_proxy_perform_search_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
130
173
static void unity_music_lens_music_store_scope_proxy_finalize (GObject* obj);
131
174
gint unity_music_lens_simple_scope_get_num_results_without_search (UnityMusicLensSimpleScope* self);
132
175
gint unity_music_lens_simple_scope_get_num_results_global_search (UnityMusicLensSimpleScope* self);
254
297
}
255
298
 
256
299
 
257
 
static void unity_music_lens_music_store_scope_proxy_real_perform_search (UnityMusicLensSimpleScope* base, UnityLensSearch* search, DeeModel* results_model, GList* filters, gint max_results) {
 
300
static void _g_object_unref0_ (gpointer var) {
 
301
        (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
 
302
}
 
303
 
 
304
 
 
305
static void _g_list_free__g_object_unref0_ (GList* self) {
 
306
        g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
 
307
        g_list_free (self);
 
308
}
 
309
 
 
310
 
 
311
static void unity_music_lens_music_store_scope_proxy_real_perform_search_data_free (gpointer _data) {
 
312
        UnityMusicLensMusicStoreScopeProxyPerformSearchData* _data_;
 
313
        _data_ = _data;
 
314
        _g_object_unref0 (_data_->search);
 
315
        __g_list_free__g_object_unref0_0 (_data_->filters);
 
316
        _g_object_unref0 (_data_->self);
 
317
        g_slice_free (UnityMusicLensMusicStoreScopeProxyPerformSearchData, _data_);
 
318
}
 
319
 
 
320
 
 
321
static gpointer _g_object_ref0 (gpointer self) {
 
322
        return self ? g_object_ref (self) : NULL;
 
323
}
 
324
 
 
325
 
 
326
static void unity_music_lens_music_store_scope_proxy_real_perform_search (UnityMusicLensSimpleScope* base, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GAsyncReadyCallback _callback_, gpointer _user_data_) {
258
327
        UnityMusicLensMusicStoreScopeProxy * self;
259
 
        UnityLensSearch* _tmp0_;
260
 
        gboolean _tmp1_ = FALSE;
261
 
        GError * _inner_error_ = NULL;
 
328
        UnityMusicLensMusicStoreScopeProxyPerformSearchData* _data_;
 
329
        UnityMusicLensMusicStoreScopeProxy* _tmp0_;
 
330
        UnityLensSearch* _tmp1_;
 
331
        UnityLensSearch* _tmp2_;
 
332
        UnitySearchType _tmp3_;
 
333
        GList* _tmp4_;
 
334
        gint _tmp5_;
262
335
        self = (UnityMusicLensMusicStoreScopeProxy*) base;
263
 
        g_return_if_fail (results_model != NULL);
264
 
        _tmp0_ = search;
265
 
        _tmp1_ = unity_music_lens_simple_scope_search_is_invalid ((UnityMusicLensSimpleScope*) self, _tmp0_);
266
 
        if (_tmp1_) {
267
 
                return;
 
336
        _data_ = g_slice_new0 (UnityMusicLensMusicStoreScopeProxyPerformSearchData);
 
337
        _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_music_lens_music_store_scope_proxy_real_perform_search);
 
338
        g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_music_lens_music_store_scope_proxy_real_perform_search_data_free);
 
339
        _tmp0_ = _g_object_ref0 (self);
 
340
        _data_->self = _tmp0_;
 
341
        _tmp1_ = search;
 
342
        _tmp2_ = _g_object_ref0 (_tmp1_);
 
343
        _data_->search = _tmp2_;
 
344
        _tmp3_ = search_type;
 
345
        _data_->search_type = _tmp3_;
 
346
        _tmp4_ = filters;
 
347
        __g_list_free__g_object_unref0_0 (_data_->filters);
 
348
        _data_->filters = _tmp4_;
 
349
        _tmp5_ = max_results;
 
350
        _data_->max_results = _tmp5_;
 
351
        unity_music_lens_music_store_scope_proxy_real_perform_search_co (_data_);
 
352
}
 
353
 
 
354
 
 
355
static void unity_music_lens_music_store_scope_proxy_real_perform_search_finish (UnityMusicLensSimpleScope* base, GAsyncResult* _res_) {
 
356
        UnityMusicLensMusicStoreScopeProxyPerformSearchData* _data_;
 
357
        _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
 
358
}
 
359
 
 
360
 
 
361
static void unity_music_lens_music_store_scope_proxy_perform_search_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
 
362
        UnityMusicLensMusicStoreScopeProxyPerformSearchData* _data_;
 
363
        _data_ = _user_data_;
 
364
        _data_->_source_object_ = source_object;
 
365
        _data_->_res_ = _res_;
 
366
        unity_music_lens_music_store_scope_proxy_real_perform_search_co (_data_);
 
367
}
 
368
 
 
369
 
 
370
static gboolean unity_music_lens_music_store_scope_proxy_real_perform_search_co (UnityMusicLensMusicStoreScopeProxyPerformSearchData* _data_) {
 
371
        switch (_data_->_state_) {
 
372
                case 0:
 
373
                goto _state_0;
 
374
                case 1:
 
375
                goto _state_1;
 
376
                default:
 
377
                g_assert_not_reached ();
 
378
        }
 
379
        _state_0:
 
380
        _data_->_tmp0_ = _data_->search;
 
381
        _data_->_tmp1_ = FALSE;
 
382
        _data_->_tmp1_ = unity_music_lens_simple_scope_is_search_empty ((UnityMusicLensSimpleScope*) _data_->self, _data_->_tmp0_);
 
383
        if (_data_->_tmp1_) {
 
384
                __g_list_free__g_object_unref0_0 (_data_->filters);
 
385
                if (_data_->_state_ == 0) {
 
386
                        g_simple_async_result_complete_in_idle (_data_->_async_result);
 
387
                } else {
 
388
                        g_simple_async_result_complete (_data_->_async_result);
 
389
                }
 
390
                g_object_unref (_data_->_async_result);
 
391
                return FALSE;
268
392
        }
269
393
        {
270
 
                DeeModel* _tmp2_;
271
 
                guint _tmp3_ = 0U;
272
 
                UnityMusicLensMusicStoreCollection* _tmp4_;
273
 
                UnityLensSearch* _tmp5_;
274
 
                DeeModel* _tmp6_;
275
 
                GList* _tmp7_;
276
 
                gint _tmp8_;
277
 
                DeeModel* _tmp9_;
278
 
                guint _tmp10_ = 0U;
279
 
                _tmp2_ = results_model;
280
 
                _tmp3_ = dee_model_get_n_rows (_tmp2_);
281
 
                g_debug ("musicstore-scope.vala:69: model has %u rows before search", _tmp3_);
282
 
                _tmp4_ = self->priv->collection;
283
 
                _tmp5_ = search;
284
 
                _tmp6_ = results_model;
285
 
                _tmp7_ = filters;
286
 
                _tmp8_ = max_results;
287
 
                unity_music_lens_music_store_collection_search (_tmp4_, _tmp5_, _tmp6_, _tmp7_, _tmp8_, &_inner_error_);
288
 
                if (_inner_error_ != NULL) {
289
 
                        if (_inner_error_->domain == G_IO_ERROR) {
 
394
                _data_->_tmp2_ = _data_->search;
 
395
                _data_->_tmp3_ = unity_lens_search_get_results_model (_data_->_tmp2_);
 
396
                _data_->_tmp4_ = _data_->_tmp3_;
 
397
                _data_->_tmp5_ = 0U;
 
398
                _data_->_tmp5_ = dee_model_get_n_rows ((DeeModel*) _data_->_tmp4_);
 
399
                g_debug ("musicstore-scope.vala:71: model has %u rows before search", _data_->_tmp5_);
 
400
                _data_->_tmp6_ = _data_->self->priv->collection;
 
401
                _data_->_tmp7_ = _data_->search;
 
402
                _data_->_tmp8_ = _data_->search_type;
 
403
                _data_->_tmp9_ = _data_->filters;
 
404
                _data_->filters = NULL;
 
405
                _data_->_tmp10_ = _data_->max_results;
 
406
                _data_->_state_ = 1;
 
407
                unity_music_lens_music_store_collection_search (_data_->_tmp6_, _data_->_tmp7_, _data_->_tmp8_, _data_->_tmp9_, _data_->_tmp10_, unity_music_lens_music_store_scope_proxy_perform_search_ready, _data_);
 
408
                return FALSE;
 
409
                _state_1:
 
410
                unity_music_lens_music_store_collection_search_finish (_data_->_tmp6_, _data_->_res_, &_data_->_inner_error_);
 
411
                if (_data_->_inner_error_ != NULL) {
 
412
                        if (_data_->_inner_error_->domain == G_IO_ERROR) {
290
413
                                goto __catch5_g_io_error;
291
414
                        }
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;
 
415
                        __g_list_free__g_object_unref0_0 (_data_->filters);
 
416
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
417
                        g_clear_error (&_data_->_inner_error_);
 
418
                        return FALSE;
295
419
                }
296
 
                _tmp9_ = results_model;
297
 
                _tmp10_ = dee_model_get_n_rows (_tmp9_);
298
 
                g_debug ("musicstore-scope.vala:71: model has %u rows after search", _tmp10_);
 
420
                _data_->_tmp11_ = _data_->search;
 
421
                _data_->_tmp12_ = unity_lens_search_get_results_model (_data_->_tmp11_);
 
422
                _data_->_tmp13_ = _data_->_tmp12_;
 
423
                _data_->_tmp14_ = 0U;
 
424
                _data_->_tmp14_ = dee_model_get_n_rows ((DeeModel*) _data_->_tmp13_);
 
425
                g_debug ("musicstore-scope.vala:73: model has %u rows after search", _data_->_tmp14_);
299
426
        }
300
427
        goto __finally5;
301
428
        __catch5_g_io_error:
302
429
        {
303
 
                GError* e = NULL;
304
 
                UnityLensSearch* _tmp11_;
305
 
                const gchar* _tmp12_;
306
 
                const gchar* _tmp13_;
307
 
                GError* _tmp14_;
308
 
                const gchar* _tmp15_;
309
 
                e = _inner_error_;
310
 
                _inner_error_ = NULL;
311
 
                _tmp11_ = search;
312
 
                _tmp12_ = unity_lens_search_get_search_string (_tmp11_);
313
 
                _tmp13_ = _tmp12_;
314
 
                _tmp14_ = e;
315
 
                _tmp15_ = _tmp14_->message;
316
 
                g_warning ("musicstore-scope.vala:73: Failed to search for '%s': %s", _tmp13_, _tmp15_);
317
 
                _g_error_free0 (e);
 
430
                _data_->e = _data_->_inner_error_;
 
431
                _data_->_inner_error_ = NULL;
 
432
                _data_->_tmp15_ = _data_->search;
 
433
                _data_->_tmp16_ = unity_lens_search_get_search_string (_data_->_tmp15_);
 
434
                _data_->_tmp17_ = _data_->_tmp16_;
 
435
                _data_->_tmp18_ = _data_->e;
 
436
                _data_->_tmp19_ = _data_->_tmp18_->message;
 
437
                g_warning ("musicstore-scope.vala:75: Failed to search for '%s': %s", _data_->_tmp17_, _data_->_tmp19_);
 
438
                _g_error_free0 (_data_->e);
318
439
        }
319
440
        __finally5:
320
 
        if (_inner_error_ != NULL) {
321
 
                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);
322
 
                g_clear_error (&_inner_error_);
323
 
                return;
324
 
        }
 
441
        if (_data_->_inner_error_ != NULL) {
 
442
                __g_list_free__g_object_unref0_0 (_data_->filters);
 
443
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
444
                g_clear_error (&_data_->_inner_error_);
 
445
                return FALSE;
 
446
        }
 
447
        __g_list_free__g_object_unref0_0 (_data_->filters);
 
448
        if (_data_->_state_ == 0) {
 
449
                g_simple_async_result_complete_in_idle (_data_->_async_result);
 
450
        } else {
 
451
                g_simple_async_result_complete (_data_->_async_result);
 
452
        }
 
453
        g_object_unref (_data_->_async_result);
 
454
        return FALSE;
325
455
}
326
456
 
327
457
 
356
486
        unity_music_lens_music_store_scope_proxy_parent_class = g_type_class_peek_parent (klass);
357
487
        g_type_class_add_private (klass, sizeof (UnityMusicLensMusicStoreScopeProxyPrivate));
358
488
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->perform_search = unity_music_lens_music_store_scope_proxy_real_perform_search;
 
489
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->perform_search_finish = unity_music_lens_music_store_scope_proxy_real_perform_search_finish;
359
490
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_without_search = unity_music_lens_music_store_scope_proxy_real_get_num_results_without_search;
360
491
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_global_search = unity_music_lens_music_store_scope_proxy_real_get_num_results_global_search;
361
492
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_lens_search = unity_music_lens_music_store_scope_proxy_real_get_num_results_lens_search;