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;
63
63
struct _RygelMediaExportDBContainer {
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);
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_;
128
RygelMediaObjects* _tmp6_;
129
132
RygelMediaObjects* _tmp7_;
133
RygelMediaObjects* _tmp8_;
132
RygelSearchExpression* _tmp9_;
136
RygelSearchExpression* _tmp10_;
135
GCancellable* _tmp12_;
137
RygelMediaObjects* _tmp14_;
138
RygelMediaObjects* _tmp15_;
139
const gchar* _tmp13_;
140
GCancellable* _tmp14_;
142
RygelMediaObjects* _tmp16_;
143
RygelMediaObjects* _tmp17_;
141
146
GError * _inner_error_;
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);
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_;
305
GCancellable* _tmp3_;
306
GCancellable* _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);
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_);
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_;
403
GCancellable* _tmp5_;
404
GCancellable* _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);
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;
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;
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;
482
501
_g_object_unref0 (_data_->children);
483
_data_->children = _data_->_tmp7_;
502
_data_->children = _data_->_tmp8_;
486
505
__catch4_rygel_media_export_media_cache_error:
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_);
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_);
509
529
_g_object_unref0 (_data_->children);
510
_data_->children = _data_->_tmp15_;
530
_data_->children = _data_->_tmp17_;
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_);
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_);
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;