rhythmbox r5883 - in trunk: . plugins/audiocd
- From: jmatthew svn gnome org
- To: svn-commits-list gnome org
- Subject: rhythmbox r5883 - in trunk: . plugins/audiocd
- Date: Fri, 5 Sep 2008 11:21:37 +0000 (UTC)
Author: jmatthew
Date: Fri Sep 5 11:21:36 2008
New Revision: 5883
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=5883&view=rev
Log:
2008-09-05 Jonathan Matthew <jonathan d14n org>
* plugins/audiocd/rb-audiocd-plugin.c: (create_source_cb),
(impl_activate):
* plugins/audiocd/rb-audiocd-source.c: (rb_audiocd_source_new),
(rb_audiocd_is_mount_audiocd):
* plugins/audiocd/rb-audiocd-source.h:
Detect audio CDs based on gio mounts rather than volumes, since we
require the volume to be mounted. Sometimes the mount hasn't finished
by the time we get the volume-added signal, so this works a bit more
reliably.
Modified:
trunk/ChangeLog
trunk/plugins/audiocd/rb-audiocd-plugin.c
trunk/plugins/audiocd/rb-audiocd-source.c
trunk/plugins/audiocd/rb-audiocd-source.h
Modified: trunk/plugins/audiocd/rb-audiocd-plugin.c
==============================================================================
--- trunk/plugins/audiocd/rb-audiocd-plugin.c (original)
+++ trunk/plugins/audiocd/rb-audiocd-plugin.c Fri Sep 5 11:21:36 2008
@@ -86,9 +86,6 @@
static void rb_audiocd_plugin_playing_uri_changed_cb (RBShellPlayer *player,
const char *uri,
RBAudioCdPlugin *plugin);
-static RBSource * create_source_cb (RBRemovableMediaManager *rmm,
- GVolume *volume,
- RBAudioCdPlugin *plugin);
RB_PLUGIN_REGISTER(RBAudioCdPlugin, rb_audiocd_plugin)
@@ -247,13 +244,19 @@
static RBSource *
create_source_cb (RBRemovableMediaManager *rmm,
- GVolume *volume,
+ GMount *mount,
RBAudioCdPlugin *plugin)
{
RBSource *source = NULL;
+ GVolume *volume = NULL;
- if (rb_audiocd_is_volume_audiocd (volume)) {
- source = RB_SOURCE (rb_audiocd_source_new (RB_PLUGIN (plugin), plugin->shell, volume));
+ if (rb_audiocd_is_mount_audiocd (mount)) {
+
+ volume = g_mount_get_volume (mount);
+ if (volume != NULL) {
+ source = RB_SOURCE (rb_audiocd_source_new (RB_PLUGIN (plugin), plugin->shell, volume));
+ g_object_unref (volume);
+ }
}
if (source != NULL) {
@@ -305,7 +308,7 @@
* plugins for more specific device types can get in first.
*/
g_signal_connect_after (rmm,
- "create-source-volume", G_CALLBACK (create_source_cb),
+ "create-source-mount", G_CALLBACK (create_source_cb),
pi);
/* only scan if we're being loaded after the initial scan has been done */
Modified: trunk/plugins/audiocd/rb-audiocd-source.c
==============================================================================
--- trunk/plugins/audiocd/rb-audiocd-source.c (original)
+++ trunk/plugins/audiocd/rb-audiocd-source.c Fri Sep 5 11:21:36 2008
@@ -176,9 +176,6 @@
char *name;
char *path;
- if (!rb_audiocd_is_volume_audiocd (volume))
- return NULL;
-
g_object_get (shell, "db", &db, NULL);
path = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
@@ -723,40 +720,30 @@
}
gboolean
-rb_audiocd_is_volume_audiocd (GVolume *volume)
+rb_audiocd_is_mount_audiocd (GMount *mount)
{
- GMount *mount;
-
- /* if it's mounted, we can check the mount root URI scheme */
- mount = g_volume_get_mount (volume);
- if (mount != NULL) {
- gboolean result = FALSE;
+ gboolean result = FALSE;
#if GLIB_CHECK_VERSION(2,17,7)
- char **types;
- guint i;
+ char **types;
+ guint i;
- types = g_mount_guess_content_type_sync (mount, FALSE, NULL, NULL);
- for (i = 0; types[i] != NULL; i++) {
- if (g_str_equal (types[i], "x-content/audio-cdda") != FALSE) {
- result = TRUE;
- break;
- }
+ types = g_mount_guess_content_type_sync (mount, FALSE, NULL, NULL);
+ for (i = 0; types[i] != NULL; i++) {
+ if (g_str_equal (types[i], "x-content/audio-cdda") != FALSE) {
+ result = TRUE;
+ break;
}
+ }
- g_strfreev (types);
+ g_strfreev (types);
#else
- GFile *file;
-
- file = g_mount_get_root (mount);
- result = g_file_has_uri_scheme (file, "cdda");
- g_object_unref (file);
+ GFile *file;
+
+ file = g_mount_get_root (mount);
+ result = g_file_has_uri_scheme (file, "cdda");
+ g_object_unref (file);
#endif /* glib 2.17.7 */
-
- g_object_unref (mount);
- return result;
- }
-
- return FALSE;
+ return result;
}
static gboolean
Modified: trunk/plugins/audiocd/rb-audiocd-source.h
==============================================================================
--- trunk/plugins/audiocd/rb-audiocd-source.h (original)
+++ trunk/plugins/audiocd/rb-audiocd-source.h Fri Sep 5 11:21:36 2008
@@ -59,7 +59,7 @@
GType rb_audiocd_source_get_type (void);
GType rb_audiocd_source_register_type (GTypeModule *module);
-gboolean rb_audiocd_is_volume_audiocd (GVolume *volume);
+gboolean rb_audiocd_is_mount_audiocd (GMount *mount);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]