[libdmapsharing] * Change configure script to require avahi, howl OR DNS_SD.H.



commit bf5eec7c7190b485212fc304ef81737a863cfbf3
Author: W. Michael Petullo <mike flyn org>
Date:   Sun Nov 29 21:50:48 2009 -0500

    * Change configure script to require avahi, howl OR DNS_SD.H.
    
    * Make dmap_record_factory_create more generic, take gpointer user_data
    instead of path.
    
    * Fix daap_connection_new, take password_required.
    
    * Use typedef's for function arguments.
    
    * DMAPDb foreach function now takes GHFunc.

 ChangeLog                                  |   17 +++++++++++++++++
 config.h.in                                |    3 +++
 configure.ac                               |    6 +++---
 distro/libdmapsharing.spec                 |   11 ++++++++++-
 libdmapsharing/daap-connection.c           |   11 +++--------
 libdmapsharing/daap-connection.h           |    2 +-
 libdmapsharing/daap-share.c                |    8 ++++----
 libdmapsharing/dmap-connection.c           |    1 +
 libdmapsharing/dmap-container-db.c         |    4 ++--
 libdmapsharing/dmap-container-db.h         |    8 +++-----
 libdmapsharing/dmap-db.c                   |   10 ++++------
 libdmapsharing/dmap-db.h                   |   19 +++++++++++++------
 libdmapsharing/dmap-mdns-publisher-dnssd.c |    3 +--
 libdmapsharing/dmap-record-factory.c       |    4 ++--
 libdmapsharing/dmap-record-factory.h       |    6 +++---
 libdmapsharing/dpap-connection.c           |   11 +++--------
 libdmapsharing/dpap-connection.h           |    2 +-
 libdmapsharing/dpap-share.c                |    6 +++---
 tests/test-daap-record-factory.c           |    2 +-
 tests/test-daap-record-factory.h           |    2 +-
 tests/test-dmap-client.c                   |   13 +------------
 tests/test-dmap-container-db.c             |    9 ++++-----
 tests/test-dmap-db.c                       |    6 ++----
 tests/test-dpap-record-factory.c           |    2 +-
 tests/test-dpap-record-factory.h           |    2 +-
 25 files changed, 88 insertions(+), 80 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0865ec4..abf03d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+28 November 2009 W. Michael Petullo <mike flyn org>
+
+	* Change configure script to require avahi, howl OR DNS_SD.H.
+
+28 August 2009 W. Michael Petullo <mike flyn org>
+
+	* Make dmap_record_factory_create more generic, take gpointer
+	user_data instead of path.
+
+27 August 2009 W. Michael Petullo <mike flyn org>
+
+	* Fix daap_connection_new, take password_required.
+
+	* Use typedef's for function arguments.
+
+	* DMAPDb foreach function now takes GHFunc.
+
 22 August 2009 W. Michael Petullo <mike flyn org>
 
 	* Work on dns_sd mDNS backend.
diff --git a/config.h.in b/config.h.in
index 4e5b5f2..d06e6a1 100644
--- a/config.h.in
+++ b/config.h.in
@@ -82,6 +82,9 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
diff --git a/configure.ac b/configure.ac
index 0c0bc06..1e62152 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,8 @@
-AC_INIT(libdmapsharing, 1.9.0.12)
+AC_INIT(libdmapsharing, 1.9.0.14)
 
 dnl when going to/from release please set the nano (fourth number) right !
 dnl releases only do Wall, cvs and prerelease does Werror too
-AS_VERSION(libdmapsharing, LIBDMAPSHARING, 1, 9, 0, 12, LIBDMAPSHARING_CVS="no", LIBDMAPSHARING_CVS="yes")
+AS_VERSION(libdmapsharing, LIBDMAPSHARING, 1, 9, 0, 14, LIBDMAPSHARING_CVS="no", LIBDMAPSHARING_CVS="yes")
 
 AM_INIT_AUTOMAKE
 
@@ -185,7 +185,7 @@ if test x"$WITH_MDNS" = xauto; then
 
     HAVE_MDNS=yes
   else
-    AC_MSG_ERROR([You need avahi or howl development files installed.])
+    AC_MSG_ERROR([You need avahi, howl or dns_sd.h development files installed.])
   fi
 fi
 
diff --git a/distro/libdmapsharing.spec b/distro/libdmapsharing.spec
index aaa53c9..90e322c 100644
--- a/distro/libdmapsharing.spec
+++ b/distro/libdmapsharing.spec
@@ -1,5 +1,5 @@
 Name: libdmapsharing
-Version: 1.9.0.11
+Version: 1.9.0.14
 Release: 1%{?dist}
 License: LGPLv2+
 Source: http://downloads.sourceforge.net/%name/%{name}-%{version}.tar.gz
@@ -58,6 +58,15 @@ rm -rf $RPM_BUILD_ROOT
 %postun -p /sbin/ldconfig
 
 %changelog
+* Sun Nov 29 2009 W. Michael Petullo <mike[ ]flyn org> - 1.9.0.14-1
+- New upstream version.
+
+* Fri Aug 28 2009 W. Michael Petullo <mike[ ]flyn org> - 1.9.0.13-1
+- New upstream version.
+
+* Thu Aug 27 2009 W. Michael Petullo <mike[ ]flyn org> - 1.9.0.12-1
+- New upstream version.
+
 * Sat Aug 15 2009 W. Michael Petullo <mike[ ]flyn org> - 1.9.0.11-1
 - New upstream version.
 - Add gtk-doc documentation to devel package.
diff --git a/libdmapsharing/daap-connection.c b/libdmapsharing/daap-connection.c
index 7fabfd0..993b29a 100644
--- a/libdmapsharing/daap-connection.c
+++ b/libdmapsharing/daap-connection.c
@@ -59,24 +59,19 @@ DAAPConnection *
 daap_connection_new (const gchar *name,
                      const gchar *host,
                      gint port,
-                     const gchar *password,
+                     gboolean password_protected,
 		     DMAPDb *db,
 		     DMAPRecordFactory *factory)
 {
-    DAAPConnection *self = DAAP_CONNECTION (g_object_new (TYPE_DAAP_CONNECTION,
+    return DAAP_CONNECTION (g_object_new (TYPE_DAAP_CONNECTION,
             "name", name,
             "host", host,
             "port", port,
+	    "password-protected", password_protected,
             "db",   db,
 	    "factory", factory,
             "need-revision-number", TRUE,
             NULL));
-
-    if (password) {
-        g_object_set (self, "password", password, NULL);
-    }
-
-    return self;
 }
 
 static SoupMessage *
diff --git a/libdmapsharing/daap-connection.h b/libdmapsharing/daap-connection.h
index 49250a8..ec86807 100644
--- a/libdmapsharing/daap-connection.h
+++ b/libdmapsharing/daap-connection.h
@@ -93,7 +93,7 @@ GType           daap_connection_get_type (void);
 DAAPConnection *daap_connection_new      (const gchar *name,
                                           const gchar *host,
                                           gint port,
-                                          const gchar *password,
+					  gboolean password_protected,
 					  DMAPDb      *db,
 				          DMAPRecordFactory *factory);
 
diff --git a/libdmapsharing/daap-share.c b/libdmapsharing/daap-share.c
index 640c49e..d3535df 100644
--- a/libdmapsharing/daap-share.c
+++ b/libdmapsharing/daap-share.c
@@ -959,7 +959,7 @@ daap_share_databases (DMAPShare *share,
 			/* Free hash table but not data: */
 			g_hash_table_destroy (records);
 		} else {
-			dmap_db_foreach (DAAP_SHARE (share)->priv->db, add_entry_to_mlcl, &mb);
+			dmap_db_foreach (DAAP_SHARE (share)->priv->db, (GHFunc) add_entry_to_mlcl, &mb);
 		}
 
 		_dmap_share_message_set_from_dmap_structure (share, message, adbs);
@@ -1003,7 +1003,7 @@ daap_share_databases (DMAPShare *share,
 		dmap_structure_add (mlit, DMAP_CC_MIMC, dmap_db_count (DAAP_SHARE (share)->priv->db));
 		dmap_structure_add (mlit, DMAP_CC_ABPL, (gchar) 1);
 
-		dmap_container_db_foreach (DAAP_SHARE (share)->priv->container_db, _dmap_share_add_playlist_to_mlcl, (gpointer) mlcl);
+		dmap_container_db_foreach (DAAP_SHARE (share)->priv->container_db, (GHFunc) _dmap_share_add_playlist_to_mlcl, (gpointer) mlcl);
 
 		_dmap_share_message_set_from_dmap_structure (share, message, aply);
 		dmap_structure_destroy (aply);
@@ -1039,7 +1039,7 @@ daap_share_databases (DMAPShare *share,
 			dmap_structure_add (apso, DMAP_CC_MRCO, (gint32) num_songs);
 			mb.mlcl = dmap_structure_add (apso, DMAP_CC_MLCL);
 
-			dmap_db_foreach (DAAP_SHARE (share)->priv->db, add_entry_to_mlcl, &mb);
+			dmap_db_foreach (DAAP_SHARE (share)->priv->db, (GHFunc) add_entry_to_mlcl, &mb);
 		} else {
 			DMAPContainerRecord *record;
 			const DMAPDb *entries;
@@ -1053,7 +1053,7 @@ daap_share_databases (DMAPShare *share,
 			dmap_structure_add (apso, DMAP_CC_MRCO, (gint32) num_songs);
 			mb.mlcl = dmap_structure_add (apso, DMAP_CC_MLCL);
 
-			dmap_db_foreach (entries, add_entry_to_mlcl, &mb);
+			dmap_db_foreach (entries, (GHFunc) add_entry_to_mlcl, &mb);
 
 			g_object_unref (record);
 		}
diff --git a/libdmapsharing/dmap-connection.c b/libdmapsharing/dmap-connection.c
index 58e9662..70fc22f 100644
--- a/libdmapsharing/dmap-connection.c
+++ b/libdmapsharing/dmap-connection.c
@@ -973,6 +973,7 @@ handle_song_listing (DMAPConnection *connection,
 			g_debug ("cannot create record for daap track %s", uri);
 			continue;
 		}
+		/* FIXME: This is DAAP-specific! */
 		g_object_set (record,
 			     "location", uri,
 			     "year", year,
diff --git a/libdmapsharing/dmap-container-db.c b/libdmapsharing/dmap-container-db.c
index 4a4b82f..f1aff1f 100644
--- a/libdmapsharing/dmap-container-db.c
+++ b/libdmapsharing/dmap-container-db.c
@@ -61,10 +61,10 @@ dmap_container_db_lookup_by_id (DMAPContainerDb *db, gint id)
 
 void
 dmap_container_db_foreach	(DMAPContainerDb *db,
-			 	 void (*fn) (DMAPContainerRecord *record, gpointer data),
+				 GHFunc func,
 			 	 gpointer data)
 {
-	DMAP_CONTAINER_DB_GET_INTERFACE (db)->foreach (db, fn, data);
+	DMAP_CONTAINER_DB_GET_INTERFACE (db)->foreach (db, func, data);
 }
 
 gulong
diff --git a/libdmapsharing/dmap-container-db.h b/libdmapsharing/dmap-container-db.h
index 8be4b89..cfbf7e8 100644
--- a/libdmapsharing/dmap-container-db.h
+++ b/libdmapsharing/dmap-container-db.h
@@ -72,9 +72,8 @@ struct _DMAPContainerDbInterface {
 	DMAPContainerRecord *(*lookup_by_id)    (DMAPContainerDb *db, gint id);
 
 	void        (*foreach) (DMAPContainerDb *db,
-					void (*fn) (DMAPContainerRecord *record,
-						    gpointer data),
-					gpointer data);
+				GHFunc func,
+				gpointer data);
 
 	gint64 (*count)        (DMAPContainerDb *db);
 };
@@ -100,8 +99,7 @@ DMAPContainerRecord *dmap_container_db_lookup_by_id    (DMAPContainerDb *db, gin
  * Apply a function to each record in a container database.
  */
 void	    dmap_container_db_foreach         (DMAPContainerDb *db,
-				     	       void (*fn) (DMAPContainerRecord *record,
-						 	   gpointer data),
+					       GHFunc func,
 				     	       gpointer data);
 
 /**
diff --git a/libdmapsharing/dmap-db.c b/libdmapsharing/dmap-db.c
index f7544d8..29a4307 100644
--- a/libdmapsharing/dmap-db.c
+++ b/libdmapsharing/dmap-db.c
@@ -69,12 +69,10 @@ dmap_db_lookup_by_id (DMAPDb *db, guint id)
 
 void
 dmap_db_foreach	(const DMAPDb *db,
-			 void (*fn) (gpointer id,
-			 	     DMAPRecord *record,
-				     gpointer data),
-			 gpointer data)
+		 GHFunc func,
+		 gpointer data)
 {
-	DMAP_DB_GET_INTERFACE (db)->foreach (db, fn, data);
+	DMAP_DB_GET_INTERFACE (db)->foreach (db, func, data);
 }
 
 gint
@@ -191,7 +189,7 @@ _dmap_db_apply_filter (DMAPDb *db, GSList *filter_def)
 	data.filter_def = filter_def;
 	data.ht = ht;
 
-	dmap_db_foreach (db, apply_filter, &data);
+	dmap_db_foreach (db, (GHFunc) apply_filter, &data);
 
 	return data.ht;
 }
diff --git a/libdmapsharing/dmap-db.h b/libdmapsharing/dmap-db.h
index 98a89da..342b136 100644
--- a/libdmapsharing/dmap-db.h
+++ b/libdmapsharing/dmap-db.h
@@ -71,9 +71,7 @@ struct _DMAPDbInterface {
 	gint (*add)			(DMAPDb *db, DMAPRecord *record);
 	DMAPRecord *(*lookup_by_id)	(DMAPDb *db, guint id);
 	void (*foreach)			(const DMAPDb *db,
-					 void (*fn) (gpointer id,
-					 	     DMAPRecord *record,
-					 	     gpointer data),
+					 GHFunc func,
 					 gpointer data);
 	gint64 (*count) 		(const DMAPDb *db);
 };
@@ -109,6 +107,17 @@ gint        dmap_db_add		    (DMAPDb *db, DMAPRecord *record);
  *
  * Returns: the database record corresponding to @id. This record should
  * be unrefed by the calling code when no longer required.
+ *
+ * If you are implementing a full database using this API, then you
+ * probably want to increment the reference count before returning a record
+ * pointer.
+ *
+ * On the other hand, if you are implementing an adapter class
+ * and the records are stored elsewhere, then you will probably return a
+ * transient record. That is, once the user is done using it, the returned
+ * record should be free'd because it is a adapter copy of the real record.
+ * In this case, the reference count should not be incremented before
+ * returning a record pointer.
  */
 DMAPRecord *dmap_db_lookup_by_id    (DMAPDb *db, guint id);
 
@@ -121,9 +130,7 @@ DMAPRecord *dmap_db_lookup_by_id    (DMAPDb *db, guint id);
  * Apply a function to each record in a media database.
  */
 void        dmap_db_foreach	    (const DMAPDb *db,
-				     void (*fn) (gpointer id,
-				     		 DMAPRecord *record,
-						 gpointer data),
+				     GHFunc func,
 				     gpointer data);
 
 /**
diff --git a/libdmapsharing/dmap-mdns-publisher-dnssd.c b/libdmapsharing/dmap-mdns-publisher-dnssd.c
index cb885c5..4e83328 100644
--- a/libdmapsharing/dmap-mdns-publisher-dnssd.c
+++ b/libdmapsharing/dmap-mdns-publisher-dnssd.c
@@ -157,8 +157,7 @@ dmap_mdns_publisher_publish (DmapMdnsPublisher *publisher,
 		type_of_service,
 		NULL,
 		NULL,
-		//port,
-		(uint16_t) htons (3689),
+		htons (port),
 		0,
 		NULL,
 		NULL,
diff --git a/libdmapsharing/dmap-record-factory.c b/libdmapsharing/dmap-record-factory.c
index 0ef699c..fa33a82 100644
--- a/libdmapsharing/dmap-record-factory.c
+++ b/libdmapsharing/dmap-record-factory.c
@@ -54,7 +54,7 @@ dmap_record_factory_get_type (void)
 }
 
 DMAPRecord *
-dmap_record_factory_create (DMAPRecordFactory *factory, const char *path)
+dmap_record_factory_create (DMAPRecordFactory *factory, gpointer user_data)
 {
-	return DMAP_RECORD_FACTORY_GET_INTERFACE (factory)->create (factory, path);
+	return DMAP_RECORD_FACTORY_GET_INTERFACE (factory)->create (factory, user_data);
 }
diff --git a/libdmapsharing/dmap-record-factory.h b/libdmapsharing/dmap-record-factory.h
index dfff16a..a0f068a 100644
--- a/libdmapsharing/dmap-record-factory.h
+++ b/libdmapsharing/dmap-record-factory.h
@@ -71,7 +71,7 @@ typedef struct _DMAPRecordFactoryInterface DMAPRecordFactoryInterface;
 struct _DMAPRecordFactoryInterface {
 	GTypeInterface parent;
 
-	DMAPRecord *(*create) (DMAPRecordFactory *factory, const char *path);
+	DMAPRecord *(*create) (DMAPRecordFactory *factory, gpointer user_data);
 };
 
 GType dmap_record_factory_get_type (void);
@@ -79,11 +79,11 @@ GType dmap_record_factory_get_type (void);
 /**
  * dmap_record_factory_create:
  * @factory: A DMAPRecordFactory.
- * @path: A file path.
+ * @user_data: Some piece of data that may be used to initialize return value.
  *
  * Returns: a new DMAPRecord as read from path.
  */
-DMAPRecord *dmap_record_factory_create (DMAPRecordFactory *factory, const char *path);
+DMAPRecord *dmap_record_factory_create (DMAPRecordFactory *factory, gpointer user_data);
 
 #endif /* __DMAP_RECORD_FACTORY_H */
 
diff --git a/libdmapsharing/dpap-connection.c b/libdmapsharing/dpap-connection.c
index b41c94c..e39d1e2 100644
--- a/libdmapsharing/dpap-connection.c
+++ b/libdmapsharing/dpap-connection.c
@@ -59,24 +59,19 @@ DPAPConnection *
 dpap_connection_new (const gchar *name,
                      const gchar *host,
                      gint         port,
-                     const gchar *password,
+                     gboolean     password_protected,
 		     DMAPDb      *db,
 		     DMAPRecordFactory *factory)
 {
-    DPAPConnection *self = DPAP_CONNECTION (g_object_new (TYPE_DPAP_CONNECTION,
+    return DPAP_CONNECTION (g_object_new (TYPE_DPAP_CONNECTION,
             "name", name,
             "host", host,
             "port", port,
+	    "password-protected", password_protected,
             "db",   db,
 	    "factory", factory,
             "need-revision-number", FALSE,
             NULL));
-
-    if (password) {
-        g_object_set (self, "password", password, NULL);
-    }
-
-    return self;
 }
 
 static SoupMessage *
diff --git a/libdmapsharing/dpap-connection.h b/libdmapsharing/dpap-connection.h
index b86019c..d4f3567 100644
--- a/libdmapsharing/dpap-connection.h
+++ b/libdmapsharing/dpap-connection.h
@@ -93,7 +93,7 @@ GType           dpap_connection_get_type (void);
 DPAPConnection *dpap_connection_new      (const gchar *name,
                                           const gchar *host,
                                           gint         port,
-                                          const gchar *password,
+                                          gboolean     password_protected,
 					  DMAPDb      *db,
 				          DMAPRecordFactory *factory);
 
diff --git a/libdmapsharing/dpap-share.c b/libdmapsharing/dpap-share.c
index 310881a..548db2c 100644
--- a/libdmapsharing/dpap-share.c
+++ b/libdmapsharing/dpap-share.c
@@ -679,7 +679,7 @@ dpap_share_databases (DMAPShare *share,
 		dmap_structure_add (mlit, DMAP_CC_MIMC, dmap_db_count (DPAP_SHARE (share)->priv->db));
 		dmap_structure_add (mlit, DMAP_CC_ABPL, (gchar) 1); /* base album (AKA playlist) */
 
-		dmap_container_db_foreach (DPAP_SHARE (share)->priv->container_db, _dmap_share_add_playlist_to_mlcl, (gpointer) mlcl);
+		dmap_container_db_foreach (DPAP_SHARE (share)->priv->container_db, (GHFunc) _dmap_share_add_playlist_to_mlcl, (gpointer) mlcl);
 
 		_dmap_share_message_set_from_dmap_structure (share, message, aply);
 		dmap_structure_destroy (aply);
@@ -715,7 +715,7 @@ dpap_share_databases (DMAPShare *share,
 			dmap_structure_add (apso, DMAP_CC_MRCO, (gint32) num_songs);
 			mb.mlcl = dmap_structure_add (apso, DMAP_CC_MLCL);
 
-			dmap_db_foreach (DPAP_SHARE (share)->priv->db, add_entry_to_mlcl, &mb);
+			dmap_db_foreach (DPAP_SHARE (share)->priv->db, (GHFunc) add_entry_to_mlcl, &mb);
 		} else {
 			DMAPContainerRecord *record;
                         const DMAPDb *entries;
@@ -729,7 +729,7 @@ dpap_share_databases (DMAPShare *share,
                         dmap_structure_add (apso, DMAP_CC_MRCO, (gint32) num_songs);
                         mb.mlcl = dmap_structure_add (apso, DMAP_CC_MLCL);
 
-			dmap_db_foreach (entries, add_entry_to_mlcl, (gpointer) &mb);
+			dmap_db_foreach (entries, (GHFunc) add_entry_to_mlcl, (gpointer) &mb);
 
 			g_object_unref (record);
 		}
diff --git a/tests/test-daap-record-factory.c b/tests/test-daap-record-factory.c
index 69d25e0..ff00cf6 100644
--- a/tests/test-daap-record-factory.c
+++ b/tests/test-daap-record-factory.c
@@ -22,7 +22,7 @@
 #include "test-daap-record.h"
 
 DMAPRecord *
-test_daap_record_factory_create  (DMAPRecordFactory *factory, const char *path)
+test_daap_record_factory_create  (DMAPRecordFactory *factory, gpointer user_data)
 {
 	return DMAP_RECORD (test_daap_record_new ());
 }
diff --git a/tests/test-daap-record-factory.h b/tests/test-daap-record-factory.h
index 28d0492..bda4e61 100644
--- a/tests/test-daap-record-factory.h
+++ b/tests/test-daap-record-factory.h
@@ -51,7 +51,7 @@ GType                  test_daap_record_factory_get_type (void);
 
 TestDAAPRecordFactory *test_daap_record_factory_new      (void);
 
-DMAPRecord            *test_daap_record_factory_create   (DMAPRecordFactory *factory, const char *path);
+DMAPRecord            *test_daap_record_factory_create   (DMAPRecordFactory *factory, gpointer user_data);
 
 #endif /* __TEST_DAAP_RECORD_FACTORY */
 
diff --git a/tests/test-dmap-client.c b/tests/test-dmap-client.c
index 243f20b..3b86fc2 100644
--- a/tests/test-dmap-client.c
+++ b/tests/test-dmap-client.c
@@ -35,17 +35,6 @@ enum {
 static GMainLoop *loop;
 static guint conn_type = DAAP;
 
-/*
-static gboolean
-disconnect_cb (DMAPConnection *conn)
-{
-    dmap_connection_disconnect (conn);
-    g_object_unref (conn);
-    g_main_loop_quit (loop);
-    return FALSE;
-}
-*/
-
 static void
 print_record (gpointer id, DMAPRecord *record, gpointer user_data)
 {
@@ -67,7 +56,7 @@ connected_cb (DMAPConnection *connection,
 {
 	g_print ("Connection cb., DB has %lu entries\n", dmap_db_count (db));
 
-	dmap_db_foreach (db, print_record, NULL);
+	dmap_db_foreach (db, (GHFunc) print_record, NULL);
 
 	g_main_loop_quit (loop);
 }
diff --git a/tests/test-dmap-container-db.c b/tests/test-dmap-container-db.c
index 18da9fa..daaf48f 100644
--- a/tests/test-dmap-container-db.c
+++ b/tests/test-dmap-container-db.c
@@ -35,12 +35,11 @@ test_dmap_container_db_lookup_by_id (DMAPContainerDb *db, gint id)
 
 static void
 test_dmap_container_db_foreach (DMAPContainerDb *db,
-				   void (*fn) (DMAPContainerRecord *record,
-					       gpointer data),
-				   gpointer data)
+				GHFunc func,
+				gpointer data)
 {
-	/* In reality, pull each record from the db and execute fn on it. */
-        fn (record, data);
+	/* In reality, pull each record from the db and execute func on it. */
+        func (record, data, NULL);
 }
 
 static gint64
diff --git a/tests/test-dmap-db.c b/tests/test-dmap-db.c
index 8bf1711..a4f9f10 100644
--- a/tests/test-dmap-db.c
+++ b/tests/test-dmap-db.c
@@ -38,12 +38,10 @@ test_dmap_db_lookup_by_id (DMAPDb *db, guint id)
 
 static void
 test_dmap_db_foreach	     (const DMAPDb *db,
-			      void (*fn) (gpointer id,
-			      		  DMAPRecord *record,
-					  gpointer data),
+			      GHFunc func,
 			      gpointer data)
 {
-	g_hash_table_foreach (TEST_DMAP_DB (db)->priv->db, (GHFunc) fn, data);
+	g_hash_table_foreach (TEST_DMAP_DB (db)->priv->db, (GHFunc) func, data);
 }
 
 static gint64
diff --git a/tests/test-dpap-record-factory.c b/tests/test-dpap-record-factory.c
index 5ed712e..c2daeb0 100644
--- a/tests/test-dpap-record-factory.c
+++ b/tests/test-dpap-record-factory.c
@@ -22,7 +22,7 @@
 #include "test-dpap-record.h"
 
 DMAPRecord *
-test_dpap_record_factory_create  (DMAPRecordFactory *factory, const char *path)
+test_dpap_record_factory_create  (DMAPRecordFactory *factory, gpointer user_data)
 {
 	return DMAP_RECORD (test_dpap_record_new ());
 }
diff --git a/tests/test-dpap-record-factory.h b/tests/test-dpap-record-factory.h
index 3105017..23ee667 100644
--- a/tests/test-dpap-record-factory.h
+++ b/tests/test-dpap-record-factory.h
@@ -51,7 +51,7 @@ GType                  test_dpap_record_factory_get_type (void);
 
 TestDPAPRecordFactory *test_dpap_record_factory_new      (void);
 
-DMAPRecord            *test_dpap_record_factory_create   (DMAPRecordFactory *factory, const char *path);
+DMAPRecord            *test_dpap_record_factory_create   (DMAPRecordFactory *factory, gpointer user_data);
 
 #endif /* __TEST_DPAP_RECORD_FACTORY */
 



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