changeset 1296:b7d8e6e77ba6 trunk

[svn] - initial album art support
author nenolod
date Sun, 18 Jun 2006 21:35:32 -0700
parents 62159c1b5a3b
children f2e1a954237f
files ChangeLog audacious/ui_fileinfo.c
diffstat 2 files changed, 67 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jun 18 03:03:40 2006 -0700
+++ b/ChangeLog	Sun Jun 18 21:35:32 2006 -0700
@@ -1,3 +1,12 @@
+2006-06-18 10:03:40 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [1502]
+  - roll back difftable changes (apparently we had them mathematically wrong for a reason)
+  
+
+  Changes:        Modified:
+  +3 -2           trunk/Plugins/Input/mpg123/layer3.c  
+
+
 2006-06-18 09:58:34 +0000  William Pitcock <nenolod@nenolod.net>
   revision [1500]
   - that didn't work to plan
--- a/audacious/ui_fileinfo.c	Sun Jun 18 03:03:40 2006 -0700
+++ b/audacious/ui_fileinfo.c	Sun Jun 18 21:35:32 2006 -0700
@@ -67,6 +67,9 @@
 GtkWidget *fileinfo_win;
 GtkWidget *filepopup_win;
 
+/* XXX: possible cover names, we need a better solution than this */
+static gchar *artwork_fn[] = { "cover.jpg", "Cover.jpg", "cover.JPG", "Cover.JPG", NULL };
+
 static void
 fileinfo_entry_set_text(const char *entry, const char *text)
 {
@@ -94,6 +97,18 @@
 }
 
 static void
+fileinfo_entry_set_image(const char *entry, const char *text)
+{
+	GladeXML *xml = g_object_get_data(G_OBJECT(fileinfo_win), "glade-xml");
+	GtkWidget *widget = glade_xml_get_widget(xml, entry);
+
+	if (xml == NULL || widget == NULL)
+		return;
+
+	gtk_image_set_from_file(GTK_IMAGE(widget), text);
+}
+
+static void
 filepopup_entry_set_text(const char *entry, const char *text)
 {
 	GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml");
@@ -106,6 +121,18 @@
 }
 
 static void
+filepopup_entry_set_image(const char *entry, const char *text)
+{
+	GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml");
+	GtkWidget *widget = glade_xml_get_widget(xml, entry);
+
+	if (xml == NULL || widget == NULL)
+		return;
+
+	gtk_image_set_from_file(GTK_IMAGE(widget), text);
+}
+
+static void
 filepopup_entry_set_text_free(const char *entry, char *text)
 {
 	GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml");
@@ -187,6 +214,11 @@
 	filepopup_entry_set_text("label_title", "");
 	filepopup_entry_set_text("label_artist", "");
 	filepopup_entry_set_text("label_album", "");
+	filepopup_entry_set_text("label_genre", "");
+	filepopup_entry_set_text("label_track", "");
+	filepopup_entry_set_text("label_year", "");
+	filepopup_entry_set_text("label_length", "");
+	filepopup_entry_set_image("image_artwork", DATA_DIR "/images/audio.png");
 }
 
 void
@@ -235,6 +267,9 @@
 void
 fileinfo_show_for_tuple(TitleInput *tuple)
 {
+	gchar *tmp;
+	gint i;
+
 	if (tuple == NULL)
 		return;
 
@@ -253,12 +288,25 @@
 	if (tuple->track_number != 0)
 		fileinfo_entry_set_text_free("entry_track", g_strdup_printf("%d", tuple->track_number));
 
+	for (i = 0; artwork_fn[i] != NULL; i++)
+	{
+		tmp = g_strdup_printf("%s/%s", tuple->file_path, artwork_fn[i]);
+
+		if (g_file_test(tmp, G_FILE_TEST_EXISTS))
+			fileinfo_entry_set_image("image_artwork", tmp);
+
+		g_free(tmp);
+	}
+
 	gtk_widget_show(fileinfo_win);
 }
 
 void
 filepopup_show_for_tuple(TitleInput *tuple)
 {
+	gchar *tmp;
+	gint i;
+
 	if (tuple == NULL)
 		return;
 
@@ -276,6 +324,16 @@
 	if (tuple->track_number != 0)
 		filepopup_entry_set_text_free("label_track", g_strdup_printf("%d", tuple->track_number));
 
+	for (i = 0; artwork_fn[i] != NULL; i++)
+	{
+		tmp = g_strdup_printf("%s/%s", tuple->file_path, artwork_fn[i]);
+
+		if (g_file_test(tmp, G_FILE_TEST_EXISTS))
+			filepopup_entry_set_image("image_artwork", tmp);
+
+		g_free(tmp);
+	}
+
 	gtk_widget_show(filepopup_win);
 }