diff options
-rw-r--r-- | src/itdb.h | 4 | ||||
-rw-r--r-- | src/itdb_photoalbum.c | 84 | ||||
-rw-r--r-- | tests/test-photos.c | 50 |
3 files changed, 0 insertions, 138 deletions
@@ -965,10 +965,6 @@ gboolean itdb_photodb_write (Itdb_PhotoDB *db, GError **error); void itdb_photodb_photoalbum_free (Itdb_PhotoAlbum *pa); gboolean itdb_photodb_remove_photo (Itdb_PhotoDB *db, const gint photo_id ); -gboolean itdb_photodb_remove_photoalbum (Itdb_PhotoDB *db, - const gchar *album_name); -gboolean itdb_photodb_rename_photoalbum (Itdb_PhotoDB *db, - const gchar *album_name, const gchar *new_album_name); /* itdb_artwork_... */ Itdb_Artwork *itdb_artwork_new (void); diff --git a/src/itdb_photoalbum.c b/src/itdb_photoalbum.c index f7d6039..003222d 100644 --- a/src/itdb_photoalbum.c +++ b/src/itdb_photoalbum.c @@ -367,90 +367,6 @@ gboolean itdb_photodb_remove_photo (Itdb_PhotoDB *db, return result; } -/** - * itdb_photodb_remove_photoalbum - * @photodb: the #Itdb_PhotoDB to apply changes to - * @album_name: the name of the photoalbum to remove from the database - * - * Return value: TRUE on success, FALSE if the album specified by @album_name could not - * be found in the database. - */ -gboolean itdb_photodb_remove_photoalbum (Itdb_PhotoDB *db, const gchar *album_name) -{ - gboolean result = TRUE; - GList *it; - - g_return_val_if_fail (db, FALSE); - g_return_val_if_fail (album_name, FALSE); - - /* Remove all the photos within that album from the library */ - for (it = db->photoalbums; it != NULL; it = it->next ) - { - Itdb_PhotoAlbum *album; - GList *it2; - - album = (Itdb_PhotoAlbum*)it->data; - g_return_val_if_fail (album, FALSE); - /* Have we found the desired album? */ - if ( strcmp (album->name, album_name) == 0 ) - { - /* iterate over the photos within that album and remove them from the database */ - for (it2 = album->members; it2 != NULL; it2 = it2->next ) - { - gint photo_id = GPOINTER_TO_INT(it2->data); - g_print (_("Deleting photo with id: %d\n"), photo_id); - result = itdb_photodb_remove_photo (db, photo_id); - if (result == FALSE) - break; - } - /* remove the album only if all members were successfully removed */ - if (result == TRUE ) - { - g_print (_("Successfuly remove album photos, removing album (%s) now.\n"), album_name ); - db->photoalbums = g_list_remove (db->photoalbums, album); - } - return result; - } - } - /* If we made it here, then there was no album by that name */ - return FALSE; -} - -/** - * itdb_photodb_rename_photoalbum: - * @album_name: The album name (in the database, @db) to be renamed - * @new_album_name: The name which @album_name will be renamed to - * - * Rename the album given by @album_name to @new_album_name - * - * Return TRUE if successful, or FALSE if the album @album_name could not be found - */ -gboolean itdb_photodb_rename_photoalbum (Itdb_PhotoDB *db, - const gchar *album_name, const gchar *new_album_name) -{ - GList *it; - - g_return_val_if_fail (db, FALSE); - g_return_val_if_fail (album_name, FALSE); - g_return_val_if_fail (new_album_name, FALSE); - - for (it = db->photoalbums; it != NULL; it = it->next ) - { - Itdb_PhotoAlbum *album; - - album = (Itdb_PhotoAlbum*)it->data; - g_return_val_if_fail (album, FALSE); - /* Have we found the desired album? */ - if (strcmp (album->name, album_name) == 0 ) - { - strcpy (album->name,new_album_name); - return TRUE; - } - } - /* Obviously the source album wasn't found */ - return FALSE; -} - Itdb_PhotoAlbum *itdb_photodb_photoalbum_new (Itdb_PhotoDB *db, const gchar *album_name) { diff --git a/tests/test-photos.c b/tests/test-photos.c index 7fae6a3..a63d51b 100644 --- a/tests/test-photos.c +++ b/tests/test-photos.c @@ -119,12 +119,6 @@ main (int argc, char **argv) g_print (_("\n")); g_print (_("Usage to dump all photos to <output_dir>:\n")); g_print (_("%s dump <mountpoint> <output_dir>\n"), argv[0]); - g_print (_("\n")); - g_print (_("Usage to delete a photo album:\n")); - g_print (_("%s delete <mountpoint> <albumname>\n"), argv[0]); - g_print (_("\n")); - g_print (_("Usage to rename a photo album:\n")); - g_print (_("%s rename <mountpoint> <albumname> <new_albumname>\n"), argv[0]); return 1; } setlocale (LC_ALL, ""); @@ -164,50 +158,6 @@ main (int argc, char **argv) dump_albums (db, argv[3]); itdb_photodb_free (db); } - else if (strcmp (argv[1], "delete") == 0) - { - db = itdb_photodb_parse (argv[2], &error); - if (db == NULL) - { - if (error) - { - g_print (_("Error reading iPod photo database.(%s)\n"), error->message); - g_error_free (error); - error = NULL; - } - else - g_print (_("Error reading iPod photo database.\n")); - - return 1; - } - itdb_photodb_remove_photoalbum( db, argv[3] ); - g_print (_("Writing to the photo database.\n")); - itdb_photodb_write (db, &error); - g_print (_("Freeing the photo database.\n")); - itdb_photodb_free (db); - } - else if (strcmp (argv[1], "rename") == 0) - { - db = itdb_photodb_parse (argv[2], &error); - if (db == NULL) - { - if (error) - { - g_print (_("Error reading iPod photo database.(%s)\n"), error->message); - g_error_free (error); - error = NULL; - } - else - g_print (_("Error reading iPod photo database.\n")); - - return 1; - } - itdb_photodb_rename_photoalbum( db, argv[3], argv[4] ); - g_print (_("Writing to the photo database.\n")); - itdb_photodb_write (db, &error); - g_print (_("Freeing the photo database.\n")); - itdb_photodb_free (db); - } else { db = itdb_photodb_parse (argv[1], &error); |