Commit 8c89187c authored by Martin's avatar Martin

Imported upstream master from 2017-11-24

parent c39284db
......@@ -6,7 +6,7 @@ try:
node = subprocess.Popen('git rev-parse --short=12 HEAD', shell=True,
stdout=subprocess.PIPE).communicate()[0]
if node:
__version__ += '-' + node.decode('utf-8').strip()
__version__ += '+' + node.decode('utf-8').strip()
except Exception:
pass
......@@ -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()
......@@ -625,23 +625,23 @@ class PubsubAvatarReceivedEvent(nec.NetworkIncomingEvent):
item = self.items_node.getTag('item')
if not item:
log.warning('Received malformed avatar data via pubsub')
log.warning(self.stanza)
log.debug(self.stanza)
return
self.sha = item.getAttr('id')
data_tag = item.getTag('data', namespace='urn:xmpp:avatar:data')
if self.sha is None or data_tag is None:
log.warning('Received malformed avatar data via pubsub')
log.warning(self.stanza)
log.debug(self.stanza)
return
self.data = data_tag.getData()
if self.data is None:
log.warning('Received malformed avatar data via pubsub')
log.warning(self.stanza)
log.debug(self.stanza)
return
try:
self.data = base64.b64decode(self.data.encode('utf-8'))
except binascii.Error as err:
log.warning('Received malformed avatar data via pubsub: %s' % err)
log.debug('Received malformed avatar data via pubsub: %s' % err)
return
return True
......
......@@ -24,7 +24,7 @@
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
import os
import sys
import logging
from gajim.common import app
......@@ -40,7 +40,7 @@ try:
DBusGMainLoop(set_as_default=True)
except ImportError:
supported = False
if not os.name == 'nt': # only say that to non Windows users
if sys.platform == 'linux': # windows and mac have no dbus
print(_('D-Bus python bindings are missing in this computer'))
print(_('D-Bus capabilities of Gajim cannot be used'))
else:
......@@ -51,7 +51,7 @@ else:
supported = True # does user have D-Bus bindings?
except dbus.DBusException:
supported = False
if not os.name == 'nt': # only say that to non Windows users
if sys.platform == 'linux': # windows and mac have no dbus
print(_('D-Bus does not run correctly on this machine'))
print(_('D-Bus capabilities of Gajim cannot be used'))
except exceptions.SystemBusNotPresent:
......
......@@ -57,7 +57,7 @@ class OptionsParser:
return False
new_version = app.config.get('version')
new_version = new_version.split('-', 1)[0]
new_version = new_version.split('+', 1)[0]
seen = set()
regex = re.compile(r"(?P<optname>[^.=]+)(?:(?:\.(?P<key>.+))?\.(?P<subname>[^.=]+))?\s=\s(?P<value>.*)")
......@@ -82,7 +82,7 @@ class OptionsParser:
app.config.set_per(optname, key, subname, value)
old_version = app.config.get('version')
old_version = old_version.split('-', 1)[0]
old_version = old_version.split('+', 1)[0]
self.update_config(old_version, new_version)
self.old_values = {} # clean mem
......
......@@ -109,7 +109,7 @@ class GioResolver(CommonResolver):
except GLib.Error as e:
if e.domain == 'g-resolver-error-quark':
result_list = []
log.warning("Could not resolve host: %s", e.message)
log.info("Could not resolve host: %s", e.message)
else:
raise
else:
......
......@@ -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
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
menu_position = 1
if app.prefers_app_menu():
menu_position = 0
# Accounts Submenu
acc_menu = menubar.get_item_link(menu_position, 'submenu')
......
......@@ -509,7 +509,7 @@ class PluginManager(metaclass=Singleton):
min_v = conf.get('info', 'min_gajim_version', fallback=None)
max_v = conf.get('info', 'max_gajim_version', fallback=None)
gajim_v = app.config.get('version').split('-', 1)[0]
gajim_v = app.config.get('version').split('+', 1)[0]
gajim_v_cmp = parse_version(gajim_v)
if min_v and gajim_v_cmp < parse_version(min_v):
......
......@@ -19,6 +19,7 @@ import gajim
pos = [x for x in os.listdir('po') if x[-3:] == ".po"]
ALL_LINGUAS = sorted([os.path.split(x)[-1][:-3] for x in pos])
cwd = os.path.dirname(os.path.realpath(__file__))
build_dir = os.path.join(cwd, "build")
def update_trans():
......@@ -56,7 +57,7 @@ def build_trans(build_cmd):
data_files = build_cmd.distribution.data_files
for lang in ALL_LINGUAS:
po_file = os.path.join('po', lang + '.po')
mo_file = os.path.join(cwd, 'build', 'mo', lang, 'LC_MESSAGES', 'gajim.mo')
mo_file = os.path.join(build_dir, 'mo', lang, 'LC_MESSAGES', 'gajim.mo')
mo_dir = os.path.dirname(mo_file)
if not (os.path.isdir(mo_dir) or os.path.islink(mo_dir)):
os.makedirs(mo_dir)
......@@ -84,7 +85,7 @@ def build_man(build_cmd):
data_files = build_cmd.distribution.data_files
for man in ['gajim.1', 'gajim-history-manager.1', 'gajim-remote.1']:
filename = os.path.join('data', man)
newdir = os.path.join(cwd, 'build', 'man')
newdir = os.path.join(build_dir, 'man')
if not (os.path.isdir(newdir) or os.path.islink(newdir)):
os.makedirs(newdir)
......@@ -112,7 +113,7 @@ def build_intl(build_cmd):
Merge translation files into desktop and mime files
'''
data_files = build_cmd.distribution.data_files
base = cwd
base = build_dir
merge_files = (('data/org.gajim.Gajim.desktop', 'share/applications', '--desktop'),
('data/gajim-remote.desktop', 'share/applications', '--desktop'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment