totem r5138 - in trunk: . src



Author: pwithnall
Date: Sun Feb 17 11:15:08 2008
New Revision: 5138
URL: http://svn.gnome.org/viewvc/totem?rev=5138&view=rev

Log:
2008-02-17  Philip Withnall  <pwithnall svn gnome org>

	* src/totem-playlist.c: (drop_cb):
	* src/totem.c: (totem_action_drop_files): Use
	g_uri_list_extract_uris instead of gnome_vfs_uri_list_parse
	for drop targets. (Closes: #512600)



Modified:
   trunk/ChangeLog
   trunk/src/totem-playlist.c
   trunk/src/totem.c

Modified: trunk/src/totem-playlist.c
==============================================================================
--- trunk/src/totem-playlist.c	(original)
+++ trunk/src/totem-playlist.c	Sun Feb 17 11:15:08 2008
@@ -374,29 +374,20 @@
 	 guint             time, 
 	 TotemPlaylist    *playlist)
 {
-	GList *list, *p, *file_list;
-
-	list = gnome_vfs_uri_list_parse ((char *)data->data);
-
-	if (list == NULL) {
-		gtk_drag_finish (context, FALSE, FALSE, time);
-		return;
-	}
+	char **list;
+	GList *p, *file_list;
+	guint i;
 
-	p = list;
+	list = g_uri_list_extract_uris ((char *)data->data);
 	file_list = NULL;
 
-	while (p != NULL) {
+	for (i = 0; list[i] != NULL; i++) {
 		/* We get the list in the wrong order here,
 		 * so when we insert the files at the same position
 		 * in the tree, they are in the right order.*/
-		file_list = g_list_prepend (file_list,
-					    gnome_vfs_uri_to_string ((const GnomeVFSURI*)(p->data), 0));
-		p = p->next;
+		file_list = g_list_prepend (file_list, list[i]);
 	}
 
-	gnome_vfs_uri_list_free (list);
-
 	if (file_list == NULL) {
 		gtk_drag_finish (context, FALSE, FALSE, time);
 		return;
@@ -427,7 +418,6 @@
 		title = NULL;
 
 		if (info == 1) {
-			g_free (p->data);
 			p = p->next;
 			if (p != NULL) {
 				if (g_str_has_prefix (p->data, "file:") != FALSE)
@@ -440,9 +430,9 @@
 		totem_playlist_add_mrl (playlist, filename, title);
 
 		g_free (filename);
-		g_free (p->data);
 	}
 
+	g_strfreev (list);
 	g_list_free (file_list);
 	gtk_drag_finish (context, TRUE, FALSE, time);
 	gtk_tree_path_free (playlist->priv->tree_path);

Modified: trunk/src/totem.c
==============================================================================
--- trunk/src/totem.c	(original)
+++ trunk/src/totem.c	Sun Feb 17 11:15:08 2008
@@ -1248,26 +1248,17 @@
 totem_action_drop_files (Totem *totem, GtkSelectionData *data,
 		int drop_type, gboolean empty_pl)
 {
-	GList *list, *p, *file_list;
+	char **list;
+	guint i;
+	GList *p, *file_list;
 	gboolean cleared = FALSE;
 
-	list = gnome_vfs_uri_list_parse ((const char *)data->data);
-
-	if (list == NULL)
-		return FALSE;
-
-	p = list;
+	list = g_uri_list_extract_uris ((const char *)data->data);
 	file_list = NULL;
 
-	while (p != NULL)
-	{
-		file_list = g_list_prepend (file_list, 
-				gnome_vfs_uri_to_string
-				((const GnomeVFSURI*)(p->data), 0));
-		p = p->next;
-	}
+	for (i = 0; list[i] != NULL; ++i)
+		file_list = g_list_prepend (file_list, list[i]);
 
-	gnome_vfs_uri_list_free (list);
 	if (file_list == NULL)
 		return FALSE;
 
@@ -1305,7 +1296,6 @@
 		/* Super _NETSCAPE_URL trick */
 		if (drop_type == 1)
 		{
-			g_free (p->data);
 			p = p->next;
 			if (p != NULL) {
 				if (g_str_has_prefix (p->data, "file:") != FALSE)
@@ -1318,9 +1308,9 @@
 		totem_playlist_add_mrl (totem->playlist, filename, title);
 
 		g_free (filename);
-		g_free (p->data);
 	}
 
+	g_strfreev (list);
 	g_list_free (file_list);
 	gdk_window_set_cursor (totem->win->window, NULL);
 



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