[rhythmbox] mtp: fix error reporting after device open failure (bug #605583)



commit c72a090f760bfdbb7e5c2f6c3af7be83e4b47389
Author: Jonathan Matthew <jonathan d14n org>
Date:   Tue Dec 29 18:34:11 2009 +1000

    mtp: fix error reporting after device open failure (bug #605583)
    
    rb_mtp_thread_report_errors() won't work here, as we don't have a libmtp
    device to get an error stack from.  Instead, just display a generic
    "couldn't open device" error message, including the device manufacturer
    and product names.

 plugins/mtpdevice/rb-mtp-source.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/plugins/mtpdevice/rb-mtp-source.c b/plugins/mtpdevice/rb-mtp-source.c
index e495a6f..3a805e1 100644
--- a/plugins/mtpdevice/rb-mtp-source.c
+++ b/plugins/mtpdevice/rb-mtp-source.c
@@ -701,6 +701,18 @@ device_opened_idle (DeviceOpenedData *data)
 static gboolean
 device_open_failed_idle (RBMtpSource *source)
 {
+	/* libmtp doesn't give us a useful error message in this case, so
+	 * all we can offer is this generic message.
+	 */
+	RBMtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
+	rb_error_dialog (NULL,
+			 _("Media player device error"),
+			 /* Translators: first %s is the device manufacturer,
+			  * second is the product name.
+			  */
+			 _("Unable to open the %s %s device"),
+			 priv->raw_device.device_entry.vendor,
+			 priv->raw_device.device_entry.product);
 	rb_source_delete_thyself (RB_SOURCE (source));
 	g_object_unref (source);
 	return FALSE;
@@ -713,9 +725,7 @@ mtp_device_open_cb (LIBMTP_mtpdevice_t *device, RBMtpSource *source)
 	RBMtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
 	DeviceOpenedData *data;
 
-	if (device == NULL) {
-		rb_mtp_thread_report_errors (priv->device_thread, TRUE);
-
+	if (device != NULL) {
 		/* can't delete the source on this thread, so move it to the main thread */
 		g_idle_add ((GSourceFunc) device_open_failed_idle, g_object_ref (source));
 		return;



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