[rygel-gst-0-10-plugins] Clean up the WritableDbContainer.



commit 541a213da39b23cfb6514d625501b9ff28aec935
Author: Krzesimir Nowak <krnowak openismus com>
Date:   Thu Jan 24 14:42:06 2013 +0100

    Clean up the WritableDbContainer.

 .../rygel-media-export-object-factory.c            |    4 +-
 .../rygel-media-export-writable-db-container.c     |  489 ++++++-------------
 .../rygel-media-export-writable-db-container.h     |    5 +-
 3 files changed, 158 insertions(+), 340 deletions(-)
---
diff --git a/src/media-export/rygel-media-export-object-factory.c b/src/media-export/rygel-media-export-object-factory.c
index 05e413a..b339104 100644
--- a/src/media-export/rygel-media-export-object-factory.c
+++ b/src/media-export/rygel-media-export-object-factory.c
@@ -53,7 +53,6 @@ static RygelMediaExportDBContainer* rygel_media_export_object_factory_real_get_c
 	const gchar* _tmp8_;
 	gboolean _tmp9_ = FALSE;
 	const gchar* _tmp16_;
-	RygelMediaExportMediaCache* _tmp21_;
 	const gchar* _tmp22_;
 	const gchar* _tmp23_;
 	RygelMediaExportWritableDbContainer* _tmp24_;
@@ -156,10 +155,9 @@ static RygelMediaExportDBContainer* rygel_media_export_object_factory_real_get_c
 		result = _tmp20_;
 		return result;
 	}
-	_tmp21_ = media_db;
 	_tmp22_ = id;
 	_tmp23_ = title;
-	_tmp24_ = rygel_media_export_writable_db_container_new (_tmp21_, _tmp22_, _tmp23_);
+	_tmp24_ = rygel_media_export_writable_db_container_new (_tmp22_, _tmp23_);
 	result = (RygelMediaExportDBContainer*) _tmp24_;
 	return result;
 }
diff --git a/src/media-export/rygel-media-export-writable-db-container.c b/src/media-export/rygel-media-export-writable-db-container.c
index 5b75f86..01de72a 100644
--- a/src/media-export/rygel-media-export-writable-db-container.c
+++ b/src/media-export/rygel-media-export-writable-db-container.c
@@ -34,379 +34,200 @@ G_DEFINE_TYPE_WITH_CODE (RygelMediaExportWritableDbContainer,
 			 G_IMPLEMENT_INTERFACE (RYGEL_TYPE_WRITABLE_CONTAINER,
 						rygel_media_export_writable_db_container_rygel_writable_container_interface_init));
 
-typedef struct _RygelMediaExportWritableDbContainerAddItemData RygelMediaExportWritableDbContainerAddItemData;
-typedef struct _RygelMediaExportWritableDbContainerRemoveItemData RygelMediaExportWritableDbContainerRemoveItemData;
-
 struct _RygelMediaExportWritableDbContainerPrivate {
   GeeArrayList* create_classes;
 };
 
-struct _RygelMediaExportWritableDbContainerAddItemData {
-	int _state_;
-	GObject* _source_object_;
-	GAsyncResult* _res_;
-	GSimpleAsyncResult* _async_result;
-	RygelMediaExportWritableDbContainer* self;
-	RygelMediaItem* item;
-	GCancellable* cancellable;
-	RygelMediaItem* _tmp0_;
-	RygelMediaItem* _tmp1_;
-	GeeArrayList* _tmp2_;
-	gpointer _tmp3_;
-	gchar* _tmp4_;
-	GFile* _tmp5_;
-	GFile* _tmp6_;
-	GFile* file;
-	GFile* _tmp7_;
-	gboolean _tmp8_;
-	RygelMediaItem* _tmp9_;
-	gint64 _tmp10_;
-	RygelMediaItem* _tmp11_;
-	GFile* _tmp12_;
-	gchar* _tmp13_;
-	gchar* _tmp14_;
-	RygelMediaExportMediaCache* _tmp15_;
-	RygelMediaItem* _tmp16_;
-	GError * _inner_error_;
-};
-
-struct _RygelMediaExportWritableDbContainerRemoveItemData {
-	int _state_;
-	GObject* _source_object_;
-	GAsyncResult* _res_;
-	GSimpleAsyncResult* _async_result;
-	RygelMediaExportWritableDbContainer* self;
-	gchar* id;
-	GCancellable* cancellable;
-	RygelMediaExportMediaCache* _tmp0_;
-	const gchar* _tmp1_;
-	GError * _inner_error_;
-};
-
-#define RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainerPrivate))
-enum  {
-	RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_DUMMY_PROPERTY,
-	RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_CREATE_CLASSES
-};
-static void rygel_media_export_writable_db_container_real_add_item_data_free (gpointer _data);
-static void rygel_media_export_writable_db_container_real_add_item (RygelWritableContainer* base, RygelMediaItem* item, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
-static gboolean rygel_media_export_writable_db_container_real_add_item_co (RygelMediaExportWritableDbContainerAddItemData* _data_);
-static void rygel_media_export_writable_db_container_real_remove_item_data_free (gpointer _data);
-static void rygel_media_export_writable_db_container_real_remove_item (RygelWritableContainer* base, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
-static gboolean rygel_media_export_writable_db_container_real_remove_item_co (RygelMediaExportWritableDbContainerRemoveItemData* _data_);
-static void rygel_media_export_writable_db_container_finalize (GObject* obj);
-static void _vala_rygel_media_export_writable_db_container_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
-static void _vala_rygel_media_export_writable_db_container_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
-
-
-static RygelMediaExportWritableDbContainer* rygel_media_export_writable_db_container_construct (GType object_type, RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title) {
-	RygelMediaExportWritableDbContainer * self = NULL;
-	const gchar* _tmp1_;
-	const gchar* _tmp2_;
-	GeeArrayList* _tmp3_;
-	GeeArrayList* _tmp4_;
-	GeeArrayList* _tmp5_;
-	GeeArrayList* _tmp6_;
-	GeeArrayList* _tmp7_;
-	GeeArrayList* _tmp8_;
-	GeeArrayList* _tmp9_;
-	GeeArrayList* _tmp10_;
-	GeeArrayList* _tmp11_;
-	GeeArrayList* _tmp12_;
-	GeeArrayList* _tmp13_;
-	GeeArrayList* _tmp14_;
-	g_return_val_if_fail (media_db != NULL, NULL);
-	g_return_val_if_fail (id != NULL, NULL);
-	g_return_val_if_fail (title != NULL, NULL);
-	_tmp1_ = id;
-	_tmp2_ = title;
-	self = RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER (g_object_new (object_type,
-								       "id", _tmp1_,
-								       "parent", NULL,
-								       "title", _tmp2_,
-								       "child-count", 0,
-								       NULL));
-	_tmp3_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
-	_tmp4_ = _tmp3_;
-	rygel_writable_container_set_create_classes ((RygelWritableContainer*) self, _tmp4_);
-	g_object_unref (_tmp4_);
-	_tmp5_ = rygel_writable_container_get_create_classes ((RygelWritableContainer*) self);
-	_tmp6_ = _tmp5_;
-	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp6_, RYGEL_IMAGE_ITEM_UPNP_CLASS);
-	_tmp7_ = rygel_writable_container_get_create_classes ((RygelWritableContainer*) self);
-	_tmp8_ = _tmp7_;
-	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp8_, RYGEL_PHOTO_ITEM_UPNP_CLASS);
-	_tmp9_ = rygel_writable_container_get_create_classes ((RygelWritableContainer*) self);
-	_tmp10_ = _tmp9_;
-	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp10_, RYGEL_VIDEO_ITEM_UPNP_CLASS);
-	_tmp11_ = rygel_writable_container_get_create_classes ((RygelWritableContainer*) self);
-	_tmp12_ = _tmp11_;
-	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp12_, RYGEL_AUDIO_ITEM_UPNP_CLASS);
-	_tmp13_ = rygel_writable_container_get_create_classes ((RygelWritableContainer*) self);
-	_tmp14_ = _tmp13_;
-	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, RYGEL_MUSIC_ITEM_UPNP_CLASS);
-	return self;
-}
+#define RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_GET_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+				RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, \
+				RygelMediaExportWritableDbContainerPrivate))
 
+RygelMediaExportWritableDbContainer*
+rygel_media_export_writable_db_container_new (const gchar *id,
+					      const gchar *title) {
+  g_return_val_if_fail (id != NULL, NULL);
+  g_return_val_if_fail (title != NULL, NULL);
 
-RygelMediaExportWritableDbContainer* rygel_media_export_writable_db_container_new (RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title) {
-	return rygel_media_export_writable_db_container_construct (RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, media_db, id, title);
+  return RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER (g_object_new (RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER,
+								 "id", id,
+								 "parent", NULL,
+								 "title", title,
+								 "child-count", 0,
+								 NULL));
 }
 
-
-static void rygel_media_export_writable_db_container_real_add_item_data_free (gpointer _data) {
-	RygelMediaExportWritableDbContainerAddItemData* _data_;
-	_data_ = _data;
-	g_object_unref (_data_->item);
-	g_object_unref (_data_->cancellable);
-	g_object_unref (_data_->self);
-	g_slice_free (RygelMediaExportWritableDbContainerAddItemData, _data_);
+static void
+rygel_media_export_writable_db_container_real_add_item (RygelWritableContainer *base,
+							RygelMediaItem         *item,
+							GCancellable           *cancellable G_GNUC_UNUSED,
+							GAsyncReadyCallback     callback,
+							gpointer                user_data) {
+  RygelMediaObject *object = RYGEL_MEDIA_OBJECT (item);
+  gchar *uri;
+  GFile *file;
+  gchar *id;
+  RygelMediaExportMediaCache *cache;
+  GError *error = NULL;
+  GSimpleAsyncResult *simple;
+
+  rygel_media_object_set_parent (object, RYGEL_MEDIA_CONTAINER (base));
+  uri = gee_abstract_list_get (GEE_ABSTRACT_LIST (object->uris), 0);
+  file = g_file_new_for_uri (uri);
+  g_free (uri);
+  if (g_file_is_native (file)) {
+    rygel_media_object_set_modified (object, G_MAXINT64);
+  }
+  id = rygel_media_export_media_cache_get_id (file);
+  g_object_unref (file);
+  rygel_media_object_set_id (object, id);
+  g_free (id);
+  cache = rygel_media_export_db_container_get_media_db (RYGEL_MEDIA_EXPORT_DB_CONTAINER (base));
+  rygel_media_export_media_cache_save_item (cache, item, &error);
+
+  if (error) {
+    simple = g_simple_async_result_new_take_error (G_OBJECT (base),
+						   callback,
+						   user_data,
+						   error);
+  } else {
+    simple = g_simple_async_result_new (G_OBJECT (base),
+					callback,
+					user_data,
+					rygel_media_export_writable_db_container_real_add_item);
+  }
+  g_simple_async_result_complete_in_idle (simple);
+  g_object_unref (simple);
 }
 
-static void rygel_media_export_writable_db_container_real_add_item (RygelWritableContainer* base, RygelMediaItem* item, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
-	RygelMediaExportWritableDbContainer * self;
-	RygelMediaExportWritableDbContainerAddItemData* _data_;
-	RygelMediaExportWritableDbContainer* _tmp0_;
-	RygelMediaItem* _tmp1_;
-	RygelMediaItem* _tmp2_;
-	GCancellable* _tmp3_;
-	GCancellable* _tmp4_;
-	self = (RygelMediaExportWritableDbContainer*) base;
-	_data_ = g_slice_new0 (RygelMediaExportWritableDbContainerAddItemData);
-	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_media_export_writable_db_container_real_add_item);
-	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_media_export_writable_db_container_real_add_item_data_free);
-	_tmp0_ = g_object_ref (self);
-	_data_->self = _tmp0_;
-	_tmp1_ = item;
-	_tmp2_ = g_object_ref (_tmp1_);
-	g_object_unref (_data_->item);
-	_data_->item = _tmp2_;
-	_tmp3_ = cancellable;
-	_tmp4_ = g_object_ref (_tmp3_);
-	g_object_unref (_data_->cancellable);
-	_data_->cancellable = _tmp4_;
-	rygel_media_export_writable_db_container_real_add_item_co (_data_);
+static void
+rygel_media_export_writable_db_container_real_add_item_finish (RygelWritableContainer  *base G_GNUC_UNUSED,
+							       GAsyncResult            *res,
+							       GError                 **error) {
+  g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
 }
 
-
-static void rygel_media_export_writable_db_container_real_add_item_finish (RygelWritableContainer* base G_GNUC_UNUSED, GAsyncResult* _res_, GError** error) {
-  g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error);
+static void
+rygel_media_export_writable_db_container_real_remove_item (RygelWritableContainer *base,
+							   const gchar            *id,
+							   GCancellable           *cancellable G_GNUC_UNUSED,
+							   GAsyncReadyCallback     callback,
+							   gpointer                user_data) {
+  RygelMediaExportDBContainer *db_container = RYGEL_MEDIA_EXPORT_DB_CONTAINER (base);
+  RygelMediaExportMediaCache *cache = rygel_media_export_db_container_get_media_db (db_container);
+  GError *error = NULL;
+  GSimpleAsyncResult *simple;
+
+  rygel_media_export_media_cache_remove_by_id (cache, id, &error);
+
+  if (error) {
+    simple = g_simple_async_result_new_take_error (G_OBJECT (base),
+						   callback,
+						   user_data,
+						   error);
+  } else {
+    simple = g_simple_async_result_new (G_OBJECT (base),
+					callback,
+					user_data,
+					rygel_media_export_writable_db_container_real_remove_item);
+  }
+  g_simple_async_result_complete_in_idle (simple);
+  g_object_unref (simple);
 }
 
-
-static gboolean rygel_media_export_writable_db_container_real_add_item_co (RygelMediaExportWritableDbContainerAddItemData* _data_) {
-	switch (_data_->_state_) {
-		case 0:
-		goto _state_0;
-		default:
-		g_assert_not_reached ();
-	}
-	_state_0:
-	_data_->_tmp0_ = _data_->item;
-	rygel_media_object_set_parent ((RygelMediaObject*) _data_->_tmp0_, (RygelMediaContainer*) _data_->self);
-	_data_->_tmp1_ = _data_->item;
-	_data_->_tmp2_ = ((RygelMediaObject*) _data_->_tmp1_)->uris;
-	_data_->_tmp3_ = NULL;
-	_data_->_tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp2_, 0);
-	_data_->_tmp4_ = (gchar*) _data_->_tmp3_;
-	_data_->_tmp5_ = NULL;
-	_data_->_tmp5_ = g_file_new_for_uri (_data_->_tmp4_);
-	_data_->_tmp6_ = _data_->_tmp5_;
-	g_free (_data_->_tmp4_);
-	_data_->file = _data_->_tmp6_;
-	_data_->_tmp7_ = _data_->file;
-	_data_->_tmp8_ = FALSE;
-	_data_->_tmp8_ = g_file_is_native (_data_->_tmp7_);
-	if (_data_->_tmp8_) {
-		_data_->_tmp9_ = _data_->item;
-		_data_->_tmp10_ = G_MAXINT64;
-		rygel_media_object_set_modified ((RygelMediaObject*) _data_->_tmp9_, (guint64) _data_->_tmp10_);
-	}
-	_data_->_tmp11_ = _data_->item;
-	_data_->_tmp12_ = _data_->file;
-	_data_->_tmp13_ = NULL;
-	_data_->_tmp13_ = rygel_media_export_media_cache_get_id (_data_->_tmp12_);
-	_data_->_tmp14_ = _data_->_tmp13_;
-	rygel_media_object_set_id ((RygelMediaObject*) _data_->_tmp11_, _data_->_tmp14_);
-	g_free (_data_->_tmp14_);
-	_data_->_tmp15_ = rygel_media_export_db_container_get_media_db (RYGEL_MEDIA_EXPORT_DB_CONTAINER (_data_->self));
-	_data_->_tmp16_ = _data_->item;
-	rygel_media_export_media_cache_save_item (_data_->_tmp15_, _data_->_tmp16_, &_data_->_inner_error_);
-	if (_data_->_inner_error_ != NULL) {
-		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
-		g_error_free (_data_->_inner_error_);
-		g_object_unref (_data_->file);
-		if (_data_->_state_ == 0) {
-			g_simple_async_result_complete_in_idle (_data_->_async_result);
-		} else {
-			g_simple_async_result_complete (_data_->_async_result);
-		}
-		g_object_unref (_data_->_async_result);
-		return FALSE;
-	}
-	g_object_unref (_data_->file);
-	if (_data_->_state_ == 0) {
-		g_simple_async_result_complete_in_idle (_data_->_async_result);
-	} else {
-		g_simple_async_result_complete (_data_->_async_result);
-	}
-	g_object_unref (_data_->_async_result);
-	return FALSE;
+static void
+rygel_media_export_writable_db_container_real_remove_item_finish (RygelWritableContainer  *base G_GNUC_UNUSED,
+								  GAsyncResult            *res,
+								  GError                 **error) {
+  g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
 }
 
-
-static void rygel_media_export_writable_db_container_real_remove_item_data_free (gpointer _data) {
-	RygelMediaExportWritableDbContainerRemoveItemData* _data_;
-	_data_ = _data;
-	g_free (_data_->id);
-	g_object_unref (_data_->cancellable);
-	g_object_unref (_data_->self);
-	g_slice_free (RygelMediaExportWritableDbContainerRemoveItemData, _data_);
+static GeeArrayList *
+rygel_media_export_writable_db_container_real_get_create_classes (RygelWritableContainer* base) {
+  GeeArrayList* result;
+  RygelMediaExportWritableDbContainer* self;
+  GeeArrayList* _tmp0_;
+  self = (RygelMediaExportWritableDbContainer*) base;
+  _tmp0_ = self->priv->create_classes;
+  result = _tmp0_;
+  return result;
 }
 
 
-static void rygel_media_export_writable_db_container_real_remove_item (RygelWritableContainer* base, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
-	RygelMediaExportWritableDbContainer * self;
-	RygelMediaExportWritableDbContainerRemoveItemData* _data_;
-	RygelMediaExportWritableDbContainer* _tmp0_;
-	const gchar* _tmp1_;
-	gchar* _tmp2_;
-	GCancellable* _tmp3_;
-	GCancellable* _tmp4_;
-	self = (RygelMediaExportWritableDbContainer*) base;
-	_data_ = g_slice_new0 (RygelMediaExportWritableDbContainerRemoveItemData);
-	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_media_export_writable_db_container_real_remove_item);
-	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_media_export_writable_db_container_real_remove_item_data_free);
-	_tmp0_ = g_object_ref (self);
-	_data_->self = _tmp0_;
-	_tmp1_ = id;
-	_tmp2_ = g_strdup (_tmp1_);
-	g_free (_data_->id);
-	_data_->id = _tmp2_;
-	_tmp3_ = cancellable;
-	_tmp4_ = g_object_ref (_tmp3_);
-	g_object_unref (_data_->cancellable);
-	_data_->cancellable = _tmp4_;
-	rygel_media_export_writable_db_container_real_remove_item_co (_data_);
+static void
+rygel_media_export_writable_db_container_real_set_create_classes (RygelWritableContainer* base, GeeArrayList* value) {
+  RygelMediaExportWritableDbContainer* self;
+  GeeArrayList* _tmp0_;
+  GeeArrayList* _tmp1_;
+  self = (RygelMediaExportWritableDbContainer*) base;
+  _tmp0_ = value;
+  _tmp1_ = g_object_ref (_tmp0_);
+  g_object_unref (self->priv->create_classes);
+  self->priv->create_classes = _tmp1_;
+  g_object_notify ((GObject *) self, "create-classes");
 }
 
 
-static void rygel_media_export_writable_db_container_real_remove_item_finish (RygelWritableContainer* base G_GNUC_UNUSED, GAsyncResult* _res_, GError** error) {
-  g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error);
-}
+static void
+rygel_media_export_writable_db_container_dispose (GObject *object) {
+  RygelMediaExportWritableDbContainer *self = RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER (object);
+  RygelMediaExportWritableDbContainerPrivate *priv = self->priv;
 
+  if (priv->create_classes) {
+    GeeArrayList *list = priv->create_classes;
 
-static gboolean rygel_media_export_writable_db_container_real_remove_item_co (RygelMediaExportWritableDbContainerRemoveItemData* _data_) {
-	switch (_data_->_state_) {
-		case 0:
-		goto _state_0;
-		default:
-		g_assert_not_reached ();
-	}
-	_state_0:
-	_data_->_tmp0_ = rygel_media_export_db_container_get_media_db (RYGEL_MEDIA_EXPORT_DB_CONTAINER (_data_->self));
-	_data_->_tmp1_ = _data_->id;
-	rygel_media_export_media_cache_remove_by_id (_data_->_tmp0_, _data_->_tmp1_, &_data_->_inner_error_);
-	if (_data_->_inner_error_ != NULL) {
-		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
-		g_error_free (_data_->_inner_error_);
-		if (_data_->_state_ == 0) {
-			g_simple_async_result_complete_in_idle (_data_->_async_result);
-		} else {
-			g_simple_async_result_complete (_data_->_async_result);
-		}
-		g_object_unref (_data_->_async_result);
-		return FALSE;
-	}
-	if (_data_->_state_ == 0) {
-		g_simple_async_result_complete_in_idle (_data_->_async_result);
-	} else {
-		g_simple_async_result_complete (_data_->_async_result);
-	}
-	g_object_unref (_data_->_async_result);
-	return FALSE;
-}
+    priv->create_classes = NULL;
+    g_object_unref (list);
+  }
 
-
-static GeeArrayList* rygel_media_export_writable_db_container_real_get_create_classes (RygelWritableContainer* base) {
-	GeeArrayList* result;
-	RygelMediaExportWritableDbContainer* self;
-	GeeArrayList* _tmp0_;
-	self = (RygelMediaExportWritableDbContainer*) base;
-	_tmp0_ = self->priv->create_classes;
-	result = _tmp0_;
-	return result;
+  G_OBJECT_CLASS (rygel_media_export_writable_db_container_parent_class)->dispose (object);
 }
 
 
-static void rygel_media_export_writable_db_container_real_set_create_classes (RygelWritableContainer* base, GeeArrayList* value) {
-	RygelMediaExportWritableDbContainer* self;
-	GeeArrayList* _tmp0_;
-	GeeArrayList* _tmp1_;
-	self = (RygelMediaExportWritableDbContainer*) base;
-	_tmp0_ = value;
-	_tmp1_ = g_object_ref (_tmp0_);
-	g_object_unref (self->priv->create_classes);
-	self->priv->create_classes = _tmp1_;
-	g_object_notify ((GObject *) self, "create-classes");
-}
-
+static void
+rygel_media_export_writable_db_container_constructed (GObject *object) {
+  GeeArrayList *create_classes;
+  GeeAbstractCollection *collection;
+  RygelWritableContainer *writable_container = RYGEL_WRITABLE_CONTAINER (object);
 
-static void rygel_media_export_writable_db_container_class_init (RygelMediaExportWritableDbContainerClass * klass) {
-	g_type_class_add_private (klass, sizeof (RygelMediaExportWritableDbContainerPrivate));
-	G_OBJECT_CLASS (klass)->get_property = _vala_rygel_media_export_writable_db_container_get_property;
-	G_OBJECT_CLASS (klass)->set_property = _vala_rygel_media_export_writable_db_container_set_property;
-	G_OBJECT_CLASS (klass)->finalize = rygel_media_export_writable_db_container_finalize;
-	g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_CREATE_CLASSES, g_param_spec_object ("create-classes", "create-classes", "create-classes", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
-}
+  G_OBJECT_CLASS (rygel_media_export_writable_db_container_parent_class)->constructed (object);
 
+  create_classes = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
+  collection = GEE_ABSTRACT_COLLECTION (create_classes);
 
-static void rygel_media_export_writable_db_container_rygel_writable_container_interface_init (RygelWritableContainerIface * iface) {
-	iface->add_item = rygel_media_export_writable_db_container_real_add_item;
-	iface->add_item_finish = rygel_media_export_writable_db_container_real_add_item_finish;
-	iface->remove_item = rygel_media_export_writable_db_container_real_remove_item;
-	iface->remove_item_finish = rygel_media_export_writable_db_container_real_remove_item_finish;
-	iface->get_create_classes = rygel_media_export_writable_db_container_real_get_create_classes;
-	iface->set_create_classes = rygel_media_export_writable_db_container_real_set_create_classes;
+  rygel_writable_container_set_create_classes (writable_container, create_classes);
+  gee_abstract_collection_add (collection, RYGEL_IMAGE_ITEM_UPNP_CLASS);
+  gee_abstract_collection_add (collection, RYGEL_PHOTO_ITEM_UPNP_CLASS);
+  gee_abstract_collection_add (collection, RYGEL_VIDEO_ITEM_UPNP_CLASS);
+  gee_abstract_collection_add (collection, RYGEL_AUDIO_ITEM_UPNP_CLASS);
+  gee_abstract_collection_add (collection, RYGEL_MUSIC_ITEM_UPNP_CLASS);
+  g_object_unref (create_classes);
 }
 
+static void
+rygel_media_export_writable_db_container_class_init (RygelMediaExportWritableDbContainerClass *writable_db_container_class) {
+  GObjectClass *object_class = G_OBJECT_CLASS (writable_db_container_class);
 
-static void rygel_media_export_writable_db_container_init (RygelMediaExportWritableDbContainer * self) {
-	self->priv = RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_GET_PRIVATE (self);
-}
-
+  object_class->dispose = rygel_media_export_writable_db_container_dispose;
+  object_class->constructed = rygel_media_export_writable_db_container_constructed;
 
-static void rygel_media_export_writable_db_container_finalize (GObject* obj) {
-	RygelMediaExportWritableDbContainer * self;
-	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainer);
-	g_object_unref (self->priv->create_classes);
-	G_OBJECT_CLASS (rygel_media_export_writable_db_container_parent_class)->finalize (obj);
+  g_type_class_add_private (writable_db_container_class,
+			    sizeof (RygelMediaExportWritableDbContainerPrivate));
 }
 
 
-static void _vala_rygel_media_export_writable_db_container_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
-	RygelMediaExportWritableDbContainer * self;
-	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainer);
-	switch (property_id) {
-		case RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_CREATE_CLASSES:
-		g_value_set_object (value, rygel_writable_container_get_create_classes ((RygelWritableContainer*) self));
-		break;
-		default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-		break;
-	}
+static void
+rygel_media_export_writable_db_container_rygel_writable_container_interface_init (RygelWritableContainerIface *iface) {
+  iface->add_item = rygel_media_export_writable_db_container_real_add_item;
+  iface->add_item_finish = rygel_media_export_writable_db_container_real_add_item_finish;
+  iface->remove_item = rygel_media_export_writable_db_container_real_remove_item;
+  iface->remove_item_finish = rygel_media_export_writable_db_container_real_remove_item_finish;
+  iface->get_create_classes = rygel_media_export_writable_db_container_real_get_create_classes;
+  iface->set_create_classes = rygel_media_export_writable_db_container_real_set_create_classes;
 }
 
 
-static void _vala_rygel_media_export_writable_db_container_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
-	RygelMediaExportWritableDbContainer * self;
-	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainer);
-	switch (property_id) {
-		case RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_CREATE_CLASSES:
-		rygel_writable_container_set_create_classes ((RygelWritableContainer*) self, g_value_get_object (value));
-		break;
-		default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-		break;
-	}
+static void
+rygel_media_export_writable_db_container_init (RygelMediaExportWritableDbContainer *self) {
+  self->priv = RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_GET_PRIVATE (self);
 }
diff --git a/src/media-export/rygel-media-export-writable-db-container.h b/src/media-export/rygel-media-export-writable-db-container.h
index d86e613..dc9f756 100644
--- a/src/media-export/rygel-media-export-writable-db-container.h
+++ b/src/media-export/rygel-media-export-writable-db-container.h
@@ -54,9 +54,8 @@ GType
 rygel_media_export_writable_db_container_get_type (void) G_GNUC_CONST;
 
 RygelMediaExportWritableDbContainer *
-rygel_media_export_writable_db_container_new (RygelMediaExportMediaCache *media_db,
-					      const gchar                *id,
-					      const gchar                *title);
+rygel_media_export_writable_db_container_new (const gchar *id,
+					      const gchar *title);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]