gtk+ r20424 - in trunk: . gtk



Author: ebassi
Date: Tue Jun 17 13:42:53 2008
New Revision: 20424
URL: http://svn.gnome.org/viewvc/gtk+?rev=20424&view=rev

Log:
2008-06-17  Emmanuele Bassi  <ebassi gnome org>

	* gtk/gtkrecentmanager.c:
	(gtk_recent_manager_remove_item),
	(gtk_recent_manager_move_item): Increase the consistency of the
	errors returned by GtkRecentManager. (Paolo Borelli)

Modified:
   trunk/ChangeLog
   trunk/gtk/gtkrecentmanager.c

Modified: trunk/gtk/gtkrecentmanager.c
==============================================================================
--- trunk/gtk/gtkrecentmanager.c	(original)
+++ trunk/gtk/gtkrecentmanager.c	Tue Jun 17 13:42:53 2008
@@ -1007,9 +1007,9 @@
       priv->recent_items = g_bookmark_file_new ();
       priv->size = 0;
 
-      g_set_error (error, G_BOOKMARK_FILE_ERROR,
-		   G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND,
-		   _("No bookmark found for URI '%s'"),
+      g_set_error (error, GTK_RECENT_MANAGER_ERROR,
+		   GTK_RECENT_MANAGER_ERROR_NOT_FOUND,
+		   _("Unable to find an item with URI '%s'"),
 		   uri);
 
       return FALSE;
@@ -1018,7 +1018,12 @@
   g_bookmark_file_remove_item (priv->recent_items, uri, &remove_error);
   if (remove_error)
     {
-      g_propagate_error (error, remove_error);
+      g_error_free (error);
+
+      g_set_error (error, GTK_RECENT_MANAGER_ERROR,
+		   GTK_RECENT_MANAGER_ERROR_NOT_FOUND,
+		   _("Unable to find an item with URI '%s'"),
+		   uri);
       
       return FALSE;
     }
@@ -1214,6 +1219,15 @@
   
   priv = recent_manager->priv;
 
+  if (!priv->recent_items)
+    {
+      g_set_error (error, GTK_RECENT_MANAGER_ERROR,
+      		   GTK_RECENT_MANAGER_ERROR_NOT_FOUND,
+      		   _("Unable to find an item with URI '%s'"),
+      		   uri);
+      return FALSE;
+    }
+
   if (!g_bookmark_file_has_item (priv->recent_items, uri))
     {
       g_set_error (error, GTK_RECENT_MANAGER_ERROR,
@@ -1229,7 +1243,12 @@
                                    &move_error);
   if (move_error)
     {
-      g_propagate_error (error, move_error);
+      g_error_free (move_error);
+
+      g_set_error (error, GTK_RECENT_MANAGER_ERROR,
+      		   GTK_RECENT_MANAGER_ERROR_NOT_FOUND,
+      		   _("Unable to find an item with URI '%s'"),
+      		   uri);
       return FALSE;
     }
   



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