diff options
| author | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2006-06-01 15:45:28 +0000 |
|---|---|---|
| committer | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2006-06-01 15:45:28 +0000 |
| commit | 080dfe6ea289c9f8809a156699fc30ec00700edf (patch) | |
| tree | 357ea03987d9101f0cadb57d1906d4bebae99d36 /src/itdb_itunesdb.c | |
| parent | 1caaeade460f1e6e3226c8f0606be2f1f3b9b102 (diff) | |
| download | libgpod-080dfe6ea289c9f8809a156699fc30ec00700edf.tar.gz libgpod-080dfe6ea289c9f8809a156699fc30ec00700edf.tar.xz libgpod-080dfe6ea289c9f8809a156699fc30ec00700edf.zip | |
* src/itdb.h:
src/itdb_private.h:
moved Itdb_DB to private part.
* src/itdb.h:
src/itdb_private.h:
src/itdb_itunesdb:
New: db_get_itunesdb(), db_get_photodb()
* src/db-artwork-parser.c
src/db-artwork-writer.c
src/db-image-parser.c
src/db-image-parser.h
src/db-parse-context.c
src/db-parse-context.h
src/itdb_endianness.h
src/itdb_itunesdb.c
src/ithumb-writer.c:
Remove all direct access to Itdb_DB->db. enum
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1296 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'src/itdb_itunesdb.c')
| -rw-r--r-- | src/itdb_itunesdb.c | 87 |
1 files changed, 56 insertions, 31 deletions
diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c index b4e4ac1..2b7a39a 100644 --- a/src/itdb_itunesdb.c +++ b/src/itdb_itunesdb.c @@ -1,4 +1,4 @@ -/* Time-stamp: <2006-06-01 22:09:17 jcs> +/* Time-stamp: <2006-06-01 23:31:27 jcs> | | Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net> | Part of the gtkpod project. @@ -4799,36 +4799,6 @@ const gchar *itdb_photodb_get_mountpoint (Itdb_PhotoDB *photodb) return photodb->device->mountpoint; } -/* Retrieve a reference to the mountpoint */ -gchar *db_get_mountpoint(Itdb_DB *db) -{ - g_return_val_if_fail (db, NULL); - - switch (db->db_type) { - case DB_TYPE_ITUNES: - g_return_val_if_fail (db->db.itdb->device, NULL); - return db->db.itdb->device->mountpoint; - case DB_TYPE_PHOTO: - g_return_val_if_fail (db->db.photodb->device, NULL); - return db->db.photodb->device->mountpoint; - } - return NULL; -} - -Itdb_Device *db_get_device(Itdb_DB *db) -{ - g_return_val_if_fail (db, NULL); - - switch (db->db_type) { - case DB_TYPE_ITUNES: - return db->db.itdb->device; - case DB_TYPE_PHOTO: - return db->db.photodb->device; - } - g_return_val_if_reached (NULL); -} - - /** * itdb_musicdirs_number: * @itdb: an #Itdb_iTunesDB @@ -5543,6 +5513,61 @@ gboolean itdb_init_ipod (const gchar *mountpoint, return TRUE; } + + +/*------------------------------------------------------------------*\ + * * + * Some functions to access Itdb_DB safely * + * * +\*------------------------------------------------------------------*/ +G_GNUC_INTERNAL +Itdb_iTunesDB *db_get_itunesdb (Itdb_DB *db) +{ + g_return_val_if_fail (db, NULL); + g_return_val_if_fail (db->db_type == DB_TYPE_ITUNES, NULL); + + return db->db.itdb; +} + +G_GNUC_INTERNAL +Itdb_PhotoDB *db_get_photodb (Itdb_DB *db) +{ + g_return_val_if_fail (db, NULL); + g_return_val_if_fail (db->db_type == DB_TYPE_PHOTO, NULL); + + return db->db.photodb; +} + +G_GNUC_INTERNAL +Itdb_Device *db_get_device(Itdb_DB *db) +{ + g_return_val_if_fail (db, NULL); + + switch (db->db_type) { + case DB_TYPE_ITUNES: + g_return_val_if_fail (db_get_itunesdb(db), NULL); + return db_get_itunesdb(db)->device; + case DB_TYPE_PHOTO: + g_return_val_if_fail (db_get_photodb(db), NULL); + return db_get_photodb(db)->device; + } + g_return_val_if_reached (NULL); +} + +G_GNUC_INTERNAL +gchar *db_get_mountpoint(Itdb_DB *db) +{ + Itdb_Device *device; + g_return_val_if_fail (db, NULL); + + device = db_get_device (db); + g_return_val_if_fail (device, NULL); + + return device->mountpoint; +} + + + /*------------------------------------------------------------------*\ * * * Create iPod directory hierarchy * |
