Update of /cvsroot/gtkpod/gtkpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv19611/src
Modified Files:
display_coverart.c fetchcover.c display_coverart.h
Log Message:
* removed calls to itdb_thumb_get_filename() from fetchcover.c and
display_coverart.c
* corrected behaviour of coverart display slider if only one album
is in the selected playlist
Index: display_coverart.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_coverart.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- display_coverart.c 15 Apr 2007 13:27:42 -0000 1.9
+++ display_coverart.c 16 Apr 2007 21:57:57 -0000 1.10
@@ -550,11 +550,12 @@
}
/**
+ * coverart_display_big_artwork:
*
* Display a big version of the artwork in a dialog
*
*/
-void coverart_display_big_artwork (GList *tracks)
+void coverart_display_big_artwork ()
{
GtkWidget *dialog;
Cover_Item *cover;
@@ -574,35 +575,27 @@
g_free (text);
- /* Get the filename of the cover art from the track's thumb */
- Itdb_Thumb *thumb = itdb_artwork_get_thumb_by_type
(cover->track->artwork, ITDB_THUMB_COVER_LARGE);
- GError *error = NULL;
- if (thumb)
+ ExtraTrackData *etd;
+
+ etd = cover->track->userdata;
+ if (etd && etd->thumb_path_locale)
{
- gchar *artpath = itdb_thumb_get_filename
(cover->track->itdb->device, thumb);
- if (g_str_has_suffix (artpath, ".ithmb"))
+ GError *error = NULL;
+ imgbuf = gdk_pixbuf_new_from_file(etd->thumb_path_locale,
&error);
+ if (error != NULL)
{
- /* playlist is on the ipod so display the file as
appears on ipod */
+ printf("Error occurred loading the image file - \nCode:
%d\nMessage: %s\n", error->code, error->message);
+ /* Artwork failed to load from file so try loading
default */
imgbuf = coverart_get_track_thumb (cover->track,
cover->track->itdb->device);
+ g_error_free (error);
}
- else
- {
- /* image is maybe in local playlist so should be normal
file */
- imgbuf = gdk_pixbuf_new_from_file(artpath, &error);
- if (error != NULL)
- {
- printf("Error occurred loading the image file -
\nCode: %d\nMessage: %s\n", error->code, error->message);
- /* Artwork failed to load from file so try
loading default */
- imgbuf = coverart_get_default_track_thumb ();
- g_error_free (error);
- }
- }
- g_free(artpath);
}
else
{
- /* No thumb extractable from track */
- imgbuf = coverart_get_default_track_thumb ();
+ /* No thumb path available, fall back to getting the small
thumbnail
+ * and if that fails, the default thumbnail image.
+ */
+ imgbuf = coverart_get_track_thumb (cover->track,
cover->track->itdb->device);
}
gint pixheight = gdk_pixbuf_get_height (imgbuf);
@@ -1339,8 +1332,26 @@
* track list length - (8 NULL images + 1 as index value),
* ie. the ones either end of the list.
*/
- gtk_range_set_range (GTK_RANGE (cdwidget->cdslider), 0, g_list_length
(cdwidget->displaytracks) - 9);
+ gint slider_ubound = g_list_length (cdwidget->displaytracks) - 9;
+ if(slider_ubound < 1)
+ {
+ /* If only one album cover is displayed then slider_ubbound
returns
+ * 0 and causes a slider assertion error. Avoid this by
disabling the
+ * slider, which makes sense because only one cover is
displayed.
+ */
+ slider_ubound = 1;
+ gtk_widget_set_sensitive (GTK_WIDGET(cdwidget->cdslider),
FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET(cdwidget->leftbutton),
FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET(cdwidget->rightbutton),
FALSE);
+ }
+ else
+ {
+ gtk_widget_set_sensitive (GTK_WIDGET(cdwidget->cdslider), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET(cdwidget->leftbutton),
TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET(cdwidget->rightbutton),
TRUE);
+ }
+ gtk_range_set_range (GTK_RANGE (cdwidget->cdslider), 0, slider_ubound);
gtk_range_set_value (GTK_RANGE (cdwidget->cdslider), 0);
/*printf("######### ORIGINAL LINE UP ########\n");
Index: fetchcover.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/fetchcover.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- fetchcover.c 16 Apr 2007 19:59:22 -0000 1.3
+++ fetchcover.c 16 Apr 2007 21:57:57 -0000 1.4
@@ -647,45 +647,26 @@
fetchcover_xml = glade_xml_new (xml_file, "fetchcover_dialog", NULL);
fetchcover_dialog = gtkpod_xml_get_widget (fetchcover_xml,
"fetchcover_dialog");
- gboolean trkartfail = FALSE;
- GError *error = NULL;
- /* Find the image cover from the track */
- Itdb_Thumb *thumb = itdb_artwork_get_thumb_by_type (track->artwork,
ITDB_THUMB_COVER_LARGE);
- if(thumb == NULL)
- thumb = itdb_artwork_get_thumb_by_type (track->artwork,
ITDB_THUMB_COVER_SMALL);
-
- if (thumb)
+ ExtraTrackData *etd;
+ etd = track->userdata;
+ if (etd && etd->thumb_path_locale)
{
- gchar *artpath = itdb_thumb_get_filename (device, thumb);
- if (g_str_has_suffix (artpath, ".ithmb"))
- {
- /* playlist is on the ipod so display the file as
appears on ipod */
- imgbuf = coverart_get_track_thumb (track, device);
- }
- else
- {
- imgbuf = gdk_pixbuf_new_from_file(artpath, &error);
- }
-
+ GError *error = NULL;
+ imgbuf = gdk_pixbuf_new_from_file(etd->thumb_path_locale,
&error);
if (error != NULL)
{
- printf("Error occurred loading the artwork file -
\nCode: %d\nMessage: %s\n", error->code, error->message);
- /* Artwork failed to load from file */
- trkartfail = TRUE;
+ printf("Error occurred loading the image file - \nCode:
%d\nMessage: %s\n", error->code, error->message);
+ /* Artwork failed to load from file so try loading
default */
+ imgbuf = coverart_get_track_thumb (track, device);
g_error_free (error);
}
- g_free(artpath);
}
else
{
- /* No thumb extractable from track */
- trkartfail = TRUE;
- }
-
- if (trkartfail)
- {
- /* Track art failed in some way so load the default file
instead */
- imgbuf = coverart_get_default_track_thumb ();
+ /* No thumb path available, fall back to getting the small
thumbnail
+ * and if that fails, the default thumbnail image.
+ */
+ imgbuf = coverart_get_track_thumb (track, device);
}
/* Add the cover to the image list */
Index: display_coverart.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_coverart.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- display_coverart.h 15 Apr 2007 13:27:42 -0000 1.5
+++ display_coverart.h 16 Apr 2007 21:57:57 -0000 1.6
@@ -41,7 +41,7 @@
extern const gchar *DISPLAY_COVER_SHOW;
-void coverart_display_big_artwork (GList *tracks);
+void coverart_display_big_artwork ();
GList *coverart_get_displayed_tracks (void);
GdkPixbuf *coverart_get_default_track_thumb (void);
void coverart_init (gchar *progpath);
-------------------------------------------------------------------------
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