changeset 1302:ade29d1d53fa trunk

[svn] fetch first jpeg/png in directory, hopefully is album image.. merged again, still needs fileinfo, maybe, and undoubtedly tweaking. but bedtime dammit.
author nemo
date Sun, 18 Jun 2006 23:06:45 -0700
parents 0b0e00851054
children a9aba74678fc
files ChangeLog audacious/ui_fileinfo.c
diffstat 2 files changed, 43 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jun 18 22:36:26 2006 -0700
+++ b/ChangeLog	Sun Jun 18 23:06:45 2006 -0700
@@ -1,3 +1,12 @@
+2006-06-19 05:36:26 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [1514]
+  - disable the psychoaccoustic modeller as it is too screwy right now, and I don't wish to fix it at this point
+  
+
+  Changes:        Modified:
+  +1 -1           trunk/Plugins/Input/mpg123/Makefile.in  
+
+
 2006-06-19 05:28:47 +0000  William Pitcock <nenolod@nenolod.net>
   revision [1512]
   - don't call filepopup_show_for_tuple() more than once
--- a/audacious/ui_fileinfo.c	Sun Jun 18 22:36:26 2006 -0700
+++ b/audacious/ui_fileinfo.c	Sun Jun 18 23:06:45 2006 -0700
@@ -67,6 +67,9 @@
 GtkWidget *fileinfo_win;
 GtkWidget *filepopup_win;
 
+void *p;  /* not as useful now that check on popup window is done */
+gchar *cur_dir;  /* only one album image per directory, no need to look again */
+
 /* XXX: possible cover names, we need a better solution than this */
 static gchar *artwork_fn[] = { "cover.jpg", "Cover.jpg", "cover.JPG", "Cover.JPG", NULL };
 
@@ -251,7 +254,6 @@
 	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");
 
 	gtk_window_resize(GTK_WINDOW(filepopup_win), 1, 1);
 }
@@ -340,13 +342,19 @@
 filepopup_show_for_tuple(TitleInput *tuple)
 {
 	gchar *tmp;
-	gint i;
+	GDir *d;
 
 	if (tuple == NULL)
 		return;
 
 	gtk_widget_realize(filepopup_win);
 
+	if (p == tuple)
+	{
+		gtk_widget_show(filepopup_win);
+		return;
+	}
+
 	filepopup_entry_set_text("label_title", tuple->track_name);
 	filepopup_entry_set_text("label_artist", tuple->performer);
 	filepopup_entry_set_text("label_album", tuple->album_name);
@@ -359,17 +367,33 @@
 	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);
+	if (!cur_dir || strcmp(cur_dir,tuple->file_path)!=0)
+	{	
+		cur_dir = tuple->file_path;
+		d = g_dir_open(cur_dir,0,NULL);
+		if (d)
+		{	
+			const gchar *f = g_dir_read_name(d);
+			while(f)
+			{
+				/* ok. why did I not have strcasestr, thought glib had that one */
+				if (strstr(f,".jpg") || strstr(f,".jpeg") || strstr(f,".png") || strstr(f,".JPG") || strstr(f,".JPEG") || strstr(f,".PNG"))
+				{
+					tmp = g_strdup_printf("%s/%s", cur_dir, f);
+					filepopup_entry_set_image("image_artwork", tmp);
+					f = NULL;
+				}
+				else
+				{
+					f = g_dir_read_name(d);
+				}
+			}
+			g_dir_close(d);
+		}
 	}
 
 	gtk_widget_show(filepopup_win);
+	p = tuple;
 }
 
 void