[rhythmbox] use libmediaplayerid to find device information when creating sources



commit ed55e746caf684361b69ccbb471894ef7c82ddd6
Author: Jonathan Matthew <jonathan d14n org>
Date:   Tue Aug 4 23:22:53 2009 +1000

    use libmediaplayerid to find device information when creating sources

 bindings/python/Makefile.am                       |    1 +
 doc/reference/Makefile.am                         |    5 +---
 lib/rb-marshal.list                               |    1 +
 plugins/audiocd/Makefile.am                       |    3 +-
 plugins/audiocd/rb-audiocd-plugin.c               |    1 +
 plugins/cd-recorder/Makefile.am                   |    2 -
 plugins/generic-player/Makefile.am                |    1 +
 plugins/generic-player/rb-generic-player-plugin.c |    2 +-
 plugins/ipod/Makefile.am                          |    3 +-
 plugins/ipod/rb-ipod-plugin.c                     |    3 +-
 plugins/mtpdevice/Makefile.am                     |    3 +-
 shell/Makefile.am                                 |    3 ++
 shell/rb-removable-media-manager.c                |   25 +++++++++++++-------
 shell/rb-removable-media-manager.h                |    3 +-
 sources/Makefile.am                               |    1 +
 15 files changed, 36 insertions(+), 21 deletions(-)
---
diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am
index ac753e2..2c0505b 100644
--- a/bindings/python/Makefile.am
+++ b/bindings/python/Makefile.am
@@ -17,6 +17,7 @@ rb_la_LIBADD = \
 rb_la_CFLAGS = \
 	-I$(top_srcdir)			\
 	-I$(top_srcdir)/lib             \
+	-I$(top_srcdir)/lib/libmediaplayerid \
 	-I$(top_srcdir)/metadata	\
 	-I$(top_srcdir)/player		\
 	-I$(top_srcdir)/rhythmdb	\
diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
index f3a8319..f8ca2c6 100644
--- a/doc/reference/Makefile.am
+++ b/doc/reference/Makefile.am
@@ -70,6 +70,7 @@ INCLUDES=\
 	-I$(top_srcdir)/metadata \
 	-I$(top_srcdir)/widgets \
 	-I$(top_srcdir)/lib \
+	-I$(top_srcdir)/lib/libmediaplayerid \
 	-I$(top_srcdir)/plugins \
 	-I$(top_srcdir)/backends \
 	$(DBUS_CFLAGS) \
@@ -87,12 +88,8 @@ GTKDOC_LIBS=\
 	$(BINDING_LIBS)					\
 	$(TOTEM_PLPARSER_LIBS)				\
 	$(HAL_LIBS)					\
-	$(LIBNAUTILUS_BURN_LIBS)			\
 	$(DBUS_LIBS)					\
 	$(SOUP_LIBS)					\
-	$(MDNS_LIBS)					\
-	$(IPOD_LIBS)					\
-	$(NOTIFY_LIBS)					\
 	$(RHYTHMBOX_LIBS)				\
 	$(MORE_GTKDOC_LIBS)
 
diff --git a/lib/rb-marshal.list b/lib/rb-marshal.list
index d5f8ca5..aa6731c 100644
--- a/lib/rb-marshal.list
+++ b/lib/rb-marshal.list
@@ -7,6 +7,7 @@ BOOLEAN:STRING,BOOLEAN
 BOOLEAN:STRING,STRING,OBJECT
 INT:VOID
 OBJECT:OBJECT
+OBJECT:OBJECT,OBJECT
 OBJECT:VOID
 STRING:STRING
 VOID:BOOLEAN,BOOLEAN
diff --git a/plugins/audiocd/Makefile.am b/plugins/audiocd/Makefile.am
index 35c97e2..3a81ca2 100644
--- a/plugins/audiocd/Makefile.am
+++ b/plugins/audiocd/Makefile.am
@@ -18,7 +18,8 @@ INCLUDES = 						\
         -DGNOMELOCALEDIR=\""$(datadir)/locale"\"        \
 	-DG_LOG_DOMAIN=\"Rhythmbox\"		 	\
 	-I$(top_srcdir) 				\
-	-I$(top_srcdir)/lib                        	\
+	-I$(top_srcdir)/lib                             \
+	-I$(top_srcdir)/lib/libmediaplayerid            \
 	-I$(top_srcdir)/metadata                       	\
 	-I$(top_srcdir)/player                       	\
 	-I$(top_srcdir)/rhythmdb                       	\
diff --git a/plugins/audiocd/rb-audiocd-plugin.c b/plugins/audiocd/rb-audiocd-plugin.c
index 1484cde..14f60f2 100644
--- a/plugins/audiocd/rb-audiocd-plugin.c
+++ b/plugins/audiocd/rb-audiocd-plugin.c
@@ -240,6 +240,7 @@ rb_audiocd_plugin_source_deleted (RBAudioCdSource *source,
 static RBSource *
 create_source_cb (RBRemovableMediaManager *rmm,
 		  GMount                  *mount,
+		  MPIDDevice              *device_info,
 		  RBAudioCdPlugin         *plugin)
 {
 	RBSource *source = NULL;
diff --git a/plugins/cd-recorder/Makefile.am b/plugins/cd-recorder/Makefile.am
index 730b1d4..81cda66 100644
--- a/plugins/cd-recorder/Makefile.am
+++ b/plugins/cd-recorder/Makefile.am
@@ -15,7 +15,6 @@ libcd_recorder_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
 libcd_recorder_la_LIBTOOLFLAGS = --tag=disable-static
 libcd_recorder_la_LIBADD = 				\
 	$(top_builddir)/shell/librhythmbox-core.la	\
-	$(HAL_LIBS)					\
 	$(LIBNAUTILUS_BURN_LIBS)			\
 	$(NULL)
 
@@ -38,7 +37,6 @@ INCLUDES = 						\
 	-DSHARE_DIR=\"$(pkgdatadir)\"                   \
 	-DDATADIR=\""$(datadir)"\"			\
 	$(RHYTHMBOX_CFLAGS)				\
-	$(HAL_CFLAGS)					\
 	$(LIBNAUTILUS_BURN_CFLAGS)			\
 	-D_XOPEN_SOURCE -D_BSD_SOURCE			\
 	$(NULL)
diff --git a/plugins/generic-player/Makefile.am b/plugins/generic-player/Makefile.am
index 574bb8f..60b1335 100644
--- a/plugins/generic-player/Makefile.am
+++ b/plugins/generic-player/Makefile.am
@@ -28,6 +28,7 @@ INCLUDES = 						\
 	-DG_LOG_DOMAIN=\"Rhythmbox\"		 	\
 	-I$(top_srcdir) 				\
 	-I$(top_srcdir)/lib                        	\
+	-I$(top_srcdir)/lib/libmediaplayerid            \
 	-I$(top_srcdir)/metadata                       	\
 	-I$(top_srcdir)/player                       	\
 	-I$(top_srcdir)/rhythmdb                       	\
diff --git a/plugins/generic-player/rb-generic-player-plugin.c b/plugins/generic-player/rb-generic-player-plugin.c
index cd7199d..83df669 100644
--- a/plugins/generic-player/rb-generic-player-plugin.c
+++ b/plugins/generic-player/rb-generic-player-plugin.c
@@ -196,7 +196,7 @@ rb_generic_player_plugin_delete_playlist (GtkAction *actino, RBGenericPlayerPlug
 }
 
 static RBSource *
-create_source_cb (RBRemovableMediaManager *rmm, GMount *mount, RBGenericPlayerPlugin *plugin)
+create_source_cb (RBRemovableMediaManager *rmm, GMount *mount, MPIDDevice *device_info, RBGenericPlayerPlugin *plugin)
 {
 	RBSource *source = NULL;
 
diff --git a/plugins/ipod/Makefile.am b/plugins/ipod/Makefile.am
index daa7997..84c0392 100644
--- a/plugins/ipod/Makefile.am
+++ b/plugins/ipod/Makefile.am
@@ -23,7 +23,8 @@ INCLUDES = 						\
         -DGNOMELOCALEDIR=\""$(datadir)/locale"\"        \
 	-DG_LOG_DOMAIN=\"Rhythmbox\"		 	\
 	-I$(top_srcdir) 				\
-	-I$(top_srcdir)/lib                        	\
+	-I$(top_srcdir)/lib                             \
+	-I$(top_srcdir)/lib/libmediaplayerid            \
 	-I$(top_srcdir)/metadata                       	\
 	-I$(top_srcdir)/player                       	\
 	-I$(top_srcdir)/rhythmdb                       	\
diff --git a/plugins/ipod/rb-ipod-plugin.c b/plugins/ipod/rb-ipod-plugin.c
index 113cdb5..1dd505c 100644
--- a/plugins/ipod/rb-ipod-plugin.c
+++ b/plugins/ipod/rb-ipod-plugin.c
@@ -84,6 +84,7 @@ static void impl_deactivate (RBPlugin *plugin, RBShell *shell);
 
 static RBSource * create_source_cb (RBRemovableMediaManager *rmm,
 				    GMount *mount,
+				    MPIDDevice *device_info,
 				    RBIpodPlugin *plugin);
 static void  rb_ipod_plugin_cmd_rename (GtkAction *action,
 					RBIpodPlugin *plugin);
@@ -229,7 +230,7 @@ rb_ipod_plugin_source_deleted (RBiPodSource *source, RBIpodPlugin *plugin)
 }
 
 static RBSource *
-create_source_cb (RBRemovableMediaManager *rmm, GMount *mount, RBIpodPlugin *plugin)
+create_source_cb (RBRemovableMediaManager *rmm, GMount *mount, MPIDDevice *device_info, RBIpodPlugin *plugin)
 {
 	RBSource *src;
 	if (!rb_ipod_helpers_is_ipod (mount)) {
diff --git a/plugins/mtpdevice/Makefile.am b/plugins/mtpdevice/Makefile.am
index a294118..599a8a6 100644
--- a/plugins/mtpdevice/Makefile.am
+++ b/plugins/mtpdevice/Makefile.am
@@ -20,8 +20,9 @@ INCLUDES = 						\
         -DGNOMELOCALEDIR=\""$(datadir)/locale"\"        \
 	-DG_LOG_DOMAIN=\"Rhythmbox\"		 	\
 	-I$(top_srcdir) 				\
-	-I$(top_srcdir)/backends				\
+	-I$(top_srcdir)/backends			\
 	-I$(top_srcdir)/lib                        	\
+	-I$(top_srcdir)/lib/libmediaplayerid          	\
 	-I$(top_srcdir)/metadata                       	\
 	-I$(top_srcdir)/player                       	\
 	-I$(top_srcdir)/rhythmdb                       	\
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 432267b..eacf157 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -31,6 +31,7 @@ INCLUDES = 						\
 	-DG_LOG_DOMAIN=\"Rhythmbox\"		 	\
 	-I$(top_srcdir) 				\
 	-I$(top_srcdir)/lib                        	\
+	-I$(top_srcdir)/lib/libmediaplayerid		\
 	-I$(top_srcdir)/metadata                       	\
 	-I$(top_srcdir)/rhythmdb                       	\
 	-I$(top_srcdir)/widgets                    	\
@@ -108,6 +109,7 @@ librhythmbox_core_la_LIBADD =				\
 	$(top_builddir)/rhythmdb/librhythmdb.la		\
 	$(top_builddir)/backends/librbbackends.la	\
 	$(top_builddir)/lib/librb.la			\
+	$(top_builddir)/lib/libmediaplayerid/libmediaplayerid.la		\
 	$(DBUS_LIBS)					\
 	$(TOTEM_PLPARSER_LIBS)				\
 	$(RHYTHMBOX_LIBS)				\
@@ -146,6 +148,7 @@ EXTRA_DIST += rb-shell.xml rb-shell-player.xml rb-playlist-manager.xml
 
 rhythmbox_LDADD = 					\
 	librhythmbox-core.la				\
+	$(TOTEM_PLPARSER_LIBS)				\
 	$(RHYTHMBOX_LIBS)				\
 	$(DBUS_LIBS)
 
diff --git a/shell/rb-removable-media-manager.c b/shell/rb-removable-media-manager.c
index 9c93602..4d24a96 100644
--- a/shell/rb-removable-media-manager.c
+++ b/shell/rb-removable-media-manager.c
@@ -271,6 +271,7 @@ rb_removable_media_manager_class_init (RBRemovableMediaManagerClass *klass)
 	/**
 	 * RBRemovableMediaManager::create-source-mount
 	 * @mgr: the #RBRemovableMediaManager
+	 * @device_info: a #MPIDDevice containing information on the device
 	 * @mount: the #GMount
 	 *
 	 * Emitted when a new mount is added to allow plugins to create a
@@ -284,9 +285,9 @@ rb_removable_media_manager_class_init (RBRemovableMediaManagerClass *klass)
 			      G_SIGNAL_RUN_LAST,
 			      G_STRUCT_OFFSET (RBRemovableMediaManagerClass, create_source_mount),
 			      rb_signal_accumulator_object_handled, NULL,
-			      rb_marshal_OBJECT__OBJECT,
+			      rb_marshal_OBJECT__OBJECT_OBJECT,
 			      RB_TYPE_SOURCE,
-			      1, G_TYPE_MOUNT);
+			      2, G_TYPE_MOUNT, MPID_TYPE_DEVICE);
 
 	g_type_class_add_private (klass, sizeof (RBRemovableMediaManagerPrivate));
 }
@@ -619,13 +620,21 @@ rb_removable_media_manager_add_mount (RBRemovableMediaManager *mgr, GMount *moun
 	}
 
 	dump_volume_identifiers (volume);
+	g_object_unref (volume);
 
-	/* might be worth trying to create a source for the volume again,
-	 * in case something wants to, but requires a mount to exist first.
-	 */
+	/* look the device up in the device info database */
+	mount_root = g_mount_get_root (mount);
+	if (mount_root == NULL) {
+		rb_debug ("unable to get mount root, can't create a source for this mount");
+		return;
+	}
+	mountpoint = g_file_get_path (mount_root);
+	g_object_unref (mount_root);
 
+	device_info = mpid_device_new (mountpoint);
+	g_free (mountpoint);
 
-	g_signal_emit (G_OBJECT (mgr), rb_removable_media_manager_signals[CREATE_SOURCE_MOUNT], 0, mount, &source);
+	g_signal_emit (G_OBJECT (mgr), rb_removable_media_manager_signals[CREATE_SOURCE_MOUNT], 0, mount, device_info, &source);
 
 	if (source) {
 		g_hash_table_insert (priv->mount_mapping, mount, source);
@@ -634,9 +643,7 @@ rb_removable_media_manager_add_mount (RBRemovableMediaManager *mgr, GMount *moun
 		rb_debug ("Unhandled media");
 	}
 
-	if (volume != NULL) {
-		g_object_unref (volume);
-	}
+	g_object_unref (device_info);
 }
 
 static void
diff --git a/shell/rb-removable-media-manager.h b/shell/rb-removable-media-manager.h
index 589d304..7303056 100644
--- a/shell/rb-removable-media-manager.h
+++ b/shell/rb-removable-media-manager.h
@@ -70,7 +70,8 @@ struct _RBRemovableMediaManagerClass
 					 gint total,
 					 double fraction);
 	RBSource * (*create_source_mount) (RBRemovableMediaManager *mgr,
-					 GMount *mount);
+					 GMount *mount,
+					 MPIDDevice *device_info);
 	RBSource * (*create_source_volume) (RBRemovableMediaManager *mgr,
 					 GVolume *volume);
 };
diff --git a/sources/Makefile.am b/sources/Makefile.am
index 9dce587..dfe6c5f 100644
--- a/sources/Makefile.am
+++ b/sources/Makefile.am
@@ -48,6 +48,7 @@ INCLUDES =						\
 	-DG_LOG_DOMAIN=\"Rhythmbox\"		 	\
 	-I$(top_srcdir) 				\
 	-I$(top_srcdir)/lib 				\
+	-I$(top_srcdir)/lib/libmediaplayerid		\
 	-I$(top_builddir)/lib 				\
 	-I$(top_srcdir)/rhythmdb			\
 	-I$(top_srcdir)/metadata 			\



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