From fc44e817e339017737e3063c050414301de4d671 Mon Sep 17 00:00:00 2001 From: Aleksejs Popovs Date: Thu, 1 May 2014 19:21:22 +0300 Subject: added "stop playback after current album finishes" functionality --- plugins/gtkui/callbacks.c | 8 ++++++++ plugins/gtkui/callbacks.h | 8 ++++++++ plugins/gtkui/deadbeef.glade | 30 ++++++++++++++++++++++++++++++ plugins/gtkui/gtkui.c | 4 ++++ plugins/gtkui/hotkeys.c | 1 + plugins/gtkui/interface.c | 18 ++++++++++++++++++ plugins/gtkui/prefwin.c | 10 ++++++++++ 7 files changed, 79 insertions(+) (limited to 'plugins/gtkui') diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index d75fb0df..51de7a9d 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -469,6 +469,14 @@ on_stop_after_current_activate (GtkMenuItem *menuitem, deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0); } +void +on_stop_after_album_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + deadbeef->conf_set_int ("playlist.stop_after_album", gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem))); + deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0); +} + void on_cursor_follows_playback_activate (GtkMenuItem *menuitem, gpointer user_data) diff --git a/plugins/gtkui/callbacks.h b/plugins/gtkui/callbacks.h index b38d5f2e..bbd33f0e 100644 --- a/plugins/gtkui/callbacks.h +++ b/plugins/gtkui/callbacks.h @@ -1308,3 +1308,11 @@ on_auto_size_columns_toggled (GtkToggleButton *togglebutton, void on_searchentry_activate (GtkEntry *entry, gpointer user_data); + +void +on_stop_after_album_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_reset_autostopalbum_toggled (GtkToggleButton *togglebutton, + gpointer user_data); diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade index 90ce9db5..b75b4589 100644 --- a/plugins/gtkui/deadbeef.glade +++ b/plugins/gtkui/deadbeef.glade @@ -582,6 +582,16 @@ + + + True + Stop after current album + True + False + + + + True @@ -2849,6 +2859,26 @@ Album False + + + + True + True + Auto-reset "Stop after current album" + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + False diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index 6f3760a9..5d2dedeb 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -596,6 +596,10 @@ gtkui_on_configchanged (void *data) { int stop_after_current = deadbeef->conf_get_int ("playlist.stop_after_current", 0); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "stop_after_current")), stop_after_current ? TRUE : FALSE); + // stop after current album + int stop_after_album = deadbeef->conf_get_int ("playlist.stop_after_album", 0); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "stop_after_album")), stop_after_album ? TRUE : FALSE); + // embolden current track gtkui_embolden_current_track = deadbeef->conf_get_int ("gtkui.embolden_current_track", 0); diff --git a/plugins/gtkui/hotkeys.c b/plugins/gtkui/hotkeys.c index 7111703f..e8bffef9 100644 --- a/plugins/gtkui/hotkeys.c +++ b/plugins/gtkui/hotkeys.c @@ -929,6 +929,7 @@ gtkui_set_default_hotkeys (void) { deadbeef->conf_set_str ("hotkey.key29", "v 0 0 stop"); deadbeef->conf_set_str ("hotkey.key30", "b 0 0 next"); deadbeef->conf_set_str ("hotkey.key31", "n 0 0 playback_random"); + deadbeef->conf_set_str ("hotkey.key32", "\"Ctrl k\" 0 0 toggle_stop_after_album"); deadbeef->conf_save (); } diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c index 29318d0a..5550996c 100644 --- a/plugins/gtkui/interface.c +++ b/plugins/gtkui/interface.c @@ -96,6 +96,7 @@ create_mainwin (void) GtkWidget *scroll_follows_playback; GtkWidget *cursor_follows_playback; GtkWidget *stop_after_current; + GtkWidget *stop_after_album; GtkWidget *separator11; GtkWidget *jump_to_current_track1; GtkWidget *Help; @@ -386,6 +387,10 @@ create_mainwin (void) gtk_widget_show (stop_after_current); gtk_container_add (GTK_CONTAINER (Playback_menu), stop_after_current); + stop_after_album = gtk_check_menu_item_new_with_mnemonic (_("Stop after current album")); + gtk_widget_show (stop_after_album); + gtk_container_add (GTK_CONTAINER (Playback_menu), stop_after_album); + separator11 = gtk_separator_menu_item_new (); gtk_widget_show (separator11); gtk_container_add (GTK_CONTAINER (Playback_menu), separator11); @@ -591,6 +596,9 @@ create_mainwin (void) g_signal_connect ((gpointer) stop_after_current, "activate", G_CALLBACK (on_stop_after_current_activate), NULL); + g_signal_connect ((gpointer) stop_after_album, "activate", + G_CALLBACK (on_stop_after_album_activate), + NULL); g_signal_connect ((gpointer) jump_to_current_track1, "activate", G_CALLBACK (on_jump_to_current_track1_activate), NULL); @@ -679,6 +687,7 @@ create_mainwin (void) GLADE_HOOKUP_OBJECT (mainwin, scroll_follows_playback, "scroll_follows_playback"); GLADE_HOOKUP_OBJECT (mainwin, cursor_follows_playback, "cursor_follows_playback"); GLADE_HOOKUP_OBJECT (mainwin, stop_after_current, "stop_after_current"); + GLADE_HOOKUP_OBJECT (mainwin, stop_after_album, "stop_after_album"); GLADE_HOOKUP_OBJECT (mainwin, separator11, "separator11"); GLADE_HOOKUP_OBJECT (mainwin, jump_to_current_track1, "jump_to_current_track1"); GLADE_HOOKUP_OBJECT (mainwin, Help, "Help"); @@ -1515,6 +1524,7 @@ create_prefwin (void) GtkWidget *resume_last_session; GtkWidget *ignore_archives; GtkWidget *reset_autostop; + GtkWidget *reset_autostopalbum; GtkWidget *label39; GtkWidget *vbox29; GtkWidget *hbox80; @@ -1843,6 +1853,10 @@ create_prefwin (void) gtk_widget_show (reset_autostop); gtk_box_pack_start (GTK_BOX (vbox8), reset_autostop, FALSE, FALSE, 0); + reset_autostopalbum = gtk_check_button_new_with_mnemonic (_("Auto-reset \"Stop after current album\"")); + gtk_widget_show (reset_autostopalbum); + gtk_box_pack_start (GTK_BOX (vbox8), reset_autostopalbum, FALSE, FALSE, 0); + label39 = gtk_label_new (_("Playback")); gtk_widget_show (label39); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 1), label39); @@ -2661,6 +2675,9 @@ create_prefwin (void) g_signal_connect ((gpointer) reset_autostop, "toggled", G_CALLBACK (on_reset_autostop_toggled), NULL); + g_signal_connect ((gpointer) reset_autostopalbum, "toggled", + G_CALLBACK (on_reset_autostopalbum_toggled), + NULL); g_signal_connect ((gpointer) dsp_add, "clicked", G_CALLBACK (on_dsp_add_clicked), NULL); @@ -2872,6 +2889,7 @@ create_prefwin (void) GLADE_HOOKUP_OBJECT (prefwin, resume_last_session, "resume_last_session"); GLADE_HOOKUP_OBJECT (prefwin, ignore_archives, "ignore_archives"); GLADE_HOOKUP_OBJECT (prefwin, reset_autostop, "reset_autostop"); + GLADE_HOOKUP_OBJECT (prefwin, reset_autostopalbum, "reset_autostopalbum"); GLADE_HOOKUP_OBJECT (prefwin, label39, "label39"); GLADE_HOOKUP_OBJECT (prefwin, vbox29, "vbox29"); GLADE_HOOKUP_OBJECT (prefwin, hbox80, "hbox80"); diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c index e59ca6df..00b68fbc 100644 --- a/plugins/gtkui/prefwin.c +++ b/plugins/gtkui/prefwin.c @@ -215,6 +215,9 @@ gtkui_run_preferences_dlg (void) { // reset autostop gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget (w, "reset_autostop")), deadbeef->conf_get_int ("playlist.stop_after_current_reset", 0)); + // reset album autostop + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget (w, "reset_autostopalbum")), deadbeef->conf_get_int ("playlist.stop_after_album_reset", 0)); + // titlebar text gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "titlebar_format_playing")), deadbeef->conf_get_str_fast ("gtkui.titlebar_playing", "%a - %t - DeaDBeeF-%V")); gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "titlebar_format_stopped")), deadbeef->conf_get_str_fast ("gtkui.titlebar_stopped", "DeaDBeeF-%V")); @@ -1068,6 +1071,13 @@ on_reset_autostop_toggled (GtkToggleButton *togglebutton, deadbeef->conf_set_int ("playlist.stop_after_current_reset", gtk_toggle_button_get_active (togglebutton)); } +void +on_reset_autostopalbum_toggled (GtkToggleButton *togglebutton, + gpointer user_data) +{ + deadbeef->conf_set_int ("playlist.stop_after_album_reset", gtk_toggle_button_get_active (togglebutton)); +} + void -- cgit v1.2.3