summaryrefslogtreecommitdiff
path: root/gtk/gtkrecentmanager.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2008-06-17 13:42:53 +0000
committerEmmanuele Bassi <ebassi@src.gnome.org>2008-06-17 13:42:53 +0000
commit8bab0d7d03c56b0261b48e52697469a5a14c2e34 (patch)
tree389f395e421420ea480894bf50f5a36f901a0284 /gtk/gtkrecentmanager.c
parent72a9cc895a78f22538db31cbac7c1013e0931922 (diff)
downloadgtk+-8bab0d7d03c56b0261b48e52697469a5a14c2e34.tar.gz
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
Diffstat (limited to 'gtk/gtkrecentmanager.c')
-rw-r--r--gtk/gtkrecentmanager.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/gtk/gtkrecentmanager.c b/gtk/gtkrecentmanager.c
index 02497225a4..48796285f1 100644
--- a/gtk/gtkrecentmanager.c
+++ b/gtk/gtkrecentmanager.c
@@ -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;
}