Skip to content
Snippets Groups Projects
Commit fc627fc1 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

Use appmenu only if system supports it

parent 276daa99
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
## ##
import os import os
import sys
import logging import logging
import locale import locale
import uuid import uuid
...@@ -500,3 +501,10 @@ def get_priority(account, show): ...@@ -500,3 +501,10 @@ def get_priority(account, show):
def log(domain): def log(domain):
root = 'gajim.' root = 'gajim.'
return logging.getLogger(root + domain) return logging.getLogger(root + domain)
def prefers_app_menu():
if sys.platform == 'darwin':
return True
if sys.platform == 'win32':
return False
return app.prefers_app_menu()
...@@ -215,10 +215,9 @@ class GajimApplication(Gtk.Application): ...@@ -215,10 +215,9 @@ class GajimApplication(Gtk.Application):
builder.add_from_file(path) builder.add_from_file(path)
menubar = builder.get_object("menubar") menubar = builder.get_object("menubar")
appmenu = builder.get_object("appmenu") appmenu = builder.get_object("appmenu")
if os.name != 'nt': if app.prefers_app_menu():
self.set_app_menu(appmenu) self.set_app_menu(appmenu)
else: else:
# Dont set Application Menu for Windows
# Add it to the menubar instead # Add it to the menubar instead
menubar.prepend_submenu('Gajim', appmenu) menubar.prepend_submenu('Gajim', appmenu)
self.set_menubar(menubar) self.set_menubar(menubar)
......
...@@ -767,9 +767,9 @@ def get_account_menu(account): ...@@ -767,9 +767,9 @@ def get_account_menu(account):
def build_accounts_menu(): def build_accounts_menu():
menubar = app.app.get_menubar() menubar = app.app.get_menubar()
# Accounts Submenu # Accounts Submenu
menu_position = 0 menu_position = 1
if os.name == 'nt': if app.prefers_app_menu():
menu_position = 1 menu_position = 0
acc_menu = menubar.get_item_link(menu_position, 'submenu') acc_menu = menubar.get_item_link(menu_position, 'submenu')
acc_menu.remove_all() acc_menu.remove_all()
...@@ -796,9 +796,9 @@ def build_bookmark_menu(account): ...@@ -796,9 +796,9 @@ def build_bookmark_menu(account):
if not bookmark_menu: if not bookmark_menu:
return return
menu_position = 0 menu_position = 1
if os.name == 'nt': if app.prefers_app_menu():
menu_position = 1 menu_position = 0
# Accounts Submenu # Accounts Submenu
acc_menu = menubar.get_item_link(menu_position, 'submenu') acc_menu = menubar.get_item_link(menu_position, 'submenu')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment