changeset 4504:a47288ced5d5

- renamed some files to reflect their UI contents - use more hooks now to call stuff
author mf0102 <0102@gmx.at>
date Tue, 22 Apr 2008 10:55:35 +0200
parents 2d20d4fa57f4
children a849b8af8db6
files src/audacious/Makefile src/audacious/hints.c src/audacious/hints.h src/audacious/main.c src/audacious/playlist.c src/audacious/playlist_evlisteners.c src/audacious/playlist_evlisteners.h src/audacious/ui_equalizer.c src/audacious/ui_hints.c src/audacious/ui_hints.h src/audacious/ui_jumptotrack.c src/audacious/ui_main.c src/audacious/ui_main_evlisteners.c src/audacious/ui_playlist.c
diffstat 14 files changed, 118 insertions(+), 183 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/Makefile	Mon Apr 21 23:40:09 2008 +0300
+++ b/src/audacious/Makefile	Tue Apr 22 10:55:35 2008 +0200
@@ -18,7 +18,6 @@
        fft.c							\
        flow.c							\
        general.c						\
-       hints.c							\
        hook.c							\
        icons-stock.c					\
        input.c							\
@@ -31,7 +30,6 @@
        playback_evlisteners.c			\
        playlist.c						\
        playlist_container.c				\
-       playlist_evlisteners.c			\
        pluginenum.c						\
        rcfile.c							\
        signals.c						\
@@ -48,12 +46,14 @@
        ui_fileinfo.c					\
        ui_fileinfopopup.c				\
        ui_fileopener.c					\
+       ui_hints.c						\
        ui_jumptotrack.c					\
        ui_jumptotrack_cache.c			\
        ui_main.c						\
        ui_main_evlisteners.c			\
        ui_manager.c						\
        ui_playlist.c					\
+       ui_playlist_evlisteners.c		\
        ui_playlist_manager.c			\
        ui_preferences.c					\
        ui_skinned_cursor.c				\
--- a/src/audacious/hints.c	Mon Apr 21 23:40:09 2008 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*  Audacious - Cross-platform multimedia player
- *  Copyright (C) 2005-2007  Audacious development team
- *
- *  Based on BMP:
- *  Copyright (C) 2003-2004  BMP development team.
- *
- *  Based on XMMS:
- *  Copyright (C) 1998-2003  XMMS development team.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; under version 3 of the License.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses>.
- *
- *  The Audacious team does not consider modular code linking to
- *  Audacious or using our public API to be a derived work.
- */
-
-#include "hints.h"
-
-#include <glib.h>
-#include <gtk/gtk.h>
-
-#include "ui_equalizer.h"
-#include "ui_main.h"
-#include "ui_playlist.h"
-
-#include "platform/smartinclude.h"
-
-void
-hint_set_always(gboolean always)
-{
-    gtk_window_set_keep_above(GTK_WINDOW(mainwin), always);
-    gtk_window_set_keep_above(GTK_WINDOW(equalizerwin), always);
-    gtk_window_set_keep_above(GTK_WINDOW(playlistwin), always);
-}
-
-void
-hint_set_sticky(gboolean sticky)
-{
-    if (sticky) {
-        gtk_window_stick(GTK_WINDOW(mainwin));
-        gtk_window_stick(GTK_WINDOW(equalizerwin));
-        gtk_window_stick(GTK_WINDOW(playlistwin));
-    }
-    else {
-        gtk_window_unstick(GTK_WINDOW(mainwin));
-        gtk_window_unstick(GTK_WINDOW(equalizerwin));
-        gtk_window_unstick(GTK_WINDOW(playlistwin));
-    }
-}
-
--- a/src/audacious/hints.h	Mon Apr 21 23:40:09 2008 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*  Audacious - Cross-platform multimedia player
- *  Copyright (C) 2005-2007  Audacious development team
- *
- *  Based on BMP:
- *  Copyright (C) 2003-2004  BMP development team.
- *
- *  Based on XMMS:
- *  Copyright (C) 1998-2003  XMMS development team.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; under version 3 of the License.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses>.
- *
- *  The Audacious team does not consider modular code linking to
- *  Audacious or using our public API to be a derived work.
- */
-
-#ifndef HINTS_H
-#define HINTS_H
-
-#include <glib.h>
-#include <gtk/gtk.h>
-
-void hint_set_always(gboolean always);
-void hint_set_sticky(gboolean sticky);
-
-#endif
--- a/src/audacious/main.c	Mon Apr 21 23:40:09 2008 +0300
+++ b/src/audacious/main.c	Tue Apr 22 10:55:35 2008 +0200
@@ -62,7 +62,6 @@
 #include "auddrct.h"
 #include "build_stamp.h"
 #include "dnd.h"
-#include "hints.h"
 #include "input.h"
 #include "logger.h"
 #include "output.h"
@@ -73,6 +72,7 @@
 #include "skin.h"
 #include "ui_equalizer.h"
 #include "ui_fileinfo.h"
+#include "ui_hints.h"
 #include "ui_main.h"
 #include "ui_manager.h"
 #include "ui_playlist.h"
@@ -846,15 +846,11 @@
     // if we are running headless
     else
     {
-        GMainLoop *loop;
-
         g_print(_("Headless operation enabled\n"));
-
         resume_playback_on_startup();
 
-        loop = g_main_loop_new(NULL, TRUE);
         g_timeout_add(10, aud_headless_iteration, NULL);
-        g_main_loop_run(loop);
+        g_main_loop_run(g_main_loop_new(NULL, TRUE));
     }
 
     aud_quit();
--- a/src/audacious/playlist.c	Mon Apr 21 23:40:09 2008 +0300
+++ b/src/audacious/playlist.c	Tue Apr 22 10:55:35 2008 +0200
@@ -55,7 +55,6 @@
 #endif
 
 #include "input.h"
-#include "main.h"
 #include "ui_main.h"
 #include "util.h"
 #include "configdb.h"
@@ -75,7 +74,6 @@
 #include "pluginenum.h"
 
 #include "playlist_evmessages.h"
-#include "playlist_evlisteners.h"
 
 typedef gint (*PlaylistCompareFunc) (PlaylistEntry * a, PlaylistEntry * b);
 typedef void (*PlaylistSaveFunc) (FILE * file);
@@ -292,8 +290,6 @@
     initial_pl = playlist_new();
 
     playlist_add_playlist(initial_pl);
-
-    playlist_evlistener_init();
 }
 
 void
@@ -317,7 +313,7 @@
         ip_data.stop = TRUE;
         playback_stop();
         ip_data.stop = FALSE;
-        mainwin_clear_song_info();
+        hook_call("playlist end reached", NULL);
     }
 
     /* trying to free the last playlist simply clears and resets it */
@@ -591,7 +587,7 @@
         if (playlist->position)
             playback_initiate();
         else
-            mainwin_clear_song_info();
+            hook_call("playlist end reached", NULL);
     }
 
     playlist_manager_update();
@@ -631,7 +627,7 @@
         if (playlist->position)
             playback_initiate();
         else
-            mainwin_clear_song_info();
+            hook_call("playlist end reached", NULL);
     }
 
     playlistwin_update_list(playlist);
@@ -1495,15 +1491,16 @@
 
     if (cfg.no_playlist_advance) {
         PLAYLIST_UNLOCK(playlist);
-        mainwin_clear_song_info();
         if (cfg.repeat)
             playback_initiate();
+        else
+            hook_call("playlist end reached", NULL);
         return;
     }
 
     if (cfg.stopaftersong) {
         PLAYLIST_UNLOCK(playlist);
-        mainwin_clear_song_info();
+        hook_call("playlist end reached", NULL);
         mainwin_set_stopaftersong(FALSE);
         return;
     }
@@ -1521,8 +1518,7 @@
 
         if (!cfg.repeat) {
             PLAYLIST_UNLOCK(playlist);
-	    hook_call("playlist end reached", playlist->position);
-            mainwin_clear_song_info();
+            hook_call("playlist end reached", NULL);
             return;
         }
     }
--- a/src/audacious/playlist_evlisteners.c	Mon Apr 21 23:40:09 2008 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Audacious
- * Copyright (c) 2006-2007 Audacious development team.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; under version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses>.
- *
- * The Audacious team does not consider modular code linking to
- * Audacious or using our public API to be a derived work.
- */
-
-#include <glib.h>
-#include "hook.h"
-#include "playlist.h"
-#include "ui_playlist.h"
-
-#include "playlist_evlisteners.h"
-
-static void
-playlist_evlistener_playlistwin_update_list(gpointer hook_data, gpointer user_data)
-{
-     Playlist *playlist = (Playlist *) hook_data;
-
-     playlistwin_update_list(playlist);
-}
-
-void playlist_evlistener_init(void)
-{
-     hook_associate("playlistwin update list", playlist_evlistener_playlistwin_update_list, NULL);
-}
--- a/src/audacious/playlist_evlisteners.h	Mon Apr 21 23:40:09 2008 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Audacious
- * Copyright (c) 2006-2007 Audacious development team.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; under version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses>.
- *
- * The Audacious team does not consider modular code linking to
- * Audacious or using our public API to be a derived work.
- */
-
-#ifndef __AUDACIOUS_PLAYLIST_EVLISTENERS_H__
-#define __AUDACIOUS_PLAYLIST_EVLISTENERS_H__
-
-void playlist_evlistener_init(void);
-
-#endif
--- a/src/audacious/ui_equalizer.c	Mon Apr 21 23:40:09 2008 +0300
+++ b/src/audacious/ui_equalizer.c	Tue Apr 22 10:55:35 2008 +0200
@@ -41,7 +41,6 @@
 #include "platform/smartinclude.h"
 #include "skin.h"
 #include "dock.h"
-#include "hints.h"
 #include "input.h"
 #include "main.h"
 #include "ui_manager.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/audacious/ui_hints.c	Tue Apr 22 10:55:35 2008 +0200
@@ -0,0 +1,59 @@
+/*  Audacious - Cross-platform multimedia player
+ *  Copyright (C) 2005-2007  Audacious development team
+ *
+ *  Based on BMP:
+ *  Copyright (C) 2003-2004  BMP development team.
+ *
+ *  Based on XMMS:
+ *  Copyright (C) 1998-2003  XMMS development team.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; under version 3 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses>.
+ *
+ *  The Audacious team does not consider modular code linking to
+ *  Audacious or using our public API to be a derived work.
+ */
+
+#include "ui_hints.h"
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "ui_equalizer.h"
+#include "ui_main.h"
+#include "ui_playlist.h"
+
+#include "platform/smartinclude.h"
+
+void
+hint_set_always(gboolean always)
+{
+    gtk_window_set_keep_above(GTK_WINDOW(mainwin), always);
+    gtk_window_set_keep_above(GTK_WINDOW(equalizerwin), always);
+    gtk_window_set_keep_above(GTK_WINDOW(playlistwin), always);
+}
+
+void
+hint_set_sticky(gboolean sticky)
+{
+    if (sticky) {
+        gtk_window_stick(GTK_WINDOW(mainwin));
+        gtk_window_stick(GTK_WINDOW(equalizerwin));
+        gtk_window_stick(GTK_WINDOW(playlistwin));
+    }
+    else {
+        gtk_window_unstick(GTK_WINDOW(mainwin));
+        gtk_window_unstick(GTK_WINDOW(equalizerwin));
+        gtk_window_unstick(GTK_WINDOW(playlistwin));
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/audacious/ui_hints.h	Tue Apr 22 10:55:35 2008 +0200
@@ -0,0 +1,35 @@
+/*  Audacious - Cross-platform multimedia player
+ *  Copyright (C) 2005-2007  Audacious development team
+ *
+ *  Based on BMP:
+ *  Copyright (C) 2003-2004  BMP development team.
+ *
+ *  Based on XMMS:
+ *  Copyright (C) 1998-2003  XMMS development team.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; under version 3 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses>.
+ *
+ *  The Audacious team does not consider modular code linking to
+ *  Audacious or using our public API to be a derived work.
+ */
+
+#ifndef HINTS_H
+#define HINTS_H
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+void hint_set_always(gboolean always);
+void hint_set_sticky(gboolean sticky);
+
+#endif
--- a/src/audacious/ui_jumptotrack.c	Mon Apr 21 23:40:09 2008 +0300
+++ b/src/audacious/ui_jumptotrack.c	Tue Apr 22 10:55:35 2008 +0200
@@ -60,7 +60,6 @@
 
 #include "dnd.h"
 #include "dock.h"
-#include "hints.h"
 #include "input.h"
 #include "playback.h"
 #include "playlist.h"
--- a/src/audacious/ui_main.c	Mon Apr 21 23:40:09 2008 +0300
+++ b/src/audacious/ui_main.c	Tue Apr 22 10:55:35 2008 +0200
@@ -60,7 +60,6 @@
 #include "configdb.h"
 #include "dnd.h"
 #include "dock.h"
-#include "hints.h"
 #include "input.h"
 #include "playback.h"
 #include "playlist.h"
@@ -68,6 +67,7 @@
 #include "ui_credits.h"
 #include "ui_equalizer.h"
 #include "ui_fileopener.h"
+#include "ui_hints.h"
 #include "ui_manager.h"
 #include "ui_playlist.h"
 #include "ui_preferences.h"
--- a/src/audacious/ui_main_evlisteners.c	Mon Apr 21 23:40:09 2008 +0300
+++ b/src/audacious/ui_main_evlisteners.c	Tue Apr 22 10:55:35 2008 +0200
@@ -18,6 +18,8 @@
  * Audacious or using our public API to be a derived work.
  */
 
+#include "ui_playlist_evlisteners.h"
+
 #include <glib.h>
 #include <math.h>
 
@@ -25,7 +27,6 @@
 #include "playback.h"
 #include "playlist.h"
 #include "playlist_evmessages.h"
-#include "playlist_evlisteners.h"
 #include "visualization.h"
 
 #include "ui_main.h"
@@ -173,6 +174,12 @@
 }
 
 static void
+ui_main_evlistener_playlist_end_reached(gpointer hook_data, gpointer user_data)
+{
+     mainwin_clear_song_info();
+}
+
+static void
 ui_main_evlistener_playlist_info_change(gpointer hook_data, gpointer user_data)
 {
      PlaylistEventInfoChange *msg = (PlaylistEventInfoChange *) hook_data;
@@ -195,6 +202,7 @@
     hook_associate("playback unpause", ui_main_evlistener_playback_unpause, NULL);
     hook_associate("playback seek", ui_main_evlistener_playback_seek, NULL);
     hook_associate("playback play file", ui_main_evlistener_playback_play_file, NULL);
+    hook_associate("playlist end reached", ui_main_evlistener_playlist_end_reached, NULL);
     hook_associate("playlist info change", ui_main_evlistener_playlist_info_change, NULL);
 }
 
--- a/src/audacious/ui_playlist.c	Mon Apr 21 23:40:09 2008 +0300
+++ b/src/audacious/ui_playlist.c	Tue Apr 22 10:55:35 2008 +0200
@@ -42,7 +42,6 @@
 #include "actions-playlist.h"
 #include "dnd.h"
 #include "dock.h"
-#include "hints.h"
 #include "input.h"
 #include "main.h"
 #include "playback.h"
@@ -54,6 +53,7 @@
 #include "ui_fileopener.h"
 #include "ui_main.h"
 #include "ui_manager.h"
+#include "ui_playlist_evlisteners.h"
 #include "util.h"
 #include "config.h"
 
@@ -1478,6 +1478,8 @@
                                   playlistwin_get_width() - 14,
                                   cfg.playlist_height - 30, 8, 5);
     g_signal_connect(playlistwin_sscroll_down, "clicked", playlistwin_scroll_down_pushed, NULL);
+
+    ui_playlist_evlistener_init();
 }
 
 static void