Philipp Hörist pushed to branch master at gajim / gajim


Commits:
94739a89 by lovetox at 2022-06-19T14:20:25+02:00
fix: Main: Process window shortcuts when no chat is open

- - - - -
f11514ad by lovetox at 2022-06-19T14:22:29+02:00
feat: Add new Shortcut for toggling the chat list

<Primary>R show/hides the chat list

- - - - -


4 changed files:

- gajim/data/gui/shortcuts_window.ui
- gajim/data/other/shortcuts.json
- gajim/gtk/chat_page.py
- gajim/gtk/main.py


Changes:

=====================================
gajim/data/gui/shortcuts_window.ui
=====================================
@@ -175,6 +175,13 @@
           <object class="GtkShortcutsGroup">
             <property name="visible">1</property>
             <property name="title" translatable="yes">Tabs</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;primary&gt;R</property>
+                <property name="title" translatable="yes">Toggle Chat 
List</property>
+              </object>
+            </child>
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">1</property>


=====================================
gajim/data/other/shortcuts.json
=====================================
@@ -30,5 +30,6 @@
     "win.switch-tab-7": ["<Alt>7", "<Alt>KP_7"],
     "win.switch-tab-8": ["<Alt>8", "<Alt>KP_8"],
     "win.switch-tab-9": ["<Alt>9", "<Alt>KP_9"],
-    "win.search-history": ["<Primary>H"]
+    "win.search-history": ["<Primary>H"],
+    "win.hide-chat-list": ["<Primary>R"]
 }


=====================================
gajim/gtk/chat_page.py
=====================================
@@ -313,3 +313,8 @@ def hide_search(self) -> bool:
             self._search_revealer.set_reveal_child(False)
             return True
         return False
+
+    def toggle_chat_list(self) -> None:
+        chat_list = self._ui.paned.get_child1()
+        assert chat_list is not None
+        chat_list.set_visible(not chat_list.get_visible())


=====================================
gajim/gtk/main.py
=====================================
@@ -343,6 +343,7 @@ def _add_actions2(self) -> None:
             'switch-tab-7',
             'switch-tab-8',
             'switch-tab-9',
+            'toggle-chat-list',
         ]
 
         disabled_for_emacs = (
@@ -363,31 +364,31 @@ def _on_action(self,
                    action: Gio.SimpleAction,
                    _param: Optional[GLib.Variant]) -> Optional[int]:
 
-        control = self.get_active_control()
-        if control is None:
+        action_name = action.get_name()
+        log.info('Activate action: %s', action_name)
+
+        if action_name == 'escape' and self._chat_page.hide_search():
             return None
-        log.info('Activate action: %s, active control: %s',
-                 action.get_name(), control.contact.jid)
 
-        action_name = action.get_name()
+        control = self.get_active_control()
+        if control is not None:
 
-        res = control.delegate_action(action_name)
-        if res != Gdk.EVENT_PROPAGATE:
-            return res
+            res = control.delegate_action(action_name)
+            if res != Gdk.EVENT_PROPAGATE:
+                return res
 
-        if action_name == 'escape':
-            if self._chat_page.hide_search():
-                return None
+            if action_name == 'escape':
+                if app.settings.get('escape_key_closes'):
+                    self._chat_page.remove_chat(control.account,
+                                                control.contact.jid)
+                    return None
 
-            if app.settings.get('escape_key_closes'):
+            elif action_name == 'close-tab':
                 self._chat_page.remove_chat(control.account,
                                             control.contact.jid)
                 return None
 
-        elif action_name == 'close-tab':
-            self._chat_page.remove_chat(control.account, control.contact.jid)
-
-        elif action_name == 'switch-next-tab':
+        if action_name == 'switch-next-tab':
             self.select_next_chat(Direction.NEXT)
 
         elif action_name == 'switch-prev-tab':
@@ -403,6 +404,9 @@ def _on_action(self,
             number = int(action_name[-1]) - 1
             self.select_chat_number(number)
 
+        elif action_name == 'toggle-chat-list':
+            self._chat_page.toggle_chat_list()
+
         return None
 
     def _on_window_motion_notify(self,



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/3599cbc014b00ced6d8615a8b61825f49aeb1536...f11514ad4f87ba401a18d85b5707efc9f6cd6aa3

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/3599cbc014b00ced6d8615a8b61825f49aeb1536...f11514ad4f87ba401a18d85b5707efc9f6cd6aa3
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to