Example #1
0
void PropertiesDialog::write()
{
    ipod.DBchanged=true;
    itdb_track_unlink(currentTrack);
    currentTrack->album=g_strdup(AlbumBox->text().toLatin1());
    currentTrack->artist=g_strdup(ArtistBox->text().toLatin1());
    currentTrack->title=g_strdup(TitleBox->text().toLatin1());
    if(coverChanged)
    {
        itdb_track_remove_thumbnails(currentTrack);
        AlbumArt->pixmap()->save("tmpcover","JPG",100);
        itdb_track_set_thumbnails_from_pixbuf(currentTrack,gdk_pixbuf_new_from_file("tmpcover",NULL));
        coverChanged=false;
    }
    itdb_track_add(ipod.currDB(),currentTrack,-1);
    emit modified();
}
Example #2
0
void
IpodDeviceHelper::unlinkPlaylistsTracksFromItdb( Itdb_iTunesDB *itdb )
{
    if( !itdb )
        return;

    while( itdb->playlists )
    {
        Itdb_Playlist *ipodPlaylist = (Itdb_Playlist *) itdb->playlists->data;
        if( !ipodPlaylist || ipodPlaylist->itdb != itdb )
        {
            /* a) itdb_playlist_unlink() cannot work if ipodPlaylist is null, prevent
             *    infinite loop
             * b) if ipodPlaylist->itdb != itdb, something went horribly wrong. Prevent
             *    infinite loop even in this case
             */
            itdb->playlists = g_list_remove( itdb->playlists, ipodPlaylist );
            continue;
        }
        itdb_playlist_unlink( ipodPlaylist );
    }

    while( itdb->tracks )
    {
        Itdb_Track *ipodTrack = (Itdb_Track *) itdb->tracks->data;
        if( !ipodTrack || ipodTrack->itdb != itdb )
        {
            /* a) itdb_track_unlink() cannot work if ipodTrack is null, prevent infinite
             *    loop
             * b) if ipodTrack->itdb != itdb, something went horribly wrong. Prevent
             *    infinite loop even in this case
             */
            itdb->tracks = g_list_remove( itdb->tracks, ipodTrack );
            continue;
        }
        itdb_track_unlink( ipodTrack );
    }
}