gnome-terminal r2542 - trunk/src



Author: chpe
Date: Fri Apr 11 19:02:39 2008
New Revision: 2542
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=2542&view=rev

Log:
Don't grab Alt-1 if there's only one tab. Bug #109128.


Modified:
   trunk/src/terminal-tabs-menu.c

Modified: trunk/src/terminal-tabs-menu.c
==============================================================================
--- trunk/src/terminal-tabs-menu.c	(original)
+++ trunk/src/terminal-tabs-menu.c	Fri Apr 11 19:02:39 2008
@@ -416,7 +416,8 @@
 static void
 tab_set_action_accelerator (GtkActionGroup *action_group,
 			    GtkAction *action,
-			    guint tab_number)
+			    guint tab_number,
+			    gboolean is_single_tab)
 {
 	const char *verb;
 	char accel_path[ACCEL_PATH_FORMAT_LENGTH];
@@ -433,7 +434,7 @@
 	gtk_action_set_accel_path (action, accel_path);
 
 	/* Only the first ten tabs get accelerators starting from 1 through 0 */
-	if (tab_number < 10)
+	if (tab_number < 10 && !is_single_tab)
 	{
 		accel_key = 0;
 		accel_number = (tab_number + 1) % 10;
@@ -461,14 +462,18 @@
 	GtkUIManager *manager;
 	GtkAction *action;
 	GList *tabs = NULL, *l;
-	guint i = 0;
+	guint i = 0, n;
+	gboolean is_single_tab;
 	const char *verb;
 
 	terminal_tabs_menu_clean (menu);
 
 	tabs = terminal_window_list_screens (p->window);
 
-	if (g_list_length (tabs) == 0) return;
+	n = g_list_length (tabs);
+	if (n == 0) return;
+
+	is_single_tab = (n == 1);
 
 	manager =  GTK_UI_MANAGER (terminal_window_get_ui_manager (p->window));
 	p->ui_id = gtk_ui_manager_new_merge_id (manager);
@@ -480,7 +485,7 @@
   
 		verb = gtk_action_get_name (action);
 
-		tab_set_action_accelerator (p->action_group, action, i++);
+		tab_set_action_accelerator (p->action_group, action, i++, is_single_tab);
 
 		gtk_ui_manager_add_ui (manager, p->ui_id,
 				       UI_PATH,



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