changeset 898:c800beaac0f9 trunk

[svn] - 'stop after current song' feature
author nhjm449
date Wed, 29 Mar 2006 23:22:03 -0800
parents eeed0ddebdfc
children 83a1c8396625
files audacious/main.c audacious/mainwin.c audacious/mainwin.h audacious/playlist.c
diffstat 4 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/audacious/main.c	Wed Mar 29 22:17:26 2006 -0800
+++ b/audacious/main.c	Wed Mar 29 23:22:03 2006 -0800
@@ -116,6 +116,7 @@
     FALSE, FALSE,               /* shuffle, repeat */
     FALSE,                      /* UNUSED (double size) */
     TRUE,                       /* autoscroll */
+    FALSE,                      /* stop after current song */
     TRUE,                       /* analyzer peaks */
     FALSE,                      /* equalizer autoload */
     FALSE,                      /* easy move */
@@ -245,6 +246,7 @@
     {"shuffle", &cfg.shuffle, TRUE},
     {"repeat", &cfg.repeat, TRUE},
     {"autoscroll_songname", &cfg.autoscroll, TRUE},
+    {"stop_after_current_song", &cfg.stopaftersong, TRUE},
     {"playlist_shaded", &cfg.playlist_shaded, TRUE},
     {"playlist_visible", &cfg.playlist_visible, TRUE},
     {"playlist_transparent", &cfg.playlist_transparent, TRUE},
--- a/audacious/mainwin.c	Wed Mar 29 22:17:26 2006 -0800
+++ b/audacious/mainwin.c	Wed Mar 29 23:22:03 2006 -0800
@@ -112,7 +112,8 @@
     MAINWIN_SONGNAME_FILEINFO,
     MAINWIN_SONGNAME_JTF,
     MAINWIN_SONGNAME_JTT,
-    MAINWIN_SONGNAME_SCROLL
+    MAINWIN_SONGNAME_SCROLL,
+    MAINWIN_SONGNAME_STOPAFTERSONG
 };
 
 enum {
@@ -251,6 +252,8 @@
     {"/-", NULL, NULL, 0, "<Separator>", NULL},
     {N_("/Autoscroll Songname"), NULL, mainwin_songname_menu_callback,
      MAINWIN_SONGNAME_SCROLL, "<ToggleItem>", NULL},
+    {N_("/Stop After Current Song"), "<control>M", mainwin_songname_menu_callback,
+     MAINWIN_SONGNAME_STOPAFTERSONG, "<ToggleItem>", NULL},
 };
 
 static gint mainwin_songname_menu_entries_num =
@@ -341,6 +344,8 @@
      MAINWIN_OPT_SHUFFLE, "<ToggleItem>", NULL},
     {N_("/No Playlist Advance"), "<control>N", mainwin_play_menu_callback,
      MAINWIN_OPT_NPA, "<ToggleItem>", NULL},
+    {N_("/Stop After Current Song"), "<control>M", mainwin_songname_menu_callback,
+     MAINWIN_SONGNAME_STOPAFTERSONG, "<ToggleItem>", NULL},
     {"/-", NULL, NULL, 0, "<Separator>", NULL},
     {N_("/Play"), "x", mainwin_general_menu_callback,
      MAINWIN_GENERAL_PLAY, "<StockItem>", GTK_STOCK_MEDIA_PLAY},
@@ -2441,9 +2446,22 @@
         check = GTK_CHECK_MENU_ITEM(item);
         mainwin_set_title_scroll(gtk_check_menu_item_get_active(check));
         break;
+    case MAINWIN_SONGNAME_STOPAFTERSONG:
+        check = GTK_CHECK_MENU_ITEM(item);
+        cfg.stopaftersong = gtk_check_menu_item_get_active(check);
+        check_set(mainwin_songname_menu, "/Stop After Current Song", cfg.stopaftersong);
+        check_set(mainwin_play_menu, "/Stop After Current Song", cfg.stopaftersong);
+        break;
     }
 }
 
+void
+mainwin_set_stopaftersong(gboolean stop)
+{
+    cfg.stopaftersong = stop;
+    check_set(mainwin_songname_menu, "/Stop After Current Song", cfg.stopaftersong);
+}
+
 static void
 mainwin_play_menu_callback(gpointer data,
                            guint action,
@@ -2970,6 +2988,7 @@
     /* Songname menu */
 
     check_set(mainwin_songname_menu, "/Autoscroll Songname", cfg.autoscroll);
+    check_set(mainwin_songname_menu, "/Stop After Current Song", cfg.stopaftersong);
 
     /* Playback menu */
 
--- a/audacious/mainwin.h	Wed Mar 29 22:17:26 2006 -0800
+++ b/audacious/mainwin.h	Wed Mar 29 23:22:03 2006 -0800
@@ -155,6 +155,7 @@
 void mainwin_set_info_text(void);
 void mainwin_set_song_info(gint rate, gint freq, gint nch);
 void mainwin_clear_song_info(void);
+void mainwin_set_stopaftersong(gboolean stop);
 
 void mainwin_set_always_on_top(gboolean always);
 void mainwin_set_volume_diff(gint diff);
--- a/audacious/playlist.c	Wed Mar 29 22:17:26 2006 -0800
+++ b/audacious/playlist.c	Wed Mar 29 23:22:03 2006 -0800
@@ -1099,6 +1099,13 @@
         return;
     }
 
+    if (cfg.stopaftersong) {
+        PLAYLIST_UNLOCK();
+        mainwin_clear_song_info();
+        mainwin_set_stopaftersong(FALSE);
+        return;
+    }
+
     if (queued_list) {
         play_queued();
     }