Re: [PATCH] Enable keypad zoom accelerators



Am Samstag, den 02.07.2005, 11:48 +0200 schrieb Christian Neumair:
> From bug 309018 [1]:
> 
> "Ctrl+ and Ctrl- seem to work on the actual keyboard, but not on the
> numeric keypad. This is with Ubuntu Hoary, Nautilus 2.10.0 and a Finnish
> keyboard layout."
> 
> The attached patch fixes this.
> 
> [1] http://bugzilla.gnome.org/show_bug.cgi?id=309018

OK, new version. I overlooked that ctrl-0 is already bound to 100% zoom.

-- 
Christian Neumair <chris gnome-de org>
Index: src/nautilus-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window.c,v
retrieving revision 1.450
diff -u -p -r1.450 nautilus-window.c
--- src/nautilus-window.c	1 Jul 2005 14:13:49 -0000	1.450
+++ src/nautilus-window.c	2 Jul 2005 11:43:02 -0000
@@ -679,6 +679,11 @@ add_view_as_menu_item (NautilusWindow *w
 	char *action_name;
 	ActivateViewData *data;
 
+	char *accel;
+	char *accel_path;
+	unsigned int accel_keyval;
+	GdkModifierType accel_mods;
+
 	info = nautilus_view_factory_lookup (identifier);
 	
 	action_name = g_strdup_printf ("view_as_%d", index);
@@ -687,6 +692,27 @@ add_view_as_menu_item (NautilusWindow *w
 				       _(info->display_location_label),
 				       NULL,
 				       0);
+
+	if (index >= 0 && index <= 9) {
+		accel = g_strdup_printf ("%d", index);
+
+		accel_path = g_strdup_printf ("<Nautilus-Window>/%s", action_name);
+
+		accel_keyval = gdk_keyval_from_name (accel);
+		g_assert (accel_keyval != GDK_VoidSymbol);
+
+		accel_mods = GDK_CONTROL_MASK;
+		if (index == 0) {
+			/* ctrl-0 is bound to 100% zoom */
+			accel_mods |= GDK_SHIFT_MASK;
+		}
+
+		gtk_accel_map_add_entry (accel_path, accel_keyval, accel_mods);
+		gtk_action_set_accel_path (GTK_ACTION (action), accel_path);
+
+		g_free (accel);
+		g_free (accel_path);
+	}
 
 	if (window->details->view_as_radio_action != NULL) {
 		gtk_radio_action_set_group (action,

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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