diff options
-rw-r--r-- | deadbeef.h | 15 | ||||
-rw-r--r-- | plugins/cdda/cdda.c | 2 | ||||
-rw-r--r-- | plugins/converter/convgui.c | 2 | ||||
-rw-r--r-- | plugins/gtkui/plcommon.c | 2 | ||||
-rw-r--r-- | plugins/hotkeys/hotkeys.c | 24 | ||||
-rw-r--r-- | plugins/lastfm/lastfm.c | 4 |
6 files changed, 31 insertions, 18 deletions
@@ -742,6 +742,15 @@ typedef struct { const char *(*pl_find_meta_raw) (DB_playItem_t *it, const char *key); } DB_functions_t; +// NOTE: an item placement must be selected like this +// if (flags & DB_ACTION_COMMON) -> main menu, or nowhere, or where GUI plugin wants +// basically, to put it into main menu, prefix the item title with the menu name +// e.g. title = "File/MyItem" --> this will add the item under File menu +// +// if (flags & PLAYLIST) -> playlist (tab) context menu +// +// if (none of the above) -> track context menu + enum { /* Action in main menu (or whereever ui prefers) */ DB_ACTION_COMMON = 1 << 0, @@ -759,14 +768,18 @@ enum { DB_ACTION_DISABLED = 1 << 4, /* Action for the playlist (tab) */ + /* this is new in 0.5.2 (API v1.2) */ DB_ACTION_PLAYLIST = 1 << 5, }; struct DB_plugin_action_s; // userdata type depends on type of action -// can be track ptr, or playlist ptr, etc +// it must be NULL for DB_ACTION_COMMON +// or ddb_playlist_t * for DB_ACTION_PLAYLIST +// or ddb_playItem_t * for none of the above (track context menu) typedef int (*DB_plugin_action_callback_t) (struct DB_plugin_action_s *action, void *userdata); +#define DDB_ACTION_CALLBACK(x)((int (*)(struct DB_plugin_action_s *action, void *userdata))x) typedef struct DB_plugin_action_s { const char *title; diff --git a/plugins/cdda/cdda.c b/plugins/cdda/cdda.c index aef9f65c..c26daac7 100644 --- a/plugins/cdda/cdda.c +++ b/plugins/cdda/cdda.c @@ -602,7 +602,7 @@ cda_action_add_cd (DB_plugin_action_t *act, DB_playItem_t *it) static DB_plugin_action_t add_cd_action = { .title = "File/Add Audio CD", .flags = DB_ACTION_COMMON, - .callback = cda_action_add_cd, + .callback = DDB_ACTION_CALLBACK(cda_action_add_cd), .next = NULL }; diff --git a/plugins/converter/convgui.c b/plugins/converter/convgui.c index d214d222..b76cc7c0 100644 --- a/plugins/converter/convgui.c +++ b/plugins/converter/convgui.c @@ -1251,7 +1251,7 @@ static DB_plugin_action_t convert_action = { .title = "Convert", .name = "convert", .flags = DB_ACTION_CAN_MULTIPLE_TRACKS | DB_ACTION_ALLOW_MULTIPLE_TRACKS | DB_ACTION_SINGLE_TRACK, - .callback = converter_show, + .callback = DDB_ACTION_CALLBACK(converter_show), .next = NULL }; diff --git a/plugins/gtkui/plcommon.c b/plugins/gtkui/plcommon.c index 4ad851c2..8f14afbc 100644 --- a/plugins/gtkui/plcommon.c +++ b/plugins/gtkui/plcommon.c @@ -513,7 +513,7 @@ list_context_menu (DdbListview *listview, DdbListviewIter it, int idx) { int count = 0; for (action = actions; action; action = action->next) { - if (action->flags & DB_ACTION_COMMON) + if (action->flags & (DB_ACTION_COMMON | DB_ACTION_PLAYLIST)) continue; // create submenus (separated with '/') diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c index e1357df8..884b2be9 100644 --- a/plugins/hotkeys/hotkeys.c +++ b/plugins/hotkeys/hotkeys.c @@ -514,7 +514,7 @@ static DB_plugin_action_t action_play = { .title = "Play", .name = "play", .flags = DB_ACTION_COMMON, - .callback = action_play_cb, + .callback = DDB_ACTION_CALLBACK (action_play_cb), .next = NULL }; @@ -522,7 +522,7 @@ static DB_plugin_action_t action_stop = { .title = "Stop", .name = "stop", .flags = DB_ACTION_COMMON, - .callback = action_stop_cb, + .callback = DDB_ACTION_CALLBACK(action_stop_cb), .next = &action_play }; @@ -530,7 +530,7 @@ static DB_plugin_action_t action_prev = { .title = "Previous", .name = "prev", .flags = DB_ACTION_COMMON, - .callback = action_prev_cb, + .callback = DDB_ACTION_CALLBACK(action_prev_cb), .next = &action_stop }; @@ -538,7 +538,7 @@ static DB_plugin_action_t action_next = { .title = "Next", .name = "next", .flags = DB_ACTION_COMMON, - .callback = action_next_cb, + .callback = DDB_ACTION_CALLBACK(action_next_cb), .next = &action_prev }; @@ -546,7 +546,7 @@ static DB_plugin_action_t action_toggle_pause = { .title = "Toggle Pause", .name = "toggle_pause", .flags = DB_ACTION_COMMON, - .callback = action_toggle_pause_cb, + .callback = DDB_ACTION_CALLBACK(action_toggle_pause_cb), .next = &action_next }; @@ -554,7 +554,7 @@ static DB_plugin_action_t action_play_pause = { .title = "Play\\/Pause", .name = "play_pause", .flags = DB_ACTION_COMMON, - .callback = action_play_pause_cb, + .callback = DDB_ACTION_CALLBACK(action_play_pause_cb), .next = &action_toggle_pause }; @@ -562,7 +562,7 @@ static DB_plugin_action_t action_play_random = { .title = "Play Random", .name = "playback_random", .flags = DB_ACTION_COMMON, - .callback = action_play_random_cb, + .callback = DDB_ACTION_CALLBACK(action_play_random_cb), .next = &action_play_pause }; @@ -570,7 +570,7 @@ static DB_plugin_action_t action_seek_forward = { .title = "Seek Forward", .name = "seek_fwd", .flags = DB_ACTION_COMMON, - .callback = action_seek_forward_cb, + .callback = DDB_ACTION_CALLBACK(action_seek_forward_cb), .next = &action_play_random }; @@ -578,7 +578,7 @@ static DB_plugin_action_t action_seek_backward = { .title = "Seek Backward", .name = "seek_back", .flags = DB_ACTION_COMMON, - .callback = action_seek_backward_cb, + .callback = DDB_ACTION_CALLBACK(action_seek_backward_cb), .next = &action_seek_forward }; @@ -586,7 +586,7 @@ static DB_plugin_action_t action_volume_up = { .title = "Volume Up", .name = "volume_up", .flags = DB_ACTION_COMMON, - .callback = action_volume_up_cb, + .callback = DDB_ACTION_CALLBACK(action_volume_up_cb), .next = &action_seek_backward }; @@ -594,7 +594,7 @@ static DB_plugin_action_t action_volume_down = { .title = "Volume Down", .name = "volume_down", .flags = DB_ACTION_COMMON, - .callback = action_volume_down_cb, + .callback = DDB_ACTION_CALLBACK(action_volume_down_cb), .next = &action_volume_up }; @@ -602,7 +602,7 @@ static DB_plugin_action_t action_toggle_stop_after_current = { .title = "Toggle Stop After Current", .name = "toggle_stop_after_current", .flags = DB_ACTION_COMMON, - .callback = action_toggle_stop_after_current_cb, + .callback = DDB_ACTION_CALLBACK(action_toggle_stop_after_current_cb), .next = &action_volume_down }; diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c index 5135822b..c8794e31 100644 --- a/plugins/lastfm/lastfm.c +++ b/plugins/lastfm/lastfm.c @@ -908,7 +908,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, + .callback = DDB_ACTION_CALLBACK(lfm_action_love), .next = NULL }; @@ -916,7 +916,7 @@ static DB_plugin_action_t lookup_action = { .title = "Lookup on Last.fm", .name = "lfm_lookup", .flags = DB_ACTION_SINGLE_TRACK, - .callback = lfm_action_lookup, + .callback = DDB_ACTION_CALLBACK (lfm_action_lookup), .next = NULL// &love_action }; |