Revision: 1995
http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1995&view=rev
Author: teuf
Date: 2008-05-30 06:19:57 -0700 (Fri, 30 May 2008)
Log Message:
-----------
* src/details.c:
* src/display_coverart.c:
* src/display_itdb.c:
* src/display_photo.c:
* src/file.c:
* src/file_itunesdb.c:
* src/misc_track.c: adjust to libgpod API changes (use
itdb_track_has_thumbnail and itdb_track_get_thumbnail instead of using
deprecated API and struct members)
Modified Paths:
--------------
gtkpod/trunk/ChangeLog
gtkpod/trunk/src/details.c
gtkpod/trunk/src/display_coverart.c
gtkpod/trunk/src/display_itdb.c
gtkpod/trunk/src/display_photo.c
gtkpod/trunk/src/file.c
gtkpod/trunk/src/file_itunesdb.c
gtkpod/trunk/src/misc_track.c
Modified: gtkpod/trunk/ChangeLog
===================================================================
--- gtkpod/trunk/ChangeLog 2008-05-30 13:00:24 UTC (rev 1994)
+++ gtkpod/trunk/ChangeLog 2008-05-30 13:19:57 UTC (rev 1995)
@@ -1,3 +1,15 @@
+2008-05-30 Christophe Fergeau <teuf at gnome.org>
+
+ * src/details.c:
+ * src/display_coverart.c:
+ * src/display_itdb.c:
+ * src/display_photo.c:
+ * src/file.c:
+ * src/file_itunesdb.c:
+ * src/misc_track.c: adjust to libgpod API changes (use
+ itdb_track_has_thumbnail and itdb_track_get_thumbnail instead of using
+ deprecated API and struct members)
+
2008-05-29 P.G. Richardson <phantom_sf at users.sourceforge.net>
* src/fetchcover.c
Modified: gtkpod/trunk/src/details.c
===================================================================
--- gtkpod/trunk/src/details.c 2008-05-30 13:00:24 UTC (rev 1994)
+++ gtkpod/trunk/src/details.c 2008-05-30 13:19:57 UTC (rev 1995)
@@ -571,7 +571,7 @@
}
/* make sure artwork gets removed, even if both thumb_paths were
unset ("") */
- if (!frtrack->artwork->thumbnails)
+ if (!itdb_track_has_thumbnails (frtrack))
{
changed |= gp_track_remove_thumbnails (totrack);
}
@@ -1286,12 +1286,12 @@
{
Track *tr = gl->data;
g_return_if_fail (tr);
- remove_artwork |= (tr->artwork->thumbnails != NULL);
+ remove_artwork |= itdb_track_has_thumbnails (tr);
}
}
else
{
- remove_artwork = (detail->track->artwork->thumbnails != NULL);
+ remove_artwork = (itdb_track_has_thumbnails (detail->track));
}
i = g_list_index (detail->tracks, detail->track);
g_return_if_fail (i != -1);
@@ -1354,7 +1354,6 @@
/* Update the displayed thumbnail */
void details_update_thumbnail (Detail *detail)
{
- Thumb *thumb;
GtkImage *img;
g_return_if_fail (detail);
@@ -1368,25 +1367,18 @@
{
detail->artwork_ok = TRUE;
/* Get large cover */
- thumb = itdb_artwork_get_thumb_by_type (detail->track->artwork,
- ITDB_THUMB_COVER_LARGE);
- if (thumb)
- {
- GdkPixbuf *pixbuf;
- pixbuf = itdb_thumb_get_gdk_pixbuf (detail->itdb->device,
- thumb);
- if (pixbuf)
- {
- gtk_image_set_from_pixbuf (img, pixbuf);
- gdk_pixbuf_unref (pixbuf);
- }
- else
- {
- gtk_image_set_from_stock (img, GTK_STOCK_DIALOG_WARNING,
- GTK_ICON_SIZE_DIALOG);
- detail->artwork_ok = FALSE;
- }
- }
+ GdkPixbuf *pixbuf = itdb_track_get_thumbnail (detail->track, 200, 200);
+ if (pixbuf)
+ {
+ gtk_image_set_from_pixbuf (img, pixbuf);
+ gdk_pixbuf_unref (pixbuf);
+ }
+ else
+ {
+ gtk_image_set_from_stock (img, GTK_STOCK_DIALOG_WARNING,
+ GTK_ICON_SIZE_DIALOG);
+ detail->artwork_ok = FALSE;
+ }
details_set_item (detail, detail->track, T_THUMB_PATH);
}
Modified: gtkpod/trunk/src/display_coverart.c
===================================================================
--- gtkpod/trunk/src/display_coverart.c 2008-05-30 13:00:24 UTC (rev 1994)
+++ gtkpod/trunk/src/display_coverart.c 2008-05-30 13:19:57 UTC (rev 1995)
@@ -1449,7 +1449,6 @@
{
GdkPixbuf *pixbuf = NULL;
GdkPixbuf *image = NULL;
- Thumb *thumb;
ExtraTrackData *etd;
gint w, h;
float ratio;
@@ -1457,11 +1456,9 @@
etd = track->userdata;
g_return_val_if_fail (etd, NULL);
- thumb = itdb_artwork_get_thumb_by_type (track->artwork,
- ITDB_THUMB_COVER_LARGE);
- if (thumb)
- {
- image = itdb_thumb_get_gdk_pixbuf (device, thumb);
+ image = itdb_track_get_thumbnail (track, 200, 200);
+ if (image)
+ {
w = gdk_pixbuf_get_width (image);
h = gdk_pixbuf_get_height (image);
Modified: gtkpod/trunk/src/display_itdb.c
===================================================================
--- gtkpod/trunk/src/display_itdb.c 2008-05-30 13:00:24 UTC (rev 1994)
+++ gtkpod/trunk/src/display_itdb.c 2008-05-30 13:19:57 UTC (rev 1995)
@@ -416,7 +416,7 @@
etr = track->userdata;
g_return_val_if_fail (etr, FALSE);
- if (track->artwork->thumbnails)
+ if (itdb_track_has_thumbnails (track))
changed = TRUE;
itdb_track_remove_thumbnails (track);
Modified: gtkpod/trunk/src/display_photo.c
===================================================================
--- gtkpod/trunk/src/display_photo.c 2008-05-30 13:00:24 UTC (rev 1994)
+++ gtkpod/trunk/src/display_photo.c 2008-05-30 13:19:57 UTC (rev 1995)
@@ -86,15 +86,6 @@
{ "STRING", 0, DND_TEXT_PLAIN }
};
-/* Photo types to try and use in displaying thumbnails */
-static gint photo_types[] = {
- ITDB_THUMB_PHOTO_SMALL,
- ITDB_THUMB_PHOTO_LARGE,
- ITDB_THUMB_PHOTO_FULL_SCREEN,
- ITDB_THUMB_PHOTO_TV_SCREEN
- };
-static gint PHOTO_TYPES_SIZE = 4;
-
/* Declarations */
static void gphoto_create_albumview();
static void gphoto_create_thumbnailview();
@@ -681,49 +672,16 @@
*/
static void gphoto_display_photo_preview(Artwork *artwork)
{
- Thumb *thumb = NULL;
- GdkPixbuf *pixbuf, *scaled;
- gint width, height;
- gdouble ratio;
- gint i;
+ GdkPixbuf *pixbuf;
g_return_if_fail (artwork);
- for (i = (PHOTO_TYPES_SIZE - 1); i >= 0 && thumb == NULL; --i)
- {
- /* Start from biggest photo type and go smaller */
- thumb = itdb_artwork_get_thumb_by_type (artwork,
photo_types[i]);
- }
-
- /* should have a thumb now but check anyway and fire off a warning if
it is still null */
- g_return_if_fail (thumb);
-
- pixbuf = itdb_thumb_get_gdk_pixbuf (device, thumb);
+ pixbuf = itdb_artwork_get_pixbuf (device, artwork,
+ PHOTO_FULL_SCREEN_WIDTH,
+ PHOTO_FULL_SCREEN_HEIGHT);
g_return_if_fail (pixbuf);
- /* Size of the preview GtkImage is set to 220x176, technically
- * the same as PHOTO_FULL_SCREEN for a normal ipod.
- */
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
- ratio = (gdouble) width / (gdouble) height;
-
- if (height > PHOTO_FULL_SCREEN_HEIGHT)
- {
- height = PHOTO_FULL_SCREEN_HEIGHT;
- width = ratio * height;
- }
-
- if (width > PHOTO_FULL_SCREEN_WIDTH)
- {
- width = PHOTO_FULL_SCREEN_WIDTH;
- height = width / ratio;
- }
-
- scaled = gdk_pixbuf_scale_simple (pixbuf, width, height,
GDK_INTERP_NEAREST);
- gdk_pixbuf_unref (pixbuf);
-
- gtk_image_set_from_pixbuf (photo_preview_image, scaled);
+ gtk_image_set_from_pixbuf (photo_preview_image, pixbuf);
gtk_misc_set_padding (GTK_MISC(photo_preview_image), 20, 20);
gdk_pixbuf_unref (scaled);
}
@@ -861,55 +819,23 @@
static void gphoto_add_image_to_iconview(Artwork *photo, gint index)
{
GdkPixbuf *pixbuf= NULL;
- GdkPixbuf *scaled = NULL;
- Thumb *thumb= NULL;
GtkListStore *model= NULL;
GtkTreeIter iter;
- gint i;
/* default sizes taken from smallest photo image type in
itdb_device.c */
gint icon_width = 42, icon_height = 30;
- gfloat pixbuf_width, pixbuf_height;
- gfloat ratio;
g_return_if_fail (photo);
model = GTK_LIST_STORE (gtk_icon_view_get_model
(thumbnail_view));
- for (i = 0; i < PHOTO_TYPES_SIZE && thumb == NULL; ++i)
- {
- thumb = itdb_artwork_get_thumb_by_type (photo,
photo_types[i]);
- }
-
- /* should have a thumb now but check anyway and fire off a
warning if it is still null */
- g_return_if_fail (thumb);
-
- pixbuf = itdb_thumb_get_gdk_pixbuf (device, thumb);
+ pixbuf = itdb_artwork_get_pixbuf (device, photo, icon_width,
icon_height);
g_return_if_fail (pixbuf);
- pixbuf_width = gdk_pixbuf_get_width (pixbuf);
- pixbuf_height = gdk_pixbuf_get_height (pixbuf);
- ratio = pixbuf_width / pixbuf_height;
-
- if (pixbuf_width > icon_width)
- {
- pixbuf_width = icon_width;
- pixbuf_height = pixbuf_width / ratio;
- }
-
- if (pixbuf_height > icon_height)
- {
- pixbuf_height = icon_height;
- pixbuf_width = pixbuf_height * ratio;
- }
-
- scaled = gdk_pixbuf_scale_simple(pixbuf, pixbuf_width,
pixbuf_height, GDK_INTERP_NEAREST);
- gdk_pixbuf_unref (pixbuf);
-
gchar *index_str= NULL;
index_str = g_strdup_printf ("%d", index);
/* Add a new row to the model */
gtk_list_store_append (model, &iter);
- gtk_list_store_set (model, &iter, COL_THUMB_NAIL, scaled,
COL_THUMB_FILENAME, index_str, COL_THUMB_ARTWORK, photo, -1);
+ gtk_list_store_set (model, &iter, COL_THUMB_NAIL, pixbuf,
COL_THUMB_FILENAME, index_str, COL_THUMB_ARTWORK, photo, -1);
gdk_pixbuf_unref (scaled);
g_free (index_str);
}
@@ -1439,8 +1365,6 @@
GtkTreeIter iter;
Artwork *artwork = NULL;
GdkPixbuf * pixbuf;
- gint i;
- Thumb *thumb = NULL;
/* Find which images are selected */
selected_images = gtk_icon_view_get_selected_items
(GTK_ICON_VIEW(thumbnail_view));
@@ -1457,16 +1381,7 @@
gtk_tree_model_get_iter (model, &iter, treePath);
gtk_tree_model_get (model, &iter, COL_THUMB_ARTWORK, &artwork, -1);
- /* Find the biggest thumb that exists on the pod */
- for (i = (PHOTO_TYPES_SIZE - 1); i >= 0 && thumb == NULL; --i)
- {
- /* Start from biggest photo type and go smaller */
- thumb = itdb_artwork_get_thumb_by_type (artwork,
photo_types[i]);
- }
- /* should have a thumb now but check anyway and fire off a warning if
it is still null */
- g_return_if_fail (thumb);
-
- pixbuf = itdb_thumb_get_gdk_pixbuf (device, thumb);
+ pixbuf = itdb_artwork_get_pixbuf (device, artwork, -1, -1);
g_return_if_fail (pixbuf);
display_image_dialog (pixbuf);
Modified: gtkpod/trunk/src/file.c
===================================================================
--- gtkpod/trunk/src/file.c 2008-05-30 13:00:24 UTC (rev 1994)
+++ gtkpod/trunk/src/file.c 2008-05-30 13:19:57 UTC (rev 1995)
@@ -1398,7 +1398,7 @@
if (prefs_get_int("coverart_file"))
{
/* APIC data takes precedence */
- if (!nti->artwork || !nti->artwork->thumbnails)
+ if (itdb_track_has_thumbnails (nti))
add_coverart (nti);
}
Modified: gtkpod/trunk/src/file_itunesdb.c
===================================================================
--- gtkpod/trunk/src/file_itunesdb.c 2008-05-30 13:00:24 UTC (rev 1994)
+++ gtkpod/trunk/src/file_itunesdb.c 2008-05-30 13:19:57 UTC (rev 1995)
@@ -605,7 +605,7 @@
{ /* if has_artwork is not set (0x00), or it has been
(potentially wrongly) set to 0x02 by gtkpod V0.99 or
smaller, determine the correct(?) value */
- if (track->artwork->thumbnails)
+ if (itdb_track_has_thumbnails (track))
track->has_artwork = 0x01;
else
track->has_artwork = 0x02;
@@ -615,7 +615,7 @@
if (track->mediatype == 0)
track->mediatype = 0x00000001;
/* restore deleted thumbnails */
- if ((track->artwork->thumbnails == NULL) &&
+ if ((!itdb_track_has_thumbnails (track)) &&
(strlen (etr->thumb_path_locale) != 0))
{
/* !! gp_track_set_thumbnails() writes on
Modified: gtkpod/trunk/src/misc_track.c
===================================================================
--- gtkpod/trunk/src/misc_track.c 2008-05-30 13:00:24 UTC (rev 1994)
+++ gtkpod/trunk/src/misc_track.c 2008-05-30 13:19:57 UTC (rev 1995)
@@ -1345,7 +1345,7 @@
{ /* no path set */
g_free (text);
text = NULL;
- if (track->artwork && track->artwork->thumbnails)
+ if (itdb_track_has_thumbnails (track))
{ /* artwork is set */
text = g_strdup (_("Embedded or filename was lost"));
}
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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2