diff src/skins/ui_playlist.c @ 3159:1ffcad5f406c

import new skins plugin
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Fri, 22 May 2009 23:18:48 +0900
parents 9978be206b93
children
line wrap: on
line diff
--- a/src/skins/ui_playlist.c	Fri May 01 16:59:54 2009 -0400
+++ b/src/skins/ui_playlist.c	Fri May 22 23:18:48 2009 +0900
@@ -23,8 +23,7 @@
  *  Audacious or using our public API to be a derived work.
  */
 
-#define AUD_DEBUG 1
-#define CONDSCAN 1
+/* #define AUD_DEBUG 1 */
 
 #include "ui_playlist.h"
 
@@ -60,8 +59,6 @@
 #include "icons-stock.h"
 #include "images/audacious_playlist.xpm"
 
-#include <audlegacy/main.h>
-
 GtkWidget *playlistwin;
 
 static GMutex *resize_mutex = NULL;
@@ -89,10 +86,6 @@
 static gboolean playlistwin_resizing = FALSE;
 static gint playlistwin_resize_x, playlistwin_resize_y;
 
-/* #if CONDSCAN */
-/* extern GCond *cond_scan; */
-/* #endif */
-
 gboolean
 playlistwin_is_shaded(void)
 {
@@ -257,11 +250,8 @@
 {
     if (UI_SKINNED_IS_PLAYLIST(playlistwin_list))
         UI_SKINNED_PLAYLIST(playlistwin_list)->first = toprow;
-#if CONDSCAN
-    GCond *cond_scan = aud_get_cond_scan();
-    AUDDBG("cond_scan = %p\n", cond_scan);
-    if(cond_scan)
-        g_cond_signal(cond_scan);
+#if 0
+    g_cond_signal(cond_scan);
 #endif
     playlistwin_update_list(aud_playlist_get_active());
 }
@@ -962,11 +952,8 @@
 
     if (event->direction == GDK_SCROLL_UP)
         playlistwin_scroll(-config.scroll_pl_by);
-#if CONDSCAN
-    GCond *cond_scan = aud_get_cond_scan();
-    AUDDBG("cond_scan = %p\n", cond_scan);
-    if(cond_scan)
-        g_cond_signal(cond_scan);
+#if 0
+    g_cond_signal(cond_scan);
 #endif
 }
 
@@ -1068,7 +1055,7 @@
 static gboolean
 playlistwin_delete(GtkWidget * w, gpointer data)
 {
-    playlistwin_hide();
+    playlistwin_show (0);
     return TRUE;
 }
 
@@ -1246,15 +1233,12 @@
     default:
         return FALSE;
     }
-#if CONDSCAN
     if (refresh) {
-        GCond *cond_scan = aud_get_cond_scan();
-        AUDDBG("cond_scan = %p\n", cond_scan);
-        if(cond_scan)
-            g_cond_signal(cond_scan);
+#if 0
+        g_cond_signal(cond_scan);
+#endif
         playlistwin_update_list(aud_playlist_get_active());
     }
-#endif
     return TRUE;
 }
 
@@ -1359,6 +1343,11 @@
     aud_playlist_next(aud_playlist_get_active());
 }
 
+static void playlistwin_hide (void)
+{
+    playlistwin_show (0);
+}
+
 static void
 playlistwin_create_widgets(void)
 {
@@ -1565,17 +1554,9 @@
     gtk_window_add_accel_group(GTK_WINDOW(playlistwin), ui_manager_get_accel_group());
 }
 
-
-void
-playlistwin_show(void)
+static void playlistwin_real_show (void)
 {
-    GtkAction *action = gtk_action_group_get_action(
-      toggleaction_group_others , "show playlist editor" );
-
     gtk_window_move(GTK_WINDOW(playlistwin), config.playlist_x, config.playlist_y);
-    gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , TRUE );
-
-    config.playlist_visible = TRUE;
     ui_skinned_button_set_inside(mainwin_pl, TRUE);
 
     playlistwin_set_toprow(0);
@@ -1586,15 +1567,9 @@
     gtk_window_present(GTK_WINDOW(playlistwin));
 }
 
-void
-playlistwin_hide(void)
+static void playlistwin_real_hide (void)
 {
-    GtkAction *action = gtk_action_group_get_action(
-      toggleaction_group_others , "show playlist editor" );
-    gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , FALSE );
-
     gtk_widget_hide(playlistwin);
-    config.playlist_visible = FALSE;
     ui_skinned_button_set_inside(mainwin_pl, FALSE);
 
     if ( config.player_visible )
@@ -1604,6 +1579,26 @@
     }
 }
 
+void playlistwin_show (char show)
+{
+    GtkAction * a;
+
+    a = gtk_action_group_get_action (toggleaction_group_others, "show playlist editor");
+
+    if (a && gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (a)) != show)
+        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (a), show);
+    else
+    {
+        config.playlist_visible = show;
+        aud_cfg->playlist_visible = show;
+
+        if (show)
+           playlistwin_real_show ();
+        else
+           playlistwin_real_hide ();
+   }
+}
+
 void action_playlist_track_info(void)
 {
     playlistwin_fileinfo();