mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-23 20:46:14 +01:00
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().
This commit is contained in:
parent
e39b793341
commit
cc37f43d1d
@ -1,3 +1,12 @@
|
||||
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
|
||||
|
@ -1,3 +1,12 @@
|
||||
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,
|
||||
|
@ -194,6 +194,13 @@ test_modify (GBookmarkFile *bookmark)
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user