Make Gajim work on OS X again.
Someone completely broke it by trying to port it to native GTK. However, that person didn't only break it with X11 GTK, with native GTK it wasn't working correctly either. Fixed it by adding lots of try/except blocks. Someone definitely deserves to be slaughtered for completely breaking it on OS X…
This commit is contained in:
parent
8fefd0ede4
commit
8def8de5c7
|
@ -29,8 +29,11 @@ _GAJIM_ERROR_IFACE = 'org.gajim.dbus.Error'
|
|||
|
||||
try:
|
||||
if sys.platform == 'darwin':
|
||||
import osx.dbus
|
||||
osx.dbus.load(True)
|
||||
try:
|
||||
import osx.dbus
|
||||
osx.dbus.load(True)
|
||||
except:
|
||||
pass
|
||||
import dbus
|
||||
import dbus.service
|
||||
import dbus.glib
|
||||
|
|
|
@ -53,8 +53,10 @@ except ImportError:
|
|||
hash_md5 = md5.new
|
||||
hash_sha1 = sha.new
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
try:
|
||||
from osx import nsapp
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
import winsound # windows-only built-in module for playing wav
|
||||
|
@ -570,7 +572,10 @@ def play_sound_file(path_to_soundfile):
|
|||
if path_to_soundfile is None or not os.path.exists(path_to_soundfile):
|
||||
return
|
||||
if sys.platform == 'darwin':
|
||||
nsapp.playFile(path_to_soundfile)
|
||||
try:
|
||||
nsapp.playFile(path_to_soundfile)
|
||||
except:
|
||||
pass
|
||||
elif os.name == 'nt':
|
||||
try:
|
||||
winsound.PlaySound(path_to_soundfile,
|
||||
|
|
14
src/gajim.py
14
src/gajim.py
|
@ -600,8 +600,11 @@ def on_exit():
|
|||
if os.path.exists(pid_filename):
|
||||
os.remove(pid_filename)
|
||||
if sys.platform == 'darwin':
|
||||
import osx
|
||||
osx.shutdown()
|
||||
try:
|
||||
import osx
|
||||
osx.shutdown()
|
||||
except:
|
||||
pass
|
||||
|
||||
import atexit
|
||||
atexit.register(on_exit)
|
||||
|
@ -3461,8 +3464,11 @@ if __name__ == '__main__':
|
|||
check_paths.check_and_possibly_create_paths()
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
import osx
|
||||
osx.init()
|
||||
try:
|
||||
import osx
|
||||
osx.init()
|
||||
except:
|
||||
pass
|
||||
|
||||
Interface()
|
||||
|
||||
|
|
|
@ -61,8 +61,10 @@ if dbus_support.supported:
|
|||
import dbus
|
||||
from lastfm_track_listener import LastFMTrackListener
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
try:
|
||||
from osx import syncmenu
|
||||
except:
|
||||
pass
|
||||
|
||||
#(icon, name, type, jid, account, editable, second pixbuf)
|
||||
(
|
||||
|
@ -4476,7 +4478,10 @@ class RosterWindow:
|
|||
advanced_sub_menu.show_all()
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
syncmenu.takeover_menu(self.xml.get_widget('menubar'))
|
||||
try:
|
||||
syncmenu.takeover_menu(self.xml.get_widget('menubar'))
|
||||
except:
|
||||
pass
|
||||
|
||||
self.actions_menu_needs_rebuild = False
|
||||
|
||||
|
@ -5692,6 +5697,8 @@ class RosterWindow:
|
|||
return True
|
||||
|
||||
def setup_for_osx(self):
|
||||
# This is broken
|
||||
return
|
||||
'''Massage the GTK menu so it will match up to the OS/X nib style menu
|
||||
when passed to sync-menu and merged'''
|
||||
main_menu = self.xml.get_widget('menubar')
|
||||
|
|
|
@ -27,7 +27,10 @@ from common import gajim
|
|||
from common import helpers
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
import osx
|
||||
try:
|
||||
import osx
|
||||
except:
|
||||
pass
|
||||
|
||||
class StatusIcon(systray.Systray):
|
||||
'''Class for the notification area icon'''
|
||||
|
|
Loading…
Reference in New Issue