← Back to team overview

zeitgeist team mailing list archive

[Merge] lp:~zeitgeist/zeitgeist/no-reconnect into lp:zeitgeist

 

Siegfried Gevatter has proposed merging lp:~zeitgeist/zeitgeist/no-reconnect into lp:zeitgeist.

Requested reviews:
  Zeitgeist Framework Team (zeitgeist)
Related bugs:
  Bug #809569 in Zeitgeist Framework: "zeitgeist does not close properly"
  https://bugs.launchpad.net/zeitgeist/+bug/809569

For more details, see:
https://code.launchpad.net/~zeitgeist/zeitgeist/no-reconnect/+merge/67949
-- 
https://code.launchpad.net/~zeitgeist/zeitgeist/no-reconnect/+merge/67949
Your team Zeitgeist Framework Team is requested to review the proposed merge of lp:~zeitgeist/zeitgeist/no-reconnect into lp:zeitgeist.
=== modified file '_zeitgeist/singleton.py'
--- _zeitgeist/singleton.py	2011-04-22 19:19:10 +0000
+++ _zeitgeist/singleton.py	2011-07-14 11:52:31 +0000
@@ -84,7 +84,7 @@
 			else:
 				logging.debug("Replacing currently running process...")
 			try:
-				interface = ZeitgeistDBusInterface()
+				interface = ZeitgeistDBusInterface(reconnect=False)
 				interface.Quit()
 				while dbus.SessionBus().name_has_owner(ZeitgeistDBusInterface.BUS_NAME):
 					pass

=== modified file 'zeitgeist/client.py'
--- zeitgeist/client.py	2011-07-07 23:39:37 +0000
+++ zeitgeist/client.py	2011-07-14 11:52:31 +0000
@@ -67,6 +67,8 @@
 		return methods, signals
 
 	def reconnect(self):
+		if not self._reconnect_when_needed:
+			return
 		self.__proxy = dbus.SessionBus().get_object(
 			self.__iface.requested_bus_name, self.__object_path)
 		self.__iface = dbus.Interface(self.__proxy, self.__interface_name)
@@ -156,11 +158,12 @@
 		self.__methods, self.__signals = self.get_members(
 			self.__proxy.Introspect())
 
-	def __init__(self, proxy, interface_name, object_path):
+	def __init__(self, proxy, interface_name, object_path, reconnect=True):
 		self.__proxy = proxy
 		self.__interface_name = interface_name
 		self.__object_path = object_path
 		self.__iface = dbus.Interface(proxy, interface_name)
+		self._reconnect_when_needed = reconnect
 		self._load_introspection_data()
 		
 		self._disconnect_callbacks = set()
@@ -173,6 +176,8 @@
 				callbacks = self._disconnect_callbacks
 				self.__methods = self.__signals = None
 			else:
+				if not self._reconnect_when_needed:
+					return
 				self.reconnect()
 				callbacks = self._reconnect_callbacks
 				for signal, callback in self._generic_callbacks:
@@ -235,7 +240,7 @@
 			cls.__shared_state["extension_interfaces"][name] = iface
 		return cls.__shared_state["extension_interfaces"][name]
 	
-	def __init__(self):
+	def __init__(self, reconnect=True):
 		if not "dbus_interface" in self.__shared_state:
 			try:
 				proxy = dbus.SessionBus().get_object(self.BUS_NAME,
@@ -249,7 +254,7 @@
 					raise
 			self.__shared_state["extension_interfaces"] = {}
 			self.__shared_state["dbus_interface"] = _DBusInterface(proxy,
-				self.INTERFACE_NAME, self.OBJECT_PATH)
+				self.INTERFACE_NAME, self.OBJECT_PATH, reconnect)
 
 class Monitor(dbus.service.Object):
 	"""


Follow ups