[patch] fix Bug 136578: Menu key should pop up context menu



I attached a simple patch to bug 136578, which fixes the fact that the "menu key" (on windows keyboards) doesn't bring up the context menu in the icon view (the list view works fine).

What the patch does, is making nautilus icon container implement GtkWidget->popup_menu() instead of manually intercept shift+F10 in key_pressed_event.


ciao
   paolo
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v
retrieving revision 1.383
diff -u -p -r1.383 nautilus-icon-container.c
--- libnautilus-private/nautilus-icon-container.c	25 Jan 2005 08:52:05 -0000	1.383
+++ libnautilus-private/nautilus-icon-container.c	17 Feb 2005 19:42:07 -0000
@@ -3867,17 +3867,13 @@ key_press_event (GtkWidget *widget,
 			handled = TRUE;
 			break;
 		case GDK_F10:
+			/* handle Ctrl+F10 because we want to display the
+			 * background popup even if something is selected.
+			 * The other cases are handled by popup_menu().
+			 */
 			if (event->state & GDK_CONTROL_MASK) {
 				handled = handle_popups (container, event,
 							 "context_click_background");
-			} else if (event->state & GDK_SHIFT_MASK) {
-				if (has_selection (container)) {
-					handled = handle_popups (container, event,
-								 "context_click_selection");
-				} else {
-					handled = handle_popups (container, event,
-								 "context_click_background");
-				}
 			}
 			break;
 		default:
@@ -3902,6 +3898,24 @@ key_press_event (GtkWidget *widget,
 	return handled;
 }
 
+static gboolean
+popup_menu (GtkWidget *widget)
+{
+	NautilusIconContainer *container;
+
+	container = NAUTILUS_ICON_CONTAINER (widget);
+
+	if (has_selection (container)) {
+		handle_popups (container, NULL,
+			       "context_click_selection");
+	} else {
+		handle_popups (container, NULL,
+			       "context_click_background");
+	}
+
+	return TRUE;
+}
+
 static void
 draw_canvas_background (EelCanvas *canvas,
 			int x, int y, int width, int height)
@@ -4242,6 +4256,7 @@ nautilus_icon_container_class_init (Naut
 	widget_class->button_release_event = button_release_event;
 	widget_class->motion_notify_event = motion_notify_event;
 	widget_class->key_press_event = key_press_event;
+	widget_class->popup_menu = popup_menu;
 	widget_class->get_accessible = get_accessible;
 	widget_class->style_set = style_set;
 	widget_class->expose_event = expose_event;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]