diff options
author | waker <wakeroid@gmail.com> | 2012-11-25 12:06:13 +0100 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2012-11-25 12:06:13 +0100 |
commit | 4d190480e4dbb382673e5a2f698fe39c9feb9b80 (patch) | |
tree | 1f20b25c59054b0d724202bf8334f764c64e7906 | |
parent | b4fb95c1a8fc2bc7a87a98355e64ac2945b79f02 (diff) |
added add/remove to/from playqueue hotkeys
-rw-r--r-- | plugins/gtkui/plcommon.c | 17 | ||||
-rw-r--r-- | plugins/hotkeys/actionhandlers.c | 28 | ||||
-rw-r--r-- | plugins/hotkeys/actionhandlers.h | 6 | ||||
-rw-r--r-- | plugins/hotkeys/hotkeys.c | 10 |
4 files changed, 44 insertions, 17 deletions
diff --git a/plugins/gtkui/plcommon.c b/plugins/gtkui/plcommon.c index c3c08346..880f5f81 100644 --- a/plugins/gtkui/plcommon.c +++ b/plugins/gtkui/plcommon.c @@ -216,7 +216,6 @@ void main_add_to_playback_queue_activate (GtkMenuItem *menuitem, gpointer user_data) { - DdbListview *ps = DDB_LISTVIEW (g_object_get_data (G_OBJECT (menuitem), "ps")); DB_playItem_t *it = deadbeef->pl_get_first (PL_MAIN); while (it) { if (deadbeef->pl_is_selected (it)) { @@ -226,8 +225,7 @@ main_add_to_playback_queue_activate (GtkMenuItem *menuitem, deadbeef->pl_item_unref (it); it = next; } - main_refresh (); - search_redraw (); + deadbeef->sendmessage (DB_EV_PLAYLIST_REFRESH, 0, 0, 0); } void @@ -235,7 +233,6 @@ main_remove_from_playback_queue_activate (GtkMenuItem *menuitem, gpointer user_data) { - DdbListview *ps = DDB_LISTVIEW (g_object_get_data (G_OBJECT (menuitem), "ps")); DB_playItem_t *it = deadbeef->pl_get_first (PL_MAIN); while (it) { if (deadbeef->pl_is_selected (it)) { @@ -245,11 +242,9 @@ main_remove_from_playback_queue_activate deadbeef->pl_item_unref (it); it = next; } - main_refresh (); - search_redraw (); + deadbeef->sendmessage (DB_EV_PLAYLIST_REFRESH, 0, 0, 0); } -#if 0 void main_reload_metadata_activate (GtkMenuItem *menuitem, @@ -286,11 +281,13 @@ main_reload_metadata_activate deadbeef->pl_item_unref (it); it = next; } + deadbeef->sendmessage (DB_EV_PLAYLIST_REFRESH, 0, 0, 0); +#if 0 main_refresh (); search_redraw (); trkproperties_fill_metadata (); -} #endif +} void main_properties_activate (GtkMenuItem *menuitem, @@ -466,12 +463,10 @@ list_context_menu (DdbListview *listview, DdbListviewIter it, int idx) { gtk_container_add (GTK_CONTAINER (playlist_menu), remove_from_playback_queue1); g_object_set_data (G_OBJECT (remove_from_playback_queue1), "ps", listview); -#if 0 reload_metadata = gtk_menu_item_new_with_mnemonic (_("Reload metadata")); gtk_widget_show (reload_metadata); gtk_container_add (GTK_CONTAINER (playlist_menu), reload_metadata); g_object_set_data (G_OBJECT (reload_metadata), "ps", listview); -#endif separator9 = gtk_separator_menu_item_new (); gtk_widget_show (separator9); @@ -636,11 +631,9 @@ list_context_menu (DdbListview *listview, DdbListviewIter it, int idx) { g_signal_connect ((gpointer) remove_from_playback_queue1, "activate", G_CALLBACK (main_remove_from_playback_queue_activate), NULL); -#if 0 g_signal_connect ((gpointer) reload_metadata, "activate", G_CALLBACK (main_reload_metadata_activate), NULL); -#endif g_signal_connect ((gpointer) remove2, "activate", G_CALLBACK (on_remove2_activate), NULL); diff --git a/plugins/hotkeys/actionhandlers.c b/plugins/hotkeys/actionhandlers.c index ec8e00b5..ab90a788 100644 --- a/plugins/hotkeys/actionhandlers.c +++ b/plugins/hotkeys/actionhandlers.c @@ -277,4 +277,32 @@ action_clear_playlist_handler (DB_plugin_action_t *act, int ctx) { return 0; } +int +action_add_to_playqueue_handler (DB_plugin_action_t *act, int ctx) { + DB_playItem_t *it = deadbeef->pl_get_first (PL_MAIN); + while (it) { + if (deadbeef->pl_is_selected (it)) { + deadbeef->pl_playqueue_push (it); + } + DB_playItem_t *next = deadbeef->pl_get_next (it, PL_MAIN); + deadbeef->pl_item_unref (it); + it = next; + } + deadbeef->sendmessage (DB_EV_PLAYLIST_REFRESH, 0, 0, 0); + return 0; +} +int +action_remove_from_playqueue_handler (DB_plugin_action_t *act, int ctx) { + DB_playItem_t *it = deadbeef->pl_get_first (PL_MAIN); + while (it) { + if (deadbeef->pl_is_selected (it)) { + deadbeef->pl_playqueue_remove (it); + } + DB_playItem_t *next = deadbeef->pl_get_next (it, PL_MAIN); + deadbeef->pl_item_unref (it); + it = next; + } + deadbeef->sendmessage (DB_EV_PLAYLIST_REFRESH, 0, 0, 0); + return 0; +} diff --git a/plugins/hotkeys/actionhandlers.h b/plugins/hotkeys/actionhandlers.h index b1f65db2..7457f8eb 100644 --- a/plugins/hotkeys/actionhandlers.h +++ b/plugins/hotkeys/actionhandlers.h @@ -90,4 +90,10 @@ action_invert_selection_handler (DB_plugin_action_t *act, int ctx); int action_clear_playlist_handler (DB_plugin_action_t *act, int ctx); +int +action_add_to_playqueue_handler (DB_plugin_action_t *act, int ctx); + +int +action_remove_from_playqueue_handler (DB_plugin_action_t *act, int ctx); + #endif diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c index 8e3adea7..ca519976 100644 --- a/plugins/hotkeys/hotkeys.c +++ b/plugins/hotkeys/hotkeys.c @@ -698,7 +698,7 @@ action_toggle_stop_after_current_cb (struct DB_plugin_action_s *action, int ctx) static DB_plugin_action_t action_reload_metadata = { .title = "Reload metadata", .name = "reload_metadata", - .flags = DB_ACTION_MULTIPLE_TRACKS | DB_ACTION_ADD_MENU, + .flags = DB_ACTION_MULTIPLE_TRACKS, .callback = action_reload_metadata_handler, .next = NULL }; @@ -873,18 +873,18 @@ static DB_plugin_action_t action_clear_playlist = { }; static DB_plugin_action_t action_remove_from_playqueue = { - .title = "Playback/[stub] Add To Playback Queue", + .title = "Playback/Remove from playback queue", .name = "remove_from_playback_queue", .flags = DB_ACTION_MULTIPLE_TRACKS, - .callback = NULL, + .callback = action_remove_from_playqueue_handler, .next = &action_clear_playlist }; static DB_plugin_action_t action_add_to_playqueue = { - .title = "Playback/[stub] Add To Playback Queue", + .title = "Playback/Add to playback queue", .name = "add_to_playback_queue", .flags = DB_ACTION_MULTIPLE_TRACKS, - .callback = NULL, + .callback = action_add_to_playqueue_handler, .next = &action_remove_from_playqueue }; |