diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-07-15 01:44:31 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-07-15 12:46:06 -0400 |
commit | 24e1323eb33f22c1126d1701639b2605c4443868 (patch) | |
tree | 4c4c61fe4e3673cf2572ddba13ccb079f2e3f089 /gtk/gtkplacessidebar.c | |
parent | bd71b801de54218907bf4211e6ef506eec23c967 (diff) | |
download | gtk+-24e1323eb33f22c1126d1701639b2605c4443868.tar.gz |
places sidebar: Handle menu key
It is good practice to handle the menu key and Shift-F10 to
allow keyboard-driven use of context menus.
Diffstat (limited to 'gtk/gtkplacessidebar.c')
-rw-r--r-- | gtk/gtkplacessidebar.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index 322b7f1542..3b20ff6106 100644 --- a/gtk/gtkplacessidebar.c +++ b/gtk/gtkplacessidebar.c @@ -249,6 +249,7 @@ static gboolean on_button_press_event (GtkWidget *widget, static gboolean on_button_release_event (GtkWidget *widget, GdkEventButton *event, GtkSidebarRow *sidebar); +static void popup_menu_cb (GtkSidebarRow *row); static void stop_drop_feedback (GtkPlacesSidebar *sidebar); @@ -3215,6 +3216,15 @@ on_key_press_event (GtkWidget *widget, rename_bookmark (GTK_SIDEBAR_ROW (row)); return TRUE; } + + if ((event->keyval == GDK_KEY_Menu) || + ((event->keyval == GDK_KEY_F10) && + (event->state & modifiers) == GDK_SHIFT_MASK)) + + { + popup_menu_cb (GTK_SIDEBAR_ROW (row)); + return TRUE; + } } } @@ -3495,6 +3505,17 @@ on_button_release_event (GtkWidget *widget, return ret; } +static void +popup_menu_cb (GtkSidebarRow *row) +{ + GtkPlacesSidebarPlaceType row_type; + + g_object_get (row, "place-type", &row_type, NULL); + + if (row_type != PLACES_CONNECT_TO_SERVER) + bookmarks_popup_menu (row, NULL); +} + static gint list_box_sort_func (GtkListBoxRow *row1, GtkListBoxRow *row2, |