diff --git a/deluge/ui/gtkui/common.py b/deluge/ui/gtkui/common.py index ee0aa372c..1bd5a903e 100644 --- a/deluge/ui/gtkui/common.py +++ b/deluge/ui/gtkui/common.py @@ -151,26 +151,27 @@ def show_other_dialog(header, type_str, image_stockid=None, image_filename=None, if type(default) != int and type(default) != float: raise TypeError("default value needs to be an int or float") - glade = gtk.glade.XML(deluge.common.resource_filename( - "deluge.ui.gtkui", os.path.join("glade", "dgtkpopups.glade")) - ) - dialog = glade.get_widget("other_dialog") + builder = gtk.Builder() + builder.add_from_file(deluge.common.resource_filename( + "deluge.ui.gtkui", os.path.join("glade", "other_dialog.ui") + )) + dialog = builder.get_object("other_dialog") dialog.set_transient_for(component.get("MainWindow").window) dialog.set_position(gtk.WIN_POS_CENTER_ON_PARENT) dialog.set_title("") - glade.get_widget("label_header").set_markup("" + header + "") - glade.get_widget("label_type").set_text(type_str) + builder.get_object("label_header").set_markup("" + header + "") + builder.get_object("label_type").set_text(type_str) if image_stockid: - glade.get_widget("image").set_from_stock(image_stockid, gtk.ICON_SIZE_LARGE_TOOLBAR) + builder.get_object("image").set_from_stock(image_stockid, gtk.ICON_SIZE_LARGE_TOOLBAR) if image_filename: # Hack for Windows since it doesn't support svg if os.path.splitext(image_filename)[1] == ".svg" and (deluge.common.windows_check() or deluge.common.osx_check()): image_filename = os.path.splitext(image_filename)[0] + "16.png" pixbuf = gtk.gdk.pixbuf_new_from_file_at_size( deluge.common.get_pixmap(image_filename), 32, 32) - glade.get_widget("image").set_from_pixbuf(pixbuf) + builder.get_object("image").set_from_pixbuf(pixbuf) - spinbutton = glade.get_widget("spinbutton") + spinbutton = builder.get_object("spinbutton") if type(default) == float: spinbutton.set_digits(1) diff --git a/deluge/ui/gtkui/glade/dgtkpopups.glade b/deluge/ui/gtkui/glade/dgtkpopups.glade deleted file mode 100644 index 68f2c4b0a..000000000 --- a/deluge/ui/gtkui/glade/dgtkpopups.glade +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - True - GTK_WIN_POS_MOUSE - True - GDK_WINDOW_TYPE_HINT_DIALOG - True - True - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - 10 - - - True - - - False - False - - - - - True - 0 - label - True - - - False - False - 1 - - - - - False - False - 1 - - - - - - - False - 2 - - - - - True - 5 - - - True - - - - - - - - True - 1 - - - True - True - 6 - True - 6 - 1 - -1 -1 99999 1 10 0 - - - - - False - 1 - - - - - True - 0 - label - - - 2 - - - - - False - False - 4 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_BUTTONBOX_END - - - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-cancel - True - -6 - - - - - True - True - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-ok - True - -5 - - - 1 - - - - - False - GTK_PACK_END - - - - - - - 5 - Add Peer - GTK_WIN_POS_MOUSE - GDK_WINDOW_TYPE_HINT_DIALOG - True - True - False - False - - - True - 2 - - - True - 2 - - - True - 5 - - - True - gtk-add - - - False - False - - - - - True - 0 - <b>Add Peer</b> - True - - - 1 - - - - - - - True - - - False - 1 - - - - - True - True - True - 39 - hostname:port - - - 2 - - - - - False - 1 - - - - - True - GTK_BUTTONBOX_END - - - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-cancel - True - 0 - - - - - True - True - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-ok - True - 1 - - - 1 - - - - - False - GTK_PACK_END - - - - - - diff --git a/deluge/ui/gtkui/glade/other_dialog.ui b/deluge/ui/gtkui/glade/other_dialog.ui new file mode 100644 index 000000000..b36de7135 --- /dev/null +++ b/deluge/ui/gtkui/glade/other_dialog.ui @@ -0,0 +1,197 @@ + + + + + + -1 + 99999 + -1 + 1 + 10 + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + True + mouse + True + dialog + True + True + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + end + + + gtk-cancel + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + True + + + False + False + 0 + + + + + gtk-ok + True + True + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + True + + + False + False + 1 + + + + + False + True + end + 0 + + + + + True + False + 10 + + + True + False + + + False + False + 0 + + + + + True + False + 0 + label + True + + + False + False + 1 + + + + + False + False + 1 + + + + + False + + + False + True + 2 + + + + + True + False + 5 + + + True + False + + + + + + True + True + 0 + + + + + True + False + 1 + + + True + True + 6 + True + 6 + 1 + False + False + True + True + adjustment1 + + + + + False + True + 1 + + + + + True + False + 0 + label + + + True + True + 2 + + + + + False + False + 4 + + + + + + button3 + button4 + + + diff --git a/deluge/ui/gtkui/peers_tab.py b/deluge/ui/gtkui/peers_tab.py index 99a85e405..2a4235a56 100644 --- a/deluge/ui/gtkui/peers_tab.py +++ b/deluge/ui/gtkui/peers_tab.py @@ -380,11 +380,12 @@ class PeersTab(Tab): def _on_menuitem_add_peer_activate(self, menuitem): """This is a callback for manually adding a peer""" log.debug("on_menuitem_add_peer") - dialog_glade = gtk.glade.XML(deluge.common.resource_filename( - "deluge.ui.gtkui", os.path.join("glade", "dgtkpopups.glade")) - ) - peer_dialog = dialog_glade.get_widget("connect_peer_dialog") - txt_ip = dialog_glade.get_widget("txt_ip") + builder = gtk.Builder() + builder.add_from_file(deluge.common.resource_filename( + "deluge.ui.gtkui", os.path.join("glade", "connect_peer_dialog.ui") + )) + peer_dialog = builder.get_object("connect_peer_dialog") + txt_ip = builder.get_object("txt_ip") response = peer_dialog.run() if response: value = txt_ip.get_text()