diff --git a/gui/sidebar.c b/gui/sidebar.c index af9b38da..2bb7c4b7 100644 --- a/gui/sidebar.c +++ b/gui/sidebar.c @@ -211,17 +211,23 @@ bool __gui_sidebar_button_press(GtkTreeView *treeview, GdkEventButton *event, gpointer data) { GtkTreePath *path; + bool ret = true; - if (event->type != GDK_2BUTTON_PRESS || - event->button != GDK_BUTTON_MIDDLE) - return false; if (!gtk_tree_view_get_path_at_pos(treeview, event->x, event->y, &path, NULL, NULL, NULL)) - return true; + return false; + + if (event->button == GDK_BUTTON_SECONDARY) { + gtk_tree_view_set_cursor(treeview, path, NULL, false); + gtk_menu_popup_at_pointer(gui_sidebar_menu(), (GdkEvent *)event); + } else if (event->type == GDK_2BUTTON_PRESS && + event->button == GDK_BUTTON_MIDDLE) { + __gui_sidebar_do_rename(path); + } else + ret = false; - __gui_sidebar_do_rename(path); gtk_tree_path_free(path); - return true; + return ret; } void __gui_sidebar_resized(GtkPaned *pane, GParamSpec *pspec, gpointer data) diff --git a/include/gui/sidebar.h b/include/gui/sidebar.h index 0effcd67..a5732161 100644 --- a/include/gui/sidebar.h +++ b/include/gui/sidebar.h @@ -106,6 +106,12 @@ static inline GtkTreeView *gui_sidebar_treeview() return GTK_TREE_VIEW(gui_builder_widget("sidebar_treeview")); } +/* Called to get the sidebar right-click menu. */ +static inline GtkMenu *gui_sidebar_menu() +{ + return GTK_MENU(gui_builder_widget("rc_sidebar")); +} + /* Called to get the random button. */ static inline GtkToggleButton *gui_random_button() { diff --git a/share/ocarina/ocarina.ui b/share/ocarina/ocarina.ui index 4234203b..7616f69d 100644 --- a/share/ocarina/ocarina.ui +++ b/share/ocarina/ocarina.ui @@ -88,6 +88,58 @@ + + True + False + dialog-ok + 1 + + + True + False + edit-delete + 1 + + + True + False + document-edit + 1 + + + True + False + + + Select Playlist + True + False + image25 + False + + + + + + Rename Playlist + True + False + image27 + False + + + + + + Delete Playlist + True + False + image26 + False + + + + True False