[d-feet] Close the bus connection when we close a connection tab for the buses different than Session Bus and



commit 81cff9ce33c3f104e2a499b6da3787790e228c54
Author: Florent Viard <fviard lacie com>
Date:   Thu Sep 30 14:47:19 2010 +0200

    Close the bus connection when we close a connection tab for the buses different than Session Bus and System Bus. + Fix a potentiel bug.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=631010

 dfeet/DFeetApp.py           |    2 ++
 dfeet/_ui/busnameinfobox.py |    5 ++++-
 dfeet/dbus_introspector.py  |    3 +++
 3 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/dfeet/DFeetApp.py b/dfeet/DFeetApp.py
index 271ca98..5763c7c 100644
--- a/dfeet/DFeetApp.py
+++ b/dfeet/DFeetApp.py
@@ -106,6 +106,8 @@ class DFeetApp:
 
     def close_tab_cb(self, button, child):
         n = self.notebook.page_num(child)
+        if child.get_bus_watch().get_bus_name() not in [u'Session Bus', u'System Bus']:
+            child.get_bus_watch().close_bus()
         self.notebook.remove_page(n)
 
     def select_or_add_bus(self, address):
diff --git a/dfeet/_ui/busnameinfobox.py b/dfeet/_ui/busnameinfobox.py
index 73ad235..8041a43 100644
--- a/dfeet/_ui/busnameinfobox.py
+++ b/dfeet/_ui/busnameinfobox.py
@@ -120,7 +120,10 @@ class BusNameInfoBox(gtk.VBox):
 
     def set_busname(self, busname):
         if self.busname:
-            self.busname.disconnect(self.busname._introspect_changed_signal_id)
+            try:
+                self.busname.disconnect(self.busname._introspect_changed_signal_id)
+            except:
+                pass
 
         self.busname = busname
         self.introspect_tree_view.set_model(busname.common_data._introspection_data)
diff --git a/dfeet/dbus_introspector.py b/dfeet/dbus_introspector.py
index dd0ecf6..8e2fab1 100644
--- a/dfeet/dbus_introspector.py
+++ b/dfeet/dbus_introspector.py
@@ -265,6 +265,9 @@ class BusWatch(gtk.GenericTreeModel):
         else:
             return self.address
 
+    def close_bus(self):
+        self.bus.close()
+
     def get_completion_model(self):
         return self.completion_model()
 



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