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:
js 2008-06-07 20:42:15 +00:00
parent 8fefd0ede4
commit 8def8de5c7
5 changed files with 35 additions and 11 deletions

View file

@ -29,8 +29,11 @@ _GAJIM_ERROR_IFACE = 'org.gajim.dbus.Error'
try: try:
if sys.platform == 'darwin': if sys.platform == 'darwin':
import osx.dbus try:
osx.dbus.load(True) import osx.dbus
osx.dbus.load(True)
except:
pass
import dbus import dbus
import dbus.service import dbus.service
import dbus.glib import dbus.glib

View file

@ -53,8 +53,10 @@ except ImportError:
hash_md5 = md5.new hash_md5 = md5.new
hash_sha1 = sha.new hash_sha1 = sha.new
if sys.platform == 'darwin': try:
from osx import nsapp from osx import nsapp
except:
pass
try: try:
import winsound # windows-only built-in module for playing wav 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): if path_to_soundfile is None or not os.path.exists(path_to_soundfile):
return return
if sys.platform == 'darwin': if sys.platform == 'darwin':
nsapp.playFile(path_to_soundfile) try:
nsapp.playFile(path_to_soundfile)
except:
pass
elif os.name == 'nt': elif os.name == 'nt':
try: try:
winsound.PlaySound(path_to_soundfile, winsound.PlaySound(path_to_soundfile,

View file

@ -600,8 +600,11 @@ def on_exit():
if os.path.exists(pid_filename): if os.path.exists(pid_filename):
os.remove(pid_filename) os.remove(pid_filename)
if sys.platform == 'darwin': if sys.platform == 'darwin':
import osx try:
osx.shutdown() import osx
osx.shutdown()
except:
pass
import atexit import atexit
atexit.register(on_exit) atexit.register(on_exit)
@ -3461,8 +3464,11 @@ if __name__ == '__main__':
check_paths.check_and_possibly_create_paths() check_paths.check_and_possibly_create_paths()
if sys.platform == 'darwin': if sys.platform == 'darwin':
import osx try:
osx.init() import osx
osx.init()
except:
pass
Interface() Interface()

View file

@ -61,8 +61,10 @@ if dbus_support.supported:
import dbus import dbus
from lastfm_track_listener import LastFMTrackListener from lastfm_track_listener import LastFMTrackListener
if sys.platform == 'darwin': try:
from osx import syncmenu from osx import syncmenu
except:
pass
#(icon, name, type, jid, account, editable, second pixbuf) #(icon, name, type, jid, account, editable, second pixbuf)
( (
@ -4476,7 +4478,10 @@ class RosterWindow:
advanced_sub_menu.show_all() advanced_sub_menu.show_all()
if sys.platform == 'darwin': 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 self.actions_menu_needs_rebuild = False
@ -5692,6 +5697,8 @@ class RosterWindow:
return True return True
def setup_for_osx(self): 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 '''Massage the GTK menu so it will match up to the OS/X nib style menu
when passed to sync-menu and merged''' when passed to sync-menu and merged'''
main_menu = self.xml.get_widget('menubar') main_menu = self.xml.get_widget('menubar')

View file

@ -27,7 +27,10 @@ from common import gajim
from common import helpers from common import helpers
if sys.platform == 'darwin': if sys.platform == 'darwin':
import osx try:
import osx
except:
pass
class StatusIcon(systray.Systray): class StatusIcon(systray.Systray):
'''Class for the notification area icon''' '''Class for the notification area icon'''