Ticket #233: patch_key_accel_tabs.diff

File patch_key_accel_tabs.diff, 8.0 KB (added by TiN, 23 months ago)
  • data/guake.schemas

    diff --git a/data/guake.schemas b/data/guake.schemas
    index 3d26c6d..e055ce6 100644
    a b  
    379379        </schema> 
    380380 
    381381        <schema> 
     382            <key>/schemas/apps/guake/keybindings/local/tab_0</key> 
     383            <applyto>/apps/guake/keybindings/local/tab_0</applyto> 
     384            <owner>guake</owner> 
     385            <type>string</type> 
     386            <default>&lt;Alt&gt;0</default> 
     387            <locale name="C"> 
     388                <short>Tab 0.</short> 
     389                <long>Shows the tab 0.</long> 
     390            </locale> 
     391        </schema> 
     392 
     393        <schema> 
     394            <key>/schemas/apps/guake/keybindings/local/tab_1</key> 
     395            <applyto>/apps/guake/keybindings/local/tab_1</applyto> 
     396            <owner>guake</owner> 
     397            <type>string</type> 
     398            <default>&lt;Alt&gt;1</default> 
     399            <locale name="C"> 
     400                <short>Tab 1.</short> 
     401                <long>Shows the tab 1.</long> 
     402            </locale> 
     403        </schema> 
     404 
     405        <schema> 
     406            <key>/schemas/apps/guake/keybindings/local/tab_2</key> 
     407            <applyto>/apps/guake/keybindings/local/tab_2</applyto> 
     408            <owner>guake</owner> 
     409            <type>string</type> 
     410            <default>&lt;Alt&gt;2</default> 
     411            <locale name="C"> 
     412                <short>Tab 2.</short> 
     413                <long>Shows the tab 2.</long> 
     414            </locale> 
     415        </schema> 
     416 
     417        <schema> 
     418            <key>/schemas/apps/guake/keybindings/local/tab_3</key> 
     419            <applyto>/apps/guake/keybindings/local/tab_3</applyto> 
     420            <owner>guake</owner> 
     421            <type>string</type> 
     422            <default>&lt;Alt&gt;3</default> 
     423            <locale name="C"> 
     424                <short>Tab 3.</short> 
     425                <long>Shows the tab 3.</long> 
     426            </locale> 
     427        </schema> 
     428 
     429        <schema> 
     430            <key>/schemas/apps/guake/keybindings/local/tab_4</key> 
     431            <applyto>/apps/guake/keybindings/local/tab_4</applyto> 
     432            <owner>guake</owner> 
     433            <type>string</type> 
     434            <default>&lt;Alt&gt;4</default> 
     435            <locale name="C"> 
     436                <short>Tab 4.</short> 
     437                <long>Shows the tab 4.</long> 
     438            </locale> 
     439        </schema> 
     440 
     441        <schema> 
     442            <key>/schemas/apps/guake/keybindings/local/tab_5</key> 
     443            <applyto>/apps/guake/keybindings/local/tab_5</applyto> 
     444            <owner>guake</owner> 
     445            <type>string</type> 
     446            <default>&lt;Alt&gt;5</default> 
     447            <locale name="C"> 
     448                <short>Tab 5.</short> 
     449                <long>Shows the tab 5.</long> 
     450            </locale> 
     451        </schema> 
     452 
     453        <schema> 
     454            <key>/schemas/apps/guake/keybindings/local/tab_6</key> 
     455            <applyto>/apps/guake/keybindings/local/tab_6</applyto> 
     456            <owner>guake</owner> 
     457            <type>string</type> 
     458            <default>&lt;Alt&gt;6</default> 
     459            <locale name="C"> 
     460                <short>Tab 6.</short> 
     461                <long>Shows the tab 6.</long> 
     462            </locale> 
     463        </schema> 
     464 
     465        <schema> 
     466            <key>/schemas/apps/guake/keybindings/local/tab_7</key> 
     467            <applyto>/apps/guake/keybindings/local/tab_7</applyto> 
     468            <owner>guake</owner> 
     469            <type>string</type> 
     470            <default>&lt;Alt&gt;7</default> 
     471            <locale name="C"> 
     472                <short>Tab 7.</short> 
     473                <long>Shows the tab 7.</long> 
     474            </locale> 
     475        </schema> 
     476 
     477        <schema> 
     478            <key>/schemas/apps/guake/keybindings/local/tab_8</key> 
     479            <applyto>/apps/guake/keybindings/local/tab_8</applyto> 
     480            <owner>guake</owner> 
     481            <type>string</type> 
     482            <default>&lt;Alt&gt;8</default> 
     483            <locale name="C"> 
     484                <short>Tab 8.</short> 
     485                <long>Shows the tab 8.</long> 
     486            </locale> 
     487        </schema> 
     488 
     489        <schema> 
     490            <key>/schemas/apps/guake/keybindings/local/tab_9</key> 
     491            <applyto>/apps/guake/keybindings/local/tab_9</applyto> 
     492            <owner>guake</owner> 
     493            <type>string</type> 
     494            <default>&lt;Alt&gt;9</default> 
     495            <locale name="C"> 
     496                <short>Tab 9.</short> 
     497                <long>Shows the tab 9.</long> 
     498            </locale> 
     499        </schema> 
     500 
     501        <schema> 
    382502            <key>/schemas/apps/guake/keybindings/local/rename_tab</key> 
    383503            <applyto>/apps/guake/keybindings/local/rename_tab</applyto> 
    384504            <owner>guake</owner> 
  • m4/intltool.m4

    diff --git a/m4/intltool.m4 b/m4/intltool.m4
    index 122d773..839e855 100644
    a b  
    172172AC_DEFUN([IT_PO_SUBDIR], 
    173173[AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS. 
    174174dnl 
    175 dnl The following CONFIG_COMMANDS should be exetuted at the very end 
     175dnl The following CONFIG_COMMANDS should be executed at the very end 
    176176dnl of config.status. 
    177177AC_CONFIG_COMMANDS_PRE([ 
    178178  AC_CONFIG_COMMANDS([$1/stamp-it], [ 
  • src/guake.py

    diff --git a/src/guake.py b/src/guake.py
    index 6214fb2..22e3ca8 100644
    a b  
    342342        to be used in internal methods. 
    343343        """ 
    344344        self.guake = guake 
     345        self.guake.key_tab = {} 
    345346        self.accel_group = None # see reload_accelerators 
    346347        self.client = gconf.client_get_default() 
    347348 
     
    352353                'previous_tab', 'next_tab', 'clipboard_copy', 'clipboard_paste', 
    353354                'quit', 
    354355                ] 
     356        keys += ["tab_%s" % i for i in xrange(10)] 
    355357        for key in keys: 
    356358            notify_add(LKEY(key), self.reload_accelerators) 
    357359            self.client.notify(LKEY(key)) 
     
    410412            self.accel_group.connect_group(key, mask, gtk.ACCEL_VISIBLE, 
    411413                                           self.guake.accel_next) 
    412414 
     415        for i in xrange(10): 
     416            key, mask = gtk.accelerator_parse(gets('tab_%s' % i)) 
     417            if key > 0: 
     418                self.guake.key_tab[key] = i 
     419                self.accel_group.connect_group(key, mask, gtk.ACCEL_VISIBLE, 
     420                                               self.guake.accel_tab) 
     421 
    413422        key, mask = gtk.accelerator_parse(gets('rename_tab')) 
    414423        if key > 0: 
    415424            self.accel_group.connect_group(key, mask, gtk.ACCEL_VISIBLE, 
     
    913922            self.notebook.next_page() 
    914923        return True 
    915924 
     925    def accel_tab(self, *args): 
     926        """Callback to go to the N tab. Called by the accel key. 
     927        """ 
     928        key = args[2] 
     929        self.notebook.set_current_page(self.key_tab[key]) 
     930        return True 
     931 
    916932    def accel_rename(self, *args): 
    917933        """Callback to show the rename tab dialog. Called by the accel 
    918934        key. 
  • src/prefs.py

    diff --git a/src/prefs.py b/src/prefs.py
    index b0a69bf..59ba36d 100644
    a b  
    2525import gconf 
    2626 
    2727from simplegladeapp import SimpleGladeApp 
    28 from guake_globals import GCONF_PATH, KEY, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER 
     28from guake_globals import GCONF_PATH, KEY 
    2929from common import * 
    30 import globalhotkeys 
    3130 
    3231# A regular expression to match possible python interpreters when 
    3332# filling interpreters combo in preferences 
     
    8483               'label': _('Paste text from clipboard')}, 
    8584              ]} 
    8685    ] 
     86for pref in HOTKEYS: 
     87    if pref['label'] == _('Navigation'): 
     88        for i in xrange(10): 
     89            pref['keys'].append({'key': LKEY('tab_%s' % i), 
     90                'label': _('Go to tab %s') % i}) 
    8791 
    8892PALETTES = [ 
    8993    # tango 
     
    412416    def set_palette_colors(self, palette): 
    413417        """Updates the color buttons with the given palette 
    414418        """ 
     419        if palette == None: return 
    415420        palette = palette.split(':') 
    416421        for i in range(16): 
    417422            color = gtk.gdk.color_parse(palette[i])