gnome-control-center r8736 - trunk/capplets/appearance



Author: ssp
Date: Sat May 31 06:07:40 2008
New Revision: 8736
URL: http://svn.gnome.org/viewvc/gnome-control-center?rev=8736&view=rev

Log:
Sat May 31 02:05:32 2008  SÃren Sandmann  <sandmann redhat com>

	* appearance-desktop.c (wp_drag_get_data): Make sure the data we
	produce is actually a list of uris, not a list of paths. (Prevents
	crash when someone drags a thumbnail back into the list).
	
	* appearance-desktop.c (wp_add_image): Be robust against NULL
	filenames; this can happen if someone drops an http url on the
	dialog.



Modified:
   trunk/capplets/appearance/ChangeLog
   trunk/capplets/appearance/appearance-desktop.c

Modified: trunk/capplets/appearance/appearance-desktop.c
==============================================================================
--- trunk/capplets/appearance/appearance-desktop.c	(original)
+++ trunk/capplets/appearance/appearance-desktop.c	Sat May 31 06:07:40 2008
@@ -177,6 +177,9 @@
 {
   GnomeWPItem *item;
 
+  if (!filename)
+    return NULL;
+  
   item = g_hash_table_lookup (data->wp_hash, filename);
 
   if (item != NULL)
@@ -422,7 +425,8 @@
     if (item == NULL)
       item = wp_add_image (data, uri);
 
-    select_item (data, item, TRUE);
+    if (item)
+      select_item (data, item, TRUE);
   }
 }
 
@@ -684,8 +688,14 @@
     GnomeWPItem *item = get_selected_item (data, NULL);
 
     if (item != NULL) {
-      gchar *uris[] = { item->filename, NULL };
+      char *uris[2];
+
+      uris[0] = g_filename_to_uri (item->filename, NULL, NULL);
+      uris[1] = NULL;
+    
       gtk_selection_data_set_uris (selection_data, uris);
+
+      g_free (uris[0]);
     }
   }
 }
@@ -858,7 +868,8 @@
   else if (strcmp (style, "none") != 0)
   {
     item = wp_add_image (data, imagepath);
-    select_item (data, item, FALSE);
+    if (item)
+      select_item (data, item, FALSE);
   }
 
   item = g_hash_table_lookup (data->wp_hash, "(none)");



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