summaryrefslogtreecommitdiff
path: root/src/dfeet/addconnectiondialog.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/dfeet/addconnectiondialog.py')
-rw-r--r--src/dfeet/addconnectiondialog.py36
1 files changed, 15 insertions, 21 deletions
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()