rhythmbox r5846 - in trunk: . sources



Author: jmatthew
Date: Sat Aug  9 05:23:02 2008
New Revision: 5846
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=5846&view=rev

Log:
2008-08-09  Jonathan Matthew  <jonathan d14n org>

	* sources/rb-removable-media-source.c:
	(rb_removable_media_source_constructor):
	Use mount or volume details rather than drive details for removable
	source names and icons.  This should make our device details
	consistent with what nautilus displays.  Also remove an extra unref
	that was causing crashes.  Fixes #494692.


Modified:
   trunk/ChangeLog
   trunk/sources/rb-removable-media-source.c

Modified: trunk/sources/rb-removable-media-source.c
==============================================================================
--- trunk/sources/rb-removable-media-source.c	(original)
+++ trunk/sources/rb-removable-media-source.c	Sat Aug  9 05:23:02 2008
@@ -146,9 +146,8 @@
 				       GObjectConstructParam *construct_properties)
 {
 	GObject *source;
-	GVolume *volume;
+	GMount *mount;
 	GIcon *icon = NULL;
-	GDrive *drive;
 	char *display_name;
 	GdkPixbuf *pixbuf = NULL;
 	RBRemovableMediaSourcePrivate *priv;
@@ -157,25 +156,23 @@
 			->constructor (type, n_construct_properties, construct_properties);
 	priv = REMOVABLE_MEDIA_SOURCE_GET_PRIVATE (source);
 
+	/* prefer mount details to volume details, as the nautilus sidebar does */
 	if (priv->mount != NULL) {
-		volume = g_mount_get_volume (priv->mount);
+		mount = g_object_ref (priv->mount);
 	} else if (priv->volume != NULL) {
-		volume = g_object_ref (priv->volume);
+		mount = g_volume_get_mount (priv->volume);
 	} else {
-		volume = NULL;
+		mount = NULL;
 	}
 
-	if (volume != NULL) {
-		drive = g_volume_get_drive (volume);
-		if (drive != NULL) {
-			display_name = g_drive_get_name (drive);
-			g_object_unref (drive);
-		} else {
-			display_name = g_volume_get_name (volume);
-		}
-		icon = g_volume_get_icon (volume);
-		g_object_unref (volume);
-		rb_debug ("display name = %s, icon = %p", display_name, icon);
+	if (mount != NULL) {
+		display_name = g_mount_get_name (priv->mount);
+		icon = g_mount_get_icon (priv->mount);
+		rb_debug ("details from mount: display name = %s, icon = %p", display_name, icon);
+	} else if (priv->volume != NULL) {
+		display_name = g_volume_get_name (priv->volume);
+		icon = g_volume_get_icon (priv->volume);
+		rb_debug ("details from volume: display name = %s, icon = %p", display_name, icon);
 	} else {
 		display_name = g_strdup ("Unknown Device");
 		icon = g_themed_icon_new ("multimedia-player");
@@ -213,8 +210,10 @@
 	if (pixbuf != NULL) {
 		g_object_unref (pixbuf);
 	}
+	if (mount != NULL) {
+		g_object_unref (mount);
+	}
 	g_object_unref (icon);
-	g_object_unref (volume);
 
 	return source;
 }



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