Quartz version of GnuCash and dbus

Mike Alexander mta at umich.edu
Wed May 18 19:13:47 EDT 2011


Although my main machine is a Mac running Snow Leopard, I normally use 
the X11 version of GnuCash.  However this week I decided to give the 
Quartz version a try to see what it is like.  I downloaded the app 
bundle from sourceforge and gave it a try (as well as building it from 
source various ways).  The app bundle worked well, but I have a few 
suggestions.

First, I noticed that the About dialog says it's version 2.4.5 built on 
2011-04-05 from r20417.  However, r20417 is actually version 2.4.4 from 
about 2011-03-13.  I don't know which is wrong, the version number or 
the SVN revision, but they are inconsistent.  Version 2.4.5 was the 
first from the new 2.4 branch, perhaps the code that gets the SVN 
revision doesn't work if it's not on trunk.

Second, and perhaps more importantly, I think you can easily fix up the 
dbus mess if you upgrade dbus to a newer version.  I don't know what 
version of dbus you're packaging with the app (it would be useful if 
sources.txt included version numbers to answer questions like this), 
but all versions since 1.4.1 have included support to integrate dbus 
with launchd on MacOSX.  If you use this you can avoid starting dbus at 
all and let launchd do it for you.

I patched the script in the app bundle as indicated in the attached 
patch and it seems to work fine using dbus 1.4.8 installed via 
MacPorts.  I had to replace libdbus-1.3.dylib in the app bundle, but 
otherwise everything is unchanged.  My patch assumes the path for the 
MacPorts dbus, you'll have to change the ln command to point to the 
launchd plist wherever you put it in the bundle.

          Mike
 
-------------- next part --------------
--- /Volumes/Gnucash-Intel-2.4.5/Gnucash.app/Contents/MacOS/Gnucash	2010-12-18 17:21:56.000000000 -0500
+++ /Applications/Gnucash/Gnucash.app/Contents/MacOS/Gnucash	2011-05-18 16:52:54.000000000 -0400
@@ -98,21 +98,12 @@
     fi
 fi
 
-if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
-    # If we get here without a way to connect to an instance of dbus-daemon,
-    # then we can kill any existing instances of dbus-daemon that originate
-    # in this copy of Gnucash.
-
-    DBUS_PIDS=`ps ux | grep dbus-daemon | grep "${PREFIX}" | awk '{print $2}'`
-
-    if /bin/test "$DBUS_PIDS"; then
-        for DBUS_PID in ${DBUS_PIDS}
-        do
-            /bin/kill "${DBUS_PID}"
-        done
-    fi
-
-    eval `"$PREFIX/bin/dbus-launch" --sh-syntax --exit-with-session --config-file="$bundle_res/etc/dbus-1/session.conf"`
+# See if the DBUS session bus is registered in launchd and register it if not
+if [ "x`launchctl list | grep 'org\.freedesktop\.dbus-session'`" == x ]; then
+    if [ ! -e ~/Library/LaunchAgents/org.freedesktop.dbus-session.plist ]; then
+        ln -s /opt/local/Library/LaunchAgents/org.freedesktop.dbus-session.plist ~/Library/LaunchAgents
+    fi
+    launchctl load -w ~/Library/LaunchAgents/org.freedesktop.dbus-session.plist
 fi
 
 GNC_MODULE_PATH="${RESPFX}/lib/gnucash:${GNC_MODULE_PATH}"


More information about the gnucash-devel mailing list