eog r4856 - in trunk: . src



Author: csaavedra
Date: Sun Oct 26 19:57:59 2008
New Revision: 4856
URL: http://svn.gnome.org/viewvc/eog?rev=4856&view=rev

Log:
2008-10-26  Claudio Saavedra  <csaavedra igalia com>

	* src/eog-thumb-view.c: (thumbview_on_drag_data_get_cb): Use
	gtk_selection_data_set_uris() to simplify the data preparation.



Modified:
   trunk/ChangeLog
   trunk/src/eog-thumb-view.c

Modified: trunk/src/eog-thumb-view.c
==============================================================================
--- trunk/src/eog-thumb-view.c	(original)
+++ trunk/src/eog-thumb-view.c	Sun Oct 26 19:57:59 2008
@@ -313,35 +313,26 @@
 	GList *node;
 	EogImage *image;
 	GFile *file;
-	gchar *str;
-	gchar *uris = NULL;
-	gchar *tmp_str;
+	gchar **uris = NULL;
+	gint i = 0, n_images;
 
 	list = eog_thumb_view_get_selected_images (EOG_THUMB_VIEW (widget));
+	n_images = eog_thumb_view_get_n_selected (EOG_THUMB_VIEW (widget));
 
-	for (node = list; node != NULL; node = node->next) {
+	uris = g_new (gchar *, n_images + 1);
+
+	for (node = list; node != NULL; node = node->next, i++) {
 		image = EOG_IMAGE (node->data);
 		file = eog_image_get_file (image);
-		str = g_file_get_uri (file);	
+		uris[i] = g_file_get_uri (file);
 		g_object_unref (image);
 		g_object_unref (file);
-		
-		/* build the "text/uri-list" string */
-		if (uris) {
-			tmp_str = g_strconcat (uris, str, "\r\n", NULL);
-			g_free (uris);
-		} else {
-			tmp_str = g_strconcat (str, "\r\n", NULL);
-		}
-		uris = tmp_str;
-
-		g_free (str);
 	}
-	gtk_selection_data_set (data, data->target, 8, 
-				(guchar*) uris, strlen (uris));
-	g_free (uris);
+	uris[i] = NULL;
+
+	gtk_selection_data_set_uris (data, uris);
+	g_strfreev (uris);
 	g_list_free (list);
-	
 }
 
 static gboolean 



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