+2006-06-12 Emmanuele Bassi <ebassi@cvs.gnome.org>
+
+ * glib/gbookmarkfile.h:
+ * glib/gbookmarkfile.c (g_bookmark_file_remove_item): Return
+ a boolean instead of void.
+
+ * tests/bookmarkfile-test.c (test_modify): Add a test case
+ for g_bookmark_file_remove_item().
+
2006-06-12 Matthias Clasen <mclasen@redhat.com>
* Bump version
+2006-06-12 Emmanuele Bassi <ebassi@cvs.gnome.org>
+
+ * glib/gbookmarkfile.h:
+ * glib/gbookmarkfile.c (g_bookmark_file_remove_item): Return
+ a boolean instead of void.
+
+ * tests/bookmarkfile-test.c (test_modify): Add a test case
+ for g_bookmark_file_remove_item().
+
2006-06-12 Matthias Clasen <mclasen@redhat.com>
* Bump version
*
* Removes the bookmark for @uri from the bookmark file @bookmark.
*
+ * Return value: %TRUE if the bookmark was removed successfully.
+ *
* Since: 2.12
*/
-void
+gboolean
g_bookmark_file_remove_item (GBookmarkFile *bookmark,
const gchar *uri,
GError **error)
{
BookmarkItem *item;
- g_return_if_fail (bookmark != NULL);
- g_return_if_fail (uri != NULL);
+ g_return_val_if_fail (bookmark != NULL, FALSE);
+ g_return_val_if_fail (uri != NULL, FALSE);
item = g_bookmark_file_lookup_item (bookmark, uri);
G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND,
_("No bookmark found for URI '%s'"),
uri);
- return;
+ return FALSE;
}
bookmark->items = g_list_remove (bookmark->items, item);
g_hash_table_remove (bookmark->items_by_uri, item->uri);
bookmark_item_free (item);
+
+ return TRUE;
}
/**
const gchar *uri,
const gchar *name,
GError **error);
-void g_bookmark_file_remove_item (GBookmarkFile *bookmark,
+gboolean g_bookmark_file_remove_item (GBookmarkFile *bookmark,
const gchar *uri,
GError **error);
gboolean g_bookmark_file_move_item (GBookmarkFile *bookmark,
g_assert (g_bookmark_file_has_group (bookmark, TEST_URI_1, "Test", NULL) == TRUE);
g_assert (g_bookmark_file_has_group (bookmark, TEST_URI_1, "Fail", NULL) == FALSE);
g_print ("ok\n");
+
+ g_print ("\t=> check remove...");
+ g_assert (g_bookmark_file_remove_item (bookmark, TEST_URI_1, &error) == TRUE);
+ test_assert_empty_error (&error);
+ g_assert (g_bookmark_file_remove_item (bookmark, TEST_URI_1, &error) == FALSE);
+ test_assert_not_empty_error (&error, G_BOOKMARK_FILE_ERROR, G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND);
+ g_print ("ok\n");
return TRUE;
}