[rhythmbox] mtp: implement impl_uri_is_source



commit a16fdcb99939ef21310fad428c89e70c42b0a0a2
Author: Jonathan Matthew <jonathan d14n org>
Date:   Tue Mar 6 18:18:03 2012 +1000

    mtp: implement impl_uri_is_source

 plugins/mtpdevice/rb-mtp-source.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/plugins/mtpdevice/rb-mtp-source.c b/plugins/mtpdevice/rb-mtp-source.c
index 8fe4df1..699ca18 100644
--- a/plugins/mtpdevice/rb-mtp-source.c
+++ b/plugins/mtpdevice/rb-mtp-source.c
@@ -82,6 +82,7 @@ static void rb_mtp_source_get_property (GObject *object,
 static void impl_delete (RBSource *asource);
 static RBTrackTransferBatch *impl_paste (RBSource *asource, GList *entries);
 static gboolean impl_show_popup (RBDisplayPage *page);
+static gboolean impl_uri_is_source (RBSource *asource, const char *uri);
 
 static gboolean impl_track_added (RBTransferTarget *target,
 				  RhythmDBEntry *entry,
@@ -199,6 +200,7 @@ rb_mtp_source_class_init (RBMtpSourceClass *klass)
 	source_class->impl_can_cut = (RBSourceFeatureFunc) rb_false_function;
 	source_class->impl_delete = impl_delete;
 	source_class->impl_paste = impl_paste;
+	source_class->impl_uri_is_source = impl_uri_is_source;
 
 	mps_class->impl_get_entries = impl_get_entries;
 	mps_class->impl_get_capacity = impl_get_capacity;
@@ -1028,6 +1030,24 @@ impl_delete (RBSource *source)
 	rb_list_destroy_free (sel, (GDestroyNotify) rhythmdb_entry_unref);
 }
 
+static gboolean
+impl_uri_is_source (RBSource *source, const char *uri)
+{
+	RBMtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
+	char *source_uri;
+	gboolean result;
+
+	if (g_str_has_prefix (uri, "gphoto2://") == FALSE)
+		return FALSE;
+
+	source_uri = g_strdup_printf ("gphoto2://[usb:%03d,%03d]/", 
+				      priv->raw_device.bus_location,
+				      priv->raw_device.devnum);
+	result = g_str_has_prefix (uri, source_uri);
+	g_free (source_uri);
+	return result;
+}
+
 static RBTrackTransferBatch *
 impl_paste (RBSource *source, GList *entries)
 {



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