From 1e2be37d17419a97289b33cd9d50142241cecbe0 Mon Sep 17 00:00:00 2001 From: waker Date: Fri, 16 Nov 2012 20:06:50 +0100 Subject: hotkeys WIP --- plugins/gtkui/ddblistview.c | 4 ---- plugins/gtkui/gtkui.c | 20 +++++++++++++++++++- plugins/gtkui/plcommon.c | 5 ++--- plugins/hotkeys/hotkeys.c | 18 +----------------- 4 files changed, 22 insertions(+), 25 deletions(-) (limited to 'plugins') diff --git a/plugins/gtkui/ddblistview.c b/plugins/gtkui/ddblistview.c index d45238d9..6e7428b2 100644 --- a/plugins/gtkui/ddblistview.c +++ b/plugins/gtkui/ddblistview.c @@ -1987,10 +1987,6 @@ ddb_listview_handle_keypress (DdbListview *ps, int keyval, int state) { cursor = 0; gtk_range_set_value (GTK_RANGE (range), gtk_adjustment_get_lower (adj)); } - else if (keyval == GDK_Delete) { - ps->binding->delete_selected (); - cursor = ps->binding->cursor (); - } else if (keyval == GDK_Menu) { DdbListviewIter it = ps->binding->head (); while (it && !ps->binding->is_selected (it)) { diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index 762b1371..fc80f268 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -1083,6 +1083,7 @@ gtkui_thread (void *ctx) { deadbeef->conf_set_str ("hotkey.key7", "\"Ctrl m\" 0 0 toggle_stop_after_current"); deadbeef->conf_set_str ("hotkey.key8", "\"Ctrl j\" 0 0 jump_to_current_track"); deadbeef->conf_set_str ("hotkey.key9", "\"F1\" 0 0 help"); + deadbeef->conf_set_str ("hotkey.key11", "\"Delete\" 1 0 remove_from_playlist"); } // construct mainwindow widgets @@ -1579,12 +1580,29 @@ static DB_plugin_action_t action_sort_custom = { .next = &action_preferences }; +static DB_plugin_action_t action_crop_selected = { + .title = "Edit/[stub] Crop Selected", + .name = "crop_selected", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_sort_custom +}; + +static DB_plugin_action_t action_remove_from_playlist = { + .title = "Edit/Remove from current playlist", + .name = "remove_from_playlist", + .flags = DB_ACTION_MULTIPLE_TRACKS, + .callback = action_remove_from_playlist_handler, + .next = &action_crop_selected +}; + + static DB_plugin_action_t action_save_playlist = { .title = "File/[stub] Save Playlist", .name = "save_playlist", .flags = DB_ACTION_COMMON, .callback = NULL, - .next = &action_sort_custom + .next = &action_remove_from_playlist }; static DB_plugin_action_t action_load_playlist = { diff --git a/plugins/gtkui/plcommon.c b/plugins/gtkui/plcommon.c index ec84d256..e2399333 100644 --- a/plugins/gtkui/plcommon.c +++ b/plugins/gtkui/plcommon.c @@ -31,6 +31,7 @@ #include "parser.h" #include "actions.h" #include "search.h" +#include "actionhandlers.h" #define min(x,y) ((x)<(y)?(x):(y)) //#define trace(...) { fprintf(stderr, __VA_ARGS__); } @@ -310,9 +311,7 @@ void on_remove1_activate (GtkMenuItem *menuitem, gpointer user_data) { - int cursor = deadbeef->pl_delete_selected (); - deadbeef->pl_save_all (); - deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0); + action_remove_from_playlist_handler (NULL, DDB_ACTION_CTX_SELECTION); } diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c index cbbc8145..aa8e0d42 100644 --- a/plugins/hotkeys/hotkeys.c +++ b/plugins/hotkeys/hotkeys.c @@ -756,28 +756,12 @@ static DB_plugin_action_t action_sort_by_title = { .next = &action_sort_by_tracknr }; -static DB_plugin_action_t action_crop_selected = { - .title = "Edit/[stub] Crop Selected", - .name = "crop_selected", - .flags = DB_ACTION_COMMON, - .callback = NULL, - .next = &action_sort_by_title -}; - -static DB_plugin_action_t action_remove_from_playlist = { - .title = "[stub] Remove from playlist", - .name = "remove_from_playlist", - .flags = DB_ACTION_MULTIPLE_TRACKS, - .callback = NULL, - .next = &action_crop_selected -}; - static DB_plugin_action_t action_invert_selection = { .title = "Edit/[stub] Invert Selection", .name = "invert_selection", .flags = DB_ACTION_COMMON, .callback = NULL, - .next = &action_remove_from_playlist + .next = &action_sort_by_tracknr }; static DB_plugin_action_t action_clear_playlist = { -- cgit v1.2.3