~ubuntu-branches/ubuntu/raring/rygel/raring

« back to all changes in this revision

Viewing changes to src/plugins/media-export/rygel-media-export-db-container.c

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson
  • Date: 2012-09-26 22:34:15 UTC
  • mfrom: (11.1.19 experimental)
  • Revision ID: package-import@ubuntu.com-20120926223415-9day2s783n9td4e8
Tags: 0.16.0-1
ImportedĀ UpstreamĀ versionĀ 0.16.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* rygel-media-export-db-container.c generated by valac 0.14.2, the Vala compiler
 
1
/* rygel-media-export-db-container.c generated by valac 0.16.1, the Vala compiler
2
2
 * generated from rygel-media-export-db-container.vala, do not modify */
3
3
 
4
4
/*
25
25
 
26
26
#include <glib.h>
27
27
#include <glib-object.h>
28
 
#include <rygel.h>
 
28
#include <rygel-server.h>
29
29
#include <gio/gio.h>
30
 
#include <gee.h>
31
30
#include <stdlib.h>
32
31
#include <string.h>
 
32
#include <gee.h>
33
33
 
34
34
 
35
35
#define RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER (rygel_media_export_db_container_get_type ())
54
54
typedef struct _RygelMediaExportMediaCacheClass RygelMediaExportMediaCacheClass;
55
55
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
56
56
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 
57
#define _g_free0(var) (var = (g_free (var), NULL))
57
58
typedef struct _RygelMediaExportDbContainerGetChildrenData RygelMediaExportDbContainerGetChildrenData;
58
59
#define _rygel_search_expression_unref0(var) ((var == NULL) ? NULL : (var = (rygel_search_expression_unref (var), NULL)))
59
60
typedef struct _RygelMediaExportDbContainerSearchData RygelMediaExportDbContainerSearchData;
60
 
#define _g_free0(var) (var = (g_free (var), NULL))
61
61
typedef struct _RygelMediaExportDbContainerFindObjectData RygelMediaExportDbContainerFindObjectData;
62
62
 
63
63
struct _RygelMediaExportDBContainer {
68
68
 
69
69
struct _RygelMediaExportDBContainerClass {
70
70
        RygelMediaContainerClass parent_class;
71
 
        void (*search) (RygelMediaExportDBContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
71
        void (*search) (RygelMediaExportDBContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
72
72
        RygelMediaObjects* (*search_finish) (RygelMediaExportDBContainer* self, GAsyncResult* _res_, guint* total_matches, GError** error);
73
73
};
74
74
 
89
89
        RygelMediaExportDBContainer* self;
90
90
        guint offset;
91
91
        guint max_count;
 
92
        gchar* sort_criteria;
92
93
        GCancellable* cancellable;
93
94
        RygelMediaObjects* result;
94
95
        RygelMediaExportMediaCache* _tmp0_;
95
 
        guint _tmp1_;
 
96
        const gchar* _tmp1_;
96
97
        guint _tmp2_;
97
 
        RygelMediaObjects* _tmp3_;
 
98
        guint _tmp3_;
98
99
        RygelMediaObjects* _tmp4_;
 
100
        RygelMediaObjects* _tmp5_;
99
101
        GError * _inner_error_;
100
102
};
101
103
 
116
118
        guint offset;
117
119
        guint max_count;
118
120
        guint total_matches;
 
121
        gchar* sort_criteria;
119
122
        GCancellable* cancellable;
120
123
        RygelMediaObjects* result;
121
124
        RygelMediaObjects* children;
122
125
        RygelMediaExportMediaCache* _tmp0_;
123
126
        RygelSearchExpression* _tmp1_;
124
127
        const gchar* _tmp2_;
125
 
        guint _tmp3_;
 
128
        const gchar* _tmp3_;
126
129
        guint _tmp4_;
127
130
        guint _tmp5_;
128
 
        RygelMediaObjects* _tmp6_;
 
131
        guint _tmp6_;
129
132
        RygelMediaObjects* _tmp7_;
 
133
        RygelMediaObjects* _tmp8_;
130
134
        GError* _error_;
131
 
        GError* _tmp8_;
132
 
        RygelSearchExpression* _tmp9_;
133
 
        guint _tmp10_;
 
135
        GError* _tmp9_;
 
136
        RygelSearchExpression* _tmp10_;
134
137
        guint _tmp11_;
135
 
        GCancellable* _tmp12_;
136
 
        guint _tmp13_;
137
 
        RygelMediaObjects* _tmp14_;
138
 
        RygelMediaObjects* _tmp15_;
139
 
        GError* _tmp16_;
140
 
        GError* _tmp17_;
 
138
        guint _tmp12_;
 
139
        const gchar* _tmp13_;
 
140
        GCancellable* _tmp14_;
 
141
        guint _tmp15_;
 
142
        RygelMediaObjects* _tmp16_;
 
143
        RygelMediaObjects* _tmp17_;
 
144
        GError* _tmp18_;
 
145
        GError* _tmp19_;
141
146
        GError * _inner_error_;
142
147
};
143
148
 
175
180
GQuark rygel_media_export_database_error_quark (void);
176
181
gint rygel_media_export_media_cache_get_child_count (RygelMediaExportMediaCache* self, const gchar* container_id, GError** error);
177
182
static void rygel_media_export_db_container_real_get_children_data_free (gpointer _data);
178
 
static void rygel_media_export_db_container_real_get_children (RygelMediaContainer* base, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
183
static void rygel_media_export_db_container_real_get_children (RygelMediaContainer* base, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
179
184
static gboolean rygel_media_export_db_container_real_get_children_co (RygelMediaExportDbContainerGetChildrenData* _data_);
180
 
RygelMediaObjects* rygel_media_export_media_cache_get_children (RygelMediaExportMediaCache* self, RygelMediaContainer* container, glong offset, glong max_count, GError** error);
 
185
RygelMediaObjects* rygel_media_export_media_cache_get_children (RygelMediaExportMediaCache* self, RygelMediaContainer* container, const gchar* sort_criteria, glong offset, glong max_count, GError** error);
181
186
static void rygel_media_export_db_container_real_search_data_free (gpointer _data);
182
 
static void rygel_media_export_db_container_real_search (RygelMediaExportDBContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
183
 
void rygel_media_export_db_container_search (RygelMediaExportDBContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
187
static void rygel_media_export_db_container_real_search (RygelMediaExportDBContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
188
void rygel_media_export_db_container_search (RygelMediaExportDBContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
184
189
RygelMediaObjects* rygel_media_export_db_container_search_finish (RygelMediaExportDBContainer* self, GAsyncResult* _res_, guint* total_matches, GError** error);
185
190
static gboolean rygel_media_export_db_container_real_search_co (RygelMediaExportDbContainerSearchData* _data_);
186
 
RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_search_expression (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, const gchar* container_id, guint offset, guint max_count, guint* total_matches, GError** error);
 
191
RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_search_expression (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, const gchar* container_id, const gchar* sort_criteria, guint offset, guint max_count, guint* total_matches, GError** error);
187
192
GQuark rygel_media_export_media_cache_error_quark (void);
188
193
static void rygel_media_export_db_container_search_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
189
194
static void rygel_media_export_db_container_real_find_object_data_free (gpointer _data);
289
294
static void rygel_media_export_db_container_real_get_children_data_free (gpointer _data) {
290
295
        RygelMediaExportDbContainerGetChildrenData* _data_;
291
296
        _data_ = _data;
 
297
        _g_free0 (_data_->sort_criteria);
292
298
        _g_object_unref0 (_data_->cancellable);
293
299
        _g_object_unref0 (_data_->result);
294
300
        _g_object_unref0 (_data_->self);
296
302
}
297
303
 
298
304
 
299
 
static void rygel_media_export_db_container_real_get_children (RygelMediaContainer* base, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
305
static void rygel_media_export_db_container_real_get_children (RygelMediaContainer* base, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
300
306
        RygelMediaExportDBContainer * self;
301
307
        RygelMediaExportDbContainerGetChildrenData* _data_;
302
308
        RygelMediaExportDBContainer* _tmp0_;
303
309
        guint _tmp1_;
304
310
        guint _tmp2_;
305
 
        GCancellable* _tmp3_;
306
 
        GCancellable* _tmp4_;
 
311
        const gchar* _tmp3_;
 
312
        gchar* _tmp4_;
 
313
        GCancellable* _tmp5_;
 
314
        GCancellable* _tmp6_;
307
315
        self = (RygelMediaExportDBContainer*) base;
308
316
        _data_ = g_slice_new0 (RygelMediaExportDbContainerGetChildrenData);
309
317
        _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_media_export_db_container_real_get_children);
314
322
        _data_->offset = _tmp1_;
315
323
        _tmp2_ = max_count;
316
324
        _data_->max_count = _tmp2_;
317
 
        _tmp3_ = cancellable;
318
 
        _tmp4_ = _g_object_ref0 (_tmp3_);
319
 
        _data_->cancellable = _tmp4_;
 
325
        _tmp3_ = sort_criteria;
 
326
        _tmp4_ = g_strdup (_tmp3_);
 
327
        _data_->sort_criteria = _tmp4_;
 
328
        _tmp5_ = cancellable;
 
329
        _tmp6_ = _g_object_ref0 (_tmp5_);
 
330
        _data_->cancellable = _tmp6_;
320
331
        rygel_media_export_db_container_real_get_children_co (_data_);
321
332
}
322
333
 
343
354
        }
344
355
        _state_0:
345
356
        _data_->_tmp0_ = _data_->self->media_db;
346
 
        _data_->_tmp1_ = _data_->offset;
347
 
        _data_->_tmp2_ = _data_->max_count;
348
 
        _data_->_tmp3_ = NULL;
349
 
        _data_->_tmp3_ = rygel_media_export_media_cache_get_children (_data_->_tmp0_, (RygelMediaContainer*) _data_->self, (glong) _data_->_tmp1_, (glong) _data_->_tmp2_, &_data_->_inner_error_);
350
 
        _data_->_tmp4_ = _data_->_tmp3_;
 
357
        _data_->_tmp1_ = _data_->sort_criteria;
 
358
        _data_->_tmp2_ = _data_->offset;
 
359
        _data_->_tmp3_ = _data_->max_count;
 
360
        _data_->_tmp4_ = NULL;
 
361
        _data_->_tmp4_ = rygel_media_export_media_cache_get_children (_data_->_tmp0_, (RygelMediaContainer*) _data_->self, _data_->_tmp1_, (glong) _data_->_tmp2_, (glong) _data_->_tmp3_, &_data_->_inner_error_);
 
362
        _data_->_tmp5_ = _data_->_tmp4_;
351
363
        if (_data_->_inner_error_ != NULL) {
352
364
                g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
353
365
                g_error_free (_data_->_inner_error_);
359
371
                g_object_unref (_data_->_async_result);
360
372
                return FALSE;
361
373
        }
362
 
        _data_->result = _data_->_tmp4_;
 
374
        _data_->result = _data_->_tmp5_;
363
375
        if (_data_->_state_ == 0) {
364
376
                g_simple_async_result_complete_in_idle (_data_->_async_result);
365
377
        } else {
381
393
        RygelMediaExportDbContainerSearchData* _data_;
382
394
        _data_ = _data;
383
395
        _rygel_search_expression_unref0 (_data_->expression);
 
396
        _g_free0 (_data_->sort_criteria);
384
397
        _g_object_unref0 (_data_->cancellable);
385
398
        _g_object_unref0 (_data_->result);
386
399
        _g_object_unref0 (_data_->self);
393
406
}
394
407
 
395
408
 
396
 
static void rygel_media_export_db_container_real_search (RygelMediaExportDBContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
409
static void rygel_media_export_db_container_real_search (RygelMediaExportDBContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
397
410
        RygelMediaExportDbContainerSearchData* _data_;
398
411
        RygelMediaExportDBContainer* _tmp0_;
399
412
        RygelSearchExpression* _tmp1_;
400
413
        RygelSearchExpression* _tmp2_;
401
414
        guint _tmp3_;
402
415
        guint _tmp4_;
403
 
        GCancellable* _tmp5_;
404
 
        GCancellable* _tmp6_;
 
416
        const gchar* _tmp5_;
 
417
        gchar* _tmp6_;
 
418
        GCancellable* _tmp7_;
 
419
        GCancellable* _tmp8_;
405
420
        _data_ = g_slice_new0 (RygelMediaExportDbContainerSearchData);
406
421
        _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_media_export_db_container_real_search);
407
422
        g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_media_export_db_container_real_search_data_free);
414
429
        _data_->offset = _tmp3_;
415
430
        _tmp4_ = max_count;
416
431
        _data_->max_count = _tmp4_;
417
 
        _tmp5_ = cancellable;
418
 
        _tmp6_ = _g_object_ref0 (_tmp5_);
419
 
        _data_->cancellable = _tmp6_;
 
432
        _tmp5_ = sort_criteria;
 
433
        _tmp6_ = g_strdup (_tmp5_);
 
434
        _data_->sort_criteria = _tmp6_;
 
435
        _tmp7_ = cancellable;
 
436
        _tmp8_ = _g_object_ref0 (_tmp7_);
 
437
        _data_->cancellable = _tmp8_;
420
438
        rygel_media_export_db_container_real_search_co (_data_);
421
439
}
422
440
 
466
484
                _data_->_tmp0_ = _data_->self->media_db;
467
485
                _data_->_tmp1_ = _data_->expression;
468
486
                _data_->_tmp2_ = ((RygelMediaObject*) _data_->self)->id;
469
 
                _data_->_tmp3_ = _data_->offset;
470
 
                _data_->_tmp4_ = _data_->max_count;
471
 
                _data_->_tmp5_ = 0U;
472
 
                _data_->_tmp6_ = NULL;
473
 
                _data_->_tmp6_ = rygel_media_export_media_cache_get_objects_by_search_expression (_data_->_tmp0_, _data_->_tmp1_, _data_->_tmp2_, _data_->_tmp3_, _data_->_tmp4_, &_data_->_tmp5_, &_data_->_inner_error_);
474
 
                _data_->total_matches = _data_->_tmp5_;
475
 
                _data_->_tmp7_ = _data_->_tmp6_;
 
487
                _data_->_tmp3_ = _data_->sort_criteria;
 
488
                _data_->_tmp4_ = _data_->offset;
 
489
                _data_->_tmp5_ = _data_->max_count;
 
490
                _data_->_tmp6_ = 0U;
 
491
                _data_->_tmp7_ = NULL;
 
492
                _data_->_tmp7_ = rygel_media_export_media_cache_get_objects_by_search_expression (_data_->_tmp0_, _data_->_tmp1_, _data_->_tmp2_, _data_->_tmp3_, _data_->_tmp4_, _data_->_tmp5_, &_data_->_tmp6_, &_data_->_inner_error_);
 
493
                _data_->total_matches = _data_->_tmp6_;
 
494
                _data_->_tmp8_ = _data_->_tmp7_;
476
495
                if (_data_->_inner_error_ != NULL) {
477
496
                        if (_data_->_inner_error_->domain == RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR) {
478
497
                                goto __catch4_rygel_media_export_media_cache_error;
480
499
                        goto __finally4;
481
500
                }
482
501
                _g_object_unref0 (_data_->children);
483
 
                _data_->children = _data_->_tmp7_;
 
502
                _data_->children = _data_->_tmp8_;
484
503
        }
485
504
        goto __finally4;
486
505
        __catch4_rygel_media_export_media_cache_error:
487
506
        {
488
507
                _data_->_error_ = _data_->_inner_error_;
489
508
                _data_->_inner_error_ = NULL;
490
 
                _data_->_tmp8_ = _data_->_error_;
491
 
                if (g_error_matches (_data_->_tmp8_, RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR, RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_UNSUPPORTED_SEARCH)) {
492
 
                        _data_->_tmp9_ = _data_->expression;
493
 
                        _data_->_tmp10_ = _data_->offset;
494
 
                        _data_->_tmp11_ = _data_->max_count;
495
 
                        _data_->_tmp12_ = _data_->cancellable;
496
 
                        _data_->_tmp13_ = 0U;
 
509
                _data_->_tmp9_ = _data_->_error_;
 
510
                if (g_error_matches (_data_->_tmp9_, RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR, RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_UNSUPPORTED_SEARCH)) {
 
511
                        _data_->_tmp10_ = _data_->expression;
 
512
                        _data_->_tmp11_ = _data_->offset;
 
513
                        _data_->_tmp12_ = _data_->max_count;
 
514
                        _data_->_tmp13_ = _data_->sort_criteria;
 
515
                        _data_->_tmp14_ = _data_->cancellable;
 
516
                        _data_->_tmp15_ = 0U;
497
517
                        _data_->_state_ = 1;
498
 
                        rygel_searchable_container_simple_search ((RygelSearchableContainer*) _data_->self, _data_->_tmp9_, _data_->_tmp10_, _data_->_tmp11_, _data_->_tmp12_, rygel_media_export_db_container_search_ready, _data_);
 
518
                        rygel_searchable_container_simple_search ((RygelSearchableContainer*) _data_->self, _data_->_tmp10_, _data_->_tmp11_, _data_->_tmp12_, _data_->_tmp13_, _data_->_tmp14_, rygel_media_export_db_container_search_ready, _data_);
499
519
                        return FALSE;
500
520
                        _state_1:
501
 
                        _data_->_tmp14_ = NULL;
502
 
                        _data_->_tmp14_ = rygel_searchable_container_simple_search_finish ((RygelSearchableContainer*) _data_->self, _data_->_res_, &_data_->_tmp13_, &_data_->_inner_error_);
503
 
                        _data_->total_matches = _data_->_tmp13_;
504
 
                        _data_->_tmp15_ = _data_->_tmp14_;
 
521
                        _data_->_tmp16_ = NULL;
 
522
                        _data_->_tmp16_ = rygel_searchable_container_simple_search_finish ((RygelSearchableContainer*) _data_->self, _data_->_res_, &_data_->_tmp15_, &_data_->_inner_error_);
 
523
                        _data_->total_matches = _data_->_tmp15_;
 
524
                        _data_->_tmp17_ = _data_->_tmp16_;
505
525
                        if (_data_->_inner_error_ != NULL) {
506
526
                                _g_error_free0 (_data_->_error_);
507
527
                                goto __finally4;
508
528
                        }
509
529
                        _g_object_unref0 (_data_->children);
510
 
                        _data_->children = _data_->_tmp15_;
 
530
                        _data_->children = _data_->_tmp17_;
511
531
                } else {
512
 
                        _data_->_tmp16_ = _data_->_error_;
513
 
                        _data_->_tmp17_ = _g_error_copy0 (_data_->_tmp16_);
514
 
                        _data_->_inner_error_ = _data_->_tmp17_;
 
532
                        _data_->_tmp18_ = _data_->_error_;
 
533
                        _data_->_tmp19_ = _g_error_copy0 (_data_->_tmp18_);
 
534
                        _data_->_inner_error_ = _data_->_tmp19_;
515
535
                        _g_error_free0 (_data_->_error_);
516
536
                        goto __finally4;
517
537
                }
549
569
}
550
570
 
551
571
 
552
 
void rygel_media_export_db_container_search (RygelMediaExportDBContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
553
 
        RYGEL_MEDIA_EXPORT_DB_CONTAINER_GET_CLASS (self)->search (self, expression, offset, max_count, cancellable, _callback_, _user_data_);
 
572
void rygel_media_export_db_container_search (RygelMediaExportDBContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
573
        RYGEL_MEDIA_EXPORT_DB_CONTAINER_GET_CLASS (self)->search (self, expression, offset, max_count, sort_criteria, cancellable, _callback_, _user_data_);
554
574
}
555
575
 
556
576
 
691
711
 
692
712
static void rygel_media_export_db_container_rygel_searchable_container_interface_init (RygelSearchableContainerIface * iface) {
693
713
        rygel_media_export_db_container_rygel_searchable_container_parent_iface = g_type_interface_peek_parent (iface);
694
 
        iface->search = (RygelMediaObjects* (*)(RygelSearchableContainer*, RygelSearchExpression*, guint, guint, guint*, GCancellable*, GError**)) rygel_media_export_db_container_search;
 
714
        iface->search = (RygelMediaObjects* (*)(RygelSearchableContainer*, RygelSearchExpression*, guint, guint, guint*, const gchar*, GCancellable*, GError**)) rygel_media_export_db_container_search;
695
715
        iface->search_finish = rygel_media_export_db_container_search_finish;
696
716
        iface->get_search_classes = rygel_media_export_db_container_real_get_search_classes;
697
717
        iface->set_search_classes = rygel_media_export_db_container_real_set_search_classes;