summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Williams <crdlb@compiz-fusion.org>2008-09-17 00:10:06 -0400
committerChristopher Williams <crdlb@compiz-fusion.org>2008-09-17 00:10:06 -0400
commit5596331ee1ac0c89df993bd0692909ba47deeaaa (patch)
tree7c022241242ad63da2c18b1168306662c1b6ce1b
parent3150dbb61d48d1bcf4ec7f9b10d21f1678dbe0e9 (diff)
downloadccsm-5596331ee1ac0c89df993bd0692909ba47deeaaa.tar.gz
ccsm-5596331ee1ac0c89df993bd0692909ba47deeaaa.tar.bz2
Attempt to support dbus-python 0.80.0 and up for single-instance support
-rwxr-xr-xccsm9
1 files changed, 8 insertions, 1 deletions
diff --git a/ccsm b/ccsm
index ac0d6a5..6e0a2c6 100755
--- a/ccsm
+++ b/ccsm
@@ -23,6 +23,9 @@ DBUS_CCSM_SERVICE = 'org.compiz_fusion.ccsm'
DBUS_CCSM_PATH = '/org/compiz_fusion/ccsm'
DBUS_CCSM_INTERFACE = 'org.compiz_fusion.ccsm'
+# from the D-Bus specification
+DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER = 1
+
from optparse import OptionParser
import pygtk
pygtk.require('2.0')
@@ -38,6 +41,10 @@ def try_register_dbus ():
except ImportError:
return
+ # rely on a reasonably new dbus-python
+ if dbus.version < (0, 80, 0):
+ return
+
class CCSMObject(dbus.service.Object):
main_window = None
@@ -61,7 +68,7 @@ def try_register_dbus ():
except dbus.DBusException:
# no ccsm instance running
if (bus.request_name(DBUS_CCSM_SERVICE)
- == dbus.bus.REQUEST_NAME_REPLY_PRIMARY_OWNER):
+ == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER):
return CCSMObject(bus, DBUS_CCSM_PATH)
else:
return