Return a boolean instead of void.
authorEmmanuele Bassi <ebassi@cvs.gnome.org>
Mon, 12 Jun 2006 17:19:13 +0000 (17:19 +0000)
committerEmmanuele Bassi <ebassi@src.gnome.org>
Mon, 12 Jun 2006 17:19:13 +0000 (17:19 +0000)
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().

ChangeLog
ChangeLog.pre-2-12
glib/gbookmarkfile.c
glib/gbookmarkfile.h
tests/bookmarkfile-test.c

index e3797f9..3411734 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index e3797f9..3411734 100644 (file)
@@ -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
index 889937f..34ddb9f 100644 (file)
@@ -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;
 }
 
 /**
index 154f96c..2448e4a 100644 (file)
@@ -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,
index efb8b27..06019ca 100644 (file)
@@ -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;
 }