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

« back to all changes in this revision

Viewing changes to src/banshee-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
 
/* banshee-scope.c generated by valac 0.15.0, the Vala compiler
 
1
/* banshee-scope.c generated by valac 0.14.1, the Vala compiler
2
2
 * generated from banshee-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
29
 
82
82
 
83
83
typedef struct _UnityMusicLensAlbum UnityMusicLensAlbum;
84
84
typedef struct _UnityMusicLensAlbumClass UnityMusicLensAlbumClass;
 
85
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
 
86
 
 
87
#define UNITY_MUSIC_LENS_TYPE_CATEGORY (unity_music_lens_category_get_type ())
 
88
typedef struct _UnityMusicLensBansheeScopeProxyPerformSearchData UnityMusicLensBansheeScopeProxyPerformSearchData;
85
89
 
86
90
struct _UnityMusicLensSimpleScope {
87
91
        GObject parent_instance;
90
94
 
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 ()
 
121
typedef enum  {
 
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;
 
127
 
 
128
struct _UnityMusicLensBansheeScopeProxyPerformSearchData {
 
129
        int _state_;
 
130
        GObject* _source_object_;
 
131
        GAsyncResult* _res_;
 
132
        GSimpleAsyncResult* _async_result;
 
133
        UnityMusicLensBansheeScopeProxy* self;
 
134
        UnityLensSearch* search;
 
135
        UnitySearchType search_type;
 
136
        GList* filters;
 
137
        gint max_results;
 
138
        gint category_override;
 
139
        UnitySearchType _tmp0_;
 
140
        UnityLensSearch* _tmp1_;
 
141
        gboolean _tmp2_;
 
142
        UnityMusicLensBansheeCollection* _tmp3_;
 
143
        UnityLensSearch* _tmp4_;
 
144
        UnitySearchType _tmp5_;
 
145
        GList* _tmp6_;
 
146
        gint _tmp7_;
 
147
        gint _tmp8_;
 
148
};
 
149
 
116
150
 
117
151
static gpointer unity_music_lens_banshee_scope_proxy_parent_class = NULL;
118
152
 
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);
466
506
}
467
507
 
468
508
 
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));
 
511
}
 
512
 
 
513
 
 
514
static void _g_list_free__g_object_unref0_ (GList* self) {
 
515
        g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
 
516
        g_list_free (self);
 
517
}
 
518
 
 
519
 
 
520
static void unity_music_lens_banshee_scope_proxy_real_perform_search_data_free (gpointer _data) {
 
521
        UnityMusicLensBansheeScopeProxyPerformSearchData* _data_;
 
522
        _data_ = _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_);
 
527
}
 
528
 
 
529
 
 
530
static gpointer _g_object_ref0 (gpointer self) {
 
531
        return self ? g_object_ref (self) : NULL;
 
532
}
 
533
 
 
534
 
 
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_;
473
 
        DeeModel* _tmp2_;
474
 
        GList* _tmp3_;
475
 
        gint _tmp4_;
 
540
        UnityLensSearch* _tmp2_;
 
541
        UnitySearchType _tmp3_;
 
542
        GList* _tmp4_;
 
543
        gint _tmp5_;
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_;
479
550
        _tmp1_ = search;
480
 
        _tmp2_ = results_model;
481
 
        _tmp3_ = filters;
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_;
 
555
        _tmp4_ = filters;
 
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_);
 
561
}
 
562
 
 
563
 
 
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_));
 
567
}
 
568
 
 
569
 
 
570
static gboolean unity_music_lens_banshee_scope_proxy_real_perform_search_co (UnityMusicLensBansheeScopeProxyPerformSearchData* _data_) {
 
571
        switch (_data_->_state_) {
 
572
                case 0:
 
573
                goto _state_0;
 
574
                default:
 
575
                g_assert_not_reached ();
 
576
        }
 
577
        _state_0:
 
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);
 
589
                        } else {
 
590
                                g_simple_async_result_complete (_data_->_async_result);
 
591
                        }
 
592
                        g_object_unref (_data_->_async_result);
 
593
                        return FALSE;
 
594
                }
 
595
        }
 
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);
 
606
        } else {
 
607
                g_simple_async_result_complete (_data_->_async_result);
 
608
        }
 
609
        g_object_unref (_data_->_async_result);
 
610
        return FALSE;
484
611
}
485
612
 
486
613
 
515
642
        unity_music_lens_banshee_scope_proxy_parent_class = g_type_class_peek_parent (klass);
516
643
        g_type_class_add_private (klass, sizeof (UnityMusicLensBansheeScopeProxyPrivate));
517
644
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->perform_search = unity_music_lens_banshee_scope_proxy_real_perform_search;
 
645
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->perform_search_finish = unity_music_lens_banshee_scope_proxy_real_perform_search_finish;
518
646
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_without_search = unity_music_lens_banshee_scope_proxy_real_get_num_results_without_search;
519
647
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_global_search = unity_music_lens_banshee_scope_proxy_real_get_num_results_global_search;
520
648
        UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_lens_search = unity_music_lens_banshee_scope_proxy_real_get_num_results_lens_search;