[d-feet/gtk-template] Use Gtk.Template for widgets



commit f16972d77b01c3b9357329def8a6aa40da9fae02
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Mon Feb 4 15:01:06 2019 +0100

    Use Gtk.Template for widgets
    
    This uses https://gitlab.gnome.org/GNOME/pygobject/merge_requests/52/ in order to clean the code
    It also moves the ui's to a gresource file to avoid having the pkgdatadir sent to all the widgets
    
    During the migration, I have also updated some depcreated widgets.

 data/meson.build                   |   9 +-
 data/org.gnome.dfeet.gresource.xml |  10 +
 data/ui/addconnectiondialog.ui     |  67 +++---
 data/ui/bus.ui                     |  31 ++-
 data/ui/executedialog.ui           | 421 ++++++++++++++++++-------------------
 data/ui/introspection.ui           | 108 +++++-----
 data/ui/mainwindow.ui              | 111 +++++-----
 data/ui/meson.build                |  12 --
 src/d-feet.in                      |   9 +-
 src/dfeet/addconnectiondialog.py   |  36 ++--
 src/dfeet/application.py           |   5 +-
 src/dfeet/bus_watch.py             |  73 +++----
 src/dfeet/executemethoddialog.py   |  58 ++---
 src/dfeet/introspection.py         |  82 ++++----
 src/dfeet/meson.build              |   1 -
 src/dfeet/uiloader.py              |  53 -----
 src/dfeet/window.py                |  52 ++---
 src/tests/tests.py.in              |   5 +-
 18 files changed, 537 insertions(+), 606 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 026bd80..6efcbeb 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,5 +1,4 @@
 subdir('icons')
-subdir('ui')
 
 desktop_conf = configuration_data()
 desktop_conf.set('PACKAGE', df_name)
@@ -37,3 +36,11 @@ install_data(
   df_namespace + '.gschema.xml',
   install_dir: gio_schemasdir,
 )
+
+gnome.compile_resources(
+  df_namespace,
+  df_namespace + '.gresource.xml',
+  gresource_bundle: true,
+  install_dir: df_datadir / meson.project_name(),
+  install: true
+)
diff --git a/data/org.gnome.dfeet.gresource.xml b/data/org.gnome.dfeet.gresource.xml
new file mode 100644
index 0000000..1a521bb
--- /dev/null
+++ b/data/org.gnome.dfeet.gresource.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/dfeet">
+    <file compressed="true" preprocess="xml-stripblanks" 
alias="addconnectiondialog.ui">ui/addconnectiondialog.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks" alias="bus.ui">ui/bus.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks" alias="executedialog.ui">ui/executedialog.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks" alias="introspection.ui">ui/introspection.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks" alias="mainwindow.ui">ui/mainwindow.ui</file>
+  </gresource>
+</gresources>
diff --git a/data/ui/addconnectiondialog.ui b/data/ui/addconnectiondialog.ui
index 19e1618..e7ca4ac 100644
--- a/data/ui/addconnectiondialog.ui
+++ b/data/ui/addconnectiondialog.ui
@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.0 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkDialog" id="add_connection_dialog1">
+  <requires lib="gtk+" version="3.2"/>
+  <template class="AddConnectionDialog" parent="GtkDialog">
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Add a Connection</property>
@@ -14,23 +15,13 @@
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
-        <child>
-          <object class="GtkHBox" id="hbox1">
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog1-action_area">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
             <child>
-              <object class="GtkLabel" id="label1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="tooltip_text" translatable="yes">See 
http://dbus.freedesktop.org/doc/dbus-specification.html#addresses</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">Address:</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
+              <placeholder/>
             </child>
             <child>
               <placeholder/>
@@ -39,26 +30,51 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="padding">5</property>
+            <property name="pack_type">end</property>
             <property name="position">0</property>
           </packing>
         </child>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog1-action_area">
+        <child>
+          <object class="GtkBox" id="hbox1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
             <child>
-              <placeholder/>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="tooltip_text" translatable="yes">See 
http://dbus.freedesktop.org/doc/dbus-specification.html#addresses</property>
+                <property name="label" translatable="yes">Address:</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
             </child>
             <child>
-              <placeholder/>
+              <object class="GtkComboBoxText" id="address_combo_box">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="active">0</property>
+                <property name="has_entry">True</property>
+                <child internal-child="entry">
+                  <object class="GtkEntry">
+                    <property name="can_focus">False</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="pack_type">end</property>
+                <property name="position">1</property>
+              </packing>
             </child>
           </object>
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="pack_type">end</property>
             <property name="position">0</property>
           </packing>
         </child>
@@ -76,5 +92,8 @@
         </child>
       </object>
     </child>
-  </object>
+    <child type="titlebar">
+      <placeholder/>
+    </child>
+  </template>
 </interface>
diff --git a/data/ui/bus.ui b/data/ui/bus.ui
index 059e041..223cb2e 100644
--- a/data/ui/bus.ui
+++ b/data/ui/bus.ui
@@ -1,14 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.0 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkBox" id="box_bus">
+  <requires lib="gtk+" version="3.10"/>
+  <template class="BusWatch" parent="GtkBox">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
+    <property name="margin_top">5</property>
+    <property name="margin_bottom">5</property>
     <property name="spacing">5</property>
-    <property name="margin-start">5</property>
-    <property name="margin-end">5</property>
-    <property name="margin-top">5</property>
-    <property name="margin-bottom">5</property>
     <child>
       <object class="GtkBox" id="box_left">
         <property name="visible">True</property>
@@ -16,11 +15,11 @@
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <child>
-          <object class="GtkSearchEntry" id="entry_filter">
+          <object class="GtkSearchEntry" id="bus_search_entry">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="invisible_char">•</property>
-            <property name="invisible_char_set">True</property>
+            <signal name="changed" handler="bus_name_filter_changed" swapped="no"/>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -33,7 +32,19 @@
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <child>
-              <placeholder/>
+              <object class="GtkViewport">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkListBox" id="bus_listbox">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <signal name="row-selected" handler="listbox_row_selected" swapped="no"/>
+                  </object>
+                </child>
+              </object>
             </child>
           </object>
           <packing>
@@ -62,5 +73,5 @@
         <property name="position">1</property>
       </packing>
     </child>
-  </object>
+  </template>
 </interface>
diff --git a/data/ui/executedialog.ui b/data/ui/executedialog.ui
index 3af6768..b039a1c 100644
--- a/data/ui/executedialog.ui
+++ b/data/ui/executedialog.ui
@@ -1,14 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.0 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="lower">1</property>
-    <property name="upper">100</property>
-    <property name="value">1</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkDialog" id="executedialog1">
+  <requires lib="gtk+" version="3.12"/>
+  <template class="ExecuteMethodDialog" parent="GtkDialog">
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Execute D-Bus Method</property>
     <property name="default_width">320</property>
@@ -65,203 +59,148 @@
           </packing>
         </child>
         <child>
-          <object class="GtkVBox" id="vbox3">
+          <object class="GtkBox">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
             <child>
-              <object class="GtkGrid" id="grid1">
+              <object class="GtkBox" id="box_output_stats">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="homogeneous">True</property>
                 <child>
-                  <object class="GtkLabel" id="label_method_name">
+                  <object class="GtkLabel" id="label5">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="halign">start</property>
-                    <property name="margin_start">5</property>
-                    <property name="xalign">0</property>
-                    <property name="use_markup">True</property>
-                    <property name="wrap">True</property>
-                    <property name="selectable">True</property>
-                    <property name="width_chars">40</property>
+                    <property name="label" translatable="yes">Ø:</property>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">0</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label8">
+                  <object class="GtkLabel" id="label_avg">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="halign">start</property>
-                    <property name="label" translatable="yes">Method name:</property>
-                    <attributes>
-                     <attribute name="weight" value="bold"/>
-                    </attributes>
+                    <property name="has_tooltip">True</property>
+                    <property name="tooltip_markup" translatable="yes">Average method execution time in 
seconds</property>
+                    <property name="tooltip_text" translatable="yes">Average method execution time in 
seconds</property>
                   </object>
                   <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label10">
+                  <object class="GtkLabel" id="label7">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="halign">start</property>
-                    <property name="label" translatable="yes">Object Path:</property>
-                    <attributes>
-                     <attribute name="weight" value="bold"/>
-                    </attributes>
+                    <property name="label" translatable="yes">Min:</property>
                   </object>
                   <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label11">
+                  <object class="GtkLabel" id="label_min">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="halign">start</property>
-                    <property name="label" translatable="yes">Interface:</property>
-                    <attributes>
-                     <attribute name="weight" value="bold"/>
-                    </attributes>
+                    <property name="has_tooltip">True</property>
+                    <property name="tooltip_markup" translatable="yes">Minimal method execution time in 
seconds</property>
+                    <property name="tooltip_text" translatable="yes">Minimal method execution time in 
seconds</property>
                   </object>
                   <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">3</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">3</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label_object_path">
+                  <object class="GtkLabel" id="label9">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="halign">start</property>
-                    <property name="margin_start">5</property>
-                    <property name="use_markup">True</property>
-                    <property name="selectable">True</property>
+                    <property name="label" translatable="yes">Max:</property>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">4</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label_interface">
+                  <object class="GtkLabel" id="label_max">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="halign">start</property>
-                    <property name="margin_start">5</property>
-                    <property name="use_markup">True</property>
-                    <property name="selectable">True</property>
+                    <property name="has_tooltip">True</property>
+                    <property name="tooltip_markup" translatable="yes">Maximal method execution time in 
seconds</property>
+                    <property name="tooltip_text" translatable="yes">Maximal method execution time in 
seconds</property>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">3</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">5</property>
                   </packing>
                 </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox" id="box2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <child>
-                  <object class="GtkLabel" id="label12">
+                  <object class="GtkLabel" id="label6">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="halign">start</property>
-                    <property name="label" translatable="yes">Bus Name:</property>
+                    <property name="label" translatable="yes">Method execution</property>
+                    <property name="yalign">0.49000000953674316</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
                     </attributes>
                   </object>
                   <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">1</property>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label_bus_name">
+                  <object class="GtkSpinButton" id="method_exec_count_spinbutton">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="halign">start</property>
-                    <property name="margin_left">5</property>
-                    <property name="margin_start">5</property>
-                    <property name="use_markup">True</property>
-                    <property name="selectable">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="has_tooltip">True</property>
+                    <property name="tooltip_markup" translatable="yes">Number of method executions</property>
+                    <property name="tooltip_text" translatable="yes">Number of method executions</property>
+                    <property name="invisible_char">•</property>
+                    <property name="text" translatable="yes">1</property>
+                    <property name="adjustment">adjustment1</property>
+                    <property name="climb_rate">1</property>
+                    <property name="value">1</property>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">1</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label4">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="halign">start</property>
-                <property name="margin_top">10</property>
-                <property name="label" translatable="yes">Method input</property>
-                <attributes>
-                 <attribute name="weight" value="bold"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
                 <property name="position">1</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkScrolledWindow" id="scrolledwindow1">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="shadow_type">in</property>
-                <child>
-                  <object class="GtkTextView" id="parametertextview1">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label3">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="halign">start</property>
-                <property name="margin_top">10</property>
-                <property name="yalign">0.49000000953674316</property>
-                <property name="label" translatable="yes">Method output</property>
-                <attributes>
-                 <attribute name="weight" value="bold"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
             <child>
               <object class="GtkFrame" id="frame2">
                 <property name="visible">True</property>
@@ -279,7 +218,7 @@
                         <property name="can_focus">True</property>
                         <property name="shadow_type">in</property>
                         <child>
-                          <object class="GtkTextView" id="prettyprinttextview1">
+                          <object class="GtkTextView" id="prettyprint_textview">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="editable">False</property>
@@ -304,7 +243,7 @@
                         <property name="can_focus">True</property>
                         <property name="shadow_type">in</property>
                         <child>
-                          <object class="GtkTextView" id="sourcetextview1">
+                          <object class="GtkTextView" id="source_textview">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="editable">False</property>
@@ -330,6 +269,42 @@
                   </object>
                 </child>
               </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="margin_top">10</property>
+                <property name="label" translatable="yes">Method output</property>
+                <property name="yalign">0.49000000953674316</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkScrolledWindow" id="scrolledwindow1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkTextView" id="parameter_textview">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                </child>
+              </object>
               <packing>
                 <property name="expand">True</property>
                 <property name="fill">True</property>
@@ -337,147 +312,161 @@
               </packing>
             </child>
             <child>
-              <object class="GtkBox" id="box2">
+              <object class="GtkLabel" id="label4">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="margin_top">10</property>
+                <property name="label" translatable="yes">Method input</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">5</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <child>
-                  <object class="GtkLabel" id="label6">
+                  <object class="GtkLabel" id="label_method_name">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="halign">start</property>
-                    <property name="yalign">0.49000000953674316</property>
-                    <property name="label" translatable="yes">Method execution</property>
-                    <attributes>
-                     <attribute name="weight" value="bold"/>
-                    </attributes>
+                    <property name="margin_left">5</property>
+                    <property name="margin_start">5</property>
+                    <property name="use_markup">True</property>
+                    <property name="wrap">True</property>
+                    <property name="selectable">True</property>
+                    <property name="width_chars">40</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkSpinButton" id="method_exec_count_spinbutton">
+                  <object class="GtkLabel" id="label8">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="has_tooltip">True</property>
-                    <property name="tooltip_markup" translatable="yes">Number of method executions</property>
-                    <property name="tooltip_text" translatable="yes">Number of method executions</property>
-                    <property name="invisible_char">•</property>
-                    <property name="invisible_char_set">True</property>
-                    <property name="adjustment">adjustment1</property>
-                    <property name="climb_rate">1</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes">Method name:</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="pack_type">end</property>
-                    <property name="position">1</property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
                   </packing>
                 </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">5</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkBox" id="box_output_stats">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="homogeneous">True</property>
                 <child>
-                  <object class="GtkLabel" id="label5">
+                  <object class="GtkLabel" id="label10">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Ø:</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes">Object Path:</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">2</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label_avg">
+                  <object class="GtkLabel" id="label11">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="has_tooltip">True</property>
-                    <property name="tooltip_markup" translatable="yes">Average method execution time in 
seconds</property>
-                    <property name="tooltip_text" translatable="yes">Average method execution time in 
seconds</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes">Interface:</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">3</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label7">
+                  <object class="GtkLabel" id="label_object_path">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Min:</property>
+                    <property name="halign">start</property>
+                    <property name="margin_left">5</property>
+                    <property name="margin_start">5</property>
+                    <property name="use_markup">True</property>
+                    <property name="selectable">True</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">2</property>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">2</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label_min">
+                  <object class="GtkLabel" id="label_interface">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="has_tooltip">True</property>
-                    <property name="tooltip_markup" translatable="yes">Minimal method execution time in 
seconds</property>
-                    <property name="tooltip_text" translatable="yes">Minimal method execution time in 
seconds</property>
+                    <property name="halign">start</property>
+                    <property name="margin_left">5</property>
+                    <property name="margin_start">5</property>
+                    <property name="use_markup">True</property>
+                    <property name="selectable">True</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">3</property>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">3</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label9">
+                  <object class="GtkLabel" id="label12">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Max:</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes">Bus Name:</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">4</property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label_max">
+                  <object class="GtkLabel" id="label_bus_name">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="has_tooltip">True</property>
-                    <property name="tooltip_markup" translatable="yes">Maximal method execution time in 
seconds</property>
-                    <property name="tooltip_text" translatable="yes">Maximal method execution time in 
seconds</property>
+                    <property name="halign">start</property>
+                    <property name="margin_left">5</property>
+                    <property name="margin_start">5</property>
+                    <property name="use_markup">True</property>
+                    <property name="selectable">True</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">5</property>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
                   </packing>
                 </child>
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="fill">False</property>
+                <property name="fill">True</property>
                 <property name="position">6</property>
               </packing>
             </child>
           </object>
           <packing>
-            <property name="expand">True</property>
+            <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">2</property>
+            <property name="position">1</property>
           </packing>
         </child>
       </object>
@@ -486,5 +475,15 @@
       <action-widget response="0">closebutton1</action-widget>
       <action-widget response="0">executebutton1</action-widget>
     </action-widgets>
+    <child type="titlebar">
+      <placeholder/>
+    </child>
+  </template>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="lower">1</property>
+    <property name="upper">100</property>
+    <property name="value">1</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
   </object>
 </interface>
diff --git a/data/ui/introspection.ui b/data/ui/introspection.ui
index 7a033f7..e551dc7 100644
--- a/data/ui/introspection.ui
+++ b/data/ui/introspection.ui
@@ -1,7 +1,44 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkBox" id="box_introspectview">
+  <requires lib="gtk+" version="3.20"/>
+  <object class="GtkMessageDialog" id="messagedialog">
+    <property name="can_focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
+    <property name="border_width">5</property>
+    <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_area">
+            <property name="can_focus">False</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+  <object class="GtkTreeStore" id="treestore">
+    <columns>
+      <!-- column-name gchararray1 -->
+      <column type="gchararray"/>
+      <!-- column-name GObject1 -->
+      <column type="GObject"/>
+    </columns>
+  </object>
+  <template class="AddressInfo" parent="GtkBox">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="orientation">vertical</property>
@@ -20,14 +57,12 @@
                 <property name="halign">start</property>
                 <property name="label" translatable="yes">Unique name:</property>
                 <attributes>
-                 <attribute name="weight" value="bold"/>
+                  <attribute name="weight" value="bold"/>
                 </attributes>
               </object>
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">2</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -37,14 +72,12 @@
                 <property name="halign">start</property>
                 <property name="label" translatable="yes">Name:</property>
                 <attributes>
-                 <attribute name="weight" value="bold"/>
+                  <attribute name="weight" value="bold"/>
                 </attributes>
               </object>
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">1</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -58,8 +91,6 @@
               <packing>
                 <property name="left_attach">1</property>
                 <property name="top_attach">2</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -73,8 +104,6 @@
               <packing>
                 <property name="left_attach">1</property>
                 <property name="top_attach">1</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -84,14 +113,12 @@
                 <property name="halign">start</property>
                 <property name="label" translatable="yes">Address:</property>
                 <attributes>
-                 <attribute name="weight" value="bold"/>
+                  <attribute name="weight" value="bold"/>
                 </attributes>
               </object>
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -105,8 +132,6 @@
               <packing>
                 <property name="left_attach">1</property>
                 <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
           </object>
@@ -134,20 +159,21 @@
         <child>
           <object class="GtkButton" id="button_reload">
             <property name="visible">True</property>
-            <property name="valign">center</property>
             <property name="can_focus">True</property>
             <property name="receives_default">True</property>
+            <property name="valign">center</property>
             <signal name="clicked" handler="button_reload_clicked_cb" swapped="no"/>
-            <style>
-              <class name="image-button"/>
-            </style>
             <child>
               <object class="GtkImage" id="reload_image">
                 <property name="visible">True</property>
-                <property name="icon_size">1</property>
+                <property name="can_focus">False</property>
                 <property name="icon_name">view-refresh-symbolic</property>
+                <property name="icon_size">1</property>
               </object>
             </child>
+            <style>
+              <class name="image-button"/>
+            </style>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -202,41 +228,5 @@
         <property name="position">1</property>
       </packing>
     </child>
-  </object>
-  <object class="GtkMessageDialog" id="messagedialog">
-    <property name="can_focus">False</property>
-    <property name="hexpand">True</property>
-    <property name="vexpand">True</property>
-    <property name="border_width">5</property>
-    <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_area">
-            <property name="can_focus">False</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-  </object>
-  <object class="GtkTreeStore" id="treestore">
-    <columns>
-      <!-- column-name gchararray1 -->
-      <column type="gchararray"/>
-      <!-- column-name GObject1 -->
-      <column type="GObject"/>
-    </columns>
-  </object>
+  </template>
 </interface>
diff --git a/data/ui/mainwindow.ui b/data/ui/mainwindow.ui
index 86a0f6e..55844c6 100644
--- a/data/ui/mainwindow.ui
+++ b/data/ui/mainwindow.ui
@@ -1,78 +1,63 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.0 -->
 <interface>
-  <!-- interface-requires gtk+ 3.10 -->
-  <menu id="gear_menu">
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">Connect to System Bus</attribute>
-        <attribute name="action">win.connect-system-bus</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">Connect to Session Bus</attribute>
-        <attribute name="action">win.connect-session-bus</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">Connect to other Bus</attribute>
-        <attribute name="action">win.connect-other-bus</attribute>
-      </item>
-    </section>
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">Close Bus</attribute>
-        <attribute name="action">win.close-bus</attribute>
-      </item>
-    </section>
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">About D-Feet</attribute>
-        <attribute name="action">app.about</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">Help</attribute>
-        <attribute name="action">app.help</attribute>
-        <attribute name="accel">F1</attribute>
-      </item>
-    </section>
-  </menu>
-  <object class="GtkHeaderBar" id="headerbar">
-    <property name="visible">True</property>
+  <requires lib="gtk+" version="3.10"/>
+  <template class="DFeetWindow" parent="GtkApplicationWindow">
     <property name="can_focus">False</property>
-    <property name="show-close-button">True</property>
-    <child type="title">
-      <object class="GtkStackSwitcher" id="stack_switcher">
+    <property name="default_width">600</property>
+    <property name="default_height">480</property>
+    <signal name="delete-event" handler="window_deleted" swapped="no"/>
+    <signal name="destroy" handler="window_destroyed" swapped="no"/>
+    <child>
+      <object class="GtkStack" id="buses_stack">
         <property name="visible">True</property>
-        <property name="valign">center</property>
-        <property name="stack">buses_stack</property>
+        <property name="can_focus">False</property>
+        <property name="transition_duration">300</property>
+        <property name="transition_type">slide-left-right</property>
+        <signal name="add" handler="stack_child_added" swapped="no"/>
+        <signal name="remove" handler="stack_child_removed" swapped="no"/>
+        <child>
+          <placeholder/>
+        </child>
       </object>
     </child>
-    <child>
-      <object class="GtkMenuButton" id="gear_menu_button">
+    <child type="titlebar">
+      <object class="GtkHeaderBar" id="headerbar">
         <property name="visible">True</property>
-        <property name="valign">center</property>
         <property name="can_focus">False</property>
-        <property name="sensitive">True</property>
-        <property name="action_name">win.gear-menu</property>
-        <property name="menu_model">gear_menu</property>
-        <style>
-          <class name="image-button"/>
-        </style>
+        <property name="show_close_button">True</property>
+        <child type="title">
+          <object class="GtkStackSwitcher" id="stack_switcher">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="valign">center</property>
+            <property name="stack">buses_stack</property>
+          </object>
+        </child>
         <child>
-          <object class="GtkImage" id="gear_image">
+          <object class="GtkMenuButton" id="gear_menu_button">
             <property name="visible">True</property>
-            <property name="icon_size">1</property>
-            <property name="icon_name">open-menu-symbolic</property>
+            <property name="can_focus">False</property>
+            <property name="receives_default">False</property>
+            <property name="valign">center</property>
+            <property name="action_name">win.gear-menu</property>
+            <child>
+              <object class="GtkImage" id="gear_image">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="icon_name">open-menu-symbolic</property>
+                <property name="icon_size">1</property>
+              </object>
+            </child>
+            <style>
+              <class name="image-button"/>
+            </style>
           </object>
+          <packing>
+            <property name="pack_type">end</property>
+          </packing>
         </child>
       </object>
-      <packing>
-        <property name="pack_type">end</property>
-      </packing>
     </child>
-  </object>
-  <object class="GtkStack" id="buses_stack">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="transition-type">slide-left-right</property>
-    <property name="transition-duration">300</property>
-  </object>
+  </template>
 </interface>
diff --git a/src/d-feet.in b/src/d-feet.in
index 55e3c53..6fa6e55 100755
--- a/src/d-feet.in
+++ b/src/d-feet.in
@@ -42,8 +42,7 @@ locale.textdomain("@GETTEXT_PACKAGE@")
 
 import gi
 gi.require_version('Gtk', '3.0')
-from gi.repository import Gtk, GObject
-from dfeet.application import DFeetApp
+from gi.repository import Gio, Gtk, GObject
 
 
 if __name__ == "__main__":
@@ -53,6 +52,10 @@ if __name__ == "__main__":
         data_dir = os.path.join(os.path.dirname(__file__), "..", "data")
         Gtk.IconTheme.get_default().prepend_search_path(
             os.path.join(os.path.dirname(__file__), "..", "data", "icons"))
+    resource = Gio.resource_load(os.path.join(data_dir, 'org.gnome.dfeet.gresource'))
+    Gio.Resource._register(resource)
+
     #start the application
-    app = DFeetApp(package="@PACKAGE_NAME@", version="@PACKAGE_VERSION@", data_dir=data_dir)
+    from dfeet.application import DFeetApp
+    app = DFeetApp(package="@PACKAGE_NAME@", version="@PACKAGE_VERSION@")
     sys.exit(app.run(sys.argv))
diff --git a/src/dfeet/addconnectiondialog.py b/src/dfeet/addconnectiondialog.py
index 9624904..4699cb3 100644
--- a/src/dfeet/addconnectiondialog.py
+++ b/src/dfeet/addconnectiondialog.py
@@ -1,30 +1,24 @@
 # -*- coding: utf-8 -*-
 from gi.repository import Gtk, Gio
-from dfeet.uiloader import UILoader
 
+@Gtk.Template(resource_path='/org/gnome/dfeet/addconnectiondialog.ui')
+class AddConnectionDialog(Gtk.Dialog):
+    __gtype_name__ = 'AddConnectionDialog'
 
-class AddConnectionDialog:
-
-    def __init__(self, data_dir, parent, address_bus_history=[]):
-        ui = UILoader(data_dir, UILoader.UI_ADDCONNECTIONDIALOG)
-
-        self.dialog = ui.get_root_widget()
-        self.dialog.set_transient_for(parent)
-        # get the hbox and add address combo box with model
-        hbox1 = ui.get_widget('hbox1')
-        self.address_combo_box_store = Gtk.ListStore(str)
-        self.address_combo_box = Gtk.ComboBox.new_with_model_and_entry(
-            self.address_combo_box_store)
-        self.address_combo_box.set_entry_text_column(0)
-        self.label_status = ui.get_widget('label_status')
-
-        hbox1.pack_start(self.address_combo_box, True, True, 0)
-        hbox1.show_all()
+    label_status = Gtk.Template.Child()
+    address_combo_box = Gtk.Template.Child()
+    def __init__(self, parent, address_bus_history=[]):
+        super(AddConnectionDialog, self).__init__()
 
+        self.set_transient_for(parent)
+        address_combo_box_store = Gtk.ListStore(str)
         # add history to model
         for el in address_bus_history:
-            self.address_combo_box_store.append([el])
+            address_combo_box_store.append([el])
 
+        self.address_combo_box.set_entry_text_column(0)
+        self.address_combo_box.set_model(address_combo_box_store)
+        
         self.dialog.add_button('gtk-cancel', Gtk.ResponseType.CANCEL)
         self.dialog.add_button('gtk-connect', Gtk.ResponseType.OK)
 
@@ -39,7 +33,7 @@ class AddConnectionDialog:
             return entry.get_text()
 
     def run(self):
-        response = self.dialog.run()
+        response = self.run()
         if response == Gtk.ResponseType.CANCEL:
             return response
         elif response == Gtk.ResponseType.OK:
@@ -53,4 +47,4 @@ class AddConnectionDialog:
                 return Gtk.ResponseType.OK
 
     def destroy(self):
-        self.dialog.destroy()
+        self.destroy()
diff --git a/src/dfeet/application.py b/src/dfeet/application.py
index 920f67b..ff0a6ed 100644
--- a/src/dfeet/application.py
+++ b/src/dfeet/application.py
@@ -11,16 +11,15 @@ _ = gettext.gettext
 
 class DFeetApp(Gtk.Application):
 
-    def __init__(self, package, version, data_dir):
+    def __init__(self, package, version):
         self.package = package
         self.version = version
-        self.data_dir = data_dir
         Gtk.Application.__init__(self, application_id="org.gnome.dfeet",
                                  flags=Gio.ApplicationFlags.FLAGS_NONE)
 
     # Note that the function in C activate() becomes do_activate() in Python
     def do_activate(self):
-        self._main_win = DFeetWindow(self, self.version, self.data_dir)
+        self._main_win = DFeetWindow(self, self.version)
 
     # Note that the function in C startup() becomes do_startup() in Python
     def do_startup(self):
diff --git a/src/dfeet/bus_watch.py b/src/dfeet/bus_watch.py
index a6472ed..358af2d 100644
--- a/src/dfeet/bus_watch.py
+++ b/src/dfeet/bus_watch.py
@@ -3,15 +3,15 @@ from __future__ import print_function
 
 from gi.repository import GObject, Gtk, Gio
 
-from dfeet.uiloader import UILoader
 from dfeet.introspection import AddressInfo
 from dfeet.wnck_utils import IconTable
 
 
-class BusNameBox(Gtk.VBox):
+class BusNameBox(Gtk.Box):
     """class to represent a BusName (eg 'org.freedesktop.NetworkManager')"""
     def __init__(self, bus_name, unique_name):
-        super(BusNameBox, self).__init__(spacing=5, expand=True)
+        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=5, expand=True)
+
         self.__bus_name = bus_name
         self.__unique_name = unique_name
         self.__process_id = 0
@@ -20,12 +20,14 @@ class BusNameBox(Gtk.VBox):
         self.__icon_table = IconTable.get_instance()
         self.__icon_image = Gtk.Image.new_from_pixbuf(self.__icon_table.default_icon)
 
-        self.__hbox = Gtk.HBox(spacing=5, halign=Gtk.Align.START)
+        self.__hbox = Gtk.Box(orientation=Gtk.Box.Orientation.HORIZONTAL, 
+                              spacing=5, halign=Gtk.Align.START)
         self.pack_start(self.__hbox, True, True, 0)
         # icon
         self.__hbox.pack_start(self.__icon_image, True, True, 0)
         # other information
-        self.__vbox_right = Gtk.VBox(spacing=5, expand=True)
+        self.__vbox_right = Gtk.Box(orientation=Gtk.Box.Orientation.VERTICAL, 
+                                    spacing=5, expand=True)
         self.__hbox.pack_start(self.__vbox_right, True, True, 0)
 
         # first element
@@ -111,23 +113,23 @@ class BusNameBox(Gtk.VBox):
         # update the shown widget
         self.__update_widget()
 
+@Gtk.Template(resource_path='/org/gnome/dfeet/bus.ui')
+class BusWatch(Gtk.Box):
+
+    __gtype_name__ = 'BusWatch'
+    
+    bus_listbox = Gtk.Template.Child()
+    bus_search_entry = Gtk.Template.Child()
 
-class BusWatch(object):
     """watch for a given bus"""
-    def __init__(self, data_dir, bus_address):
-        self.__data_dir = data_dir
+    def __init__(self, bus_address):
         self.__bus_address = bus_address
-        # setup UI
-        ui = UILoader(self.__data_dir, UILoader.UI_BUS)
-        self.__box_bus = ui.get_root_widget()
-        self.__scrolledwindow_listbox = ui.get_widget("scrolledwindow_listbox")
-        self.__bus_name_filter = ui.get_widget('entry_filter')
+
         # create a listbox for all the busnames
-        self.__listbox = Gtk.ListBox(hexpand=True, vexpand=True, expand=True)
-        self.__listbox.set_sort_func(self.__listbox_sort_by_name, None)
-        self.__listbox.set_filter_func(self.__listbox_filter_by_name, None)
-        self.__scrolledwindow_listbox.add(self.__listbox)
-        self.__scrolledwindow_listbox.show_all()
+        listbox = Gtk.Template.Child('scrolledwindow_listbox').get_children()
+        self.bus_listbox.set_sort_func(self.__listbox_sort_by_name, None)
+        self.bus_listbox.set_filter_func(self.__listbox_filter_by_name, None)
+
         # setup the bus connection
         if self.__bus_address == Gio.BusType.SYSTEM or self.__bus_address == Gio.BusType.SESSION:
             # TODO: do this async
@@ -146,14 +148,6 @@ class BusWatch(object):
         self.connection.signal_subscribe(None, "org.freedesktop.DBus", "NameOwnerChanged",
                                          None, None, 0, self.__name_owner_changed_cb, None)
 
-        # refilter if someone wants to filter the busbox list
-        self.__bus_name_filter.connect("changed",
-                                       self.__bus_name_filter_changed_cb)
-
-        # change bus detail tree if a different bus is selected
-        self.__listbox.connect("row-selected",
-                               self.__listbox_row_selected_cb)
-
         # TODO: do this async
         self.bus_proxy = Gio.DBusProxy.new_sync(self.connection,
                                                 Gio.DBusProxyFlags.NONE,
@@ -175,18 +169,20 @@ class BusWatch(object):
     @property
     def box_bus(self):
         """the main widget for the bus"""
-        return self.__box_bus
+        return self
 
+    @Gtk.Template.Callback('bus_name_filter_changed')
     def __bus_name_filter_changed_cb(self, bus_name_filter):
         """someone typed something in the searchbox - refilter"""
-        self.__listbox.invalidate_filter()
+        self.bus_listbox.invalidate_filter()
 
+    @Gtk.Template.Callback('listbox_row_selected')
     def __listbox_row_selected_cb(self, listbox, listbox_row):
         """someone selected a different row of the listbox"""
-        childs = self.box_bus.get_children()
+        childs = self.get_children()
         # never remove first element - that's the listbox with the busnames
         if len(childs) > 1:
-            self.box_bus.remove(childs[-1])
+            self.remove(childs[-1])
 
         try:
             del(self.__addr_info)
@@ -198,13 +194,12 @@ class BusWatch(object):
             row_childs = listbox_row.get_children()
             bus_name_box = row_childs[0]
             # add the introspection info to the left side
-            self.__addr_info = AddressInfo(self.__data_dir,
-                                           self.__bus_address,
+            self.__addr_info = AddressInfo(self.__bus_address,
                                            bus_name_box.bus_name,
                                            bus_name_box.unique_name,
                                            connection_is_bus=True)
-            self.box_bus.pack_end(self.__addr_info.introspect_box, True, True, 0)
-        self.box_bus.show_all()
+            self.pack_end(self.__addr_info.introspect_box, True, True, 0)
+        self.show_all()
 
     def __name_owner_changed_cb(self, connection, sender_name,
                                 object_path, interface_name, signal_name,
@@ -229,7 +224,7 @@ class BusWatch(object):
 
     def __listbox_find_bus_name(self, bus_name):
         """find the given busname in the listbox or return None if not found"""
-        for listbox_child in self.__listbox.get_children():
+        for listbox_child in self.bus_listbox.get_children():
             if listbox_child.get_children()[0].bus_name == bus_name:
                 return listbox_child
         # busname not found
@@ -239,7 +234,7 @@ class BusWatch(object):
         """remove the given busname from the listbox"""
         obj = self.__listbox_find_bus_name(bus_name)
         if obj:
-            self.__listbox.remove(obj)
+            self.bus_listbox.remove(obj)
             # if bus is activatable, add the bus name again
             if bus_name in self.__activatable_names:
                 bnb = BusNameBox(bus_name, '')
@@ -257,7 +252,7 @@ class BusWatch(object):
             bus_name_box = bn.get_children()[0]
         else:
             # add busnamebox to the list
-            self.__listbox.add(bus_name_box)
+            self.bus_listbox.add(bus_name_box)
 
         # update bus info stuff
         self.bus_proxy.GetConnectionUnixProcessID(
@@ -319,7 +314,7 @@ class BusWatch(object):
 
     def __listbox_filter_by_name(self, row, user_data):
         bus_name_box_list = row.get_children()
-        return self.__bus_name_filter.get_text().lower() in bus_name_box_list[0].bus_name.lower()
+        return self.bus_search_entry.get_text().lower() in bus_name_box_list[0].bus_name.lower()
 
     def __listbox_sort_by_name(self, row1, row2, user_data):
         """sort function for listbox"""
@@ -372,7 +367,7 @@ if __name__ == "__main__":
     win = Gtk.Window()
     win.connect("delete-event", Gtk.main_quit)
     win.set_default_size(1024, 768)
-    win.add(bw.box_bus)
+    win.add(bw)
     win.show_all()
     try:
         Gtk.main()
diff --git a/src/dfeet/executemethoddialog.py b/src/dfeet/executemethoddialog.py
index ffdb3aa..6b4d9d1 100644
--- a/src/dfeet/executemethoddialog.py
+++ b/src/dfeet/executemethoddialog.py
@@ -3,43 +3,45 @@ import time
 from pprint import pformat
 from gi.repository import GLib, Gio, Gtk
 
-from dfeet.uiloader import UILoader
 
+@Gtk.Template(resource_path='/org/gnome/dfeet/executedialog.ui')
+class ExecuteMethodDialog(Gtk.Dialog):
 
-class ExecuteMethodDialog:
-    def __init__(self, data_dir, connection, connection_is_bus, bus_name,
+    __gtype_name__ = 'ExecuteMethodDialog'
+
+    label_method_name = Gtk.Template.Child()
+    label_bus_name = Gtk.Template.Child()
+    label_interface = Gtk.Template.Child()
+    label_object_path = Gtk.Template.Child()
+
+    source_textview = Gtk.Template.Child()
+    parameter_textview = Gtk.Template.Child()
+    prettyprint_textview = Gtk.Template.Child()
+
+    method_exec_count_spinbutton = Gtk.Template.Child()
+
+    label_avg = Gtk.Template.Child()
+    label_min = Gtk.Template.Child()
+    label_max = Gtk.Template.Child()
+
+
+    def __init__(self, connection, connection_is_bus, bus_name,
                  method_obj, parent_window):
-        signal_dict = {
-            'execute_dbus_method_cb': self.execute_cb,
-            'execute_dialog_close_cb': self.close_cb
-            }
+        super(ExecuteMethodDialog, self).__init__()
+
+        self.set_transient_for(parent_window)
 
         self.connection = connection
         self.connection_is_bus = connection_is_bus
         self.bus_name = bus_name
         self.method_obj = method_obj
 
-        ui = UILoader(data_dir, UILoader.UI_EXECUTEDIALOG)
-        self.dialog = ui.get_root_widget()
-        self.dialog.set_transient_for(parent_window)
-        self.label_method_name = ui.get_widget('label_method_name')
-        self.label_bus_name = ui.get_widget('label_bus_name')
-        self.label_object_path = ui.get_widget('label_object_path')
-        self.label_interface = ui.get_widget('label_interface')
-        self.notebook = ui.get_widget('notebook1')
-        self.parameter_textview = ui.get_widget('parametertextview1')
-        self.source_textview = ui.get_widget('sourcetextview1')
-        self.prettyprint_textview = ui.get_widget('prettyprinttextview1')
-        self.method_execution_count_spinbutton = ui.get_widget('method_exec_count_spinbutton')
-        self.label_avg = ui.get_widget('label_avg')
-        self.label_min = ui.get_widget('label_min')
-        self.label_max = ui.get_widget('label_max')
-        ui.connect_signals(signal_dict)
         self.label_method_name.set_markup("%s" % (self.method_obj.markup_str))
         self.label_bus_name.set_text(self.bus_name)
         self.label_object_path.set_markup("%s" % (self.method_obj.object_path))
         self.label_interface.set_markup("%s" % (self.method_obj.iface_info.name))
 
+    @Gtk.Template.Callback('execute_dbus_method_cb')
     def execute_cb(self, widget):
         # get given parameters
         buf = self.parameter_textview.get_buffer()
@@ -73,7 +75,8 @@ class ExecuteMethodDialog:
                                                self.method_obj.iface_info.name,
                                                None)
                 # call the function
-                for i in range(0, self.method_execution_count_spinbutton.get_value_as_int()):
+                method_exec_count = self.method_exec_count_spinbutton.get_value_as_int()
+                for i in range(0, method_exec_count):
                     user_data['method_call_time_start'] = time.time()
                     proxy.call(
                         self.method_obj.method_info.name, params_gvariant,
@@ -123,9 +126,10 @@ class ExecuteMethodDialog:
             self.prettyprint_textview.get_buffer().set_text(pformat(str(e)))
 
     def run(self):
-        response = self.dialog.run()
+        response = self.run()
         if response == Gtk.ResponseType.DELETE_EVENT or response == Gtk.ResponseType.CLOSE:
-            self.dialog.destroy()
+            self.destroy()
 
+    @Gtk.Template.Callback('execute_dialog_close_cb')
     def close_cb(self, widget):
-        self.dialog.destroy()
+        self.destroy()
diff --git a/src/dfeet/introspection.py b/src/dfeet/introspection.py
index fd41b92..96da597 100644
--- a/src/dfeet/introspection.py
+++ b/src/dfeet/introspection.py
@@ -4,7 +4,6 @@ from __future__ import print_function
 from gi.repository import Gtk, Gio, GLib
 from dfeet.executemethoddialog import ExecuteMethodDialog
 
-from dfeet.uiloader import UILoader
 
 from dfeet.introspection_helper import DBusNode
 from dfeet.introspection_helper import DBusInterface
@@ -13,53 +12,43 @@ from dfeet.introspection_helper import DBusSignal
 from dfeet.introspection_helper import DBusMethod
 from dfeet.introspection_helper import DBusAnnotation
 
-
-class AddressInfo():
+@Gtk.Template(resource_path='/org/gnome/dfeet/introspection.ui')
+class AddressInfo(Gtk.Box):
     """
     class to handle information about a name (eg "org.freedesktop.NetworkManager")
     on a given address (eg Gio.BusType.SYSTEM or unix:path=/var/run/dbus/system_bus_socket)
     """
+    __gtype_name__ = 'AddressInfo'
+
+    treemodel = Gtk.Template.Child('treestore')
+    spinner = Gtk.Template.Child()
+
+    label_name = Gtk.Template.Child()
+    label_unique_name = Gtk.Template.Child()
+    label_address = Gtk.Template.Child()
+
     def __del__(self):
         try:
             self.connection.close()
         except GLib.GError:
             pass
 
-    def __init__(self, data_dir, address, name, unique_name, connection_is_bus=True):
-        self.data_dir = data_dir
-        signal_dict = {
-            'treeview_row_activated_cb': self.__treeview_row_activated_cb,
-            'treeview_row_expanded_cb': self.__treeview_row_expanded_cb,
-            'button_reload_clicked_cb': self.__button_reload_clicked_cb,
-            }
+    def __init__(self, address, name, unique_name, connection_is_bus=True):
+        super(AddressInfo, self).__init__()
 
         self.address = address  # can be Gio.BusType.SYSTEM or Gio.BusType.SYSTEM or other address
         self.name = name  # the well-known name or None
         self.unique_name = unique_name  # the unique name or None
         self.connection_is_bus = connection_is_bus  # is it a bus or a p2p connection?
 
-        # setup UI
-        ui = UILoader(self.data_dir, UILoader.UI_INTROSPECTION)
-        self.introspect_box = ui.get_root_widget()  # this is the main box with the treeview
-        self.__spinner = ui.get_widget('spinner')  # progress during the introspection
-        self.__scrolledwindow = \
-            ui.get_widget('scrolledwindow')  # the scrolledwindow contains the treeview
-        self.__treemodel = ui.get_widget('treestore')
-        self.__treemodel.set_sort_func(0, self.__sort_model)
-        self.__treemodel.set_sort_column_id(0, Gtk.SortType.ASCENDING)
-        self.__treeview = ui.get_widget('treeview')
-        self.__label_name = ui.get_widget('label_name')
-        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)
+        self.treemodel.set_sort_func(0, self.__sort_model)
+        self.treemodel.set_sort_column_id(0, Gtk.SortType.ASCENDING)
+
         if self.connection_is_bus:
             # we expect a bus connection
             if self.address == Gio.BusType.SYSTEM or self.address == Gio.BusType.SESSION:
                 self.connection = Gio.bus_get_sync(self.address, None)
-                self.__label_address.set_text(
+                self.label_address.set_text(
                     Gio.dbus_address_get_for_bus_sync(self.address, None))
             elif Gio.dbus_is_address(self.address):
                 self.connection = Gio.DBusConnection.new_for_address_sync(
@@ -67,7 +56,7 @@ class AddressInfo():
                     Gio.DBusConnectionFlags.AUTHENTICATION_CLIENT |
                     Gio.DBusConnectionFlags.MESSAGE_BUS_CONNECTION,
                     None, None)
-                self.__label_address.set_text(self.address)
+                self.label_address.set_text(self.address)
             else:
                 self.connection = None
                 raise Exception("Invalid bus address '%s'" % (self.address))
@@ -78,7 +67,7 @@ class AddressInfo():
                     self.address,
                     Gio.DBusConnectionFlags.AUTHENTICATION_CLIENT,
                     None, None)
-                self.__label_address.set_text(self.address)
+                self.label_address.set_text(self.address)
             else:
                 self.connection = None
                 raise Exception("Invalid p2p address '%s'" % (self.address))
@@ -89,6 +78,7 @@ class AddressInfo():
     def __messagedialog_close_cb(self, dialog):
         self.__messagedialog.destroy()
 
+    @Gtk.Template.Callback('treeview_row_activated_cb')
     def __treeview_row_activated_cb(self, treeview, path, view_column):
         model = treeview.get_model()
         iter_ = model.get_iter(path)
@@ -97,10 +87,9 @@ class AddressInfo():
 
         if isinstance(obj, DBusMethod):
             # execute the selected method
-            parent_window = self.introspect_box.get_toplevel()
-            dialog = ExecuteMethodDialog(
-                self.data_dir, self.connection, self.connection_is_bus, self.name, obj,
-                parent_window)
+            parent_window = self.get_toplevel()
+            dialog = ExecuteMethodDialog(self.connection, self.connection_is_bus, self.name, 
+                                        obj, parent_window)
             dialog.run()
         elif isinstance(obj, DBusProperty):
             # update the selected property (TODO: do this async)
@@ -122,6 +111,7 @@ class AddressInfo():
             else:
                 treeview.expand_row(path, False)
 
+    @Gtk.Template.Callback('treeview_row_expanded_cb')
     def __treeview_row_expanded_cb(self, treeview, iter_, path):
         model = treeview.get_model()
         node = model.get(iter_, 1)[0]
@@ -165,6 +155,7 @@ class AddressInfo():
         # start introspection
         self.__dbus_node_introspect("/")
 
+    @Gtk.Template.Callback('button_reload_clicked_cb')
     def __button_reload_clicked_cb(self, widget):
         """reload the introspection data"""
         self.introspect_start()
@@ -175,10 +166,11 @@ class AddressInfo():
             res = connection.call_finish(result_async)
         except Exception as e:
             # got an exception (eg dbus timeout). show the exception
-            self.__messagedialog.set_title("DBus Exception")
-            self.__messagedialog.set_property("text", "%s : %s" % (self.name, str(e)))
-            self.__messagedialog.run()
-            self.__messagedialog.destroy()
+                dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.INFO,
+                                                Gtk.ButtonsType.OK, "DBus Exception")
+                dialog.format_secondary_text("%s : %s" % (self.name, str(e)))
+                dialog.run()
+                dialog.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])
@@ -244,19 +236,19 @@ class AddressInfo():
                     self.__dbus_node_introspect(object_path_new)
             else:
                 # no nodes left. we finished the introspection
-                self.__spinner.stop()
-                self.__spinner.set_visible(False)
+                self.spinner.stop()
+                self.spinner.set_visible(False)
                 # update name, unique name, ...
-                self.__label_name.set_text(self.name)
-                self.__label_unique_name.set_text(self.unique_name)
+                self.label_name.set_text(self.name)
+                self.label_unique_name.set_text(self.unique_name)
 
-                self.introspect_box.show_all()
+                self.show_all()
 
     def __dbus_node_introspect(self, object_path):
         """Introspect the given object path. This function will be called recursive"""
         # start spinner
-        self.__spinner.start()
-        self.__spinner.set_visible(True)
+        self.spinner.start()
+        self.spinner.set_visible(True)
         # start async dbus call
         self.connection.call(
             self.name, object_path, 'org.freedesktop.DBus.Introspectable', 'Introspect',
diff --git a/src/dfeet/meson.build b/src/dfeet/meson.build
index f1460d5..0f3794c 100644
--- a/src/dfeet/meson.build
+++ b/src/dfeet/meson.build
@@ -8,7 +8,6 @@ df_data = files(
   'introspection_helper.py',
   'introspection.py',
   'settings.py',
-  'uiloader.py',
   'wnck_utils.py',
   'window.py',
 )
diff --git a/src/dfeet/window.py b/src/dfeet/window.py
index bfc08cc..6c0249a 100644
--- a/src/dfeet/window.py
+++ b/src/dfeet/window.py
@@ -25,24 +25,24 @@ gettext.textdomain('d-feet')
 
 from dfeet.bus_watch import BusWatch
 from dfeet.settings import Settings
-from dfeet.uiloader import UILoader
 from dfeet.addconnectiondialog import AddConnectionDialog
 
-
+@Gtk.Template(resource_path='/org/gnome/dfeet/mainwindow.ui')
 class DFeetWindow(Gtk.ApplicationWindow):
     """the main window"""
+    __gtype_name__ = 'DFeetWindow'
+    
+    buses_stack = Gtk.Template.Child()
 
     HISTORY_MAX_SIZE = 10
 
-    def __init__(self, app, version, data_dir):
-        Gtk.Window.__init__(self, application=app)
+    def __init__(self, app, version):
+        Gtk.ApplicationWindow.__init__(self, application=app)
         self.version = version
-        self.data_dir = data_dir
         self.session_bus = None
         self.system_bus = None
 
         # setup the window
-        self.set_default_size(600, 480)
         self.set_icon_name(app.props.application_id)
 
         # create actions
@@ -60,20 +60,9 @@ class DFeetWindow(Gtk.ApplicationWindow):
 
         # get settings
         settings = Settings.get_instance()
-        self.connect('delete-event', self.__delete_cb)
         self.set_default_size(int(settings.general['windowwidth']),
                               int(settings.general['windowheight']))
 
-        # setup ui
-        ui = UILoader(self.data_dir, UILoader.UI_MAINWINDOW)
-        header = ui.get_widget('headerbar')
-        self.set_titlebar(header)
-        self.stack = ui.get_widget('buses_stack')
-        self.add(self.stack)
-        self.__stack_child_added_id = self.stack.connect('add', self.__stack_child_added_cb)
-        self.__stack_child_removed_id = self.stack.connect('remove', self.__stack_child_removed_cb)
-        self.connect('destroy', self.__on_destroy)
-
         # create bus history list and load entries from settings
         self.__bus_history = []
         for bus in settings.general['addbus_list']:
@@ -93,7 +82,8 @@ class DFeetWindow(Gtk.ApplicationWindow):
     @bus_history.setter
     def bus_history(self, history_new):
         self.__bus_history = history_new
-
+    
+    @Gtk.Template.Callback('stack_child_added')
     def __stack_child_added_cb(self, stack, child):
         existing = self.lookup_action('close-bus')
         if existing is None:
@@ -101,8 +91,9 @@ class DFeetWindow(Gtk.ApplicationWindow):
             action.connect('activate', self.__action_close_bus_cb)
             self.add_action(action)
 
+    @Gtk.Template.Callback('stack_child_removed')
     def __stack_child_removed_cb(self, stack, child):
-        current = self.stack.get_visible_child()
+        current = self.buses_stack.get_visible_child()
         if current is None:
             self.remove_action('close-bus')
 
@@ -119,18 +110,18 @@ class DFeetWindow(Gtk.ApplicationWindow):
             action.connect('activate', self.__action_connect_session_bus_cb)
             self.add_action(action)
 
+    @Gtk.Template.Callback('window_destroyed')
     def __on_destroy(self, data=None):
-        self.stack.disconnect(self.__stack_child_added_id)
-        self.stack.disconnect(self.__stack_child_removed_id)
+        self.buses_stack.disconnect(None)
 
     def __action_connect_system_bus_cb(self, action, parameter):
         """connect to system bus"""
         try:
             if self.system_bus is not None:
                 return
-            bw = BusWatch(self.data_dir, Gio.BusType.SYSTEM)
+            bw = BusWatch(Gio.BusType.SYSTEM)
             self.system_bus = bw.box_bus
-            self.stack.add_titled(self.system_bus, 'System Bus', 'System Bus')
+            self.buses_stack.add_titled(self.system_bus, 'System Bus', 'System Bus')
             self.remove_action('connect-system-bus')
         except Exception as e:
             print(e)
@@ -140,16 +131,16 @@ class DFeetWindow(Gtk.ApplicationWindow):
         try:
             if self.session_bus is not None:
                 return
-            bw = BusWatch(self.data_dir, Gio.BusType.SESSION)
+            bw = BusWatch(Gio.BusType.SESSION)
             self.session_bus = bw.box_bus
-            self.stack.add_titled(self.session_bus, 'Session Bus', 'Session Bus')
+            self.buses_stack.add_titled(self.session_bus, 'Session Bus', 'Session Bus')
             self.remove_action('connect-session-bus')
         except Exception as e:
             print(e)
 
     def __action_connect_other_bus_cb(self, action, parameter):
         """connect to other bus"""
-        dialog = AddConnectionDialog(self.data_dir, self, self.bus_history)
+        dialog = AddConnectionDialog(self, self.bus_history)
         result = dialog.run()
         if result == Gtk.ResponseType.OK:
             address = dialog.address
@@ -161,8 +152,8 @@ class DFeetWindow(Gtk.ApplicationWindow):
                 return
             else:
                 try:
-                    bw = BusWatch(self.data_dir, address)
-                    self.stack.add_titled(bw.box_bus, address, address)
+                    bw = BusWatch(address)
+                    self.buses_stack.add_titled(bw.box_bus, address, address)
                     # Fill history
                     if address in self.bus_history:
                         self.bus_history.remove(address)
@@ -177,11 +168,12 @@ class DFeetWindow(Gtk.ApplicationWindow):
     def __action_close_bus_cb(self, action, parameter):
         """close current bus"""
         try:
-            current = self.stack.get_visible_child()
-            self.stack.remove(current)
+            current = self.buses_stack.get_visible_child()
+            self.buses_stack.remove(current)
         except Exception as e:
             print(e)
 
+    @Gtk.Template.Callback('window_deleted')
     def __delete_cb(self, main_window, event):
         """store some settings"""
         settings = Settings.get_instance()
diff --git a/src/tests/tests.py.in b/src/tests/tests.py.in
index de40cf3..87bb061 100755
--- a/src/tests/tests.py.in
+++ b/src/tests/tests.py.in
@@ -37,9 +37,6 @@ XML = """
 </node>
 """
 
-DATA_DIR = os.path.abspath("@DATA_DIR@")
-
-
 class IntrospectionHelperTest(unittest.TestCase):
     """tests for the introspection helper classes"""
     def setUp(self):
@@ -98,7 +95,7 @@ class AddressInfoTest(unittest.TestCase):
 
     def test_bus(self):
         """introspect a name on the system bus"""
-        ai = AddressInfo(DATA_DIR, self.bus.get_bus_address(), None, "org.freedesktop.DBus")
+        ai = AddressInfo(self.bus.get_bus_address(), None, "org.freedesktop.DBus")
 
     @unittest.skip("TODO:peer to peer test not implemented")
     def test_peer_to_peer(self):


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