[Rhythmbox-devel] PATCH: Cosmetic enhancement, for MTP devices



This patch solves a problem for mtp devices that do not support setting the owner name.
If the owner name is not set or hardcoded to ????? it shows the model name instead in the rhythmbox sidebar.
Attached goes an svn diff.

Regards,
Flávio Martins

Index: plugins/mtpdevice/rb-mtp-source.c
===================================================================
--- plugins/mtpdevice/rb-mtp-source.c	(revision 5356)
+++ plugins/mtpdevice/rb-mtp-source.c	(working copy)
@@ -343,15 +343,20 @@
 rb_mtp_source_load_tracks (RBMtpSource *source)
 {
 	RBMtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
+	char* ownername = NULL;
 	char* name = NULL;
 
 	if ((priv->device != NULL) && (priv->entry_map != NULL)) {
-		name = LIBMTP_Get_Friendlyname (priv->device);
+		name = LIBMTP_Get_Modelname (priv->device);
+		ownername = LIBMTP_Get_Friendlyname (priv->device);
+		if(strlen (ownername) > 0 && strcmp (ownername, "?????") != 0)
+			name = g_strdup_printf ("%s", ownername);
 		g_object_set (RB_SOURCE (source),
 			      "name", name,
 			      NULL);
 		g_idle_add ((GSourceFunc)load_mtp_db_idle_cb, source);
 	}
+	g_free (ownername);
 	g_free (name);
 }
 


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