Commit 8bab0d7d authored by Emmanuele Bassi's avatar Emmanuele Bassi Committed by Emmanuele Bassi

Increase the consistency of the errors returned by GtkRecentManager.

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)

svn path=/trunk/; revision=20424
parent 72a9cc89
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)
2008-06-17 Paolo Borelli <pborelli@katamail.com>
* gtk/tests/recentmanager.c: add some unit tests for GtkRecentManager.
......
......@@ -1007,9 +1007,9 @@ gtk_recent_manager_remove_item (GtkRecentManager *manager,
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 @@ gtk_recent_manager_remove_item (GtkRecentManager *manager,
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 @@ gtk_recent_manager_move_item (GtkRecentManager *recent_manager,
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 @@ gtk_recent_manager_move_item (GtkRecentManager *recent_manager,
&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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment