rhythmbox r5999 - in trunk: . sources



Author: teuf
Date: Sun Oct 26 19:49:58 2008
New Revision: 5999
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=5999&view=rev

Log:
Add RbRemovableMediaSource::should_paste as part of a fix for bug #411634

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

Modified: trunk/sources/rb-removable-media-source.c
==============================================================================
--- trunk/sources/rb-removable-media-source.c	(original)
+++ trunk/sources/rb-removable-media-source.c	Sun Oct 26 19:49:58 2008
@@ -68,6 +68,8 @@
 static void impl_paste (RBSource *source, GList *entries);
 #endif
 static gboolean impl_receive_drag (RBSource *asource, GtkSelectionData *data);
+static gboolean impl_should_paste (RBRemovableMediaSource *source,
+				   RhythmDBEntry *entry);
 static guint impl_want_uri (RBSource *source, const char *uri);
 static gboolean impl_uri_is_source (RBSource *source, const char *uri);
 
@@ -118,6 +120,8 @@
 	browser_source_class->impl_get_paned_key = NULL;
 	browser_source_class->impl_has_drop_support = (RBBrowserSourceFeatureFunc) rb_false_function;
 
+	klass->impl_should_paste = impl_should_paste;
+
 	g_object_class_install_property (object_class,
 					 PROP_VOLUME,
 					 g_param_spec_object ("volume",
@@ -363,7 +367,7 @@
 		entry_type = rhythmdb_entry_get_entry_type (entry);
 
 		if (entry_type == our_entry_type ||
-		    entry_type->category != RHYTHMDB_ENTRY_NORMAL) {
+		    !rb_removable_media_source_should_paste (RB_REMOVABLE_MEDIA_SOURCE (source), entry)) {
 			goto impl_paste_end;
 		}
 
@@ -634,6 +638,24 @@
 		return NULL;
 }
 
+static gboolean
+impl_should_paste (RBRemovableMediaSource *source, RhythmDBEntry *entry)
+{
+	RhythmDBEntryType entry_type = rhythmdb_entry_get_entry_type (entry);
+	gboolean should_paste = (entry_type->category == RHYTHMDB_ENTRY_NORMAL);
+	g_boxed_free (RHYTHMDB_TYPE_ENTRY_TYPE, entry_type);
+	return should_paste;
+}
+
+gboolean
+rb_removable_media_source_should_paste (RBRemovableMediaSource *source,
+					RhythmDBEntry *entry)
+{
+	RBRemovableMediaSourceClass *klass = RB_REMOVABLE_MEDIA_SOURCE_GET_CLASS (source);
+
+	return klass->impl_should_paste (source, entry);
+}
+
 void
 rb_removable_media_source_track_added (RBRemovableMediaSource *source,
 				       RhythmDBEntry *entry,

Modified: trunk/sources/rb-removable-media-source.h
==============================================================================
--- trunk/sources/rb-removable-media-source.h	(original)
+++ trunk/sources/rb-removable-media-source.h	Sun Oct 26 19:49:58 2008
@@ -62,8 +62,13 @@
 						 const char *uri,
 						 guint64 filesize,
 						 const char *mimetype);
+	gboolean	(*impl_should_paste)	(RBRemovableMediaSource *source,
+						 RhythmDBEntry *entry);
 } RBRemovableMediaSourceClass;
 
+typedef gboolean	(*RBRemovableMediaSourceShouldPasteFunc) (RBRemovableMediaSource *source,
+								  RhythmDBEntry *entry);
+
 GType			rb_removable_media_source_get_type	(void);
 
 char*		rb_removable_media_source_build_dest_uri 	(RBRemovableMediaSource *source,
@@ -76,6 +81,8 @@
 								 guint64 filesize,
 								 const char *mimetype);
 GList *		rb_removable_media_source_get_mime_types	(RBRemovableMediaSource *source);
+gboolean	rb_removable_media_source_should_paste		(RBRemovableMediaSource *source,
+								 RhythmDBEntry *entry);
 
 G_END_DECLS
 



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