diff options
author | Christophe Fergeau <teuf@gnome.org> | 2005-11-04 09:48:02 +0000 |
---|---|---|
committer | Christophe Fergeau <teuf@gnome.org> | 2005-11-04 09:48:02 +0000 |
commit | be7488f5b7b58f2c17db98650ec85561be83abd1 (patch) | |
tree | 3ab46585966bebfddb36ea762ff784a23d5c80c9 | |
parent | 7de31d6f7cd87c0722521b1abf2d27cff23468e6 (diff) | |
download | libgpod-tmz-be7488f5b7b58f2c17db98650ec85561be83abd1.tar.gz libgpod-tmz-be7488f5b7b58f2c17db98650ec85561be83abd1.tar.xz libgpod-tmz-be7488f5b7b58f2c17db98650ec85561be83abd1.zip |
2005-11-04 Christophe Fergeau <teuf@gnome.org>
* src/ipod-device.c: (ipod_device_new):
* src/ipod-device.h:
* src/itdb.h:
* src/itdb_itunesdb.c: (itdb_free), (itdb_parse),
(itdb_shuffle_write), (itdb_set_mountpoint): added an IpodDevice
element to Itdb_iTunesDB. This makes it possible for libgpod to know
the type (regular/nano/mini/video/...) of the iPod it's currently
dealing with (which is necessary for proper cover art support for
example)
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1139 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | src/ipod-device.c | 2 | ||||
-rw-r--r-- | src/ipod-device.h | 2 | ||||
-rw-r--r-- | src/itdb.h | 3 | ||||
-rw-r--r-- | src/itdb_itunesdb.c | 15 |
5 files changed, 27 insertions, 7 deletions
@@ -1,5 +1,17 @@ 2005-11-04 Christophe Fergeau <teuf@gnome.org> + * src/ipod-device.c: (ipod_device_new): + * src/ipod-device.h: + * src/itdb.h: + * src/itdb_itunesdb.c: (itdb_free), (itdb_parse), + (itdb_shuffle_write), (itdb_set_mountpoint): added an IpodDevice + element to Itdb_iTunesDB. This makes it possible for libgpod to know + the type (regular/nano/mini/video/...) of the iPod it's currently + dealing with (which is necessary for proper cover art support for + example) + +2005-11-04 Christophe Fergeau <teuf@gnome.org> + * src/Makefile.am: db-itunes-parser.h was missing from the source file list, this made "make dist" generate uncompilable tarballs diff --git a/src/ipod-device.c b/src/ipod-device.c index b429bfb..8971693 100644 --- a/src/ipod-device.c +++ b/src/ipod-device.c @@ -1437,7 +1437,7 @@ ipod_device_run_command(IpodDevice *device, const char *command, /* PUBLIC METHODS */ IpodDevice * -ipod_device_new(gchar *hal_volume_id) +ipod_device_new(const gchar *hal_volume_id) { IpodDevice *device = g_object_new(TYPE_IPOD_DEVICE, "hal-volume-id", hal_volume_id, NULL); diff --git a/src/ipod-device.h b/src/ipod-device.h index 68b3f2a..726ca36 100644 --- a/src/ipod-device.h +++ b/src/ipod-device.h @@ -170,7 +170,7 @@ enum { }; GType itdb_device_get_type(void); -IpodDevice *itdb_device_new(gchar *mount_point); +IpodDevice *itdb_device_new(const gchar *mount_point); gboolean itdb_device_rescan_disk(IpodDevice *device); guint itdb_device_eject(IpodDevice *device, GError **error); guint itdb_device_reboot(IpodDevice *device, GError **error_out); @@ -40,6 +40,8 @@ # include <config.h> #endif +#include "ipod-device.h" + #include <sys/types.h> #include <time.h> #include <glib.h> @@ -337,6 +339,7 @@ typedef struct GList *playlists; gchar *filename; /* filename of iTunesDB */ gchar *mountpoint; /* mountpoint of iPod (if available) */ + IpodDevice *device; gint musicdirs; /* number of /iPod_Control/Music/F.. dirs */ guint32 version; guint64 id; diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c index 5f7ae4d..f1eb953 100644 --- a/src/itdb_itunesdb.c +++ b/src/itdb_itunesdb.c @@ -845,6 +845,9 @@ void itdb_free (Itdb_iTunesDB *itdb) g_list_free (itdb->tracks); g_free (itdb->filename); g_free (itdb->mountpoint); + if (itdb->device != NULL) { + g_object_unref (G_OBJECT (itdb->device)); + } if (itdb->userdata && itdb->userdata_destroy) (*itdb->userdata_destroy) (itdb->userdata); g_free (itdb); @@ -2299,7 +2302,7 @@ Itdb_iTunesDB *itdb_parse (const gchar *mp, GError **error) itdb = itdb_parse_file (filename, error); if (itdb) { - itdb->mountpoint = g_strdup (mp); + itdb_set_mountpoint (itdb, mp); /* We don't test the return value of ipod_parse_artwork_db * since the database content will be consistent even if @@ -3824,11 +3827,9 @@ gboolean itdb_shuffle_write (Itdb_iTunesDB *itdb, if (result == TRUE) result = itdb_rename_files (mp, error); - if (result == TRUE) + if ((result == TRUE) && (mp != itdb->mountpoint)) { - gchar *mnp = g_strdup (mp); - g_free (itdb->mountpoint); - itdb->mountpoint = mnp; + itdb_set_mountpoint (itdb, mp); } /* make sure all buffers are flushed as some people tend to @@ -4083,6 +4084,10 @@ void itdb_set_mountpoint (Itdb_iTunesDB *itdb, const gchar *mp) g_free (itdb->mountpoint); itdb->mountpoint = g_strdup (mp); + if (itdb->device != NULL) { + g_object_unref (G_OBJECT (itdb->device)); + } + itdb->device = itdb_device_new (mp); itdb->musicdirs = 0; } |