Gentoo Archives: gentoo-commits

From: "Mart Raudsepp (leio)" <leio@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in x11-terms/gnome-terminal/files: gnome-terminal-2.24.2-restore-switch-to-tab.patch
Date: Mon, 01 Dec 2008 09:44:39
Message-Id: E1L75KW-0005aL-0G@stork.gentoo.org
1 leio 08/12/01 09:44:36
2
3 Added: gnome-terminal-2.24.2-restore-switch-to-tab.patch
4 Log:
5 Version bump. Add patches to bring back "Switch to Tab <n>" functionality completely, including the keyboard shortcuts dialog entries and translations.
6 (Portage version: 2.2_rc16/cvs/Linux 2.6.27-gentoo-r4 x86_64)
7
8 Revision Changes Path
9 1.1 x11-terms/gnome-terminal/files/gnome-terminal-2.24.2-restore-switch-to-tab.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/x11-terms/gnome-terminal/files/gnome-terminal-2.24.2-restore-switch-to-tab.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/x11-terms/gnome-terminal/files/gnome-terminal-2.24.2-restore-switch-to-tab.patch?rev=1.1&content-type=text/plain
13
14 Index: gnome-terminal-2.24.2-restore-switch-to-tab.patch
15 ===================================================================
16 Index: src/terminal-accels.c
17 ===================================================================
18 --- src/terminal-accels.c (revision 3169)
19 +++ src/terminal-accels.c (revision 3171)
20 @@ -20,11 +20,14 @@
21
22 #include <string.h>
23
24 +#include <gdk/gdkkeysyms.h>
25 +
26 #include "terminal-accels.h"
27 #include "terminal-app.h"
28 #include "terminal-intl.h"
29 #include "terminal-profile.h"
30 #include "terminal-util.h"
31 +#include "terminal-accels.h"
32
33 #ifdef DEBUG_ACCELS
34 #define D(x) x
35 @@ -71,6 +74,7 @@
36 #define ACCEL_PATH_MOVE_TAB_LEFT ACCEL_PATH_ROOT "TabsMoveLeft"
37 #define ACCEL_PATH_MOVE_TAB_RIGHT ACCEL_PATH_ROOT "TabsMoveRight"
38 #define ACCEL_PATH_DETACH_TAB ACCEL_PATH_ROOT "TabsDetach"
39 +#define ACCEL_PATH_SWITCH_TAB_PREFIX ACCEL_PATH_ROOT "TabsSwitch"
40
41 #define KEY_CLOSE_TAB CONF_KEYS_PREFIX "/close_tab"
42 #define KEY_CLOSE_WINDOW CONF_KEYS_PREFIX "/close_window"
43 @@ -93,6 +97,7 @@
44 #define KEY_ZOOM_IN CONF_KEYS_PREFIX "/zoom_in"
45 #define KEY_ZOOM_NORMAL CONF_KEYS_PREFIX "/zoom_normal"
46 #define KEY_ZOOM_OUT CONF_KEYS_PREFIX "/zoom_out"
47 +#define KEY_SWITCH_TAB_PREFIX CONF_KEYS_PREFIX "/switch_to_tab_"
48
49 typedef struct
50 {
51 @@ -173,6 +178,42 @@
52 KEY_MOVE_TAB_RIGHT, ACCEL_PATH_MOVE_TAB_RIGHT, 0, 0, NULL, FALSE, TRUE },
53 { N_("Detach Tab"),
54 KEY_DETACH_TAB, ACCEL_PATH_DETACH_TAB, 0, 0, NULL, FALSE, TRUE },
55 + { N_("Switch to Tab 1"),
56 + KEY_SWITCH_TAB_PREFIX "1",
57 + ACCEL_PATH_SWITCH_TAB_PREFIX "1", GDK_1, GDK_MOD1_MASK, NULL, FALSE, TRUE },
58 + { N_("Switch to Tab 2"),
59 + KEY_SWITCH_TAB_PREFIX "2",
60 + ACCEL_PATH_SWITCH_TAB_PREFIX "2", GDK_2, GDK_MOD1_MASK, NULL, FALSE, TRUE },
61 + { N_("Switch to Tab 3"),
62 + KEY_SWITCH_TAB_PREFIX "3",
63 + ACCEL_PATH_SWITCH_TAB_PREFIX "3", GDK_3, GDK_MOD1_MASK, NULL, FALSE, TRUE },
64 + { N_("Switch to Tab 4"),
65 + KEY_SWITCH_TAB_PREFIX "4",
66 + ACCEL_PATH_SWITCH_TAB_PREFIX "4", GDK_4, GDK_MOD1_MASK, NULL, FALSE, TRUE },
67 + { N_("Switch to Tab 5"),
68 + KEY_SWITCH_TAB_PREFIX "5",
69 + ACCEL_PATH_SWITCH_TAB_PREFIX "5", GDK_5, GDK_MOD1_MASK, NULL, FALSE, TRUE },
70 + { N_("Switch to Tab 6"),
71 + KEY_SWITCH_TAB_PREFIX "6",
72 + ACCEL_PATH_SWITCH_TAB_PREFIX "6", GDK_6, GDK_MOD1_MASK, NULL, FALSE, TRUE },
73 + { N_("Switch to Tab 7"),
74 + KEY_SWITCH_TAB_PREFIX "7",
75 + ACCEL_PATH_SWITCH_TAB_PREFIX "7", GDK_7, GDK_MOD1_MASK, NULL, FALSE, TRUE },
76 + { N_("Switch to Tab 8"),
77 + KEY_SWITCH_TAB_PREFIX "8",
78 + ACCEL_PATH_SWITCH_TAB_PREFIX "8", GDK_8, GDK_MOD1_MASK, NULL, FALSE, TRUE },
79 + { N_("Switch to Tab 9"),
80 + KEY_SWITCH_TAB_PREFIX "9",
81 + ACCEL_PATH_SWITCH_TAB_PREFIX "9", GDK_9, GDK_MOD1_MASK, NULL, FALSE, TRUE },
82 + { N_("Switch to Tab 10"),
83 + KEY_SWITCH_TAB_PREFIX "10",
84 + ACCEL_PATH_SWITCH_TAB_PREFIX "10", 0, 0, NULL, FALSE, TRUE },
85 + { N_("Switch to Tab 11"),
86 + KEY_SWITCH_TAB_PREFIX "11",
87 + ACCEL_PATH_SWITCH_TAB_PREFIX "11", 0, 0, NULL, FALSE, TRUE },
88 + { N_("Switch to Tab 12"),
89 + KEY_SWITCH_TAB_PREFIX "12",
90 + ACCEL_PATH_SWITCH_TAB_PREFIX "12", 0, 0, NULL, FALSE, TRUE }
91 };
92
93 static KeyEntry help_entries[] = {
94 @@ -186,7 +227,7 @@
95 { view_entries, G_N_ELEMENTS (view_entries), N_("View") },
96 { terminal_entries, G_N_ELEMENTS (terminal_entries), N_("Terminal") },
97 { tabs_entries, G_N_ELEMENTS (tabs_entries), N_("Tabs") },
98 - { help_entries, G_N_ELEMENTS (help_entries), N_("Help") }
99 + { help_entries, G_N_ELEMENTS (help_entries), N_("Help") },
100 };
101
102 enum
103 Index: src/terminal-tabs-menu.c
104 ===================================================================
105 --- src/terminal-tabs-menu.c (revision 3169)
106 +++ src/terminal-tabs-menu.c (revision 3171)
107 @@ -30,14 +30,16 @@
108 #include "terminal-screen-container.h"
109 #include "terminal-intl.h"
110
111 +#define TERMINAL_ACCELS_N_TABS_SWITCH (12)
112 +
113 #define LABEL_WIDTH_CHARS 32
114 #define ACTION_VERB_FORMAT_PREFIX "JmpTab"
115 -#define ACTION_VERB_FORMAT_PREFIX_LEN (6) /* strlen (ACTION_VERB_FORMAT_PREFIX) */
116 -#define ACTION_VERB_FORMAT ACTION_VERB_FORMAT_PREFIX "%x"
117 +#define ACTION_VERB_FORMAT_PREFIX_LEN strlen (ACTION_VERB_FORMAT_PREFIX)
118 +#define ACTION_VERB_FORMAT ACTION_VERB_FORMAT_PREFIX "%u"
119 #define ACTION_VERB_FORMAT_LENGTH strlen (ACTION_VERB_FORMAT) + 14 + 1
120 #define ACTION_VERB_FORMAT_BASE (16) /* %x is hex */
121 -#define ACCEL_PATH_FORMAT "<Actions>/TabsActions/%s"
122 -#define ACCEL_PATH_FORMAT_LENGTH strlen (ACCEL_PATH_FORMAT) -2 + ACTION_VERB_FORMAT_LENGTH
123 +#define ACCEL_PATH_FORMAT "<Actions>/Main/TabsSwitch%u"
124 +#define ACCEL_PATH_FORMAT_LENGTH strlen (ACCEL_PATH_FORMAT) + 14 + 1
125 #define DATA_KEY "TerminalTabsMenu::Action"
126
127 #define UI_PATH "/menubar/Tabs"
128 @@ -379,7 +381,7 @@
129 g_type_class_add_private (object_class, sizeof (TerminalTabsMenuPrivate));
130
131 /* We don't want to save accels, so skip them */
132 - gtk_accel_map_add_filter ("<Actions>/TabsActions/JmpTab*");
133 + gtk_accel_map_add_filter ("<Actions>/Main/TabsSwitch*");
134 }
135
136 static void
137 @@ -416,40 +418,19 @@
138 guint tab_number,
139 gboolean is_single_tab)
140 {
141 - const char *verb;
142 - char accel_path[ACCEL_PATH_FORMAT_LENGTH];
143 - char accel[7];
144 - gint accel_number;
145 - guint accel_key;
146 - GdkModifierType accel_mods;
147 + if (!is_single_tab &&
148 + tab_number < TERMINAL_ACCELS_N_TABS_SWITCH)
149 + {
150 + char accel_path[ACCEL_PATH_FORMAT_LENGTH];
151
152 - verb = gtk_action_get_name (action);
153 -
154 - /* set the accel path for the menu item */
155 - g_snprintf (accel_path, sizeof (accel_path),
156 - ACCEL_PATH_FORMAT, verb);
157 - gtk_action_set_accel_path (action, accel_path);
158 -
159 - /* Only the first ten tabs get accelerators starting from 1 through 0 */
160 - if (tab_number < 10 && !is_single_tab)
161 - {
162 - accel_key = 0;
163 - accel_number = (tab_number + 1) % 10;
164 -
165 - g_snprintf (accel, sizeof (accel), "<alt>%d", accel_number);
166 -
167 - gtk_accelerator_parse (accel, &accel_key, &accel_mods);
168 -
169 - if (accel_key != 0)
170 - {
171 - gtk_accel_map_change_entry (accel_path, accel_key,
172 - accel_mods, TRUE);
173 - }
174 - }
175 - else
176 - {
177 - gtk_accel_map_change_entry (accel_path, 0, 0, TRUE);
178 - }
179 + g_snprintf (accel_path, sizeof (accel_path), ACCEL_PATH_FORMAT, tab_number + 1);
180 + gtk_action_set_accel_path (action, accel_path);
181 + }
182 + else
183 + {
184 + gtk_action_set_accel_path (action, NULL);
185 + return;
186 + }
187 }
188
189 static void
190 Index: src/gnome-terminal.schemas.in
191 ===================================================================
192 --- src/gnome-terminal.schemas.in (revision 3169)
193 +++ src/gnome-terminal.schemas.in (revision 3171)
194 @@ -916,6 +916,210 @@
195 </schema>
196
197 <schema>
198 + <key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_1</key>
199 + <applyto>/apps/gnome-terminal/keybindings/switch_to_tab_1</applyto>
200 + <owner>gnome-terminal</owner>
201 + <type>string</type>
202 + <default>&lt;Alt&gt;1</default>
203 + <locale name="C">
204 + <short>Keyboard shortcut to switch to tab 1</short>
205 + <long>
206 + Keyboard shortcut key for switch to tab 1. Expressed as a string
207 + in the same format used for GTK+ resource files.
208 + If you set the option to the special string "disabled", then there
209 + will be no keyboard shortcut for this action.
210 + </long>
211 + </locale>
212 + </schema>
213 +
214 + <schema>
215 + <key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_2</key>
216 + <applyto>/apps/gnome-terminal/keybindings/switch_to_tab_2</applyto>
217 + <owner>gnome-terminal</owner>
218 + <type>string</type>
219 + <default>&lt;Alt&gt;2</default>
220 + <locale name="C">
221 + <short>Keyboard shortcut to switch to tab 2</short>
222 + <long>
223 + Keyboard shortcut key for switch to tab 2. Expressed as a string
224 + in the same format used for GTK+ resource files.
225 + If you set the option to the special string "disabled", then there
226 + will be no keyboard shortcut for this action.
227 + </long>
228 + </locale>
229 + </schema>
230 +
231 + <schema>
232 + <key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_3</key>
233 + <applyto>/apps/gnome-terminal/keybindings/switch_to_tab_3</applyto>
234 + <owner>gnome-terminal</owner>
235 + <type>string</type>
236 + <default>&lt;Alt&gt;3</default>
237 + <locale name="C">
238 + <short>Keyboard shortcut to switch to tab 3</short>
239 + <long>
240 + Keyboard shortcut key for switch to tab 3. Expressed as a string
241 + in the same format used for GTK+ resource files.
242 + If you set the option to the special string "disabled", then there
243 + will be no keyboard shortcut for this action.
244 + </long>
245 + </locale>
246 + </schema>
247 +
248 + <schema>
249 + <key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_4</key>
250 + <applyto>/apps/gnome-terminal/keybindings/switch_to_tab_4</applyto>
251 + <owner>gnome-terminal</owner>
252 + <type>string</type>
253 + <default>&lt;Alt&gt;4</default>
254 + <locale name="C">
255 + <short>Keyboard shortcut to switch to tab 4</short>
256 + <long>
257 + Keyboard shortcut key for switch to tab 4. Expressed as a string
258 + in the same format used for GTK+ resource files.
259 + If you set the option to the special string "disabled", then there
260 + will be no keyboard shortcut for this action.
261 + </long>
262 + </locale>
263 + </schema>
264 +
265 + <schema>
266 + <key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_5</key>
267 + <applyto>/apps/gnome-terminal/keybindings/switch_to_tab_5</applyto>
268 + <owner>gnome-terminal</owner>
269 + <type>string</type>
270 + <default>&lt;Alt&gt;5</default>
271 + <locale name="C">
272 + <short>Keyboard shortcut to switch to tab 5</short>
273 + <long>
274 + Keyboard shortcut key for switch to tab 5. Expressed as a string
275 + in the same format used for GTK+ resource files.
276 + If you set the option to the special string "disabled", then there
277 + will be no keyboard shortcut for this action.
278 + </long>
279 + </locale>
280 + </schema>
281 +
282 + <schema>
283 + <key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_6</key>
284 + <applyto>/apps/gnome-terminal/keybindings/switch_to_tab_6</applyto>
285 + <owner>gnome-terminal</owner>
286 + <type>string</type>
287 + <default>&lt;Alt&gt;6</default>
288 + <locale name="C">
289 + <short>Keyboard shortcut to switch to tab 6</short>
290 + <long>
291 + Keyboard shortcut key for switch to tab 6. Expressed as a string
292 + in the same format used for GTK+ resource files.
293 + If you set the option to the special string "disabled", then there
294 + will be no keyboard shortcut for this action.
295 + </long>
296 + </locale>
297 + </schema>
298 +
299 + <schema>
300 + <key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_7</key>
301 + <applyto>/apps/gnome-terminal/keybindings/switch_to_tab_7</applyto>
302 + <owner>gnome-terminal</owner>
303 + <type>string</type>
304 + <default>&lt;Alt&gt;7</default>
305 + <locale name="C">
306 + <short>Keyboard shortcut to switch to tab 7</short>
307 + <long>
308 + Keyboard shortcut key for switch to tab 7. Expressed as a string
309 + in the same format used for GTK+ resource files.
310 + If you set the option to the special string "disabled", then there
311 + will be no keyboard shortcut for this action.
312 + </long>
313 + </locale>
314 + </schema>
315 +
316 + <schema>
317 + <key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_8</key>
318 + <applyto>/apps/gnome-terminal/keybindings/switch_to_tab_8</applyto>
319 + <owner>gnome-terminal</owner>
320 + <type>string</type>
321 + <default>&lt;Alt&gt;8</default>
322 + <locale name="C">
323 + <short>Keyboard shortcut to switch to tab 8</short>
324 + <long>
325 + Keyboard shortcut key for switch to tab 8. Expressed as a string
326 + in the same format used for GTK+ resource files.
327 + If you set the option to the special string "disabled", then there
328 + will be no keyboard shortcut for this action.
329 + </long>
330 + </locale>
331 + </schema>
332 +
333 + <schema>
334 + <key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_9</key>
335 + <applyto>/apps/gnome-terminal/keybindings/switch_to_tab_9</applyto>
336 + <owner>gnome-terminal</owner>
337 + <type>string</type>
338 + <default>&lt;Alt&gt;9</default>
339 + <locale name="C">
340 + <short>Keyboard shortcut to switch to tab 9</short>
341 + <long>
342 + Keyboard shortcut key for switch to tab 9. Expressed as a string
343 + in the same format used for GTK+ resource files.
344 + If you set the option to the special string "disabled", then there
345 + will be no keyboard shortcut for this action.
346 + </long>
347 + </locale>
348 + </schema>
349 +
350 + <schema>
351 + <key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_10</key>
352 + <applyto>/apps/gnome-terminal/keybindings/switch_to_tab_10</applyto>
353 + <owner>gnome-terminal</owner>
354 + <type>string</type>
355 +<!-- no default -->
356 + <locale name="C">
357 + <short>Keyboard shortcut to switch to tab 10</short>
358 + <long>
359 + Keyboard shortcut key for switch to tab 10. Expressed as a string
360 + in the same format used for GTK+ resource files.
361 + If you set the option to the special string "disabled", then there
362 + will be no keyboard shortcut for this action.
363 + </long>
364 + </locale>
365 + </schema>
366 +
367 + <schema>
368 + <key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_11</key>
369 + <applyto>/apps/gnome-terminal/keybindings/switch_to_tab_11</applyto>
370 + <owner>gnome-terminal</owner>
371 + <type>string</type>
372 +<!-- no default -->
373 + <locale name="C">
374 + <short>Keyboard shortcut to switch to tab 11</short>
375 + <long>
376 + Keyboard shortcut key for switch to tab 11. Expressed as a string
377 + in the same format used for GTK+ resource files.
378 + If you set the option to the special string "disabled", then there
379 + will be no keyboard shortcut for this action.
380 + </long>
381 + </locale>
382 + </schema>
383 +
384 + <schema>
385 + <key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_12</key>
386 + <applyto>/apps/gnome-terminal/keybindings/switch_to_tab_12</applyto>
387 + <owner>gnome-terminal</owner>
388 + <type>string</type>
389 +<!-- no default -->
390 + <locale name="C">
391 + <short>Keyboard shortcut to switch to tab 12</short>
392 + <long>
393 + Keyboard shortcut key for switch to tab 12. Expressed as a string
394 + in the same format used for GTK+ resource files.
395 + If you set the option to the special string "disabled", then there
396 + will be no keyboard shortcut for this action.
397 + </long>
398 + </locale>
399 + </schema>
400 +
401 + <schema>
402 <key>/schemas/apps/gnome-terminal/keybindings/help</key>
403 <applyto>/apps/gnome-terminal/keybindings/help</applyto>
404 <owner>gnome-terminal</owner>