diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/cdda/cdda.c | 2 | ||||
-rw-r--r-- | plugins/converter/convgui.c | 2 | ||||
-rw-r--r-- | plugins/gtkui/actions.c | 2 | ||||
-rw-r--r-- | plugins/gtkui/gtkui.c | 103 | ||||
-rw-r--r-- | plugins/gtkui/hotkeys.c | 76 | ||||
-rw-r--r-- | plugins/gtkui/plcommon.c | 2 | ||||
-rw-r--r-- | plugins/hotkeys/hotkeys.c | 219 | ||||
-rw-r--r-- | plugins/lastfm/lastfm.c | 2 | ||||
-rw-r--r-- | plugins/shellexec/shellexec.c | 1 | ||||
-rw-r--r-- | plugins/shellexecui/shellexecui.c | 2 |
10 files changed, 367 insertions, 44 deletions
diff --git a/plugins/cdda/cdda.c b/plugins/cdda/cdda.c index 26283d39..fa039969 100644 --- a/plugins/cdda/cdda.c +++ b/plugins/cdda/cdda.c @@ -645,7 +645,7 @@ cda_action_add_cd (DB_plugin_action_t *act, int ctx) static DB_plugin_action_t add_cd_action = { .name = "cd_add", .title = "File/Add audio CD", - .flags = DB_ACTION_COMMON, + .flags = DB_ACTION_COMMON | DB_ACTION_ADD_MENU, .callback = cda_action_add_cd, .next = NULL }; diff --git a/plugins/converter/convgui.c b/plugins/converter/convgui.c index b44a1c1e..7147f09e 100644 --- a/plugins/converter/convgui.c +++ b/plugins/converter/convgui.c @@ -1431,7 +1431,7 @@ encoder_cmdline_help_link_create (gchar *widget_name, gchar *string1, gchar *str static DB_plugin_action_t convert_action = { .title = "Convert", .name = "convert", - .flags = DB_ACTION_MULTIPLE_TRACKS | DB_ACTION_SINGLE_TRACK, + .flags = DB_ACTION_MULTIPLE_TRACKS | DB_ACTION_SINGLE_TRACK | DB_ACTION_ADD_MENU, .callback = converter_show, .next = NULL }; diff --git a/plugins/gtkui/actions.c b/plugins/gtkui/actions.c index ee7831f6..9d514d64 100644 --- a/plugins/gtkui/actions.c +++ b/plugins/gtkui/actions.c @@ -86,7 +86,7 @@ add_mainmenu_actions (void) for (action = actions; action; action = action->next) { char *tmp = NULL; - if (0 == (action->flags & DB_ACTION_COMMON)) + if (!(action->flags & DB_ACTION_COMMON) || !(action->flags & DB_ACTION_ADD_MENU)) continue; // 1st check if we have slashes diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index 2336e53a..97718ed7 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -1396,6 +1396,108 @@ gtkui_get_mainwin (void) { return mainwin; } +static DB_plugin_action_t action_preferences = { + .title = "Edit/[stub] Preferences", + .name = "preferences", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = NULL +}; + +static DB_plugin_action_t action_sort_custom = { + .title = "Edit/[stub] Sort Custom", + .name = "sort_custom", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_preferences +}; + +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 +}; + +static DB_plugin_action_t action_load_playlist = { + .title = "File/[stub] Load Playlist", + .name = "load_playlist", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_save_playlist +}; + +static DB_plugin_action_t action_new_playlist = { + .title = "File/[stub] New Playlist", + .name = "new_playlist", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_load_playlist +}; + +static DB_plugin_action_t action_toggle_eq = { + .title = "[stub] Show\\/Hide Equalizer", + .name = "toggle_eq", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_new_playlist +}; + +static DB_plugin_action_t action_hide_eq = { + .title = "[stub] Hide Equalizer", + .name = "hide_eq", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_toggle_eq +}; + +static DB_plugin_action_t action_show_eq = { + .title = "[stub] Show Equalizer", + .name = "show_eq", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_hide_eq +}; + +static DB_plugin_action_t action_toggle_mainwin = { + .title = "[stub] Show\\/Hide Player Window", + .name = "toggle_player_window", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_show_eq +}; + +static DB_plugin_action_t action_hide_mainwin = { + .title = "[stub] Hide Player Window", + .name = "hide_player_window", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_toggle_mainwin +}; + +static DB_plugin_action_t action_show_mainwin = { + .title = "[stub] Show Player Window", + .name = "show_player_window", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_hide_mainwin +}; + +static DB_plugin_action_t action_find = { + .title = "Edit/[stub] Find", + .name = "find", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_show_mainwin +}; + +static DB_plugin_action_t * +gtkui_get_actions (DB_playItem_t *it) +{ + return &action_find; +} + #if !GTK_CHECK_VERSION(3,0,0) DB_plugin_t * ddb_gui_GTK2_load (DB_functions_t *api) { @@ -1461,6 +1563,7 @@ static ddb_gtkui_t plugin = { .gui.plugin.configdialog = settings_dlg, .gui.plugin.message = gtkui_message, .gui.run_dialog = gtkui_run_dialog_root, + .gui.plugin.get_actions = gtkui_get_actions, .get_mainwin = gtkui_get_mainwin, .w_reg_widget = w_reg_widget, .w_unreg_widget = w_unreg_widget, diff --git a/plugins/gtkui/hotkeys.c b/plugins/gtkui/hotkeys.c index a33f0e9e..c8cca149 100644 --- a/plugins/gtkui/hotkeys.c +++ b/plugins/gtkui/hotkeys.c @@ -78,6 +78,21 @@ unescape_forward_slash (const char *src, char *dst, int size) { *dst = 0; } + +static const char * +get_display_action_title (const char *title) { + const char *t = title + strlen (title) - 1; + while (t > title) { + if (*t != '/' || *(t-1) == '\\') { + t--; + continue; + } + t++; + break; + } + return t; +} + static DB_plugin_action_t * find_action_by_name (const char *command) { // find action with this name, and add to list @@ -140,14 +155,10 @@ hotkeys_load (void) { GtkTreeIter iter; gtk_list_store_append (hkstore, &iter); - const char *t = strrchr (action->title, '/'); - if (t) { - t++; - } - else { - t = action->title; - } - gtk_list_store_set (hkstore, &iter, 0, keycombo, 1, t, 2, ctx_names[ctx], 3, isglobal, 4, action->name, 5, ctx, -1); + const char *t = get_display_action_title (action->title); + char title[100]; + unescape_forward_slash (t, title, sizeof (title)); + gtk_list_store_set (hkstore, &iter, 0, keycombo, 1, title, 2, ctx_names[ctx], 3, isglobal, 4, action->name, 5, ctx, -1); n_items++; out: @@ -196,6 +207,15 @@ action_tree_append (const char *title, GtkTreeStore *store, GtkTreeIter *root_it int got_iter = 0; for (;;) { char *s = strchr (p, '/'); + // find unescaped forward slash + if (s == p) { + p++; + continue; + } + if (s && s > p && *(s-1) == '\\') { + p = s + 1; + continue; + } if (!s) { break; } @@ -208,21 +228,28 @@ action_tree_append (const char *title, GtkTreeStore *store, GtkTreeIter *root_it root_iter = &i; } else { + int found = 0; do { GValue val = {0,}; gtk_tree_model_get_value (GTK_TREE_MODEL (store), &i, 0, &val); const char *n = g_value_get_string (&val); if (n && !strcmp (n, p)) { root_iter = &i; + found = 1; break; } } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &i)); + if (!found) { + gtk_tree_store_append (store, &i, root_iter); + gtk_tree_store_set (store, &i, 0, p, 1, NULL, 2, -1, -1); + root_iter = &i; + } } p = s+1; } gtk_tree_store_append (store, iter, root_iter); - return title + (int)(p-t); + return get_display_action_title (title); } void @@ -295,20 +322,23 @@ prefwin_init_hotkeys (GtkWidget *_prefwin) { while (actions) { if (actions->name && actions->title) { // only add actions with both the name and the title char title[100]; - unescape_forward_slash (actions->title, title, sizeof (title)); GtkTreeIter iter; const char *t; if (actions->flags & DB_ACTION_COMMON) { - t = action_tree_append (title, actions_store, &action_main_iter, &iter); - gtk_tree_store_set (actions_store, &iter, 0, t, 1, actions->name, 2, DDB_ACTION_CTX_MAIN, -1); + t = action_tree_append (actions->title, actions_store, &action_main_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_MAIN, -1); } if (actions->flags & (DB_ACTION_SINGLE_TRACK | DB_ACTION_MULTIPLE_TRACKS | DB_ACTION_CAN_MULTIPLE_TRACKS__DEPRECATED)) { - t = action_tree_append (title, actions_store, &action_selection_iter, &iter); - gtk_tree_store_set (actions_store, &iter, 0, t, 1, actions->name, 2, DDB_ACTION_CTX_SELECTION, -1); - t = action_tree_append (title, actions_store, &action_playlist_iter, &iter); - gtk_tree_store_set (actions_store, &iter, 0, t, 1, actions->name, 2, DDB_ACTION_CTX_PLAYLIST, -1); - t = action_tree_append (title, actions_store, &action_nowplaying_iter, &iter); + 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); + t = action_tree_append (actions->title, actions_store, &action_playlist_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_PLAYLIST, -1); + t = action_tree_append (actions->title, actions_store, &action_nowplaying_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_NOWPLAYING, -1); } } @@ -452,14 +482,10 @@ on_hotkeys_actions_cursor_changed (GtkTreeView *treeview, GtkTreeIter iter; if (path && gtk_tree_model_get_iter (model, &iter, path)) { if (action) { - const char *t = strrchr (action->title, '/'); - if (t) { - t++; - } - else { - t = action->title; - } - gtk_list_store_set (GTK_LIST_STORE (model), &iter, 1, t, 4, action->name, 5, ctx, 2, ctx_names[ctx], -1); + const char *t = get_display_action_title (action->title); + char title[100]; + unescape_forward_slash (t, title, sizeof (title)); + gtk_list_store_set (GTK_LIST_STORE (model), &iter, 1, title, 4, action->name, 5, ctx, 2, ctx_names[ctx], -1); } else { gtk_list_store_set (GTK_LIST_STORE (model), &iter, 1, _("<Not set>"), 4, NULL, 2, _("<Not set>"), -1); diff --git a/plugins/gtkui/plcommon.c b/plugins/gtkui/plcommon.c index 1dd43308..ec84d256 100644 --- a/plugins/gtkui/plcommon.c +++ b/plugins/gtkui/plcommon.c @@ -558,7 +558,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) || !(action->flags & DB_ACTION_ADD_MENU) || !(action->flags & (DB_ACTION_MULTIPLE_TRACKS | DB_ACTION_SINGLE_TRACK))) continue; // create submenus (separated with '/') diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c index c218b81b..8a5fb34c 100644 --- a/plugins/hotkeys/hotkeys.c +++ b/plugins/hotkeys/hotkeys.c @@ -609,16 +609,209 @@ action_toggle_stop_after_current_cb (struct DB_plugin_action_s *action, int ctx) return 0; } +static DB_plugin_action_t action_toggle_menu = { + .title = "View/[stub] Show\\/Hide menu", + .name = "toggle_menu", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = NULL +}; + +static DB_plugin_action_t action_toggle_column_headers = { + .title = "View/[stub] Show\\/Hide playlist column headers", + .name = "toggle_headers", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_toggle_menu +}; + +static DB_plugin_action_t action_toggle_statusbar = { + .title = "View/[stub] Show\\/Hide statusbar", + .name = "toggle_statusbar", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_toggle_column_headers +}; + +static DB_plugin_action_t action_next_playlist = { + .title = "Edit/[stub] Next playlist", + .name = "sort_next_playlist", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_toggle_statusbar +}; + +static DB_plugin_action_t action_prev_playlist = { + .title = "Edit/[stub] Prev playlist", + .name = "sort_prev_playlist", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_next_playlist +}; + +static DB_plugin_action_t action_sort_randomize = { + .title = "Edit/[stub] Sort Randomize", + .name = "sort_randomize", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_prev_playlist +}; + +static DB_plugin_action_t action_sort_by_date = { + .title = "Edit/[stub] Sort by date", + .name = "sort_date", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_sort_randomize +}; + +static DB_plugin_action_t action_sort_by_artist = { + .title = "Edit/[stub] Sort by artist", + .name = "sort_artist", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_sort_by_date +}; + + +static DB_plugin_action_t action_sort_by_album = { + .title = "Edit/[stub] Sort by album", + .name = "sort_album", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_sort_by_artist +}; + +static DB_plugin_action_t action_sort_by_tracknr = { + .title = "Edit/[stub] Sort by track number", + .name = "sort_tracknr", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_sort_by_album +}; + +static DB_plugin_action_t action_sort_by_title = { + .title = "Edit/[stub] Sort by title", + .name = "sort_title", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .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_selected = { + .title = "Edit/[stub] Remove Selected", + .name = "remove_selected", + .flags = DB_ACTION_COMMON, + .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_selected +}; + +static DB_plugin_action_t action_deselect_all = { + .title = "Edit/[stub] Deselect All", + .name = "deselect_all", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_invert_selection +}; + +static DB_plugin_action_t action_select_all = { + .title = "Edit/[stub] Select All", + .name = "select_all", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_deselect_all +}; + +static DB_plugin_action_t action_clear_playlist = { + .title = "Edit/[stub] Clear playlist", + .name = "clear_playlist", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_select_all +}; + +static DB_plugin_action_t action_quit = { + .title = "[stub] Quit", + .name = "quit", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_clear_playlist +}; + +static DB_plugin_action_t action_delete_from_disk = { + .title = "[stub] Delete From Disk", + .name = "delete_from_disk", + .flags = DB_ACTION_SINGLE_TRACK | DB_ACTION_MULTIPLE_TRACKS, + .callback = NULL, + .next = &action_quit +}; + +static DB_plugin_action_t action_add_location = { + .title = "File/[stub] Add Location", + .name = "add_location", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_delete_from_disk +}; + +static DB_plugin_action_t action_add_folders = { + .title = "File/[stub] Add Folder(s)", + .name = "add_folders", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_add_location +}; + +static DB_plugin_action_t action_add_files = { + .title = "File/[stub] Add File(s)", + .name = "add_files", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_add_folders +}; + +static DB_plugin_action_t action_add_to_playqueue = { + .title = "Playback/[stub] Add To Playback Queue", + .name = "add_to_playback_queue", + .flags = DB_ACTION_MULTIPLE_TRACKS, + .callback = NULL, + .next = &action_add_files +}; + +static DB_plugin_action_t action_toggle_mute = { + .title = "Playback/[stub] Toggle Mute", + .name = "toggle_mute", + .flags = DB_ACTION_COMMON, + .callback = NULL, + .next = &action_add_to_playqueue +}; + static DB_plugin_action_t action_play = { - .title = "Play", + .title = "Playback/Play", .name = "play", .flags = DB_ACTION_COMMON, .callback = action_play_cb, - .next = NULL + .next = &action_toggle_mute }; static DB_plugin_action_t action_stop = { - .title = "Stop", + .title = "Playback/Stop", .name = "stop", .flags = DB_ACTION_COMMON, .callback = action_stop_cb, @@ -626,7 +819,7 @@ static DB_plugin_action_t action_stop = { }; static DB_plugin_action_t action_prev = { - .title = "Previous", + .title = "Playback/Previous", .name = "prev", .flags = DB_ACTION_COMMON, .callback = action_prev_cb, @@ -634,7 +827,7 @@ static DB_plugin_action_t action_prev = { }; static DB_plugin_action_t action_next = { - .title = "Next", + .title = "Playback/Next", .name = "next", .flags = DB_ACTION_COMMON, .callback = action_next_cb, @@ -642,7 +835,7 @@ static DB_plugin_action_t action_next = { }; static DB_plugin_action_t action_toggle_pause = { - .title = "Toggle Pause", + .title = "Playback/Toggle Pause", .name = "toggle_pause", .flags = DB_ACTION_COMMON, .callback = action_toggle_pause_cb, @@ -650,7 +843,7 @@ static DB_plugin_action_t action_toggle_pause = { }; static DB_plugin_action_t action_play_pause = { - .title = "Play\\/Pause", + .title = "Playback/Play\\/Pause", .name = "play_pause", .flags = DB_ACTION_COMMON, .callback = action_play_pause_cb, @@ -658,7 +851,7 @@ static DB_plugin_action_t action_play_pause = { }; static DB_plugin_action_t action_play_random = { - .title = "Play Random", + .title = "Playback/Play Random", .name = "playback_random", .flags = DB_ACTION_COMMON, .callback = action_play_random_cb, @@ -666,7 +859,7 @@ static DB_plugin_action_t action_play_random = { }; static DB_plugin_action_t action_seek_forward = { - .title = "Seek Forward", + .title = "Playback/Seek Forward", .name = "seek_fwd", .flags = DB_ACTION_COMMON, .callback = action_seek_forward_cb, @@ -674,7 +867,7 @@ static DB_plugin_action_t action_seek_forward = { }; static DB_plugin_action_t action_seek_backward = { - .title = "Seek Backward", + .title = "Playback/Seek Backward", .name = "seek_back", .flags = DB_ACTION_COMMON, .callback = action_seek_backward_cb, @@ -682,7 +875,7 @@ static DB_plugin_action_t action_seek_backward = { }; static DB_plugin_action_t action_volume_up = { - .title = "Volume Up", + .title = "Playback/Volume Up", .name = "volume_up", .flags = DB_ACTION_COMMON, .callback = action_volume_up_cb, @@ -690,7 +883,7 @@ static DB_plugin_action_t action_volume_up = { }; static DB_plugin_action_t action_volume_down = { - .title = "Volume Down", + .title = "Playback/Volume Down", .name = "volume_down", .flags = DB_ACTION_COMMON, .callback = action_volume_down_cb, @@ -698,7 +891,7 @@ static DB_plugin_action_t action_volume_down = { }; static DB_plugin_action_t action_toggle_stop_after_current = { - .title = "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, diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c index c5c9c313..252290f3 100644 --- a/plugins/lastfm/lastfm.c +++ b/plugins/lastfm/lastfm.c @@ -952,7 +952,7 @@ static DB_plugin_action_t love_action = { static DB_plugin_action_t lookup_action = { .title = "Lookup on Last.fm", .name = "lfm_lookup", - .flags = DB_ACTION_SINGLE_TRACK, + .flags = DB_ACTION_SINGLE_TRACK | DB_ACTION_ADD_MENU, .callback = lfm_action_lookup, .next = NULL// &love_action }; diff --git a/plugins/shellexec/shellexec.c b/plugins/shellexec/shellexec.c index ce13db7d..2ba6d449 100644 --- a/plugins/shellexec/shellexec.c +++ b/plugins/shellexec/shellexec.c @@ -305,6 +305,7 @@ shx_get_actions (DB_plugin_action_callback_t callback) action->shcommand = strdup (command); action->parent.callback = callback; action->parent.next = NULL; + action->parent.flags |= DB_ACTION_ADD_MENU; action->shx_flags = 0; diff --git a/plugins/shellexecui/shellexecui.c b/plugins/shellexecui/shellexecui.c index 898be448..15440523 100644 --- a/plugins/shellexecui/shellexecui.c +++ b/plugins/shellexecui/shellexecui.c @@ -364,7 +364,7 @@ shellexecui_action_callback(DB_plugin_action_t *action, int ctx) { static DB_plugin_action_t shellexecui_action = { .title = "Edit/Configure custom shell commands", .name = "shellexec_conf", - .flags = DB_ACTION_COMMON, + .flags = DB_ACTION_COMMON | DB_ACTION_ADD_MENU, .callback = shellexecui_action_callback, .next = NULL, }; |