[kupfer] plugin.nautilusselection: Catch D-Bus exceptions



commit 005baadeabe0d63312caadf4c1db1606ccdc9b58
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Thu Sep 3 09:34:00 2009 +0200

    plugin.nautilusselection: Catch D-Bus exceptions
    
    Take care to catch exceptions in unpickle_finish

 kupfer/plugin/nautilusselection.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/kupfer/plugin/nautilusselection.py b/kupfer/plugin/nautilusselection.py
index 96ce872..ffbf65e 100644
--- a/kupfer/plugin/nautilusselection.py
+++ b/kupfer/plugin/nautilusselection.py
@@ -34,14 +34,17 @@ class SelectionSource (Source, PicklingHelperMixin):
 		self.unpickle_finish()
 
 	def unpickle_finish(self):
-		session_bus = dbus.Bus()
+		self._selection = []
+		try:
+			session_bus = dbus.Bus()
+		except dbus.DBusException:
+			return
 		callback = WeakCallback(self, "_selected_signal")
 		callback.dbus_token = session_bus.add_signal_receiver(
 				callback,
 				"SelectionChanged",
 				dbus_interface="se.kaizer.KupferNautilusPlugin",
 				byte_arrays=True)
-		self._selection = []
 
 	def _selected_signal(self, selection):
 		self._selection = selection



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]