Commit cc37f43d authored by Emmanuele Bassi's avatar Emmanuele Bassi Committed by Emmanuele Bassi
Browse files

Return a boolean instead of void.

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().
parent e39b7933
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
......
......@@ -2016,17 +2016,19 @@ g_bookmark_file_add_item (GBookmarkFile *bookmark,
*
* 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);
......@@ -2036,13 +2038,15 @@ g_bookmark_file_remove_item (GBookmarkFile *bookmark,
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;
}
/**
......
......@@ -174,7 +174,7 @@ gboolean g_bookmark_file_remove_application (GBookmarkFile *bookmark,
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,
......
......@@ -193,6 +193,13 @@ test_modify (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;
}
......
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