[libdmapsharing] Work on dmapserve.vala and related changes to libdmapsharing Signed-off-by: W. Michael Petullo <mike



commit 4b641b84cf0c28794d96b1c05b1562643a640245
Author: W. Michael Petullo <mike flyn org>
Date:   Wed Dec 22 11:02:44 2010 -0600

    Work on dmapserve.vala and related changes to libdmapsharing
    Signed-off-by: W. Michael Petullo <mike flyn org>

 libdmapsharing/dmap-container-db.c |    6 +++---
 libdmapsharing/dmap-container-db.h |   18 +++++++++---------
 tests/Makefile.am                  |   23 +++++++++++++++++++++--
 tests/vala-dmap-db.vala            |    5 +++--
 tests/vala-dpap-record.vala        |    4 ++++
 5 files changed, 40 insertions(+), 16 deletions(-)
---
diff --git a/libdmapsharing/dmap-container-db.c b/libdmapsharing/dmap-container-db.c
index 7873228..8ad2535 100644
--- a/libdmapsharing/dmap-container-db.c
+++ b/libdmapsharing/dmap-container-db.c
@@ -23,13 +23,13 @@
 static gint dmap_container_db_init_count = 0;
 
 static void
-dmap_container_db_init (DMAPContainerDbInterface *iface)
+dmap_container_db_init (DMAPContainerDbIface *iface)
 {
         dmap_container_db_init_count++;
 }
 
 static void
-dmap_container_db_finalize (DMAPContainerDbInterface *iface)
+dmap_container_db_finalize (DMAPContainerDbIface *iface)
 {
 	dmap_container_db_init_count--;
 }
@@ -41,7 +41,7 @@ dmap_container_db_get_type (void)
 	static GType object_type = 0;
 	if (!object_type) {
 		static const GTypeInfo object_info = {
-			sizeof(DMAPContainerDbInterface),
+			sizeof(DMAPContainerDbIface),
 			(GBaseInitFunc) dmap_container_db_init,
 			(GBaseFinalizeFunc) dmap_container_db_finalize
 		};
diff --git a/libdmapsharing/dmap-container-db.h b/libdmapsharing/dmap-container-db.h
index f2ef3a1..528f3fb 100644
--- a/libdmapsharing/dmap-container-db.h
+++ b/libdmapsharing/dmap-container-db.h
@@ -28,11 +28,11 @@
 G_BEGIN_DECLS
 
 /**
- * TYPE_DMAP_CONTAINER_DB:
+ * DMAP_TYPE_CONTAINER_DB:
  *
  * The type for #DMAPContainerDb.
  */
-#define TYPE_DMAP_CONTAINER_DB		 (dmap_container_db_get_type ())
+#define DMAP_TYPE_CONTAINER_DB		 (dmap_container_db_get_type ())
 /**
  * DMAP_CONTAINER_DB:
  * @o: Object which is subject to casting.
@@ -42,16 +42,16 @@ G_BEGIN_DECLS
  * certain runtime checks to identify invalid casts.
  */
 #define DMAP_CONTAINER_DB(o)		 (G_TYPE_CHECK_INSTANCE_CAST ((o), \
-				          TYPE_DMAP_CONTAINER_DB, DMAPContainerDb))
+				          DMAP_TYPE_CONTAINER_DB, DMAPContainerDb))
 /**
  * IS_DMAP_CONTAINER_DB:
- * @o: Instance to check for being a %TYPE_DMAP_CONTAINER_DB.
+ * @o: Instance to check for being a %DMAP_TYPE_CONTAINER_DB.
  *
  * Checks whether a valid #GTypeInstance pointer is of type
- * %TYPE_DMAP_CONTAINER_DB.
+ * %DMAP_TYPE_CONTAINER_DB.
  */
 #define IS_DMAP_CONTAINER_DB(o)		 (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
-				          TYPE_DMAP_CONTAINER_DB))
+				          DMAP_TYPE_CONTAINER_DB))
 /**
  * DMAP_CONTAINER_DB_GET_INTERFACE:
  * @o: a #DMAPContainerDb instance.
@@ -61,12 +61,12 @@ G_BEGIN_DECLS
  * Returns: pointer to object interface structure.
  */
 #define DMAP_CONTAINER_DB_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), \
-				            TYPE_DMAP_CONTAINER_DB, DMAPContainerDbInterface))
+				            DMAP_TYPE_CONTAINER_DB, DMAPContainerDbIface))
 
 typedef struct _DMAPContainerDb DMAPContainerDb;
-typedef struct _DMAPContainerDbInterface DMAPContainerDbInterface;
+typedef struct _DMAPContainerDbIface DMAPContainerDbIface;
 
-struct _DMAPContainerDbInterface {
+struct _DMAPContainerDbIface {
 	GTypeInterface parent;
 
 	DMAPContainerRecord *(*lookup_by_id)    (DMAPContainerDb *db, guint id);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0b7828a..3ca057a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,7 @@
 noinst_PROGRAMS = test-dmap-client test-dmap-server
 
 if HAVE_VALA
-noinst_PROGRAMS += dpapview dmapcopy
+noinst_PROGRAMS += dpapview dmapcopy dmapserve
 endif
 
 test_dmap_client_SOURCES = \
@@ -43,7 +43,7 @@ test_dmap_server_LDADD = \
 	$(MDNS_LIBS)
 
 if MAINTAINER_MODE
-BUILT_SOURCES = dpapview.stamp dmapcopy.stamp
+BUILT_SOURCES = dpapview.stamp dmapcopy.stamp dmapserve.stamp
 
 dpapview.stamp: $(dpapview_VALASOURCES)
 	$(VALAC) --vapidir=$(srcdir) --pkg gee-1.0 --pkg gtk+-2.0 --pkg gstreamer-0.10 --pkg libdmapsharing-2.2 --pkg libsoup-2.4 --pkg glib-2.0 $^ -C
@@ -52,6 +52,10 @@ dpapview.stamp: $(dpapview_VALASOURCES)
 dmapcopy.stamp: $(dmapcopy_VALASOURCES)
 	$(VALAC) --vapidir=$(srcdir) --pkg gee-1.0 --pkg gstreamer-0.10 --pkg libdmapsharing-2.2 --pkg libsoup-2.4 --pkg glib-2.0 $^ -C
 	touch $@
+
+dmapserve.stamp: $(dmapserve_VALASOURCES)
+	$(VALAC) --vapidir=$(srcdir) --pkg gee-1.0 --pkg gstreamer-0.10 --pkg libdmapsharing-2.2 --pkg libsoup-2.4 --pkg glib-2.0 $^ -C
+	touch $@
 endif
 
 if HAVE_VALA
@@ -83,6 +87,21 @@ dmapcopy_SOURCES = \
 dmapcopy_LDADD = \
 	$(top_builddir)/libdmapsharing/libdmapsharing-3.0.la \
 	$(GEE_LIBS)
+
+dmapserve_VALASOURCES = \
+	dmapserve.vala \
+	vala-dmap-db.vala \
+	vala-dpap-record.vala \
+	vala-dmap-container-db.vala
+
+dmapserve_VALABUILTSOURCES = $(dmapserve_VALASOURCES:.vala=.c)
+
+dmapserve_SOURCES = \
+	$(dmapserve_VALABUILTSOURCES)
+
+dmapserve_LDADD = \
+	$(top_builddir)/libdmapsharing/libdmapsharing-3.0.la \
+	$(GEE_LIBS)
 endif
 
 AM_CPPFLAGS = \
diff --git a/tests/vala-dmap-db.vala b/tests/vala-dmap-db.vala
index a5d8cb3..846e8b5 100644
--- a/tests/vala-dmap-db.vala
+++ b/tests/vala-dmap-db.vala
@@ -23,7 +23,8 @@
 private class ValaDMAPDb : GLib.Object, DMAP.Db {
 	// A dumb database that stores everything in an array
 
-	private Gee.ArrayList<ValaDPAPRecord> db = new Gee.ArrayList<ValaDPAPRecord> ();
+	/* FIXME: What is with this unowned? */
+	private Gee.ArrayList<unowned ValaDPAPRecord> db = new Gee.ArrayList<ValaDPAPRecord> ();
 
 	public uint add (DMAP.Record record) {
 		db.add (((ValaDPAPRecord) record));
@@ -50,7 +51,7 @@ private class ValaDMAPDb : GLib.Object, DMAP.Db {
 	}
 
 	public unowned DMAP.Record lookup_by_id (uint id) {
-		GLib.error ("lookup_by_id not implemented");
+		return db.get ((int) id);
 	}
 
 
diff --git a/tests/vala-dpap-record.vala b/tests/vala-dpap-record.vala
index f66cdb8..e6f8b20 100644
--- a/tests/vala-dpap-record.vala
+++ b/tests/vala-dpap-record.vala
@@ -105,6 +105,10 @@ private class ValaDPAPRecord : GLib.Object, DMAP.Record, DPAP.Record {
 	public unowned GLib.ByteArray to_blob () {
 		GLib.error ("to_blob not implemented");
 	}
+
+	public ValaDPAPRecord () {
+		location = "FIXME";
+	}
 }
 
 private class ValaDPAPRecordFactory : GLib.Object, DMAP.RecordFactory {



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