From d57f8a1f517dd445bac338ef8507340d1b9a8576 Mon Sep 17 00:00:00 2001 From: Jorg Schuler Date: Sat, 12 Nov 2005 04:18:53 +0000 Subject: * src/itdb_itunesdb.c: (itdb_set_mountpoint) do not call itdb_device_new() with NULL pointer (no mountpoint == local repository) to avoid critical warning. * src/itdb.h src/itdb_itunesdb.c: change API for itdb_shuffle_write() to be identical to itdb_itunesdb_write() git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1147 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- ChangeLog | 11 +++++++++++ src/itdb.h | 5 ++--- src/itdb_itunesdb.c | 32 ++++++++++++++------------------ 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 338732f..2331933 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2005-11-11 Jorg Schuler + + * src/itdb_itunesdb.c: (itdb_set_mountpoint) do not call + itdb_device_new() with NULL pointer (no mountpoint == local + repository) to avoid critical warning. + +2005-11-09 Jorg Schuler + + * src/itdb.h src/itdb_itunesdb.c: change API for + itdb_shuffle_write() to be identical to itdb_itunesdb_write() + 2005-11-08 Christophe Fergeau * configure.ac: fixed hal detection, stole a bit more autoconf-fu from diff --git a/src/itdb.h b/src/itdb.h index b5d3bb5..d039c61 100644 --- a/src/itdb.h +++ b/src/itdb.h @@ -1,4 +1,4 @@ -/* Time-stamp: <2005-10-02 18:56:10 jcs> +/* Time-stamp: <2005-11-10 00:10:05 jcs> | | Copyright (C) 2002-2005 Jorg Schuler | Part of the gtkpod project. @@ -638,8 +638,7 @@ Itdb_iTunesDB *itdb_parse_file (const gchar *filename, GError **error); gboolean itdb_write (Itdb_iTunesDB *itdb, GError **error); gboolean itdb_write_file (Itdb_iTunesDB *itdb, const gchar *filename, GError **error); -gboolean itdb_shuffle_write (Itdb_iTunesDB *itdb, - const gchar *mp, GError **error); +gboolean itdb_shuffle_write (Itdb_iTunesDB *itdb, GError **error); gboolean itdb_shuffle_write_file (Itdb_iTunesDB *itdb, const gchar *filename, GError **error); Itdb_iTunesDB *itdb_new (void); diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c index f1eb953..fd1a95a 100644 --- a/src/itdb_itunesdb.c +++ b/src/itdb_itunesdb.c @@ -1,4 +1,4 @@ -/* Time-stamp: <2005-11-01 22:18:16 jcs> +/* Time-stamp: <2005-11-11 22:44:42 jcs> | | Copyright (C) 2002-2005 Jorg Schuler | Part of the gtkpod project. @@ -3787,27 +3787,25 @@ All integers in the iTunesSD file are in BIG endian form... Returns TRUE on success, FALSE on error, in which case @error is set accordingly. - @mp must point to the mount point of the iPod, e.g. "/mnt/ipod" and - be in local encoding. If mp==NULL, itdb->mountpoint is tried. */ + itdb->mountpoint must point to the mount point of the iPod, + e.g. "/mnt/ipod" and be in local encoding. */ -gboolean itdb_shuffle_write (Itdb_iTunesDB *itdb, - const gchar *mp, GError **error) +gboolean itdb_shuffle_write (Itdb_iTunesDB *itdb, GError **error) { gchar *itunes_filename, *itunes_path; const gchar *db[] = {"iPod_Control","iTunes",NULL}; gboolean result = FALSE; g_return_val_if_fail (itdb, FALSE); - g_return_val_if_fail (mp || itdb->mountpoint, FALSE); - - if (!mp) mp = itdb->mountpoint; + g_return_val_if_fail (itdb->mountpoint, FALSE); - itunes_path = itdb_resolve_path (mp, db); + itunes_path = itdb_resolve_path (itdb->mountpoint, db); if(!itunes_path) { - gchar *str = g_build_filename (mp, db[0], db[1], db[2], NULL); + gchar *str = g_build_filename (itdb->mountpoint, + db[0], db[1], db[2], NULL); g_set_error (error, ITDB_FILE_ERROR, ITDB_FILE_ERROR_NOTFOUND, @@ -3825,12 +3823,7 @@ gboolean itdb_shuffle_write (Itdb_iTunesDB *itdb, g_free(itunes_path); if (result == TRUE) - result = itdb_rename_files (mp, error); - - if ((result == TRUE) && (mp != itdb->mountpoint)) - { - itdb_set_mountpoint (itdb, mp); - } + result = itdb_rename_files (itdb->mountpoint, error); /* make sure all buffers are flushed as some people tend to disconnect as soon as gtkpod returns */ @@ -4084,10 +4077,13 @@ void itdb_set_mountpoint (Itdb_iTunesDB *itdb, const gchar *mp) g_free (itdb->mountpoint); itdb->mountpoint = g_strdup (mp); - if (itdb->device != NULL) { + if (itdb->device) + { g_object_unref (G_OBJECT (itdb->device)); + itdb->device = NULL; } - itdb->device = itdb_device_new (mp); + if (mp) + itdb->device = itdb_device_new (mp); itdb->musicdirs = 0; } -- cgit