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


Commits:
de8b2246 by nicoco at 2024-04-14T16:48:12+00:00
feat: Hide/show main menu bar

- - - - -


6 changed files:

- gajim/common/setting_values.py
- gajim/data/gui/application_menu.ui
- gajim/data/gui/shortcuts_window.ui
- gajim/data/other/shortcuts.json
- gajim/gtk/const.py
- gajim/gtk/main.py


Changes:

=====================================
gajim/common/setting_values.py
=====================================
@@ -65,6 +65,7 @@ class _ACCOUNTDEFAULT:
     'preview_verify_https',
     'print_status_in_chats',
     'remote_control',
+    'show_main_menu',
     'save_main_window_position',
     'send_on_ctrl_enter',
     'show_chatstate_in_banner',
@@ -247,6 +248,7 @@ class _ACCOUNTDEFAULT:
     'show_chatstate_in_banner': True,
     'show_help_start_chat': True,
     'show_in_taskbar': True,
+    'show_main_menu': True,
     'show_main_window_on_startup': 'always',
     'show_notifications': True,
     'show_notifications_away': False,


=====================================
gajim/data/gui/application_menu.ui
=====================================
@@ -42,6 +42,10 @@
           <attribute name="label" translatable="yes">_File Transfer</attribute>
           <attribute name="action">app.file-transfer</attribute>
         </item>
+        <item>
+          <attribute name="label" translatable="yes">_Show menu bar</attribute>
+          <attribute name="action">win.toggle-menu-bar</attribute>
+        </item>
       </section>
     </submenu>
     <submenu>


=====================================
gajim/data/gui/shortcuts_window.ui
=====================================
@@ -87,6 +87,13 @@
                 <property name="title" translatable="yes">Reset User Interface 
Font Size</property>
               </object>
             </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;primary&gt;M</property>
+                <property name="title" translatable="yes">Hide/show the main 
window menu</property>
+              </object>
+            </child>
           </object>
         </child>
 


=====================================
gajim/data/other/shortcuts.json
=====================================
@@ -42,6 +42,7 @@
     "win.decrease-app-font-size": ["<Primary>minus", "<Primary>KP_Subtract"],
     "win.reset-app-font-size": ["<Primary>0", "<Primary>KP_0"],
     "win.toggle-chat-list": ["<Primary>R"],
+    "win.toggle-menu-bar": ["<Primary>M"],
     "win.scroll-view-up": ["<Shift>Page_Up"],
     "win.scroll-view-down": ["<Shift>Page_Down"],
     "win.quote-prev": ["<Primary><Shift>Up"],


=====================================
gajim/gtk/const.py
=====================================
@@ -267,6 +267,7 @@ def __str__(self):
     ('decrease-app-font-size', None, True),
     ('reset-app-font-size', None, True),
     ('toggle-chat-list', None, True),
+    ('toggle-menu-bar', None, True),
     ('add-workspace', 's', True),
     ('edit-workspace', 's', True),
     ('remove-workspace', 's', True),


=====================================
gajim/gtk/main.py
=====================================
@@ -153,6 +153,8 @@ def __init__(self) -> None:
         app.app.systray.connect_unread_widget(chat_list_stack,
                                               'unread-count-changed')
 
+        self.set_show_menubar(app.settings.get_app_setting('show_main_menu'))
+
         for client in app.get_clients():
             client.connect_signal('state-changed',
                                   self._on_client_state_changed)
@@ -454,6 +456,7 @@ def _connect_actions(self) -> None:
             ('decrease-app-font-size', self._on_app_font_size_action),
             ('reset-app-font-size', self._on_app_font_size_action),
             ('toggle-chat-list', self._on_action),
+            ('toggle-menu-bar', self._on_action),
             ('preview-download', self._on_preview_action),
             ('preview-open', self._on_preview_action),
             ('preview-save-as', self._on_preview_action),
@@ -543,6 +546,11 @@ def _on_action(self,
         elif action_name == 'toggle-chat-list':
             self._toggle_chat_list()
 
+        elif action_name == 'toggle-menu-bar':
+            show_menu_bar = not self.get_show_menubar()
+            app.settings.set_app_setting('show_main_menu', show_menu_bar)
+            self.set_show_menubar(show_menu_bar)
+
         return None
 
     def _on_app_font_size_action(



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/de8b2246fe3509f8929954eb2ae3e7b4f9e6d423

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/de8b2246fe3509f8929954eb2ae3e7b4f9e6d423
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to