? backends
? foo.sh
? rb-770-test.m3u
? metadata/rhythmbox-metadata
? metadata/test-metadata
? shell/rb-playlist-manager-glue.h
? sources/rb-iaudio-source.c
? sources/rb-iaudio-source.h
? sources/rb-nokia770-support.patch
Index: shell/rb-removable-media-manager.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-removable-media-manager.c,v
retrieving revision 1.19
diff -u -u -r1.19 rb-removable-media-manager.c
--- shell/rb-removable-media-manager.c	4 Mar 2006 22:37:39 -0000	1.19
+++ shell/rb-removable-media-manager.c	5 Mar 2006 03:40:50 -0000
@@ -35,6 +35,7 @@
 #include "rb-psp-source.h"
 #ifdef HAVE_HAL
 #include "rb-nokia770-source.h"
+#include "rb-iaudio-source.h"
 #endif
 #ifdef WITH_IPOD_SUPPORT
 #include "rb-ipod-source.h"
@@ -596,6 +597,8 @@
 #ifdef HAVE_HAL
 	if (source == NULL && rb_nokia770_is_volume_player (volume))
 		source = rb_nokia770_source_new (shell, volume);
+	if (source == NULL && rb_iaudio_is_volume_player (volume))
+		source = rb_iaudio_source_new (shell, volume);
 #endif
 	if (source == NULL && rb_generic_player_is_volume_player (volume))
 		source = rb_generic_player_source_new (shell, volume);
Index: sources/Makefile.am
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/Makefile.am,v
retrieving revision 1.36
diff -u -u -r1.36 Makefile.am
--- sources/Makefile.am	2 Mar 2006 18:31:41 -0000	1.36
+++ sources/Makefile.am	5 Mar 2006 03:40:50 -0000
@@ -78,7 +78,9 @@
 
 hal_files =				\
 	rb-nokia770-source.c		\
-	rb-nokia770-source.h
+	rb-nokia770-source.h		\
+	rb-iaudio-source.c		\
+	rb-iaudio-source.h
 
 if HAVE_HAL
 libsourcesimpl_la_SOURCES += $(hal_files)
--- /dev/null	2006-03-02 01:39:51.000000000 +1100
+++ sources/rb-iaudio-source.c	2006-03-05 14:38:25.000000000 +1100
@@ -0,0 +1,253 @@
+/*
+ *  arch-tag: Implementation of iAudio source object
+ *
+ *  Copyright (C) 2006 James Livingston  <jrl@ids.org.au>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include <config.h>
+
+#include <gtk/gtktreeview.h>
+#include <string.h>
+#include "rhythmdb.h"
+#include <libgnome/gnome-i18n.h>
+#include <libgnomevfs/gnome-vfs-volume.h>
+#include <libgnomevfs/gnome-vfs-volume-monitor.h>
+#include <libhal.h>
+#include <dbus/dbus.h>
+
+#include "eel-gconf-extensions.h"
+#include "rb-iaudio-source.h"
+#include "rb-debug.h"
+#include "rb-util.h"
+#include "rb-file-helpers.h"
+#include "rhythmdb.h"
+
+
+static char * impl_transform_playlist_uri (RBGenericPlayerSource *source, const char *uri);
+
+
+typedef struct {
+} RBiAudioSourcePrivate;
+
+G_DEFINE_TYPE (RBiAudioSource, rb_iaudio_source, RB_TYPE_GENERIC_PLAYER_SOURCE)
+#define IAUDIO_SOURCE_GET_PRIVATE(o)   (G_TYPE_INSTANCE_GET_PRIVATE ((o), RB_TYPE_IAUDIO_SOURCE, RBiAudioSourcePrivate))
+
+
+static void
+rb_iaudio_source_class_init (RBiAudioSourceClass *klass)
+{
+	RBGenericPlayerSourceClass *generic_class = RB_GENERIC_PLAYER_SOURCE_CLASS (klass);
+
+	generic_class->impl_transform_playlist_uri = impl_transform_playlist_uri;
+
+	g_type_class_add_private (klass, sizeof (RBiAudioSourcePrivate));
+}
+
+static void
+rb_iaudio_source_init (RBiAudioSource *source)
+{
+
+}
+
+RBRemovableMediaSource *
+rb_iaudio_source_new (RBShell *shell, GnomeVFSVolume *volume)
+{
+	RBiAudioSource *source;
+	RhythmDBEntryType entry_type;
+
+	g_assert (rb_iaudio_is_volume_player (volume));
+
+	entry_type =  rhythmdb_entry_register_type ();
+
+	source = RB_IAUDIO_SOURCE (g_object_new (RB_TYPE_IAUDIO_SOURCE,
+					  "entry-type", entry_type,
+					  "volume", volume,
+					  "shell", shell,
+					  NULL));
+
+	rb_shell_register_entry_type_for_source (shell, RB_SOURCE (source), entry_type);
+
+	return RB_REMOVABLE_MEDIA_SOURCE (source);
+}
+
+static char *
+impl_transform_playlist_uri (RBGenericPlayerSource *source, const char *uri)
+{
+	char *local_uri;
+
+	local_uri = rb_uri_append_uri (rb_generic_player_source_get_mount_path (source), uri);
+	return local_uri;
+}
+
+
+#ifdef HAVE_HAL_0_5
+
+static gboolean
+hal_udi_is_iaudio (const char *udi)
+{
+	LibHalContext *ctx;
+	DBusConnection *conn;
+	char *parent_udi = NULL, *str = NULL;
+	gboolean result;
+	DBusError error;
+
+	result = FALSE;
+	dbus_error_init (&error);
+	
+	conn = NULL;
+	ctx = libhal_ctx_new ();
+	if (ctx == NULL) {
+		rb_debug ("cannot connect to HAL");
+		goto end;
+	}
+	conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
+	if (conn == NULL || dbus_error_is_set (&error))
+		goto end;
+
+	libhal_ctx_set_dbus_connection (ctx, conn);
+	if (!libhal_ctx_init (ctx, &error) || dbus_error_is_set (&error))
+		goto end;
+
+	parent_udi = libhal_device_get_property_string (ctx, udi,
+			"info.parent", &error);
+	rb_debug ("detection: info.parent=%s", parent_udi);
+	if (parent_udi == NULL || dbus_error_is_set (&error))
+		goto end;
+
+	str = libhal_device_get_property_string (ctx, parent_udi,
+			"storage.physical_device", &error);
+	g_free (parent_udi);
+	rb_debug ("detection: storage.physical_device=%s", str);
+	if (str == NULL || dbus_error_is_set (&error))
+		goto end;
+
+	parent_udi = libhal_device_get_property_string (ctx, str,
+			"info.parent", &error);
+	g_free (str);
+	if (parent_udi == NULL || dbus_error_is_set (&error))
+		goto end;
+	rb_debug ("detection: info.parent=%s", parent_udi);
+
+	str = libhal_device_get_property_string (ctx, parent_udi,
+			"info.vendor", &error);
+	rb_debug ("detection: info.vendor=%s", str);
+	if (str == NULL || dbus_error_is_set (&error))
+		goto end;
+
+	if (strcmp (str, "Cowon Systems, Inc.") == 0) {
+		g_free (str);
+
+		str = libhal_device_get_property_string (ctx, parent_udi,
+			"info.product", &error);
+		rb_debug ("detection: info.product=%s", str);
+		if (str == NULL || dbus_error_is_set (&error))
+			goto end;
+
+		if (strcmp (str, "iAUDIO M5") == 0) {
+			result = TRUE;
+		}
+	}
+	
+	g_free (str);
+	g_free (parent_udi);
+end:
+	if (dbus_error_is_set (&error)) {
+		rb_debug ("Error: %s\n", error.message);
+		dbus_error_free (&error);
+		dbus_error_init (&error);
+	}
+
+	if (ctx) {
+		libhal_ctx_shutdown (ctx, &error);
+		libhal_ctx_free(ctx);
+	}
+
+	dbus_error_free (&error);
+
+	return result;
+}
+
+#elif HAVE_HAL_0_2
+
+static gboolean
+hal_udi_is_iaudio (const char *udi)
+{
+	LibHalContext *ctx;
+	char *parent_udi = NULL, *str = NULL;
+	gboolean result;
+
+	result = FALSE;
+	ctx = hal_initialize (NULL, FALSE);
+	if (ctx == NULL) {
+		return FALSE;
+	}
+	parent_udi = hal_device_get_property_string (ctx, udi, "info.parent");
+	if (parent_udi == NULL)
+		goto error;
+	str = hal_device_get_property_string (ctx, parent_udi, "storage.physical_device");
+	if (str == NULL)
+		goto error;
+	g_free (parent_udi);
+	parent_udi = hal_device_get_property_string (ctx, str, "info.parent");
+	if (parent_udi == NULL)
+		goto error;
+	g_free (str);
+	str = hal_device_get_property_string (ctx, parent_udi, "info.vendor");
+
+	if (str != NULL && strcmp (str, "Cowon Systems, Inc.") == 0) {
+		g_free (str);
+		str = hal_device_get_property_string (ctx, parent_udi,
+				"info.product");
+		if (str != NULL && strcmp (str, "iAUDIO M5") == 0) {
+			result = TRUE;
+		}
+	}
+
+error:
+	g_free (str);
+	g_free (parent_udi);
+
+	hal_shutdown (ctx);
+
+	return result;
+}
+
+#endif
+
+gboolean
+rb_iaudio_is_volume_player (GnomeVFSVolume *volume)
+{
+	gboolean result = FALSE;
+	gchar *str;
+
+	if (gnome_vfs_volume_get_volume_type (volume) != GNOME_VFS_VOLUME_TYPE_MOUNTPOINT) {
+		return FALSE;
+	}
+
+	str = gnome_vfs_volume_get_hal_udi (volume);
+	if (str != NULL) {
+		gboolean result;
+
+		result = hal_udi_is_iaudio (str);
+		g_free (str);
+		return result;
+	}
+
+	return result;
+}
+
--- /dev/null	2006-03-02 01:39:51.000000000 +1100
+++ sources/rb-iaudio-source.h	2006-03-05 14:11:00.000000000 +1100
@@ -0,0 +1,55 @@
+/*
+ *  arch-tag: Header for iAudio source object
+ *
+ *  Copyright (C) 2006 James Livingston  <jrl@ids.org.au>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef __RB_IAUDIO_SOURCE_H
+#define __RB_IAUDIO_SOURCE_H
+
+#include "rb-shell.h"
+#include "rb-generic-player-source.h"
+#include "rhythmdb.h"
+
+G_BEGIN_DECLS
+
+#define RB_TYPE_IAUDIO_SOURCE         (rb_iaudio_source_get_type ())
+#define RB_IAUDIO_SOURCE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_IAUDIO_SOURCE, RBiAudioSource))
+#define RB_IAUDIO_SOURCE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_IAUDIO_SOURCE, RBiAudioSourceClass))
+#define RB_IS_IAUDIO_SOURCE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_IAUDIO_SOURCE))
+#define RB_IS_IAUDIO_SOURCE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_IAUDIO_SOURCE))
+#define RB_IAUDIO_SOURCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_IAUDIO_SOURCE, RBiAudioSourceClass))
+
+typedef struct
+{
+	RBGenericPlayerSource parent;
+} RBiAudioSource;
+
+typedef struct
+{
+	RBGenericPlayerSourceClass parent;
+} RBiAudioSourceClass;
+
+RBRemovableMediaSource *	rb_iaudio_source_new		(RBShell *shell, GnomeVFSVolume *volume);
+GType				rb_iaudio_source_get_type	(void);
+
+gboolean			rb_iaudio_is_volume_player	(GnomeVFSVolume *volume);
+
+G_END_DECLS
+
+#endif /* __RB_IAUDIO_SOURCE_H */
