[nautilus/antonioffix-menus-and-popovers: 10/13] view-icon-controller: Open context menu with keybindings
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/antonioffix-menus-and-popovers: 10/13] view-icon-controller: Open context menu with keybindings
- Date: Sun, 14 Jan 2018 17:47:27 +0000 (UTC)
commit 78cd6955ddcc78d0d3171a4759dc96eea3ffdb04
Author: António Fernandes <antoniof gnome org>
Date: Sat Jan 13 23:16:03 2018 +0000
view-icon-controller: Open context menu with keybindings
The old views already handle the "popup-menu" signal to trigger context
menus when the user presses the <Menu> key or the <Shift>+<F10> combo.
Implement it for the new icon view too.
src/nautilus-view-icon-controller.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
---
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index 0a7976ad9..d34d715a9 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -695,6 +695,27 @@ on_button_press_event (GtkWidget *widget,
return GDK_EVENT_STOP;
}
+static gboolean
+popup_menu_callback (GtkWidget *widget,
+ gpointer user_data)
+{
+ NautilusViewIconController *self;
+ g_autoptr (GList) selection;
+
+ self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
+ selection = gtk_flow_box_get_selected_children (GTK_FLOW_BOX (self->view_ui));
+ if (selection != NULL)
+ {
+ nautilus_files_view_pop_up_selection_context_menu (NAUTILUS_FILES_VIEW (self), NULL);
+ }
+ else
+ {
+ nautilus_files_view_pop_up_background_context_menu (NAUTILUS_FILES_VIEW (self), NULL);
+ }
+
+ return TRUE;
+}
+
static int
real_compare_files (NautilusFilesView *files_view,
NautilusFile *file1,
@@ -860,6 +881,8 @@ constructed (GObject *object)
gtk_container_add (GTK_CONTAINER (self->event_box), GTK_WIDGET (self->view_ui));
g_signal_connect (GTK_WIDGET (self->event_box), "button-press-event",
(GCallback) on_button_press_event, self);
+ g_signal_connect (GTK_WIDGET (self->event_box), "popup-menu",
+ (GCallback) popup_menu_callback, self);
content_widget = nautilus_files_view_get_content_widget (NAUTILUS_FILES_VIEW (self));
gtk_container_add (GTK_CONTAINER (content_widget), GTK_WIDGET (self->event_box));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]