Revision: 1642
          http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1642&view=rev
Author:   phantom_sf
Date:     2007-07-13 16:28:05 -0700 (Fri, 13 Jul 2007)

Log Message:
-----------
Merge of latest changes from trunk

Modified Paths:
--------------
    gtkpod/branches/photo_support_branch/src/autodetection.c
    gtkpod/branches/photo_support_branch/src/details.c
    gtkpod/branches/photo_support_branch/src/details.h
    gtkpod/branches/photo_support_branch/src/display_coverart.c
    gtkpod/branches/photo_support_branch/src/display_coverart.h
    gtkpod/branches/photo_support_branch/src/display_itdb.c

Modified: gtkpod/branches/photo_support_branch/src/autodetection.c
===================================================================
--- gtkpod/branches/photo_support_branch/src/autodetection.c    2007-07-13 
23:13:48 UTC (rev 1641)
+++ gtkpod/branches/photo_support_branch/src/autodetection.c    2007-07-13 
23:28:05 UTC (rev 1642)
@@ -23,7 +23,7 @@
 |
 |  This product is not supported/written/published by Apple!
 |
-|  $Id: autodetection.c,v 1.1 2007/05/11 15:41:53 jcsjcs Exp $
+|  $Id$
 */
 
 
@@ -44,7 +44,7 @@
 #include <dbus/dbus.h>
 #endif
 
-#define DEBUG_AUTO
+#undef DEBUG_AUTO
 #ifdef DEBUG_AUTO
 #   define _TO_STR(x) #x
 #   define TO_STR(x) _TO_STR(x)
@@ -392,7 +392,8 @@
                }
                else
                {
-                   gtkpod_warning (_("Newly mounted iPod at '%s' appearss to 
be already loaded!\n\n"));
+                   gtkpod_warning (_("Newly mounted iPod at '%s' appears to be 
already loaded!\n\n"),
+                                    mountpoint);
                }
                debug ("...OK (used)\n");
            }

Modified: gtkpod/branches/photo_support_branch/src/details.c
===================================================================
--- gtkpod/branches/photo_support_branch/src/details.c  2007-07-13 23:13:48 UTC 
(rev 1641)
+++ gtkpod/branches/photo_support_branch/src/details.c  2007-07-13 23:28:05 UTC 
(rev 1642)
@@ -34,9 +34,11 @@
 #include "fileselection.h"
 #include "misc.h"
 #include "fetchcover.h"
+#include "display_coverart.h"
 #include "misc_track.h"
 #include "prefs.h"
 #include <string.h>
+#include <glib/gstdio.h>
 
 /*
 void details_close (void);
@@ -53,7 +55,41 @@
 static const gchar *DETAILS_WINDOW_DEFY="details_window_defy";
 static const gchar 
*DETAILS_WINDOW_NOTEBOOK_PAGE="details_window_notebook_page";
 
+/* enum types */
+typedef enum
+{
+    DETAILS_MEDIATYPE_AUDIO_VIDEO = 0,
+    DETAILS_MEDIATYPE_AUDIO,
+    DETAILS_MEDIATYPE_MOVIE,
+    DETAILS_MEDIATYPE_PODCAST,
+    DETAILS_MEDIATYPE_VIDEO_PODCAST,
+    DETAILS_MEDIATYPE_AUDIOBOOK,
+    DETAILS_MEDIATYPE_MUSICVIDEO,
+    DETAILS_MEDIATYPE_TVSHOW,
+    DETAILS_MEDIATYPE_MUSICVIDEO_TVSHOW
+} DETAILS_MEDIATYPE;
 
+typedef struct
+{
+    guint32 id;
+    const gchar *str;
+} ComboEntry;
+
+/* strings for mediatype combobox */
+static const ComboEntry mediatype_comboentries[] =
+{
+    { 0,                                               N_("Audio/Video") },
+    { ITDB_MEDIATYPE_AUDIO,                            N_("Audio") },
+    { ITDB_MEDIATYPE_MOVIE,                            N_("Video") },
+    { ITDB_MEDIATYPE_PODCAST,                          N_("Podcast") },
+    { ITDB_MEDIATYPE_PODCAST|ITDB_MEDIATYPE_MOVIE,     N_("Video Podcast") },
+    { ITDB_MEDIATYPE_AUDIOBOOK,                        N_("Audiobook") },
+    { ITDB_MEDIATYPE_MUSICVIDEO,                       N_("Music Video") },
+    { ITDB_MEDIATYPE_TVSHOW,                           N_("TV Show") },
+    { ITDB_MEDIATYPE_TVSHOW|ITDB_MEDIATYPE_MUSICVIDEO, N_("TV Show & Music 
Video") },
+    { 0,                                               NULL }
+};
+
 /* Declarations */
 static void details_set_track (Detail *detail, Track *track);
 static void details_free (Detail *detail);
@@ -265,6 +301,7 @@
                g_return_if_fail (etr);
                gp_track_set_thumbnails (tr, filename);
                etr->tchanged = TRUE;
+               etr->tartwork_changed = TRUE;
            }
        }
        else
@@ -273,6 +310,7 @@
            g_return_if_fail (etr);
            gp_track_set_thumbnails (detail->track, filename);
            etr->tchanged = TRUE;
+           etr->tartwork_changed = TRUE;
        }
        detail->changed = TRUE;
        details_update_thumbnail (detail);
@@ -323,6 +361,7 @@
 {
     GList *gl, *gl_orig;
     gboolean changed = FALSE;
+    GList *changed_tracks = NULL;
 
     g_return_if_fail (detail);
 
@@ -355,8 +394,18 @@
 
            if (tr_changed)
            {
+               tr_orig->time_modified = time (NULL);
                pm_track_changed (tr_orig);
            }
+
+           if (prefs_get_int("id3_write"))
+           {
+               /* add tracks to a list because write_tags_to_file()
+                  can remove newly created duplicates which is not a
+                  good idea from within a for() loop over tracks */
+               changed_tracks = g_list_prepend (changed_tracks, tr_orig);
+           }
+
            changed |= tr_changed;
            etr->tchanged = FALSE;
        }
@@ -366,9 +415,24 @@
 
     if (changed)
     {
-                       data_changed (detail->itdb);
+       data_changed (detail->itdb);
     }
     
+    if (prefs_get_int("id3_write"))
+    {
+       if (changed_tracks)
+       {
+           for (gl=changed_tracks; gl; gl=gl->next)
+           {
+               Track *tr = gl->data;
+               write_tags_to_file (tr);
+               /* display possible duplicates that have been removed */
+           }
+           gp_duplicate_remove (NULL, NULL);
+       }
+    }
+    g_list_free (changed_tracks);
+
     details_update_headline (detail);
 
     details_update_buttons (detail);
@@ -462,14 +526,14 @@
 }
 
 
-/****** Copy artwork data if filaname has changed ****** */
+/****** Copy artwork data if filename has changed ****** */
 static gboolean details_copy_artwork (Track *frtrack, Track *totrack)
 {
-    gboolean changed = FALSE;
-    ExtraTrackData *fretr, *toetr;
+               gboolean changed = FALSE;
+       ExtraTrackData *fretr, *toetr;
 
-    g_return_val_if_fail (frtrack, FALSE);
-    g_return_val_if_fail (totrack, FALSE);
+       g_return_val_if_fail (frtrack, FALSE);
+       g_return_val_if_fail (totrack, FALSE);
 
     fretr = frtrack->userdata;
     toetr = totrack->userdata;
@@ -479,26 +543,33 @@
 
     g_return_val_if_fail (fretr->thumb_path_locale, FALSE);
     g_return_val_if_fail (toetr->thumb_path_locale, FALSE);
-
-    if (strcmp (fretr->thumb_path_locale, toetr->thumb_path_locale) != 0)
-    {
-       itdb_artwork_free (totrack->artwork);
-       totrack->artwork = itdb_artwork_duplicate (frtrack->artwork);
-       totrack->artwork_size = frtrack->artwork_size;
-       totrack->artwork_count = frtrack->artwork_count;
-       totrack->has_artwork = frtrack->has_artwork;
-       g_free (toetr->thumb_path_locale);
-       g_free (toetr->thumb_path_utf8);
-       toetr->thumb_path_locale = g_strdup (fretr->thumb_path_locale);
-       toetr->thumb_path_utf8 = g_strdup (fretr->thumb_path_utf8);
-       changed = TRUE;
-    }
+       
+       if (strcmp (fretr->thumb_path_locale, toetr->thumb_path_locale) != 0
+                       || fretr->tartwork_changed == TRUE)
+  {
+               itdb_artwork_free (totrack->artwork);
+               totrack->artwork = itdb_artwork_duplicate (frtrack->artwork);
+               totrack->artwork_size = frtrack->artwork_size;
+               totrack->artwork_count = frtrack->artwork_count;
+               totrack->has_artwork = frtrack->has_artwork;
+               g_free (toetr->thumb_path_locale);
+               g_free (toetr->thumb_path_utf8);
+               toetr->thumb_path_locale = g_strdup (fretr->thumb_path_locale);
+               toetr->thumb_path_utf8 = g_strdup (fretr->thumb_path_utf8);
+               changed = TRUE;
+       }
     /* make sure artwork gets removed, even if both thumb_paths were
        unset ("") */
     if (!frtrack->artwork->thumbnails)
     {
        changed |= gp_track_remove_thumbnails (totrack);
     }
+    
+    /* Since no data changes affect the coverart display.
+     * Need to force a change by calling set covers directly.
+     */
+     force_update_covers ();
+    
     return changed;
 }
 
@@ -550,7 +621,56 @@
 }
 
 
+/****** comboentries helper functions ******/
 
+/* Get index from ID (returns -1 if ID could not be found) */
+static gint comboentry_index_from_id (const ComboEntry centries[],
+                                     guint32 id)
+{
+    gint i;
+
+    g_return_val_if_fail (centries, -1);
+
+    for (i=0; centries[i].str; ++i)
+    {
+       if (centries[i].id == id)  return i;
+    }
+    return -1;
+}
+
+
+/* initialize a combobox with the corresponding entry strings */
+static void details_setup_combobox (GtkWidget *cb,
+                                   const ComboEntry centries[])
+{
+    const ComboEntry *ce = centries;
+    GtkCellRenderer *cell;
+    GtkListStore *store;
+
+    g_return_if_fail (cb);
+    g_return_if_fail (centries);
+
+    /* clear any renderers that may have been set */
+    gtk_cell_layout_clear (GTK_CELL_LAYOUT (cb));
+    /* set new model */
+    store = gtk_list_store_new (1, G_TYPE_STRING);
+    gtk_combo_box_set_model (GTK_COMBO_BOX (cb), GTK_TREE_MODEL (store));
+    g_object_unref (store);
+
+    cell = gtk_cell_renderer_text_new ();
+    gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb), cell, TRUE);
+    gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb), cell,
+                                   "text", 0,
+                                   NULL);
+
+    while (ce->str != NULL)
+    {
+       gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _(ce->str));
+       ++ce;
+    }
+}
+
+
 /****** Setup of widgets ******/
 static void details_setup_widget (Detail *detail, T_item item)
 {
@@ -572,6 +692,7 @@
        w = gtkpod_xml_get_widget (detail->xml, buf);
        gtk_button_set_label (GTK_BUTTON (w),
                              gettext (get_t_string (item)));
+       g_free (buf);
        break;
     default:
        buf = g_strdup_printf ("details_label_%d", item);
@@ -622,6 +743,13 @@
     case T_TV_NETWORK:
     case T_SEASON_NR:
     case T_EPISODE_NR:
+    case T_ALBUMARTIST:
+    case T_SORT_ARTIST:
+    case T_SORT_TITLE:
+    case T_SORT_ALBUM:
+    case T_SORT_ALBUMARTIST:
+    case T_SORT_COMPOSER:
+    case T_SORT_TVSHOW:
        buf = g_strdup_printf ("details_entry_%d", item);
        w = gtkpod_xml_get_widget (detail->xml, buf);
        g_signal_connect (w, "activate",
@@ -655,6 +783,7 @@
     case T_MEDIA_TYPE:
        buf = g_strdup_printf ("details_combobox_%d", item);
        w = gtkpod_xml_get_widget (detail->xml, buf);
+       details_setup_combobox (w, mediatype_comboentries);
        g_signal_connect (w, "changed",
                          G_CALLBACK (details_combobox_changed),
                          detail);
@@ -746,6 +875,13 @@
     case T_TV_NETWORK:
     case T_SEASON_NR:
     case T_EPISODE_NR:
+    case T_ALBUMARTIST:
+    case T_SORT_ARTIST:
+    case T_SORT_TITLE:
+    case T_SORT_ALBUM:
+    case T_SORT_ALBUMARTIST:
+    case T_SORT_COMPOSER:
+    case T_SORT_TVSHOW:
        w = gtkpod_xml_get_widget (detail->xml, entry);
        g_signal_handlers_block_by_func (w, details_text_changed, detail);
        gtk_entry_set_text (GTK_ENTRY (w), text);
@@ -820,13 +956,18 @@
     case T_MEDIA_TYPE:
        if ((w = gtkpod_xml_get_widget (detail->xml, combobox)))
        {
-         if (track)
+           gint index = -1;
+           if (track)
            {
-             gint gui = dbToGUI(track->mediatype);
-             gtk_combo_box_set_active (GTK_COMBO_BOX (w), gui);
+               index = comboentry_index_from_id (mediatype_comboentries,
+                                                 track->mediatype);
+               if (index == -1)
+               {
+                   gtkpod_warning (_("Please report unknown mediatype %x\n"),
+                                   track->mediatype);
+               }
            }
-           else
-             gtk_combo_box_set_active (GTK_COMBO_BOX (w), 0);
+           gtk_combo_box_set_active (GTK_COMBO_BOX (w), index);
        }
        break;
     case T_ALL:
@@ -838,6 +979,7 @@
     g_free (entry);
     g_free (checkbutton);
     g_free (textview);
+    g_free (combobox);
     g_free (text);
 }
 
@@ -904,6 +1046,13 @@
     case T_TV_NETWORK:
     case T_SEASON_NR:
     case T_EPISODE_NR:
+    case T_ALBUMARTIST:
+    case T_SORT_ARTIST:
+    case T_SORT_TITLE:
+    case T_SORT_ALBUM:
+    case T_SORT_ALBUMARTIST:
+    case T_SORT_COMPOSER:
+    case T_SORT_TVSHOW:
        if ((w = gtkpod_xml_get_widget (detail->xml, entry)))
        {
            const gchar *text;
@@ -1024,12 +1173,15 @@
        {
            gint active;
            active = gtk_combo_box_get_active (GTK_COMBO_BOX (w));
-           guint32 mediatype_db = guiToDB(active);
+           if (active != -1)
+           {
+               guint32 new_mediatype = mediatype_comboentries[active].id;
 
-           if (track->mediatype != mediatype_db)
-           {
-               track->mediatype = mediatype_db;
-               changed = TRUE;
+               if (track->mediatype != new_mediatype)
+               {
+                   track->mediatype = new_mediatype;
+                   changed = TRUE;
+               }
            }
        }
        break;
@@ -1077,6 +1229,7 @@
     g_free (entry);
     g_free (checkbutton);
     g_free (textview);
+    g_free (combobox);
 
     details_update_buttons (detail);
 }
@@ -1313,6 +1466,7 @@
        etr_dup = tr_dup->userdata;
        g_return_if_fail (etr_dup);
        etr_dup->tchanged = FALSE;
+       etr_dup->tartwork_changed = FALSE;
        detail->tracks = g_list_prepend (detail->tracks, tr_dup);
     }
 
@@ -1486,11 +1640,10 @@
                      G_CALLBACK (details_writethrough_toggled),
                      detail);
 
-
-
     g_signal_connect (detail->window, "delete_event",
                      G_CALLBACK (details_delete_event), detail);
 
+
     details_set_tracks (detail, selected_tracks);
 
     /* set notebook page */

Modified: gtkpod/branches/photo_support_branch/src/details.h
===================================================================
--- gtkpod/branches/photo_support_branch/src/details.h  2007-07-13 23:13:48 UTC 
(rev 1641)
+++ gtkpod/branches/photo_support_branch/src/details.h  2007-07-13 23:28:05 UTC 
(rev 1642)
@@ -47,7 +47,7 @@
     GList *tracks;      /* tracks displayed in details window */
     Track *track;       /* currently displayed track          */
     gboolean artwork_ok;/* artwork can be displayed or not    */
-    gboolean changed;   /* at lease one track was changed     */
+    gboolean changed;   /* at least one track was changed     */
 
 };
 

Modified: gtkpod/branches/photo_support_branch/src/display_coverart.c
===================================================================
--- gtkpod/branches/photo_support_branch/src/display_coverart.c 2007-07-13 
23:13:48 UTC (rev 1641)
+++ gtkpod/branches/photo_support_branch/src/display_coverart.c 2007-07-13 
23:28:05 UTC (rev 1642)
@@ -1,5 +1,5 @@
 /*
-|  Copyright (C) 2002-2007 Jorg Schuler <jcsjcs at users sourceforge net>
+|  Copyright (C) 2007 P.G. Richardson <phantom_sf at users.sourceforge.net>
 |  Part of the gtkpod project.
 |
 |  URL: http://www.gtkpod.org/
@@ -23,7 +23,7 @@
 |
 |  This product is not supported/written/published by Apple!
 |
-|  $Id: display_coverart.c,v 1.19 2007/05/17 20:06:03 phantom_sf Exp $
+|  $Id$
 */
 
 #ifdef HAVE_CONFIG_H
@@ -42,30 +42,28 @@
 
 /* Declarations */
 static void free_album (Album_Item *album);
- static void free_CDWidget ();
+static void free_CDWidget ();
 static gint compare_album_keys (gchar *a, gchar *b);
 static void set_display_dimensions ();
-static GdkPixbuf *draw_blank_cdimage ();
-static void set_highlight (Cover_Item *cover, gboolean ismain);
+static void set_highlight (Cover_Item *cover, gint index);
 static void raise_cdimages (GPtrArray *cdcovers);
-/*static void scroll_covers (gint direction);*/
 static void remove_track_from_album (Album_Item *album, Track *track, gchar 
*key, gint index, GList *keylistitem);
 static void on_cover_display_button_clicked (GtkWidget *widget, gpointer data);
 static gint on_main_cover_image_clicked (GnomeCanvasItem *canvasitem, GdkEvent 
*event, gpointer data);
 static void on_cover_display_slider_value_changed (GtkRange *range, gpointer 
user_data);
-static void set_cover_dimensions (Cover_Item *cover, int cover_index);
+static void set_cover_dimensions (Cover_Item *cover, int cover_index, gdouble 
img_width, gdouble img_height);
 static void coverart_sort_images (GtkSortType order);
 static void prepare_canvas ();
 static void set_slider_range (gint index);
-static void set_covers ();
-static void set_cover_item (gint ndex, Cover_Item *cover, gchar *key);
+static void set_covers (gboolean force_imgupdate);
+static void set_cover_item (gint ndex, Cover_Item *cover, gchar *key, gboolean 
force_imgupdate);
 
 /* Prefs keys */
 const gchar *KEY_DISPLAY_COVERART="display_coverart";
 
 /* The structure that holds values used throughout all the functions */
 static CD_Widget *cdwidget = NULL;
-/* The backing hash for the albums and it associated key list */
+/* The backing hash for the albums and its associated key list */
 static GHashTable *album_hash;
 static GList *album_key_list;
 /* Dimensions used for the canvas */
@@ -73,12 +71,6 @@
 static gint HEIGHT;
 static gint DEFAULT_WIDTH;
 static gint DEFAULT_HEIGHT;
-/* Dimensions used for the smaller 8 cd cover images */
-static gdouble SMALL_IMG_WIDTH;
-static gdouble SMALL_IMG_HEIGHT;
-/* Dimensions used for the main cd cover image */
-static gdouble BIG_IMG_WIDTH;
-static gdouble BIG_IMG_HEIGHT;
 /* Path of the png file used for albums without cd covers */
 static gchar *DEFAULT_FILE;
 /* Path of the png file used for the highlighting of cd covers */
@@ -127,11 +119,12 @@
 
 /**
  * 
+ * free_CDWidget
+ * 
  * destroy the CD Widget and free everything currently
  * in memory.
- * 
  */
- static void free_CDWidget()
+ static void free_CDWidget ()
  {
                g_signal_handler_disconnect (cdwidget->leftbutton, 
lbutton_signal_id);
                g_signal_handler_disconnect (cdwidget->rightbutton, 
rbutton_signal_id);
@@ -172,50 +165,6 @@
  }
  
 /**
- * draw_blank_cdimage:
- *
- * creates a blank "black" pixbuf cd image to represent the
- * display when the playlist has no tracks in it.
- * 
- * Returns:
- * pixbuf of blank pixbuf
- */
-static GdkPixbuf *draw_blank_cdimage ()
-{      
-       gdouble width = 4;
-       gdouble height = 4;
-       gint pixel_offset, rowstride, x, y;
-       guchar *drawbuf;
-
-       drawbuf = g_malloc ((gint) (width * 16) * (gint) height);
-       
-       /* drawing buffer length multiplied by 4
-        * due to 1 width per R, G, B & ALPHA
-        */
-       rowstride = width * 4;
-                       
-  for(y = 0; y < height; ++y)
-  {
-       for(x = 0; x < width; ++x)
-       {
-               pixel_offset = (y * rowstride) + (x * 4);
-               drawbuf[pixel_offset] = 0;
-               drawbuf[pixel_offset + 1] = 0;
-               drawbuf[pixel_offset + 2] = 0;
-               drawbuf[pixel_offset + 3] = 255;
-       }
-  }
-  return gdk_pixbuf_new_from_data(drawbuf,
-                                                                       
GDK_COLORSPACE_RGB,
-                                                                       TRUE,
-                                                                       8,
-                                                                       width,
-                                                                       height,
-                                                                       
rowstride,
-                                                                       
(GdkPixbufDestroyNotify) g_free, NULL);
-}
-
-/**
  * set_highlight:
  *
  * Sets the highlighted image to the cover to give shine 
@@ -224,32 +173,30 @@
  * @cover: A Cover_Item object which the higlighted is added to.
  *  
  */
-static void set_highlight (Cover_Item *cover, gboolean ismain)
+static void set_highlight (Cover_Item *cover, gint index)
 {
-    GdkPixbuf *image;
-    GError *error = NULL;
-    GdkPixbuf *scaled;
-
-               if(ismain)
-                       image = gdk_pixbuf_new_from_file(HIGHLIGHT_FILE_MAIN, 
&error);
-               else
-       image = gdk_pixbuf_new_from_file(HIGHLIGHT_FILE, &error);
+  GdkPixbuf *image;
+  GError *error = NULL;
+  GdkPixbuf *scaled;
+                                                                               
                                                                                
+       if(index == IMG_MAIN)
+               image = gdk_pixbuf_new_from_file(HIGHLIGHT_FILE_MAIN, &error);
+       else
+       image = gdk_pixbuf_new_from_file(HIGHLIGHT_FILE, &error);
     
-    if(error != NULL)
-    {  
-       printf("Error occurred loading file - \nCode: %d\nMessage: %s\n", 
error->code, error->message); 
-       g_return_if_fail (image);
-    }
+  if(error != NULL)
+  {    
+               printf("Error occurred loading file - \nCode: %d\nMessage: 
%s\n", error->code, error->message); 
+               g_return_if_fail (image);
+       }
 
-    scaled = gdk_pixbuf_scale_simple(image, cover->img_width, 
((cover->img_height * 2) + 6), GDK_INTERP_NEAREST);
-    gdk_pixbuf_unref (image);
+  scaled = gdk_pixbuf_scale_simple(image, cover->img_width, 
((cover->img_height * 2) + 6), GDK_INTERP_NEAREST);
+  gdk_pixbuf_unref (image);
                
-    gnome_canvas_item_set (cover->highlight,
+  gnome_canvas_item_set (cover->highlight,
                           "pixbuf", scaled,
                           NULL);
-    gdk_pixbuf_unref (scaled);
-
-    gnome_canvas_item_hide (cover->highlight);                         
+  gdk_pixbuf_unref (scaled);                           
 }
 
 /**
@@ -284,21 +231,38 @@
 }
 
 /**
+ * 
+ * force_update_covers:
+ * 
+ * Call the resetting of the covers and override the cached images so that they
+ * are loaded with the latest files existing on the filesystem.
+ * 
+ */
+void force_update_covers ()
+{
+       set_covers (TRUE);
+}
+
+/**
  * set_covers:
  *
  * Internal function responsible for the resetting of the artwork
  * covers in response to some kind of change in selection, eg. new
  * selection in sort tab, button click etc...
  * 
+ * @force_imgupdate: forces the resetting of the cached images so that the
+ * values are reread from the tracks and updated. Used sparingly.
  */
-static void set_covers ()
+static void set_covers (gboolean force_imgupdate)
 { 
   gint i, dataindex;
   gchar *key;
   Cover_Item *cover;
 
-  for(i = 0; i < IMG_TOTAL; ++i)
+  if (cdwidget && cdwidget->cdcovers)
   {
+    for(i = 0; i < IMG_TOTAL; ++i)
+    {
                cover = g_ptr_array_index(cdwidget->cdcovers, i);
                dataindex = cdwidget->first_imgindex + i;
 
@@ -307,7 +271,8 @@
                 */
                key = g_list_nth_data (album_key_list, dataindex);
                
-               set_cover_item (i, cover, key); 
+               set_cover_item (i, cover, key, force_imgupdate);        
+    }
   }
 }
 
@@ -317,7 +282,7 @@
  * Internal function called  by set_covers to reset an artwork cover.
  * 
  */
-static void set_cover_item (gint index, Cover_Item *cover, gchar *key)
+static void set_cover_item (gint index, Cover_Item *cover, gchar *key, 
gboolean force_imgupdate)
 {
        GdkPixbuf *reflection;
        GdkPixbuf *scaled;
@@ -325,39 +290,19 @@
   
        if (key == NULL)
        {
-               GdkPixbuf *imgbuf;
-               album = NULL;
-               imgbuf = draw_blank_cdimage ();
-               
-               /* Hide the highlight */
-               gnome_canvas_item_hide (cover->highlight);
-               
-               /* Set the cover */
-               scaled = gdk_pixbuf_scale_simple (imgbuf, cover->img_width, 
cover->img_height, GDK_INTERP_NEAREST);
-         gnome_canvas_item_set (cover->cdimage,
-                                       "pixbuf", scaled,
-                                       NULL);
-         
+               /* Clear everything */
+         gnome_canvas_item_hide (cover->cdimage);
          /* Set the reflection to blank too */
-        reflection = gdk_pixbuf_flip (scaled, FALSE);
-        gnome_canvas_item_set (cover->cdreflection,
-                 "pixbuf", reflection,
-                 NULL);
-        
+         gnome_canvas_item_hide (cover->cdreflection);
+               /* Set the highlight to black too */
+               if (cover->highlight != NULL)
+                       gnome_canvas_item_hide (cover->highlight);
+                
                if (index == IMG_MAIN)
                {
-                       /* Set the text to blank */
-                       gnome_canvas_item_set (GNOME_CANVAS_ITEM 
(cdwidget->cvrtext),
-                                       "text", "No Artist",
-                                       "fill_color", "black",
-                                       "justification", GTK_JUSTIFY_CENTER,
-                                       NULL);
-               }
-               
-               gdk_pixbuf_unref (reflection);             
-               gdk_pixbuf_unref (scaled);
-               gdk_pixbuf_unref (imgbuf);
-               
+                       /* Hide the artist/album text*/
+                       gnome_canvas_item_hide (GNOME_CANVAS_ITEM 
(cdwidget->cvrtext));
+               }               
                return;
        }
        
@@ -367,14 +312,29 @@
        album  = g_hash_table_lookup (album_hash, key);
        cover->album = album;
        
+       if (force_imgupdate)
+       {
+               gdk_pixbuf_unref (album->albumart);
+               album->albumart = NULL;
+       }
+       
        Track *track;
        if (album->albumart == NULL)
        {
                track = g_list_nth_data (album->tracks, 0);
-               album->albumart = coverart_get_track_thumb (track, 
track->itdb->device);
+               album->albumart = coverart_get_track_thumb (track, 
track->itdb->device);                                
        }
        
+       /* Set the x, y, height and width of the CD cover */
+       set_cover_dimensions (
+                               cover,
+                               index,
+                               gdk_pixbuf_get_width (album->albumart),
+                               gdk_pixbuf_get_height (album->albumart));
+       
        /* Display the highlight */
+       set_highlight (cover, index);
+       
        gnome_canvas_item_show (cover->highlight);      
        
        /* Set the Cover */
@@ -382,12 +342,21 @@
        gnome_canvas_item_set (cover->cdimage,
                        "pixbuf", scaled,
                        NULL);
-                       
+                       
+       gnome_canvas_item_show (cover->cdimage);
+           
+        gnome_canvas_item_set (cover->cdcvrgrp,
+                       "x", (gdouble) cover->img_x,
+                       "y", (gdouble) cover->img_y,           
+                       NULL);
+               
         /* flip image vertically to create reflection */
        reflection = gdk_pixbuf_flip (scaled, FALSE);
        gnome_canvas_item_set (cover->cdreflection,
                  "pixbuf", reflection,
+                 "y", (gdouble) (cover->img_height + 4),
                  NULL);
+       gnome_canvas_item_show (cover->cdreflection);
                
        gdk_pixbuf_unref (reflection);
        gdk_pixbuf_unref (scaled);
@@ -400,19 +369,12 @@
                gnome_canvas_item_set (GNOME_CANVAS_ITEM (cdwidget->cvrtext),
                                 "text", text,
                                 "fill_color", "white",
+                                "y", (gdouble) cover->img_y + 
cover->img_height + 10,
                                 "justification", GTK_JUSTIFY_CENTER,
                                 NULL);
+                                
+               gnome_canvas_item_show (GNOME_CANVAS_ITEM (cdwidget->cvrtext));
                g_free (text);
-               
-               /*
-               int i;
-               Track *track;
-               for (i = 0; i < g_list_length(album->tracks); ++i)
-               {
-                       track = g_list_nth_data (album->tracks, i);
-                       printf ("Track artist:%s album:%s  title:%s\n", 
track->artist, track->album, track->title);
-               }
-               */
        }
 }
 
@@ -444,7 +406,7 @@
   if (cdwidget->first_imgindex > (displaytotal - IMG_MAIN))
        cdwidget->first_imgindex = displaytotal - IMG_MAIN;
        
-  set_covers ();
+  set_covers (FALSE);
 }
 
 /**
@@ -576,36 +538,24 @@
 {
        gint i;
        Cover_Item *cover = NULL;
-       GdkPixbuf *buf;
        
-       buf = draw_blank_cdimage ();
-       
        for (i = 0; i < IMG_TOTAL; i++)
        {
-         GdkPixbuf *buf2;
                /* Reset the pixbuf */
                cover = g_ptr_array_index(cdwidget->cdcovers, i);
                cover->album = NULL;
-               buf2 = gdk_pixbuf_scale_simple(buf, cover->img_width, 
cover->img_height, GDK_INTERP_NEAREST);
-               gnome_canvas_item_set(cover->cdimage, "pixbuf", buf2, NULL);
-               gnome_canvas_item_set(cover->cdreflection, "pixbuf", buf2, 
NULL);
-               gnome_canvas_item_hide (cover->highlight);
+               gnome_canvas_item_hide (cover->cdimage);
+               gnome_canvas_item_hide (cover->cdreflection);
                
-               gdk_pixbuf_unref (buf2);
+               if (cover->highlight != NULL)
+                       gnome_canvas_item_hide (cover->highlight);
                
-               /* Reset track list too */
-               cover->album = NULL;
-               
                if (i == IMG_MAIN)
                {
                        /* Set the text to display details of the main image */
-                   gnome_canvas_item_set (GNOME_CANVAS_ITEM 
(cdwidget->cvrtext),
-                                          "text", "No Artist",
-                                          "fill_color", "black",
-                                          NULL);
+                       gnome_canvas_item_hide (GNOME_CANVAS_ITEM 
(cdwidget->cvrtext));
                }
        }
-       gdk_pixbuf_unref(buf);
 }
 
 /**
@@ -622,26 +572,19 @@
 GdkPixbuf *coverart_get_track_thumb (Track *track, Itdb_Device *device)
 {
        GdkPixbuf *pixbuf = NULL;       
+       Thumb *thumb;
        ExtraTrackData *etd;
-       
+
        etd = track->userdata;
-       if (etd && etd->thumb_path_locale)
+       g_return_val_if_fail (etd, NULL);
+
+       thumb = itdb_artwork_get_thumb_by_type (track->artwork,
+                                               ITDB_THUMB_COVER_LARGE);
+       if (thumb)
        {
-               GError *error = NULL;
-               pixbuf = gdk_pixbuf_new_from_file (etd->thumb_path_locale, 
&error);
-               if (error != NULL)
-               {
-                       /*
-                       printf("Error occurred loading the image file - \nCode: 
%d\nMessage: %s\n", error->code, error->message);
-                       */
-                       g_error_free (error);
-               }
+           pixbuf = itdb_thumb_get_gdk_pixbuf (device, thumb);
        }
        
-       /* Either thumb was null or the attempt at getting a pixbuf failed
-        * due to invalid file. For example, some nut (like me) decided to
-        * apply an mp3 file to the track as its cover file
-        */
        if (pixbuf ==  NULL)
        {
                /* Could not get a viable thumbnail so get default pixbuf */
@@ -678,7 +621,8 @@
 {
        GtkWidget *dialog;
        Cover_Item *cover;
-       GdkPixbuf *imgbuf;
+       GdkPixbuf *imgbuf = NULL;
+       ExtraTrackData *etd;
        
        cover = g_ptr_array_index(cdwidget->cdcovers, IMG_MAIN);
        g_return_if_fail (cover);
@@ -697,15 +641,32 @@
        
        g_free (text);
        
-       if (cover->album->albumart != NULL)
-               imgbuf = cover->album->albumart;
-       else
+       Track *track;
+       track = g_list_nth_data (cover->album->tracks, 0);
+       etd = track->userdata;
+       if (etd && etd->thumb_path_locale)
        {
-               Track *track;
-               track = g_list_nth_data (cover->album->tracks, 0);
-               imgbuf = coverart_get_track_thumb (track, track->itdb->device);
+               GError *error = NULL;
+               imgbuf = gdk_pixbuf_new_from_file (etd->thumb_path_locale, 
&error);
+               if (error != NULL)
+               {
+                       /*
+                       printf("Error occurred loading the image file - \nCode: 
%d\nMessage: %s\n", error->code, error->message);
+                       */
+                       g_error_free (error);
+               }
        }
-               
+       
+       /* Either thumb was null or the attempt at getting a pixbuf failed
+        * due to invalid file. For example, some nut (like me) decided to
+        * apply an mp3 file to the track as its cover file
+        */
+       if (imgbuf ==  NULL)
+       {
+               /* Could not get a viable thumbnail so get default pixbuf */
+               imgbuf = coverart_get_default_track_thumb ();
+       }
+       
        gint pixheight = gdk_pixbuf_get_height (imgbuf);
        gint pixwidth = gdk_pixbuf_get_width (imgbuf);
        
@@ -757,6 +718,8 @@
 GdkPixbuf *coverart_get_default_track_thumb (void)
 {
        GdkPixbuf *pixbuf = NULL;
+       GdkPixbuf *scaled = NULL;
+       gdouble default_size = 140;
        GError *error = NULL;
        
        pixbuf = gdk_pixbuf_new_from_file(DEFAULT_FILE, &error);
@@ -765,8 +728,12 @@
                        printf("Error occurred loading the default file - 
\nCode: %d\nMessage: %s\n", error->code, error->message);
                        g_return_val_if_fail(pixbuf, NULL);
        }
+       
+       scaled = gdk_pixbuf_scale_simple(pixbuf, default_size, default_size, 
GDK_INTERP_NEAREST);
+  gdk_pixbuf_unref (pixbuf);
+       
 
-       return pixbuf;
+       return scaled;
 }
 
 /**
@@ -812,9 +779,9 @@
                if (suffix)
                {
                *suffix = 0;
-               DEFAULT_FILE = g_build_filename (progname, "pixmaps", 
"default-cover.png", NULL);
-               HIGHLIGHT_FILE = g_build_filename (progname, "pixmaps", 
"cdshine.png", NULL);
-               HIGHLIGHT_FILE_MAIN = g_build_filename (progname, "pixmaps", 
"cdshine_main.png", NULL);
+               DEFAULT_FILE = g_build_filename (progname, "data", 
"default-cover.png", NULL);
+               HIGHLIGHT_FILE = g_build_filename (progname, "data", 
"cdshine.png", NULL);
+               HIGHLIGHT_FILE_MAIN = g_build_filename (progname, "data", 
"cdshine_main.png", NULL);
                }
        }
     
@@ -840,15 +807,15 @@
   
   if (!DEFAULT_FILE)
   {
-      DEFAULT_FILE = g_build_filename (PACKAGE_DATA_DIR, PACKAGE, "pixmaps", 
"default-cover.png", NULL);
+      DEFAULT_FILE = g_build_filename (PACKAGE_DATA_DIR, PACKAGE, "data", 
"default-cover.png", NULL);
   }
   if (!HIGHLIGHT_FILE)
   {
-      HIGHLIGHT_FILE = g_build_filename (PACKAGE_DATA_DIR, PACKAGE, "pixmaps", 
"cdshine.png", NULL);
+      HIGHLIGHT_FILE = g_build_filename (PACKAGE_DATA_DIR, PACKAGE, "data", 
"cdshine.png", NULL);
   }
   if (!HIGHLIGHT_FILE_MAIN)
   {
-      HIGHLIGHT_FILE_MAIN = g_build_filename (PACKAGE_DATA_DIR, PACKAGE, 
"pixmaps", "cdshine_main.png", NULL);
+      HIGHLIGHT_FILE_MAIN = g_build_filename (PACKAGE_DATA_DIR, PACKAGE, 
"data", "cdshine_main.png", NULL);
   }
 }
 
@@ -921,8 +888,7 @@
                if ( ! prefs_get_int (KEY_DISPLAY_COVERART))
                return FALSE;
                
-       gint width, i;
-       Cover_Item *cover;
+       gint width;
        
        width = gtk_paned_get_position (GTK_PANED(widget));
        if ((width >= DEFAULT_WIDTH) && (width != WIDTH))
@@ -932,18 +898,7 @@
                                       "x", (gdouble) WIDTH / 2,
                                       NULL);
                
-               for(i = 0; i < IMG_TOTAL; ++i)
-       {
-               cover = g_ptr_array_index(cdwidget->cdcovers, i);
-               set_cover_dimensions (cover, i);
-               if(i == IMG_MAIN)
-                               set_highlight (cover, FALSE);
-                       else
-                               set_highlight (cover, TRUE);
-       }
-               
-               set_covers ();
-               
+               set_covers (FALSE);             
        }
                
        return FALSE;
@@ -1041,88 +996,81 @@
  * @cover_index: index of the widget. Used to determine whether
  *                                                                             
                cover is the main cover or not
  */
-static void set_cover_dimensions (Cover_Item *cover, int cover_index)
+static void set_cover_dimensions (Cover_Item *cover, int cover_index, gdouble 
img_width, gdouble img_height)
 {
-       gdouble x = 0, y = 0, img_width = 0, img_height = 0;
+       gdouble x = 0, y = 0;
+       gdouble small_img_width, small_img_height;
+       gdouble display_width = 0, display_diff = 0, display_ratio = 0;
+       gint temp_index = 0;
        
-       SMALL_IMG_WIDTH = WIDTH / 3;
-       SMALL_IMG_HEIGHT = HEIGHT / 3;
-       BIG_IMG_WIDTH = WIDTH / 2;
-       BIG_IMG_HEIGHT = HEIGHT / 2;
+       small_img_width = img_width * 0.75;
+       small_img_height = img_height * 0.75;
        
-       img_width = SMALL_IMG_WIDTH;
-       img_height = SMALL_IMG_HEIGHT;
+       display_width = (WIDTH / 2) - (BORDER * 2);
+       display_diff = display_width - small_img_width; 
+       
+       /* Set the x location of the cover image */
+       switch(cover_index) {
+               case 0:
+               case 1:
+               case 2:
+               case 3:
+                       display_ratio = ((gdouble) cover_index) / 4;
+                       x = BORDER + (display_ratio * display_diff);
+                       break;
+               case IMG_MAIN:
+                       /* The Main Image CD Cover Image */
+                       x = (WIDTH - img_width) / 2;
+                       break;
+               case 5:
+               case 6:
+               case 7:
+               case 8:                 
+                       temp_index = cover_index - 8;
+                       if (temp_index < 0)
+                               temp_index = temp_index * -1; 
+       
+                       display_ratio = ((gdouble) temp_index) / 4;
+                       x = WIDTH - (BORDER + small_img_width + (display_ratio 
* display_diff)); 
+                       break;
+       }
                
-               /* Set the x location of the cover image */
-               switch(cover_index) {
-                       case 0:
-                               x = BORDER;
-                               break;
-                       case 1:
-                               x = BORDER * 1.6;
-                               break;
-                       case 2:
-                               x = BORDER * 2.2;
-                               break;
-                       case 3:
-                               x = BORDER * 2.8;
-                               break;
-                       case IMG_MAIN:
-                               /* The Main Image CD Cover Image */
-                               x = (WIDTH - BIG_IMG_WIDTH) / 2;
-                               img_width = BIG_IMG_WIDTH;
-                               break;
-                       case 5:
-                               x = WIDTH - (SMALL_IMG_WIDTH + (BORDER * 2.8));
-                               break;
-                       case 6:
-                               x = WIDTH - (SMALL_IMG_WIDTH + (BORDER * 2.2));
-                               break;
-                       case 7:
-                               x = WIDTH - (SMALL_IMG_WIDTH + (BORDER * 1.6));
-                               break;
-                       case 8:
-                               x =     WIDTH - (SMALL_IMG_WIDTH + BORDER);
-                               break;
-               }
+       /* Set the y location of the cover image */             
+       switch(cover_index) {
+               case 0:
+               case 8:
+                       y = BORDER;
+                       break;
+               case 1:
+               case 7:
+                       y = BORDER * 3;
+                       break;
+               case 2:
+               case 6:
+                       y = BORDER * 5;
+                       break;
+               case 3:
+               case 5:
+                       y = BORDER * 7;
+                       break;
+               case IMG_MAIN:
+                       /* The Main Image CD Cover Image */
+                       y = HEIGHT - (img_height + (BORDER * 4));       
+       }
+                       
+       cover->img_x = x;
+       cover->img_y = y;
                
-               /* Set the y location of the cover image */             
-               switch(cover_index) {
-                       case 0:
-                       case 8:
-                               y = BORDER;
-                               break;
-                       case 1:
-                       case 7:
-                               y = BORDER * 3;
-                               break;
-                       case 2:
-                       case 6:
-                               y = BORDER * 5;
-                               break;
-                       case 3:
-                       case 5:
-                               y = BORDER * 7;
-                               break;
-                       case IMG_MAIN:
-                               /* The Main Image CD Cover Image */
-                               y = HEIGHT - (BIG_IMG_HEIGHT + (BORDER * 4));
-                               img_height = BIG_IMG_HEIGHT;    
-               }
-               
-               cover->img_x = x;
-               cover->img_y = y;
+       if (cover_index == IMG_MAIN)
+       {
                cover->img_height = img_height;
                cover->img_width = img_width;
-               
-               gnome_canvas_item_set (cover->cdcvrgrp,
-                                      "x", (gdouble) cover->img_x,
-                                      "y", (gdouble) cover->img_y,
-                                      NULL);
-               
-               gnome_canvas_item_set (cover->cdreflection,
-                                      "y", (gdouble) (cover->img_height + 4),
-                                      NULL);
+       }
+       else
+       {
+               cover->img_height = small_img_height;
+               cover->img_width = small_img_width;
+       }
 }
 
 /**
@@ -1209,34 +1157,28 @@
                cover->cdreflection = gnome_canvas_item_new((GnomeCanvasGroup 
*) cover->cdcvrgrp,
                                                                                
GNOME_TYPE_CANVAS_PIXBUF,
                                                                                
NULL);
-       
-               set_cover_dimensions (cover, i);
                
                cover->highlight = gnome_canvas_item_new((GnomeCanvasGroup *) 
cover->cdcvrgrp,
                                                                                
                                                                                
                GNOME_TYPE_CANVAS_PIXBUF,
-                                                                               
                                                                        NULL);  
        
-               
+                                                                               
                                                                        NULL);  
+                       
                if(i == IMG_MAIN)
-               {
-                       set_highlight (cover, TRUE);
-               
+               {       
                        /* set up some callback events on the main scaled image 
*/
                        g_signal_connect(GTK_OBJECT(cover->cdimage), "event", 
GTK_SIGNAL_FUNC(on_main_cover_image_clicked), NULL);
                
                        cdwidget->cvrtext = 
GNOME_CANVAS_TEXT(gnome_canvas_item_new(gnome_canvas_root(cdwidget->canvas),
                                                                                
GNOME_TYPE_CANVAS_TEXT,
-                                                                               
"text", "No Artist",
+                                                                               
"text", " ",
                                                                                
"x", (gdouble) WIDTH / 2,
-                                                                               
"y", (gdouble) cover->img_y + cover ->img_height,
+                                                                               
"y", (gdouble) 0,
                                                                                
"justification", GTK_JUSTIFY_CENTER,
                                                                        
"anchor", GTK_ANCHOR_NORTH,
-                                                                       
"fill_color", "black",
+                                                                       
"fill_color", "white",
                                                                        "font", 
"-*-clean-medium-r-normal-*-12-*-*-*-*-*-*",
                                                                                
NULL));
                }
-               else
-                       set_highlight (cover, FALSE);
-               
+
                g_ptr_array_add(cdwidget->cdcovers, cover);
                cover = NULL;
        }
@@ -1384,7 +1326,7 @@
   else if((cdwidget->first_imgindex + IMG_TOTAL) >= displaytotal)
        cdwidget->first_imgindex = displaytotal - IMG_TOTAL;
       
-  set_covers ();
+  set_covers (FALSE);
   
   /* Set the index value of the slider but avoid causing an infinite
    * cover selection by blocking the event
@@ -1482,7 +1424,7 @@
                        g_return_if_fail (keypos);
                        g_free (trk_key);
                        
-                       /* Reassign trk_key to the ky from the list */
+                       /* Reassign trk_key to the key from the list */
                        trk_key = keypos->data;
                        index = g_list_position (album_key_list, keypos);
        
@@ -1495,7 +1437,7 @@
                        if (index >= cdwidget->first_imgindex && index <= 
(cdwidget->first_imgindex + IMG_TOTAL))
                        {       
                                /* reset the covers and should reset to 
original position but without the index */
-                               set_covers ();
+                               set_covers (FALSE);
                        }
                        
                        /* Size of key list may have changed so reset the 
slider 
@@ -1555,7 +1497,7 @@
                                for (i = 0; i < IMG_MAIN; ++i)
                                        album_key_list = g_list_prepend 
(album_key_list, NULL);
                
-                               set_covers ();
+                               set_covers (FALSE);
                        }
                        else
                        {
@@ -1604,7 +1546,7 @@
                          index = g_list_index (album->tracks, track);
                          if (index != -1)
                          {
-                               /* Track exists in the album list so return and 
ignore the change */
+                               /* Track exists in the album list so ignore the 
change and return */
                                return;
                          }
                          else
@@ -1640,7 +1582,7 @@
                                                        * under the new album 
key
                                                        */
                                                        remove_track_from_album 
(album, track, key, index, klist);
-                                                       set_covers();
+                                                       set_covers(FALSE);
                                                        /* Found the album and 
removed so no need to continue the loop */
                                                        break;
                                                }
@@ -1752,9 +1694,9 @@
                if (tracks == NULL)
                        return;
                
-               gchar *album_key;
                while (tracks)
                {
+                   gchar *album_key;
                        track = tracks->data;
                        
                        album_key = g_strconcat (track->artist, "_", 
track->album, NULL);
@@ -1779,10 +1721,11 @@
                        }
                        else
                        {
-                               /* Album Item found in the album hash so append 
the track to
-                                * the end of the track list
-                                */
-                                album->tracks = g_list_append (album->tracks, 
track);
+                           /* Album Item found in the album hash so
+                            * append the track to the end of the
+                            * track list */
+                           g_free (album_key);
+                           album->tracks = g_list_append (album->tracks, 
track);
                        }
                        
                        tracks = tracks->next;
@@ -1805,7 +1748,7 @@
        for (i = 0; i < IMG_MAIN; ++i)
                album_key_list = g_list_prepend (album_key_list, NULL);
                
-       set_covers ();
+       set_covers (FALSE);
        
        set_slider_range (cdwidget->first_imgindex);
        
@@ -1829,14 +1772,18 @@
 {
   if (GTK_WIDGET_REALIZED(gtkpod_window))
   {
-               if (val)
-                       gdk_window_set_cursor (gtkpod_window->window, 
gdk_cursor_new (GDK_WATCH));
-               else
-                       gdk_window_set_cursor (gtkpod_window->window, NULL);
-       }
-       
-       if (cdwidget != NULL)
-               cdwidget->block_display_change = val;
+      if (val)
+      {
+         GdkCursor *cursor = gdk_cursor_new (GDK_WATCH);
+         gdk_window_set_cursor (gtkpod_window->window, cursor);
+         gdk_cursor_unref (cursor);
+      }
+      else
+         gdk_window_set_cursor (gtkpod_window->window, NULL);
+  }
+
+  if (cdwidget != NULL)
+      cdwidget->block_display_change = val;
 }
 
 /**
@@ -1876,7 +1823,7 @@
     
   g_free (filename);
   
-  set_covers ();
+  set_covers (FALSE);
 }
 
 /**
@@ -1914,5 +1861,5 @@
         
        on_coverart_context_menu_click (tracks);
        
-       set_covers ();
+       set_covers (FALSE);
 }

Modified: gtkpod/branches/photo_support_branch/src/display_coverart.h
===================================================================
--- gtkpod/branches/photo_support_branch/src/display_coverart.h 2007-07-13 
23:13:48 UTC (rev 1641)
+++ gtkpod/branches/photo_support_branch/src/display_coverart.h 2007-07-13 
23:28:05 UTC (rev 1642)
@@ -1,3 +1,31 @@
+/*
+|  Copyright (C) 2007 P.G. Richardson <phantom_sf at users.sourceforge.net>
+|  Part of the gtkpod project.
+|
+|  URL: http://www.gtkpod.org/
+|  URL: http://gtkpod.sourceforge.net/
+|
+|  Gtkpod is free software; you can redistribute it and/or modify
+|  it under the terms of the GNU General Public License as published by
+|  the Free Software Foundation; either version 2 of the License, or
+|  (at your option) any later version.
+|
+|  Gtkpod is distributed in the hope that it will be useful,
+|  but WITHOUT ANY WARRANTY; without even the implied warranty of
+|  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+|  GNU General Public License for more details.
+|
+|  You should have received a copy of the GNU General Public License
+|  along with gtkpod; if not, write to the Free Software
+|  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+|
+|  iTunes and iPod are trademarks of Apple
+|
+|  This product is not supported/written/published by Apple!
+|
+|  $Id$
+*/
+
 #ifndef __DISPLAY_COVERART_H__
 #define __DISPLAY_COVERART_H__
 
@@ -54,6 +82,7 @@
 GList *coverart_get_displayed_tracks (void);
 GdkPixbuf *coverart_get_default_track_thumb (void);
 void coverart_init (gchar *progpath);
+void force_update_covers ();
 void coverart_select_cover (Itdb_Track *track);
 void coverart_set_images (gboolean clear_track_list);
 void coverart_track_changed (Track *track, gint signal);

Modified: gtkpod/branches/photo_support_branch/src/display_itdb.c
===================================================================
--- gtkpod/branches/photo_support_branch/src/display_itdb.c     2007-07-13 
23:13:48 UTC (rev 1641)
+++ gtkpod/branches/photo_support_branch/src/display_itdb.c     2007-07-13 
23:28:05 UTC (rev 1642)
@@ -45,6 +45,7 @@
 #include "info.h"
 #include "prefs.h"
 #include "syncdir.h"
+#include "display_photo.h"
 
 
 /* A struct containing a list with available iTunesDBs. A pointer to
@@ -553,7 +554,7 @@
     g_return_val_if_fail (pl_name, pl);
     pl = itdb_playlist_by_name (itdb, pl_name);
     if (pl)
-    {   /* check if the it's the same type (spl or normal) */
+    {   /* check if it's the same type (spl or normal) */
        if (pl->is_spl == spl) return pl;
     }
     /* Create a new playlist */
@@ -803,6 +804,13 @@
     if (!track->tvshow)          track->tvshow = g_strdup("");
     if (!track->tvepisode)       track->tvepisode = g_strdup("");
     if (!track->tvnetwork)       track->tvnetwork = g_strdup("");
+    if (!track->albumartist)     track->albumartist = g_strdup ("");
+    if (!track->sort_artist)     track->sort_artist = g_strdup ("");
+    if (!track->sort_title)      track->sort_title = g_strdup ("");
+    if (!track->sort_album)      track->sort_album = g_strdup ("");
+    if (!track->sort_albumartist)track->sort_albumartist = g_strdup ("");
+    if (!track->sort_composer)   track->sort_composer = g_strdup ("");
+    if (!track->sort_tvshow)     track->sort_tvshow = g_strdup ("");
     if (!etr->pc_path_utf8)      etr->pc_path_utf8 = g_strdup ("");
     if (!etr->pc_path_locale)    etr->pc_path_locale = g_strdup ("");
     if (!etr->thumb_path_utf8)   etr->thumb_path_utf8 = g_strdup ("");
@@ -1029,8 +1037,23 @@
                pl->podcastflag = 0;
            }
        }
+       
+       /* Add the photo playlist onto IPOD itdb if the
+        * IPOD supports photos
+        */
+       if ((type & GP_ITDB_TYPE_IPOD) && gp_photodb_ipod_supports_photos 
(itdb))
+       {   /* add photo playlist */
+               printf ("Photos supported. Adding node\n");
+         pl = gp_playlist_new (_("Photos"), FALSE);
+         pl->type = GP_PL_TYPE_PHOTO;
+               itdb_playlist_add (itdb, pl, -1);
+         eitdb = itdb->userdata;
+         g_return_val_if_fail (eitdb, NULL);
+         eitdb->data_changed = FALSE;
+       }
+               
        g_free (cfgdir);
-    }
+  }
     return itdb;
 }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to