Use appmenu only if system supports it
This commit is contained in:
parent
276daa991c
commit
fc627fc19c
|
@ -28,6 +28,7 @@
|
|||
##
|
||||
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
import locale
|
||||
import uuid
|
||||
|
@ -500,3 +501,10 @@ def get_priority(account, show):
|
|||
def log(domain):
|
||||
root = 'gajim.'
|
||||
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):
|
|||
builder.add_from_file(path)
|
||||
menubar = builder.get_object("menubar")
|
||||
appmenu = builder.get_object("appmenu")
|
||||
if os.name != 'nt':
|
||||
if app.prefers_app_menu():
|
||||
self.set_app_menu(appmenu)
|
||||
else:
|
||||
# Dont set Application Menu for Windows
|
||||
# Add it to the menubar instead
|
||||
menubar.prepend_submenu('Gajim', appmenu)
|
||||
self.set_menubar(menubar)
|
||||
|
|
|
@ -767,9 +767,9 @@ def get_account_menu(account):
|
|||
def build_accounts_menu():
|
||||
menubar = app.app.get_menubar()
|
||||
# Accounts Submenu
|
||||
menu_position = 0
|
||||
if os.name == 'nt':
|
||||
menu_position = 1
|
||||
if app.prefers_app_menu():
|
||||
menu_position = 0
|
||||
|
||||
acc_menu = menubar.get_item_link(menu_position, 'submenu')
|
||||
acc_menu.remove_all()
|
||||
|
@ -796,9 +796,9 @@ def build_bookmark_menu(account):
|
|||
if not bookmark_menu:
|
||||
return
|
||||
|
||||
menu_position = 0
|
||||
if os.name == 'nt':
|
||||
menu_position = 1
|
||||
if app.prefers_app_menu():
|
||||
menu_position = 0
|
||||
|
||||
# Accounts Submenu
|
||||
acc_menu = menubar.get_item_link(menu_position, 'submenu')
|
||||
|
|
Loading…
Reference in New Issue