diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/converter/convgui.c | 2 | ||||
-rw-r--r-- | plugins/gtkui/actions.c | 46 | ||||
-rw-r--r-- | plugins/gtkui/actions.h | 6 | ||||
-rw-r--r-- | plugins/gtkui/callbacks.c | 8 | ||||
-rw-r--r-- | plugins/gtkui/gtkui.c | 78 | ||||
-rw-r--r-- | plugins/gtkui/hotkeys.c | 2 | ||||
-rw-r--r-- | plugins/gtkui/plcommon.c | 32 | ||||
-rw-r--r-- | plugins/gtkui/pltmenu.c | 7 | ||||
-rw-r--r-- | plugins/gtkui/widgets.c | 8 | ||||
-rw-r--r-- | plugins/hotkeys/hotkeys.c | 109 | ||||
-rw-r--r-- | plugins/lastfm/lastfm.c | 4 | ||||
-rw-r--r-- | plugins/shellexec/shellexec.c | 12 | ||||
-rw-r--r-- | plugins/shellexecui/shellexecui.c | 2 |
13 files changed, 169 insertions, 147 deletions
diff --git a/plugins/converter/convgui.c b/plugins/converter/convgui.c index 7ae73bc1..a8546549 100644 --- a/plugins/converter/convgui.c +++ b/plugins/converter/convgui.c @@ -1434,7 +1434,7 @@ static DB_plugin_action_t convert_action = { .title = "Convert", .name = "convert", .flags = DB_ACTION_MULTIPLE_TRACKS | DB_ACTION_SINGLE_TRACK | DB_ACTION_ADD_MENU, - .callback = converter_show, + .callback2 = converter_show, .next = NULL }; diff --git a/plugins/gtkui/actions.c b/plugins/gtkui/actions.c index a85851e9..74a2175f 100644 --- a/plugins/gtkui/actions.c +++ b/plugins/gtkui/actions.c @@ -24,6 +24,7 @@ #include "gtkui.h" #include "../../deadbeef.h" #include "support.h" +#include "actions.h" #define trace(...) { fprintf(stderr, __VA_ARGS__); } //#define trace(fmt,...) @@ -35,7 +36,12 @@ static gboolean menu_action_cb (void *ctx) { DB_plugin_action_t *action = ctx; - action->callback (action, DDB_ACTION_CTX_MAIN); + if (action->callback) { + gtkui_exec_action_14 (action, -1); + } + else if (action->callback2) { + action->callback2 (action, DDB_ACTION_CTX_MAIN); + } return FALSE; } @@ -94,7 +100,7 @@ add_mainmenu_actions (void) { char *tmp = NULL; - int has_addmenu = (action->flags & DB_ACTION_COMMON) && ((action->flags & DB_ACTION_ADD_MENU) | (action->flags & DB_ACTION_USING_API_14)); + int has_addmenu = (action->flags & DB_ACTION_COMMON) && ((action->flags & DB_ACTION_ADD_MENU) || (action->callback)); if (!has_addmenu) continue; @@ -183,3 +189,39 @@ add_mainmenu_actions (void) } } +void +gtkui_exec_action_14 (DB_plugin_action_t *action, int cursor) { + // Plugin can handle all tracks by itself + if (action->flags & DB_ACTION_CAN_MULTIPLE_TRACKS) + { + action->callback (action, NULL); + return; + } + + // For single-track actions just invoke it with first selected track + if (!(action->flags & DB_ACTION_MULTIPLE_TRACKS)) + { + if (cursor == -1) { + cursor = deadbeef->pl_get_cursor (PL_MAIN); + } + if (cursor == -1) + { + return; + } + DB_playItem_t *it = deadbeef->pl_get_for_idx_and_iter (cursor, PL_MAIN); + action->callback (action, it); + deadbeef->pl_item_unref (it); + return; + } + + //We end up here if plugin won't traverse tracks and we have to do it ourselves + DB_playItem_t *it = deadbeef->pl_get_first (PL_MAIN); + while (it) { + if (deadbeef->pl_is_selected (it)) { + action->callback (action, it); + } + DB_playItem_t *next = deadbeef->pl_get_next (it, PL_MAIN); + deadbeef->pl_item_unref (it); + it = next; + } +} diff --git a/plugins/gtkui/actions.h b/plugins/gtkui/actions.h index 815e99cc..e2c1f5a5 100644 --- a/plugins/gtkui/actions.h +++ b/plugins/gtkui/actions.h @@ -21,6 +21,10 @@ #ifndef __ACTIONS_H #define __ACTIONS_H -void add_mainmenu_actions (void); +void +add_mainmenu_actions (void); + +void +gtkui_exec_action_14 (DB_plugin_action_t *action, int cursor); #endif diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index b551f7d7..e1f943ee 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -50,6 +50,7 @@ #include "widgets.h" #include "../hotkeys/hotkeys.h" #include "actionhandlers.h" +#include "actions.h" //#define trace(...) { fprintf (stderr, __VA_ARGS__); } #define trace(fmt,...) @@ -204,11 +205,14 @@ on_mainwin_key_press_event (GtkWidget *widget, if (hkplug) { int ctx; DB_plugin_action_t *act = ((DB_hotkeys_plugin_t *)hkplug)->get_action_for_keycombo (accel_key, mods, 0, &ctx); - if (act && act->callback) { + if (act && act->callback2) { trace ("executing action %s in ctx %d\n", act->name, ctx); - act->callback (act, ctx); + act->callback2 (act, ctx); return TRUE; } + else if (act && act->callback) { + gtkui_exec_action_14 (act, -1); + } } trace ("action not found\n"); return FALSE; diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index 3d958163..53f45f1f 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -1295,7 +1295,7 @@ static DB_plugin_action_t action_deselect_all = { .title = "Edit/Deselect All", .name = "deselect_all", .flags = DB_ACTION_COMMON, - .callback = action_deselect_all_handler, + .callback2 = action_deselect_all_handler, .next = NULL }; @@ -1303,7 +1303,7 @@ static DB_plugin_action_t action_select_all = { .title = "Edit/Select All", .name = "select_all", .flags = DB_ACTION_COMMON, - .callback = action_select_all_handler, + .callback2 = action_select_all_handler, .next = &action_deselect_all }; @@ -1311,7 +1311,7 @@ static DB_plugin_action_t action_quit = { .title = "Quit", .name = "quit", .flags = DB_ACTION_COMMON, - .callback = action_quit_handler, + .callback2 = action_quit_handler, .next = &action_select_all }; @@ -1319,7 +1319,7 @@ static DB_plugin_action_t action_delete_from_disk = { .title = "Delete From Disk", .name = "delete_from_disk", .flags = DB_ACTION_MULTIPLE_TRACKS, - .callback = action_delete_from_disk_handler, + .callback2 = action_delete_from_disk_handler, .next = &action_quit }; @@ -1327,7 +1327,7 @@ static DB_plugin_action_t action_add_location = { .title = "File/Add Location", .name = "add_location", .flags = DB_ACTION_COMMON, - .callback = action_add_location_handler, + .callback2 = action_add_location_handler, .next = &action_delete_from_disk }; @@ -1335,7 +1335,7 @@ static DB_plugin_action_t action_add_folders = { .title = "File/Add Folder(s)", .name = "add_folders", .flags = DB_ACTION_COMMON, - .callback = action_add_folders_handler, + .callback2 = action_add_folders_handler, .next = &action_add_location }; @@ -1343,7 +1343,7 @@ static DB_plugin_action_t action_add_files = { .title = "File/Add File(s)", .name = "add_files", .flags = DB_ACTION_COMMON, - .callback = action_add_files_handler, + .callback2 = action_add_files_handler, .next = &action_add_folders }; @@ -1351,7 +1351,7 @@ static DB_plugin_action_t action_open_files = { .title = "File/Open File(s)", .name = "open_files", .flags = DB_ACTION_COMMON, - .callback = action_open_files_handler, + .callback2 = action_open_files_handler, .next = &action_add_files }; @@ -1360,7 +1360,7 @@ static DB_plugin_action_t action_track_properties = { .title = "Track properties", .name = "track_properties", .flags = DB_ACTION_MULTIPLE_TRACKS, - .callback = action_show_track_properties_handler, + .callback2 = action_show_track_properties_handler, .next = &action_open_files }; @@ -1368,7 +1368,7 @@ static DB_plugin_action_t action_show_help = { .title = "Help/Show help page", .name = "help", .flags = DB_ACTION_COMMON, - .callback = action_show_help_handler, + .callback2 = action_show_help_handler, .next = &action_track_properties }; @@ -1376,7 +1376,7 @@ static DB_plugin_action_t action_playback_loop_cycle = { .title = "Playback/Cycle playback looping mode", .name = "loop_cycle", .flags = DB_ACTION_COMMON, - .callback = action_playback_loop_cycle_handler, + .callback2 = action_playback_loop_cycle_handler, .next = &action_show_help }; @@ -1384,7 +1384,7 @@ static DB_plugin_action_t action_playback_loop_off = { .title = "Playback/Playback looping - Don't loop", .name = "loop_off", .flags = DB_ACTION_COMMON, - .callback = action_playback_loop_off_handler, + .callback2 = action_playback_loop_off_handler, .next = &action_playback_loop_cycle }; @@ -1392,7 +1392,7 @@ static DB_plugin_action_t action_playback_loop_single = { .title = "Playback/Playback looping - Single track", .name = "loop_track", .flags = DB_ACTION_COMMON, - .callback = action_playback_loop_single_handler, + .callback2 = action_playback_loop_single_handler, .next = &action_playback_loop_off }; @@ -1400,7 +1400,7 @@ static DB_plugin_action_t action_playback_loop_all = { .title = "Playback/Playback looping - All", .name = "loop_all", .flags = DB_ACTION_COMMON, - .callback = action_playback_loop_all_handler, + .callback2 = action_playback_loop_all_handler, .next = &action_playback_loop_single }; @@ -1408,7 +1408,7 @@ static DB_plugin_action_t action_playback_order_cycle = { .title = "Playback/Cycle playback order", .name = "order_cycle", .flags = DB_ACTION_COMMON, - .callback = action_playback_order_cycle_handler, + .callback2 = action_playback_order_cycle_handler, .next = &action_playback_loop_all }; @@ -1416,7 +1416,7 @@ static DB_plugin_action_t action_playback_order_random = { .title = "Playback/Playback order - Random", .name = "order_random", .flags = DB_ACTION_COMMON, - .callback = action_playback_order_random_handler, + .callback2 = action_playback_order_random_handler, .next = &action_playback_order_cycle }; @@ -1424,7 +1424,7 @@ static DB_plugin_action_t action_playback_order_shuffle_albums = { .title = "Playback/Playback order - Shuffle albums", .name = "order_shuffle_albums", .flags = DB_ACTION_COMMON, - .callback = action_playback_order_shuffle_albums_handler, + .callback2 = action_playback_order_shuffle_albums_handler, .next = &action_playback_order_random }; @@ -1432,7 +1432,7 @@ static DB_plugin_action_t action_playback_order_shuffle = { .title = "Playback/Playback order - Shuffle tracks", .name = "order_shuffle", .flags = DB_ACTION_COMMON, - .callback = action_playback_order_shuffle_handler, + .callback2 = action_playback_order_shuffle_handler, .next = &action_playback_order_shuffle_albums }; @@ -1440,7 +1440,7 @@ static DB_plugin_action_t action_playback_order_linear = { .title = "Playback/Playback order - Linear", .name = "order_linear", .flags = DB_ACTION_COMMON, - .callback = action_playback_order_linear_handler, + .callback2 = action_playback_order_linear_handler, .next = &action_playback_order_shuffle }; @@ -1449,7 +1449,7 @@ static DB_plugin_action_t action_cursor_follows_playback = { .title = "Playback/Cursor follows playback toggle", .name = "toggle_cursor_follows_playback", .flags = DB_ACTION_COMMON, - .callback = action_cursor_follows_playback_handler, + .callback2 = action_cursor_follows_playback_handler, .next = &action_playback_order_linear }; @@ -1458,7 +1458,7 @@ static DB_plugin_action_t action_scroll_follows_playback = { .title = "Playback/Scroll follows playback toggle", .name = "toggle_scroll_follows_playback", .flags = DB_ACTION_COMMON, - .callback = action_scroll_follows_playback_handler, + .callback2 = action_scroll_follows_playback_handler, .next = &action_cursor_follows_playback }; @@ -1466,7 +1466,7 @@ static DB_plugin_action_t action_toggle_menu = { .title = "View/Show\\/Hide menu", .name = "toggle_menu", .flags = DB_ACTION_COMMON, - .callback = action_toggle_menu_handler, + .callback2 = action_toggle_menu_handler, .next = &action_scroll_follows_playback }; @@ -1474,7 +1474,7 @@ static DB_plugin_action_t action_toggle_statusbar = { .title = "View/Show\\/Hide statusbar", .name = "toggle_statusbar", .flags = DB_ACTION_COMMON, - .callback = action_toggle_statusbar_handler, + .callback2 = action_toggle_statusbar_handler, .next = &action_toggle_menu }; @@ -1482,7 +1482,7 @@ static DB_plugin_action_t action_toggle_designmode = { .title = "Edit/Toggle design mode", .name = "toggle_design_mode", .flags = DB_ACTION_COMMON, - .callback = action_toggle_designmode_handler, + .callback2 = action_toggle_designmode_handler, .next = &action_toggle_statusbar }; @@ -1490,7 +1490,7 @@ static DB_plugin_action_t action_preferences = { .title = "Edit/Preferences", .name = "preferences", .flags = DB_ACTION_COMMON, - .callback = action_preferences_handler, + .callback2 = action_preferences_handler, .next = &action_toggle_designmode }; @@ -1498,7 +1498,7 @@ static DB_plugin_action_t action_sort_custom = { .title = "Edit/Sort Custom", .name = "sort_custom", .flags = DB_ACTION_COMMON, - .callback = action_sort_custom_handler, + .callback2 = action_sort_custom_handler, .next = &action_preferences }; @@ -1506,7 +1506,7 @@ static DB_plugin_action_t action_crop_selected = { .title = "Edit/Crop Selected", .name = "crop_selected", .flags = DB_ACTION_COMMON, - .callback = action_crop_selected_handler, + .callback2 = action_crop_selected_handler, .next = &action_sort_custom }; @@ -1514,7 +1514,7 @@ 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, + .callback2 = action_remove_from_playlist_handler, .next = &action_crop_selected }; @@ -1522,7 +1522,7 @@ static DB_plugin_action_t action_save_playlist = { .title = "File/Save playlist", .name = "save_playlist", .flags = DB_ACTION_COMMON, - .callback = action_save_playlist_handler, + .callback2 = action_save_playlist_handler, .next = &action_remove_from_playlist }; @@ -1530,7 +1530,7 @@ static DB_plugin_action_t action_load_playlist = { .title = "File/Load playlist", .name = "load_playlist", .flags = DB_ACTION_COMMON, - .callback = action_load_playlist_handler, + .callback2 = action_load_playlist_handler, .next = &action_save_playlist }; @@ -1538,7 +1538,7 @@ static DB_plugin_action_t action_remove_current_playlist = { .title = "File/Remove current playlist", .name = "remove_current_playlist", .flags = DB_ACTION_COMMON, - .callback = action_remove_current_playlist_handler, + .callback2 = action_remove_current_playlist_handler, .next = &action_load_playlist }; @@ -1547,7 +1547,7 @@ static DB_plugin_action_t action_new_playlist = { .title = "File/New Playlist", .name = "new_playlist", .flags = DB_ACTION_COMMON, - .callback = action_new_playlist_handler, + .callback2 = action_new_playlist_handler, .next = &action_remove_current_playlist }; @@ -1555,7 +1555,7 @@ static DB_plugin_action_t action_toggle_eq = { .title = "View/Show\\/Hide Equalizer", .name = "toggle_eq", .flags = DB_ACTION_COMMON, - .callback = action_toggle_eq_handler, + .callback2 = action_toggle_eq_handler, .next = &action_new_playlist }; @@ -1563,7 +1563,7 @@ static DB_plugin_action_t action_hide_eq = { .title = "View/Hide Equalizer", .name = "hide_eq", .flags = DB_ACTION_COMMON, - .callback = action_hide_eq_handler, + .callback2 = action_hide_eq_handler, .next = &action_toggle_eq }; @@ -1571,7 +1571,7 @@ static DB_plugin_action_t action_show_eq = { .title = "View/Show Equalizer", .name = "show_eq", .flags = DB_ACTION_COMMON, - .callback = action_show_eq_handler, + .callback2 = action_show_eq_handler, .next = &action_hide_eq }; @@ -1579,7 +1579,7 @@ static DB_plugin_action_t action_toggle_mainwin = { .title = "View/Show\\/Hide Player Window", .name = "toggle_player_window", .flags = DB_ACTION_COMMON, - .callback = action_toggle_mainwin_handler, + .callback2 = action_toggle_mainwin_handler, .next = &action_show_eq }; @@ -1587,7 +1587,7 @@ static DB_plugin_action_t action_hide_mainwin = { .title = "View/Hide Player Window", .name = "hide_player_window", .flags = DB_ACTION_COMMON, - .callback = action_hide_mainwin_handler, + .callback2 = action_hide_mainwin_handler, .next = &action_toggle_mainwin }; @@ -1595,7 +1595,7 @@ static DB_plugin_action_t action_show_mainwin = { .title = "View/Show Player Window", .name = "show_player_window", .flags = DB_ACTION_COMMON, - .callback = action_show_mainwin_handler, + .callback2 = action_show_mainwin_handler, .next = &action_hide_mainwin }; @@ -1603,7 +1603,7 @@ static DB_plugin_action_t action_find = { .title = "Edit/Find", .name = "find", .flags = DB_ACTION_COMMON, - .callback = action_find_handler, + .callback2 = action_find_handler, .next = &action_show_mainwin }; diff --git a/plugins/gtkui/hotkeys.c b/plugins/gtkui/hotkeys.c index 33bf01e2..f176cf8d 100644 --- a/plugins/gtkui/hotkeys.c +++ b/plugins/gtkui/hotkeys.c @@ -344,7 +344,7 @@ init_action_tree (GtkWidget *actions, const char *act, int ctx) { unescape_forward_slash (t, title, sizeof (title)); gtk_tree_store_set (actions_store, &iter, 0, title, 1, actions->name, 2, DDB_ACTION_CTX_MAIN, -1); } - if (actions->flags & (DB_ACTION_SINGLE_TRACK | DB_ACTION_MULTIPLE_TRACKS | DB_ACTION_CAN_MULTIPLE_TRACKS__DEPRECATED)) { + if (actions->flags & (DB_ACTION_SINGLE_TRACK | DB_ACTION_MULTIPLE_TRACKS | DB_ACTION_CAN_MULTIPLE_TRACKS)) { t = action_tree_append (actions->title, actions_store, &action_selection_iter, &iter); unescape_forward_slash (t, title, sizeof (title)); gtk_tree_store_set (actions_store, &iter, 0, title, 1, actions->name, 2, DDB_ACTION_CTX_SELECTION, -1); diff --git a/plugins/gtkui/plcommon.c b/plugins/gtkui/plcommon.c index 08f7e3fa..299384d0 100644 --- a/plugins/gtkui/plcommon.c +++ b/plugins/gtkui/plcommon.c @@ -467,37 +467,11 @@ void actionitem_activate (GtkMenuItem *menuitem, DB_plugin_action_t *action) { - if (action->flags & DB_ACTION_USING_API_14) { - typedef int (*action_callback_14_t)(struct DB_plugin_action_s *action, void *userdata); - // Plugin can handle all tracks by itself - if (action->flags & DB_ACTION_CAN_MULTIPLE_TRACKS__DEPRECATED) - { - ((action_callback_14_t)action->callback) (action, NULL); - return; - } - - // For single-track actions just invoke it with first selected track - if (!(action->flags & DB_ACTION_MULTIPLE_TRACKS)) - { - DB_playItem_t *it = deadbeef->pl_get_for_idx_and_iter (clicked_idx, PL_MAIN); - ((action_callback_14_t)action->callback) (action, it); - deadbeef->pl_item_unref (it); - return; - } - - //We end up here if plugin won't traverse tracks and we have to do it ourselves - DB_playItem_t *it = deadbeef->pl_get_first (PL_MAIN); - while (it) { - if (deadbeef->pl_is_selected (it)) { - ((action_callback_14_t)action->callback) (action, it); - } - DB_playItem_t *next = deadbeef->pl_get_next (it, PL_MAIN); - deadbeef->pl_item_unref (it); - it = next; - } + if (action->callback) { + gtkui_exec_action_14 (action, clicked_idx); } else { - action->callback (action, DDB_ACTION_CTX_SELECTION); + action->callback2 (action, DDB_ACTION_CTX_SELECTION); } } diff --git a/plugins/gtkui/pltmenu.c b/plugins/gtkui/pltmenu.c index eb6c4b3d..6fd803a2 100644 --- a/plugins/gtkui/pltmenu.c +++ b/plugins/gtkui/pltmenu.c @@ -105,19 +105,18 @@ static void on_actionitem_activate (GtkMenuItem *menuitem, DB_plugin_action_t *action) { - if (action->flags & DB_ACTION_USING_API_14) { + if (action->callback) { ddb_playlist_t *plt = NULL; if (pltmenu_idx != -1) { plt = deadbeef->plt_get_for_idx (pltmenu_idx); } - typedef int (*action_callback_14_t)(struct DB_plugin_action_s *action, void *userdata); - ((action_callback_14_t)action->callback) (action, plt); + action->callback (action, plt); if (plt) { deadbeef->plt_unref (plt); } } else { - action->callback (action, DDB_ACTION_CTX_PLAYLIST); + action->callback2 (action, DDB_ACTION_CTX_PLAYLIST); } } diff --git a/plugins/gtkui/widgets.c b/plugins/gtkui/widgets.c index d65987f1..d4f58d0a 100644 --- a/plugins/gtkui/widgets.c +++ b/plugins/gtkui/widgets.c @@ -3224,7 +3224,13 @@ on_button_clicked (GtkButton *button, DB_plugin_action_t *acts = plugins[i]->get_actions (NULL); while (acts) { if (!strcmp (acts->name, w->action)) { - acts->callback (acts, w->action_ctx); + if (acts->callback) { +#warning FIXME: context + acts->callback (acts, NULL); + } + else if (acts->callback2) { + acts->callback2 (acts, w->action_ctx); + } return; } acts = acts->next; diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c index df5274b8..b7179ca1 100644 --- a/plugins/hotkeys/hotkeys.c +++ b/plugins/hotkeys/hotkeys.c @@ -70,7 +70,6 @@ typedef struct command_s { int modifier; int ctx; int isglobal; - int is_14_action; // means action is coming from plugin using API 1.4 or less DB_plugin_action_t *action; } command_t; @@ -117,28 +116,26 @@ trim (char* s) return h; } -typedef int (*action_callback_14_t)(struct DB_plugin_action_s *action, void *userdata); - static void -cmd_invoke_plugin_command (DB_plugin_action_t *action, int ctx, int is_14_action) +cmd_invoke_plugin_command (DB_plugin_action_t *action, int ctx) { - if (is_14_action) { + if (action->callback) { if (ctx == DDB_ACTION_CTX_MAIN) { // collect stuff for 1.4 user data // common action if (action->flags & DB_ACTION_COMMON) { - ((action_callback_14_t)action->callback) (action, NULL); + action->callback (action, NULL); return; } // playlist action - if (action->flags & DB_ACTION_PLAYLIST__DEPRECATED) + if (action->flags & DB_ACTION_PLAYLIST) { ddb_playlist_t *plt = deadbeef->plt_get_curr (); if (plt) { - ((action_callback_14_t)action->callback) (action, plt); + action->callback (action, plt); deadbeef->plt_unref (plt); } return; @@ -179,16 +176,16 @@ cmd_invoke_plugin_command (DB_plugin_action_t *action, int ctx, int is_14_action //So, action is allowed, do it. - if (action->flags & DB_ACTION_CAN_MULTIPLE_TRACKS__DEPRECATED) + if (action->flags & DB_ACTION_CAN_MULTIPLE_TRACKS) { - ((action_callback_14_t)action->callback) (action, NULL); + action->callback (action, NULL); } else { pit = deadbeef->pl_get_first (PL_MAIN); while (pit) { if (deadbeef->pl_is_selected (pit)) { - ((action_callback_14_t)action->callback) (action, pit); + action->callback (action, pit); } DB_playItem_t *next = deadbeef->pl_get_next (pit, PL_MAIN); deadbeef->pl_item_unref (pit); @@ -198,14 +195,13 @@ cmd_invoke_plugin_command (DB_plugin_action_t *action, int ctx, int is_14_action } } else { - action->callback (action, ctx); + action->callback2 (action, ctx); } } static DB_plugin_action_t * -find_action_by_name (const char *command, int *is_14_action) { +find_action_by_name (const char *command) { // find action with this name, and add to list - *is_14_action = 0; DB_plugin_action_t *actions = NULL; DB_plugin_t **plugins = deadbeef->plug_get_list (); for (int i = 0; plugins[i]; i++) { @@ -214,9 +210,6 @@ find_action_by_name (const char *command, int *is_14_action) { actions = p->get_actions (NULL); while (actions) { if (actions->name && actions->title && !strcasecmp (actions->name, command)) { - if (p->api_vminor < 5) { - *is_14_action = 1; - } break; // found } actions = actions->next; @@ -307,7 +300,7 @@ read_config (void) { trace ("hotkeys: unexpected eol (action)\n"); goto out; } - cmd_entry->action = find_action_by_name (token, &cmd_entry->is_14_action); + cmd_entry->action = find_action_by_name (token); if (!cmd_entry->action) { trace ("hotkeys: action not found %s\n", token); goto out; @@ -485,7 +478,7 @@ hotkeys_event_loop (void *unused) { (state == commands[ i ].modifier)) { trace ("matches to commands[%d]!\n", i); - cmd_invoke_plugin_command (commands[i].action, commands[i].ctx, commands->is_14_action); + cmd_invoke_plugin_command (commands[i].action, commands[i].ctx); break; } } @@ -748,7 +741,7 @@ static DB_plugin_action_t action_reload_metadata = { .title = "Reload metadata", .name = "reload_metadata", .flags = DB_ACTION_MULTIPLE_TRACKS, - .callback = action_reload_metadata_handler, + .callback2 = action_reload_metadata_handler, .next = NULL }; @@ -756,7 +749,7 @@ static DB_plugin_action_t action_jump_to_current = { .title = "Playback/Jump to currently playing track", .name = "jump_to_current_track", .flags = DB_ACTION_COMMON, - .callback = action_jump_to_current_handler, + .callback2 = action_jump_to_current_handler, .next = &action_reload_metadata }; @@ -764,7 +757,7 @@ static DB_plugin_action_t action_next_playlist = { .title = "Next playlist", .name = "next_playlist", .flags = DB_ACTION_COMMON, - .callback = action_next_playlist_handler, + .callback2 = action_next_playlist_handler, .next = &action_jump_to_current }; @@ -772,7 +765,7 @@ static DB_plugin_action_t action_prev_playlist = { .title = "Prev playlist", .name = "prev_playlist", .flags = DB_ACTION_COMMON, - .callback = action_prev_playlist_handler, + .callback2 = action_prev_playlist_handler, .next = &action_next_playlist }; @@ -780,7 +773,7 @@ static DB_plugin_action_t action_playlist10 = { .title = "Switch to playlist 10", .name = "playlist10", .flags = DB_ACTION_COMMON, - .callback = action_playlist10_handler, + .callback2 = action_playlist10_handler, .next = &action_prev_playlist }; @@ -788,7 +781,7 @@ static DB_plugin_action_t action_playlist9 = { .title = "Switch to playlist 9", .name = "playlist9", .flags = DB_ACTION_COMMON, - .callback = action_playlist9_handler, + .callback2 = action_playlist9_handler, .next = &action_playlist10 }; @@ -796,7 +789,7 @@ static DB_plugin_action_t action_playlist8 = { .title = "Switch to playlist 8", .name = "playlist8", .flags = DB_ACTION_COMMON, - .callback = action_playlist8_handler, + .callback2 = action_playlist8_handler, .next = &action_playlist9 }; @@ -804,7 +797,7 @@ static DB_plugin_action_t action_playlist7 = { .title = "Switch to playlist 7", .name = "playlist7", .flags = DB_ACTION_COMMON, - .callback = action_playlist7_handler, + .callback2 = action_playlist7_handler, .next = &action_playlist8 }; @@ -812,7 +805,7 @@ static DB_plugin_action_t action_playlist6 = { .title = "Switch to playlist 6", .name = "playlist6", .flags = DB_ACTION_COMMON, - .callback = action_playlist6_handler, + .callback2 = action_playlist6_handler, .next = &action_playlist7 }; @@ -820,7 +813,7 @@ static DB_plugin_action_t action_playlist5 = { .title = "Switch to playlist 5", .name = "playlist5", .flags = DB_ACTION_COMMON, - .callback = action_playlist5_handler, + .callback2 = action_playlist5_handler, .next = &action_playlist6 }; @@ -828,7 +821,7 @@ static DB_plugin_action_t action_playlist4 = { .title = "Switch to playlist 4", .name = "playlist4", .flags = DB_ACTION_COMMON, - .callback = action_playlist4_handler, + .callback2 = action_playlist4_handler, .next = &action_playlist5 }; @@ -836,7 +829,7 @@ static DB_plugin_action_t action_playlist3 = { .title = "Switch to playlist 3", .name = "playlist3", .flags = DB_ACTION_COMMON, - .callback = action_playlist3_handler, + .callback2 = action_playlist3_handler, .next = &action_playlist4 }; @@ -844,7 +837,7 @@ static DB_plugin_action_t action_playlist2 = { .title = "Switch to playlist 2", .name = "playlist2", .flags = DB_ACTION_COMMON, - .callback = action_playlist2_handler, + .callback2 = action_playlist2_handler, .next = &action_playlist3 }; @@ -852,7 +845,7 @@ static DB_plugin_action_t action_playlist1 = { .title = "Switch to playlist 1", .name = "playlist1", .flags = DB_ACTION_COMMON, - .callback = action_playlist1_handler, + .callback2 = action_playlist1_handler, .next = &action_playlist2 }; @@ -860,7 +853,7 @@ static DB_plugin_action_t action_sort_randomize = { .title = "Edit/Sort Randomize", .name = "sort_randomize", .flags = DB_ACTION_COMMON, - .callback = action_sort_randomize_handler, + .callback2 = action_sort_randomize_handler, .next = &action_playlist1 }; @@ -868,7 +861,7 @@ static DB_plugin_action_t action_sort_by_date = { .title = "Edit/Sort by date", .name = "sort_date", .flags = DB_ACTION_COMMON, - .callback = action_sort_by_date_handler, + .callback2 = action_sort_by_date_handler, .next = &action_sort_randomize }; @@ -876,7 +869,7 @@ static DB_plugin_action_t action_sort_by_artist = { .title = "Edit/Sort by artist", .name = "sort_artist", .flags = DB_ACTION_COMMON, - .callback = action_sort_by_artist_handler, + .callback2 = action_sort_by_artist_handler, .next = &action_sort_by_date }; @@ -885,7 +878,7 @@ static DB_plugin_action_t action_sort_by_album = { .title = "Edit/Sort by album", .name = "sort_album", .flags = DB_ACTION_COMMON, - .callback = action_sort_by_album_handler, + .callback2 = action_sort_by_album_handler, .next = &action_sort_by_artist }; @@ -893,7 +886,7 @@ static DB_plugin_action_t action_sort_by_tracknr = { .title = "Edit/Sort by track number", .name = "sort_tracknr", .flags = DB_ACTION_COMMON, - .callback = action_sort_by_tracknr_handler, + .callback2 = action_sort_by_tracknr_handler, .next = &action_sort_by_album }; @@ -901,7 +894,7 @@ static DB_plugin_action_t action_sort_by_title = { .title = "Edit/Sort by title", .name = "sort_title", .flags = DB_ACTION_COMMON, - .callback = action_sort_by_title_handler, + .callback2 = action_sort_by_title_handler, .next = &action_sort_by_tracknr }; @@ -909,7 +902,7 @@ static DB_plugin_action_t action_invert_selection = { .title = "Edit/Invert Selection", .name = "invert_selection", .flags = DB_ACTION_COMMON, - .callback = action_invert_selection_handler, + .callback2 = action_invert_selection_handler, .next = &action_sort_by_tracknr }; @@ -917,7 +910,7 @@ static DB_plugin_action_t action_clear_playlist = { .title = "Edit/Clear playlist", .name = "clear_playlist", .flags = DB_ACTION_COMMON, - .callback = action_clear_playlist_handler, + .callback2 = action_clear_playlist_handler, .next = &action_invert_selection }; @@ -925,7 +918,7 @@ static DB_plugin_action_t action_remove_from_playqueue = { .title = "Playback/Remove from playback queue", .name = "remove_from_playback_queue", .flags = DB_ACTION_MULTIPLE_TRACKS, - .callback = action_remove_from_playqueue_handler, + .callback2 = action_remove_from_playqueue_handler, .next = &action_clear_playlist }; @@ -933,7 +926,7 @@ static DB_plugin_action_t action_add_to_playqueue = { .title = "Playback/Add to playback queue", .name = "add_to_playback_queue", .flags = DB_ACTION_MULTIPLE_TRACKS, - .callback = action_add_to_playqueue_handler, + .callback2 = action_add_to_playqueue_handler, .next = &action_remove_from_playqueue }; @@ -941,7 +934,7 @@ static DB_plugin_action_t action_toggle_mute = { .title = "Playback/Toggle Mute", .name = "toggle_mute", .flags = DB_ACTION_COMMON, - .callback = action_toggle_mute_handler, + .callback2 = action_toggle_mute_handler, .next = &action_add_to_playqueue }; @@ -949,7 +942,7 @@ static DB_plugin_action_t action_play = { .title = "Playback/Play", .name = "play", .flags = DB_ACTION_COMMON, - .callback = action_play_cb, + .callback2 = action_play_cb, .next = &action_toggle_mute }; @@ -957,7 +950,7 @@ static DB_plugin_action_t action_stop = { .title = "Playback/Stop", .name = "stop", .flags = DB_ACTION_COMMON, - .callback = action_stop_cb, + .callback2 = action_stop_cb, .next = &action_play }; @@ -965,7 +958,7 @@ static DB_plugin_action_t action_prev = { .title = "Playback/Previous", .name = "prev", .flags = DB_ACTION_COMMON, - .callback = action_prev_cb, + .callback2 = action_prev_cb, .next = &action_stop }; @@ -973,7 +966,7 @@ static DB_plugin_action_t action_next = { .title = "Playback/Next", .name = "next", .flags = DB_ACTION_COMMON, - .callback = action_next_cb, + .callback2 = action_next_cb, .next = &action_prev }; @@ -981,7 +974,7 @@ static DB_plugin_action_t action_toggle_pause = { .title = "Playback/Toggle Pause", .name = "toggle_pause", .flags = DB_ACTION_COMMON, - .callback = action_toggle_pause_cb, + .callback2 = action_toggle_pause_cb, .next = &action_next }; @@ -989,7 +982,7 @@ static DB_plugin_action_t action_play_pause = { .title = "Playback/Play\\/Pause", .name = "play_pause", .flags = DB_ACTION_COMMON, - .callback = action_play_pause_cb, + .callback2 = action_play_pause_cb, .next = &action_toggle_pause }; @@ -997,7 +990,7 @@ static DB_plugin_action_t action_play_random = { .title = "Playback/Play Random", .name = "playback_random", .flags = DB_ACTION_COMMON, - .callback = action_play_random_cb, + .callback2 = action_play_random_cb, .next = &action_play_pause }; @@ -1005,7 +998,7 @@ static DB_plugin_action_t action_seek_1p_forward = { .title = "Playback/Seek 1% forward", .name = "seek_1p_fwd", .flags = DB_ACTION_COMMON, - .callback = action_seek_1p_forward_cb, + .callback2 = action_seek_1p_forward_cb, .next = &action_play_random }; @@ -1013,7 +1006,7 @@ static DB_plugin_action_t action_seek_1p_backward = { .title = "Playback/Seek 1% backward", .name = "seek_1p_back", .flags = DB_ACTION_COMMON, - .callback = action_seek_1p_backward_cb, + .callback2 = action_seek_1p_backward_cb, .next = &action_seek_1p_forward }; @@ -1021,7 +1014,7 @@ static DB_plugin_action_t action_seek_5p_forward = { .title = "Playback/Seek 5% forward", .name = "seek_5p_fwd", .flags = DB_ACTION_COMMON, - .callback = action_seek_5p_forward_cb, + .callback2 = action_seek_5p_forward_cb, .next = &action_seek_1p_backward }; @@ -1029,7 +1022,7 @@ static DB_plugin_action_t action_seek_5p_backward = { .title = "Playback/Seek 5% backward", .name = "seek_5p_back", .flags = DB_ACTION_COMMON, - .callback = action_seek_5p_backward_cb, + .callback2 = action_seek_5p_backward_cb, .next = &action_seek_5p_forward }; @@ -1037,7 +1030,7 @@ static DB_plugin_action_t action_volume_up = { .title = "Playback/Volume Up", .name = "volume_up", .flags = DB_ACTION_COMMON, - .callback = action_volume_up_cb, + .callback2 = action_volume_up_cb, .next = &action_seek_5p_backward }; @@ -1045,7 +1038,7 @@ static DB_plugin_action_t action_volume_down = { .title = "Playback/Volume Down", .name = "volume_down", .flags = DB_ACTION_COMMON, - .callback = action_volume_down_cb, + .callback2 = action_volume_down_cb, .next = &action_volume_up }; @@ -1053,7 +1046,7 @@ static DB_plugin_action_t action_toggle_stop_after_current = { .title = "Playback/Toggle Stop After Current", .name = "toggle_stop_after_current", .flags = DB_ACTION_COMMON, - .callback = action_toggle_stop_after_current_cb, + .callback2 = action_toggle_stop_after_current_cb, .next = &action_volume_down }; diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c index 29898742..d0d64e34 100644 --- a/plugins/lastfm/lastfm.c +++ b/plugins/lastfm/lastfm.c @@ -945,7 +945,7 @@ static DB_plugin_action_t love_action = { .title = "Love at Last.fm", .name = "lfm_love", .flags = DB_ACTION_SINGLE_TRACK, - .callback = lfm_action_love, + .callback2 = lfm_action_love, .next = NULL }; @@ -953,7 +953,7 @@ static DB_plugin_action_t lookup_action = { .title = "Lookup on Last.fm", .name = "lfm_lookup", .flags = DB_ACTION_SINGLE_TRACK | DB_ACTION_ADD_MENU, - .callback = lfm_action_lookup, + .callback2 = lfm_action_lookup, .next = NULL// &love_action }; diff --git a/plugins/shellexec/shellexec.c b/plugins/shellexec/shellexec.c index b76cd365..329b9d9e 100644 --- a/plugins/shellexec/shellexec.c +++ b/plugins/shellexec/shellexec.c @@ -89,7 +89,7 @@ static int shx_exec_track_cmd (Shx_action_t *action, DB_playItem_t *it) { } strcat (cmd, "&"); trace ("%s\n", cmd); - system (cmd); + res = system (cmd); } static int @@ -99,7 +99,7 @@ shx_callback (Shx_action_t *action, int ctx) switch (ctx) { case DDB_ACTION_CTX_MAIN: trace ("%s\n", action->shcommand); - system (action->shcommand); + int res = system (action->shcommand); break; case DDB_ACTION_CTX_SELECTION: { @@ -255,7 +255,7 @@ shx_save_actions (void) } Shx_action_t* -shx_get_actions (DB_plugin_action_callback_t callback) +shx_get_actions (DB_plugin_action_callback2_t callback) { Shx_action_t *action_list = NULL; Shx_action_t *prev = NULL; @@ -303,7 +303,7 @@ shx_get_actions (DB_plugin_action_callback_t callback) action->parent.title = strdup (title); action->parent.name = strdup (name); action->shcommand = strdup (command); - action->parent.callback = callback; + action->parent.callback2 = callback; action->parent.next = NULL; action->parent.flags |= DB_ACTION_ADD_MENU; @@ -339,7 +339,7 @@ shx_get_actions (DB_plugin_action_callback_t callback) Shx_action_t* shx_action_add (void) { Shx_action_t *a = calloc (sizeof (Shx_action_t), 1); - a->parent.callback = (DB_plugin_action_callback_t)shx_callback; + a->parent.callback2 = (DB_plugin_action_callback2_t)shx_callback; if (!actions) { actions = a; } @@ -389,7 +389,7 @@ shx_action_remove (Shx_action_t *action) { static int shx_start () { - actions = shx_get_actions((DB_plugin_action_callback_t)shx_callback); + actions = shx_get_actions((DB_plugin_action_callback2_t)shx_callback); return 0; } diff --git a/plugins/shellexecui/shellexecui.c b/plugins/shellexecui/shellexecui.c index 7cfd2155..5dda6490 100644 --- a/plugins/shellexecui/shellexecui.c +++ b/plugins/shellexecui/shellexecui.c @@ -365,7 +365,7 @@ static DB_plugin_action_t shellexecui_action = { .title = "Edit/Configure custom shell commands", .name = "shellexec_conf", .flags = DB_ACTION_COMMON | DB_ACTION_ADD_MENU, - .callback = shellexecui_action_callback, + .callback2 = shellexecui_action_callback, .next = NULL, }; |