changeset 2351:911743d27aba trunk

[svn] - simplify and optimize the metadata tooltip trigger function
author giacomo
date Tue, 16 Jan 2007 16:49:21 -0800
parents 54cb84d3a581
children 19c91d5731ab
files ChangeLog src/audacious/ui_fileinfopopup.c src/audacious/ui_playlist.c
diffstat 3 files changed, 28 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jan 16 11:12:11 2007 -0800
+++ b/ChangeLog	Tue Jan 16 16:49:21 2007 -0800
@@ -1,3 +1,10 @@
+2007-01-16 19:12:11 +0000  Jonathan Schleifer <js@h3c.de>
+  revision [3710]
+  D'oh. I was really too tired when I wrote this. Fixed stupid bugs.
+  trunk/migrate_config.sh |    8 ++++----
+  1 file changed, 4 insertions(+), 4 deletions(-)
+
+
 2007-01-16 18:35:30 +0000  Jonathan Schleifer <js@h3c.de>
   revision [3708]
   Replaced intricate part.
--- a/src/audacious/ui_fileinfopopup.c	Tue Jan 16 11:12:11 2007 -0800
+++ b/src/audacious/ui_fileinfopopup.c	Tue Jan 16 16:49:21 2007 -0800
@@ -361,15 +361,18 @@
 void
 audacious_fileinfopopup_hide(GtkWidget *filepopup_win, gpointer unused)
 {
-	gtk_widget_hide(filepopup_win);
+	if ( GTK_WIDGET_VISIBLE(filepopup_win) == TRUE )
+	{
+		gtk_widget_hide(filepopup_win);
 
-	filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_title", "");
-	filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_artist", "");
-	filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_album", "");
-	filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_genre", "");
-	filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_track", "");
-	filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_year", "");
-	filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_length", "");
+		filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_title", "");
+		filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_artist", "");
+		filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_album", "");
+		filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_genre", "");
+		filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_track", "");
+		filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_year", "");
+		filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_length", "");
 
-	gtk_window_resize(GTK_WINDOW(filepopup_win), 1, 1);
+		gtk_window_resize(GTK_WINDOW(filepopup_win), 1, 1);
+	}
 }
--- a/src/audacious/ui_playlist.c	Tue Jan 16 11:12:11 2007 -0800
+++ b/src/audacious/ui_playlist.c	Tue Jan 16 16:49:21 2007 -0800
@@ -70,7 +70,7 @@
 static gboolean playlistwin_hint_flag = FALSE;
 
 static GtkWidget *playlistwin_infopopup = NULL;
-static gint playlistwin_infopopup_sid = 0;
+static guint playlistwin_infopopup_sid = 0;
 
 static PlaylistSlider *playlistwin_slider = NULL;
 static TextBox *playlistwin_time_min, *playlistwin_time_sec;
@@ -1805,8 +1805,9 @@
     playlistwin_set_toprow(0);
     playlist_check_pos_current(playlist_get_active());
 
-    playlistwin_infopopup_sid = g_timeout_add(
-      50 , (GSourceFunc)playlistwin_fileinfopopup_probe , playlistwin_infopopup );
+    if ( playlistwin_infopopup_sid == 0 )
+      playlistwin_infopopup_sid = g_timeout_add(
+        50 , (GSourceFunc)playlistwin_fileinfopopup_probe , playlistwin_infopopup );
 
     gtk_widget_show(playlistwin);
 }
@@ -1824,7 +1825,10 @@
 
     /* no point in probing for playlistwin_infopopup trigger when the playlistwin is hidden */
     if ( playlistwin_infopopup_sid != 0 )
+    {
       g_source_remove( playlistwin_infopopup_sid );
+      playlistwin_infopopup_sid = 0;
+    }
 
     if ( cfg.player_visible )
     {
@@ -2183,9 +2187,7 @@
 	{
 		prev_pos = pos;
 		ctr = 0;
-                if ( GTK_WIDGET(filepopup_win)->window != NULL &&
-                     gdk_window_is_viewable(GDK_WINDOW(GTK_WIDGET(filepopup_win)->window)) )
-                  audacious_fileinfopopup_hide(GTK_WIDGET(filepopup_win), NULL);
+                audacious_fileinfopopup_hide(GTK_WIDGET(filepopup_win), NULL);
 		return TRUE;
 	}
 
@@ -2200,16 +2202,13 @@
 		return TRUE;
 	}
 
-	if (GTK_WIDGET(filepopup_win)->window == NULL)
-		skip = TRUE;
-
 	if (playlistwin_is_shaded()) {
 		shaded_pos = playlist_get_position(playlist);
 		if (shaded_prev_pos != shaded_pos)
 			skip = TRUE;
 	}
 
-        if (ctr >= cfg.filepopup_delay && (skip == TRUE || gdk_window_is_viewable(GDK_WINDOW(GTK_WIDGET(filepopup_win)->window)) != TRUE)) {
+        if (ctr >= cfg.filepopup_delay && (skip == TRUE || GTK_WIDGET_VISIBLE(GTK_WIDGET(filepopup_win)) != TRUE)) {
 		if (pos == -1 && !playlistwin_is_shaded()) {
 			audacious_fileinfopopup_hide(GTK_WIDGET(filepopup_win), NULL);
 			return TRUE;