Adjusted the menu code in an attempt to make it work better on leopard. Removed

the idle_add wrapper for on_quit and moved the idle_add wrapping into the
sync-menu code instead.
This commit is contained in:
James Newton 2007-11-16 23:11:35 +00:00
parent 483604cd0b
commit c2b901dfe9
8 changed files with 46 additions and 38 deletions

View File

@ -23,12 +23,10 @@ The bits that dont work
- fix user session management - fix user session management
-integrate the Gajim and gajim-remote scripts with autoconf and add GTK -integrate the Gajim and gajim-remote scripts with autoconf and add GTK
framework detection framework detection
-Pass icons to OS/X menu -Maybe setup the pasteboard services for an OS/X alternative to the
-set the LSEnvironment in Info.plist for gtk paths instead of hard coding in
gajim.py
-Maybe setup the pasteboard services for an OS/X alternative to the
gajim_remote gajim_remote
-CFBundleDocumentTypes.NSDocument -CFBundleDocumentTypes.NSDocument
-zeroconf has a parsing problem with the MDNS result.
Native GTK bugs Native GTK bugs

View File

@ -3,19 +3,22 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>IBDocumentLocation</key> <key>IBDocumentLocation</key>
<string>69 10 356 240 0 0 1280 832 </string> <string>82 255 356 240 0 0 1280 832 </string>
<key>IBEditorPositions</key> <key>IBEditorPositions</key>
<dict> <dict>
<key>29</key> <key>29</key>
<string>245 312 185 44 0 0 1280 832 </string> <string>476 296 342 44 0 0 1280 832 </string>
</dict> </dict>
<key>IBFramework Version</key> <key>IBFramework Version</key>
<string>446.1</string> <string>446.1</string>
<key>IBOldestOS</key>
<integer>4</integer>
<key>IBOpenObjects</key> <key>IBOpenObjects</key>
<array> <array>
<integer>289</integer>
<integer>29</integer> <integer>29</integer>
</array> </array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>8R218</string> <string>8S165</string>
</dict> </dict>
</plist> </plist>

Binary file not shown.

View File

@ -4,6 +4,10 @@ OS=`uname -s`
if [ "x${OS}" == "xDarwin" ]; then if [ "x${OS}" == "xDarwin" ]; then
export RESOURCEPATH="${BASE}/dist/Gajim.app/Contents/Resources" export RESOURCEPATH="${BASE}/dist/Gajim.app/Contents/Resources"
GTK_DIR="/Library/Frameworks/GTK+.framework/Versions/Current"
export PATH="${GTK_DIR}/bin:$PATH"
export PYTHONPATH="${GTK_DIR}/lib/python2.5/site-packages:${GTK_DIR}/lib/python2.5/site-packages/gtk-2.0:${PYTHONPATH}"
unset GTK_DIR
fi fi
cd ${BASE}/src cd ${BASE}/src

View File

@ -297,7 +297,7 @@ def pid_alive():
return False return False
elif sys.platform == 'darwin': elif sys.platform == 'darwin':
from osx import checkPID from osx import checkPID
return checkPID(pid, 'gajim') return checkPID(pid, 'Gajim.bin')
try: try:
if not os.path.exists('/proc'): if not os.path.exists('/proc'):
return True # no /proc, assume Gajim is running return True # no /proc, assume Gajim is running

View File

@ -10,8 +10,8 @@ if BUILD_COCOA
syncmenulib_LTLIBRARIES = syncmenu.la syncmenulib_LTLIBRARIES = syncmenu.la
syncmenulibdir = $(libdir)/gajim syncmenulibdir = $(libdir)/gajim
syncmenu_la_SOURCES = sync-menu.c pysyncmenu.c syncmenu_la_SOURCES = sync-menu.c pysyncmenu.c
syncmenu_la_LDFLAGS = -module -avoid-version $(GTKLDFLAGS) syncmenu_la_LDFLAGS = -module -avoid-version -Xcompiler -isysroot -Xcompiler /Developer/SDKs/MacOSX10.4u.sdk -Xcompiler -arch -Xcompiler ppc -Xcompiler -arch -Xcompiler i386 $(GTKLDFLAGS)
syncmenu_la_CFLAGS = $(GTKCFLAGS) -Wall -g $(INCLUDES) syncmenu_la_CFLAGS = -Xcompiler -isysroot -Xcompiler /Developer/SDKs/MacOSX10.4u.sdk -Xcompiler -arch -Xcompiler ppc -Xcompiler -arch -Xcompiler i386 $(GTKCFLAGS) -Wall -g $(INCLUDES)
endif endif
DISTCLEANFILES = DISTCLEANFILES =

View File

@ -477,11 +477,16 @@ carbon_menu_item_connect (GtkWidget *menu_item,
return carbon_item; return carbon_item;
} }
/* /*
* carbon event handler * carbon event handler
*/ */
gboolean menuitem_activate_wrapper(gpointer data)
{
gtk_menu_item_activate((GtkMenuItem*)data);
return FALSE;
}
static OSStatus static OSStatus
menu_event_handler_func (EventHandlerCallRef event_handler_call_ref, menu_event_handler_func (EventHandlerCallRef event_handler_call_ref,
EventRef event_ref, EventRef event_ref,
@ -526,7 +531,8 @@ menu_event_handler_func (EventHandlerCallRef event_handler_call_ref,
sizeof (widget), 0, &widget); sizeof (widget), 0, &widget);
if (err == noErr && widget) if (err == noErr && widget)
{ {
gtk_menu_item_activate (GTK_MENU_ITEM (widget)); g_idle_add(menuitem_activate_wrapper,
(gpointer)GTK_MENU_ITEM (widget));
return noErr; return noErr;
} }
} }

View File

@ -4191,9 +4191,6 @@ class RosterWindow:
gtk.main_quit() gtk.main_quit()
def on_quit_menuitem_activate(self, widget): def on_quit_menuitem_activate(self, widget):
gobject.idle_add(self.on_quit_menuitem_activate_real, widget)
def on_quit_menuitem_activate_real(self, widget):
accounts = gajim.connections.keys() accounts = gajim.connections.keys()
get_msg = False get_msg = False
for acct in accounts: for acct in accounts:
@ -5187,47 +5184,47 @@ class RosterWindow:
def setup_for_osx(self): def setup_for_osx(self):
# 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")
app_item = gtk.MenuItem('Gajim') app_item = gtk.MenuItem("Gajim")
main_menu.insert(app_item, 0) main_menu.insert(app_item, 0)
win_item = gtk.MenuItem('Window') win_item = gtk.MenuItem("Window")
main_menu.insert(win_item, 4) main_menu.insert(win_item, 4)
actions_menu = self.xml.get_widget('actions_menu_menu') actions_menu = self.xml.get_widget("actions_menu_menu")
quit_item = self.xml.get_widget('quit_menuitem') quit_item = self.xml.get_widget("quit_menuitem")
actions_menu.remove(quit_item) actions_menu.remove(quit_item)
actions_menu.remove(self.xml.get_widget('separator1')) actions_menu.remove(self.xml.get_widget("separator1"))
edit_menu = self.xml.get_widget('edit_menu_menu') edit_menu = self.xml.get_widget("edit_menu_menu")
edit_menu.remove(self.xml.get_widget('preferences_menuitem')) #edit_menu.remove(self.xml.get_widget("preferences_menuitem"))
edit_menu.remove(self.xml.get_widget('separator2')) edit_menu.remove(self.xml.get_widget("separator2"))
help_menu = self.xml.get_widget('help_menu_menu') help_menu = self.xml.get_widget("help_menu_menu")
about_item = self.xml.get_widget('about_menuitem') about_item = self.xml.get_widget("about_menuitem")
help_menu.remove(about_item) help_menu.remove(about_item)
# Build up App menu # Build up App menu
app_menu = gtk.Menu() app_menu = gtk.Menu()
app_item.set_submenu(app_menu) app_item.set_submenu(app_menu)
app_menu.append(about_item) app_menu.append(about_item)
app_menu.append(gtk.MenuItem('__SKIP__')) app_menu.append(gtk.MenuItem("__SKIP__"))
prefs_item = gtk.MenuItem('Preferences...') prefs_item = gtk.MenuItem("Preferences...")
prefs_item.connect("activate", self.on_preferences_menuitem_activate) prefs_item.connect("activate", self.on_preferences_menuitem_activate)
accels = gtk.AccelGroup() accels = gtk.AccelGroup()
self.xml.get_widget('roster_window').add_accel_group(accels) self.xml.get_widget("roster_window").add_accel_group(accels)
prefs_item.add_accelerator('activate', accels, ord(','), prefs_item.add_accelerator("activate", accels, ord(','),
gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE) gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE)
app_menu.append(prefs_item) app_menu.append(prefs_item)
app_menu.append(gtk.MenuItem('__SKIP__')) app_menu.append(gtk.MenuItem("__SKIP__"))
app_menu.append(gtk.MenuItem('__SKIP__')) app_menu.append(gtk.MenuItem("__SKIP__"))
app_menu.append(gtk.MenuItem('__SKIP__')) app_menu.append(gtk.MenuItem("__SKIP__"))
app_menu.append(gtk.MenuItem('__SKIP__')) app_menu.append(gtk.MenuItem("__SKIP__"))
app_menu.append(gtk.MenuItem('__SKIP__')) app_menu.append(gtk.MenuItem("__SKIP__"))
app_menu.append(gtk.MenuItem('__SKIP__')) app_menu.append(gtk.MenuItem("__SKIP__"))
app_menu.append(gtk.MenuItem('__SKIP__')) app_menu.append(gtk.MenuItem("__SKIP__"))
app_menu.append(quit_item) app_menu.append(quit_item)
app_menu.show_all() app_menu.show_all()
# Do the merge baby! # Do the merge baby!
syncmenu.takeover_menu(main_menu) syncmenu.takeover_menu(main_menu)
self.make_menu(force = True) self.make_menu(force = True)
# Hide the GTK menubar itself and let the OS/X menubar do its thing # Hide the GTK menubar itself and let the OS/X menubar do its thing
self.xml.get_widget('menubar').hide() #self.xml.get_widget("menubar").hide()
return return
def __init__(self): def __init__(self):