[d-feet] Add close-button to exception dialog



commit ec6505fa6238bcb3adf17fdbeddc0e7b45d9f8b2
Author: Thomas Bechtold <thomasbechtold jpberlin de>
Date:   Sat Jan 12 09:26:11 2013 +0100

    Add close-button to exception dialog

 dfeet/introspection.py |    8 +++++---
 ui/introspection.ui    |    3 ++-
 2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/dfeet/introspection.py b/dfeet/introspection.py
index e0dc277..4c05cd5 100644
--- a/dfeet/introspection.py
+++ b/dfeet/introspection.py
@@ -44,10 +44,9 @@ class AddressInfo():
         self.__label_unique_name = ui.get_widget('label_unique_name')
         self.__label_address = ui.get_widget('label_address')
         self.__messagedialog = ui.get_widget('messagedialog')
-
+        self.__messagedialog.connect("close", self.__messagedialog_close_cb)
         #connect signals
         ui.connect_signals(signal_dict)
-
         if self.connection_is_bus:
             #we expect a bus connection
             if self.address == Gio.BusType.SYSTEM or self.address == Gio.BusType.SESSION:
@@ -75,6 +74,9 @@ class AddressInfo():
         #start processing data
         self.introspect_start()
 
+    def __messagedialog_close_cb(self, dialog):
+        self.__messagedialog.destroy()
+
 
     def __treeview_row_activated_cb(self, treeview, path, view_column):
         model = treeview.get_model()
@@ -160,10 +162,10 @@ class AddressInfo():
             res = connection.call_finish(result_async)
         except Exception as e:
             #got an exception (eg dbus timeout). show the exception
-            print("Exception: '%s'" % (str(e)))
             self.__messagedialog.set_title("DBus Exception")
             self.__messagedialog.set_property("text", "%s : %s" % (self.name, str(e)))
             self.__messagedialog.run()
+            self.__messagedialog.destroy()
         else:
             #we got a valid result from dbus call! Create nodes and add to treemodel
             node_info = Gio.DBusNodeInfo.new_for_xml(res[0])
diff --git a/ui/introspection.ui b/ui/introspection.ui
index 6784320..424fa38 100644
--- a/ui/introspection.ui
+++ b/ui/introspection.ui
@@ -196,13 +196,14 @@
     <property name="type_hint">dialog</property>
     <property name="skip_taskbar_hint">True</property>
     <property name="message_type">error</property>
+    <property name="buttons">close</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="messagedialog-vbox">
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <child internal-child="action_area">
-          <object class="GtkButtonBox" id="messagedialog-action_area2">
+          <object class="GtkButtonBox" id="messagedialog-action_area">
             <property name="can_focus">False</property>
           </object>
           <packing>



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