Daniel Brötzmann pushed to branch master at gajim / gajim

Commits:

4 changed files:

Changes:

  • gajim/data/gui/shortcuts_window.ui
    ... ... @@ -151,35 +151,35 @@
    151 151
                   <object class="GtkShortcutsShortcut">
    
    152 152
                     <property name="visible">1</property>
    
    153 153
                     <property name="accelerator">&lt;primary&gt;Page_Up</property>
    
    154
    -                <property name="title" translatable="yes">Switch to the previous tab</property>
    
    154
    +                <property name="title" translatable="yes">Switch to the previous chat</property>
    
    155 155
                   </object>
    
    156 156
                 </child>
    
    157 157
                 <child>
    
    158 158
                   <object class="GtkShortcutsShortcut">
    
    159 159
                     <property name="visible">1</property>
    
    160 160
                     <property name="accelerator">&lt;primary&gt;Page_Down</property>
    
    161
    -                <property name="title" translatable="yes">Switch to the next tab</property>
    
    161
    +                <property name="title" translatable="yes">Switch to the next chat</property>
    
    162 162
                   </object>
    
    163 163
                 </child>
    
    164 164
                 <child>
    
    165 165
                   <object class="GtkShortcutsShortcut">
    
    166 166
                     <property name="visible">1</property>
    
    167 167
                     <property name="accelerator">&lt;Alt&gt;1...9</property>
    
    168
    -                <property name="title" translatable="yes">Switch to the first - ninth tab</property>
    
    168
    +                <property name="title" translatable="yes">Switch to the first - ninth chat</property>
    
    169 169
                   </object>
    
    170 170
                 </child>
    
    171 171
                 <child>
    
    172 172
                   <object class="GtkShortcutsShortcut">
    
    173 173
                     <property name="visible">1</property>
    
    174 174
                     <property name="accelerator">&lt;primary&gt;&lt;shift&gt;Tab</property>
    
    175
    -                <property name="title" translatable="yes">Switch to the previous unread tab</property>
    
    175
    +                <property name="title" translatable="yes">Switch to the previous unread chat</property>
    
    176 176
                   </object>
    
    177 177
                 </child>
    
    178 178
                 <child>
    
    179 179
                   <object class="GtkShortcutsShortcut">
    
    180 180
                     <property name="visible">1</property>
    
    181 181
                     <property name="accelerator">&lt;primary&gt;Tab</property>
    
    182
    -                <property name="title" translatable="yes">Switch to the next unread tab</property>
    
    182
    +                <property name="title" translatable="yes">Switch to the next unread chat</property>
    
    183 183
                   </object>
    
    184 184
                 </child>
    
    185 185
                 <child>
    
    ... ... @@ -189,6 +189,13 @@
    189 189
                     <property name="title" translatable="yes">Close chat</property>
    
    190 190
                   </object>
    
    191 191
                 </child>
    
    192
    +            <child>
    
    193
    +              <object class="GtkShortcutsShortcut">
    
    194
    +                <property name="visible">1</property>
    
    195
    +                <property name="accelerator">&lt;primary&gt;1...9</property>
    
    196
    +                <property name="title" translatable="yes">Switch to the first - ninth workspace</property>
    
    197
    +              </object>
    
    198
    +            </child>
    
    192 199
               </object>
    
    193 200
             </child>
    
    194 201
             <child>
    

  • gajim/data/other/shortcuts.json
    ... ... @@ -29,5 +29,14 @@
    29 29
         "win.switch-tab-7": ["<Alt>7", "<Alt>KP_7"],
    
    30 30
         "win.switch-tab-8": ["<Alt>8", "<Alt>KP_8"],
    
    31 31
         "win.switch-tab-9": ["<Alt>9", "<Alt>KP_9"],
    
    32
    +    "win.switch-workspace-1": ["<Primary>1", "<Primary>KP_1"],
    
    33
    +    "win.switch-workspace-2": ["<Primary>2", "<Primary>KP_2"],
    
    34
    +    "win.switch-workspace-3": ["<Primary>3", "<Primary>KP_3"],
    
    35
    +    "win.switch-workspace-4": ["<Primary>4", "<Primary>KP_4"],
    
    36
    +    "win.switch-workspace-5": ["<Primary>5", "<Primary>KP_5"],
    
    37
    +    "win.switch-workspace-6": ["<Primary>6", "<Primary>KP_6"],
    
    38
    +    "win.switch-workspace-7": ["<Primary>7", "<Primary>KP_7"],
    
    39
    +    "win.switch-workspace-8": ["<Primary>8", "<Primary>KP_8"],
    
    40
    +    "win.switch-workspace-9": ["<Primary>9", "<Primary>KP_9"],
    
    32 41
         "win.toggle-chat-list": ["<Primary>R"]
    
    33 42
     }

  • gajim/gtk/main.py
    ... ... @@ -373,6 +373,15 @@ def _add_actions2(self) -> None:
    373 373
                 'switch-tab-7',
    
    374 374
                 'switch-tab-8',
    
    375 375
                 'switch-tab-9',
    
    376
    +            'switch-workspace-1',
    
    377
    +            'switch-workspace-2',
    
    378
    +            'switch-workspace-3',
    
    379
    +            'switch-workspace-4',
    
    380
    +            'switch-workspace-5',
    
    381
    +            'switch-workspace-6',
    
    382
    +            'switch-workspace-7',
    
    383
    +            'switch-workspace-8',
    
    384
    +            'switch-workspace-9',
    
    376 385
                 'toggle-chat-list',
    
    377 386
             ]
    
    378 387
     
    
    ... ... @@ -442,6 +451,10 @@ def _on_action(self,
    442 451
                 number = int(action_name[-1]) - 1
    
    443 452
                 self.select_chat_number(number)
    
    444 453
     
    
    454
    +        elif action_name.startswith('switch-workspace-'):
    
    455
    +            number = int(action_name[-1]) - 1
    
    456
    +            self._workspace_side_bar.activate_workspace_number(number)
    
    457
    +
    
    445 458
             elif action_name == 'toggle-chat-list':
    
    446 459
                 self._toggle_chat_list()
    
    447 460
     
    

  • gajim/gtk/workspace_side_bar.py
    ... ... @@ -218,9 +218,8 @@ def add_workspace(self, workspace_id: str) -> None:
    218 218
             self.insert(row, len(self.get_children()) - 1)
    
    219 219
     
    
    220 220
         def store_workspace_order(self) -> None:
    
    221
    -        workspaces: list[CommonWorkspace] = cast(
    
    222
    -            list[CommonWorkspace], self.get_children())
    
    223
    -        order: list[str] = [row.workspace_id for row in workspaces]
    
    221
    +        workspaces = cast(list[CommonWorkspace], self.get_children())
    
    222
    +        order = [row.workspace_id for row in workspaces]
    
    224 223
             order.remove('add')
    
    225 224
             app.settings.set_app_setting('workspace_order', order)
    
    226 225
     
    
    ... ... @@ -239,6 +238,11 @@ def activate_workspace(self, workspace_id: str) -> None:
    239 238
             row = self._workspaces[workspace_id]
    
    240 239
             self.select_row(row)
    
    241 240
     
    
    241
    +    def activate_workspace_number(self, number: int) -> None:
    
    242
    +        row = cast(CommonWorkspace, self.get_row_at_index(number))
    
    243
    +        if row is not None and row.workspace_id != 'add':
    
    244
    +            app.window.activate_workspace(row.workspace_id)
    
    245
    +
    
    242 246
         def get_active_workspace(self) -> Optional[str]:
    
    243 247
             row = cast(CommonWorkspace, self.get_selected_row())
    
    244 248
             if row is None:
    
    ... ... @@ -246,8 +250,7 @@ def get_active_workspace(self) -> Optional[str]:
    246 250
             return row.workspace_id
    
    247 251
     
    
    248 252
         def get_first_workspace(self) -> str:
    
    249
    -        workspaces: list[CommonWorkspace] = cast(
    
    250
    -            list[CommonWorkspace], self.get_children())
    
    253
    +        workspaces = cast(list[CommonWorkspace], self.get_children())
    
    251 254
             for row in workspaces:
    
    252 255
                 return row.workspace_id
    
    253 256
             return ''
    
    ... ... @@ -255,8 +258,7 @@ def get_first_workspace(self) -> str:
    255 258
         def get_workspace_by_id(self,
    
    256 259
                                 workspace_id: str
    
    257 260
                                 ) -> Optional[CommonWorkspace]:
    
    258
    -        workspaces: list[CommonWorkspace] = cast(
    
    259
    -            list[CommonWorkspace], self.get_children())
    
    261
    +        workspaces = cast(list[CommonWorkspace], self.get_children())
    
    260 262
             for row in workspaces:
    
    261 263
                 if row.workspace_id == workspace_id:
    
    262 264
                     return row