gui/sidebar: Conditionally hide the rename menu option

We can only rename user-created playlists, so let's not even show this
option for the other playlist types.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2017-09-03 09:13:39 -04:00
parent 64e27c1221
commit 07196a7cc8
2 changed files with 7 additions and 1 deletions

View File

@ -210,7 +210,9 @@ bool __gui_sidebar_keypress(GtkTreeView *treeview, GdkEventKey *event,
bool __gui_sidebar_button_press(GtkTreeView *treeview, GdkEventButton *event,
gpointer data)
{
enum playlist_type_t type = PL_MAX_TYPE;
GtkTreePath *path;
GtkTreeIter iter;
bool ret = true;
if (!gtk_tree_view_get_path_at_pos(treeview, event->x, event->y,
@ -219,6 +221,10 @@ bool __gui_sidebar_button_press(GtkTreeView *treeview, GdkEventButton *event,
if (event->button == GDK_BUTTON_SECONDARY) {
gtk_tree_view_set_cursor(treeview, path, NULL, false);
if (gui_sidebar_iter_current(&iter))
type = gui_sidebar_iter_type(&iter);
gtk_widget_set_visible(gui_builder_widget("rc_sidebar_rename"),
type == PL_USER);
gtk_menu_popup_at_pointer(gui_sidebar_menu(), (GdkEvent *)event);
} else if (event->type == GDK_2BUTTON_PRESS &&
event->button == GDK_BUTTON_MIDDLE) {

View File

@ -120,7 +120,7 @@
</object>
</child>
<child>
<object class="GtkImageMenuItem">
<object class="GtkImageMenuItem" id="rc_sidebar_rename">
<property name="label" translatable="yes">Rename Playlist</property>
<property name="visible">True</property>
<property name="can_focus">False</property>