From 807bc095b4b5da08adb7fd57ecdda7a07aac702c Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Wed, 6 Jul 2011 21:10:24 +0100 Subject: [PATCH] Moved remove torrent dialog to GtkBuilder. --- ..._dialog.glade => remove_torrent_dialog.ui} | 151 ++++++++++++------ deluge/ui/gtkui/removetorrentdialog.py | 14 +- 2 files changed, 106 insertions(+), 59 deletions(-) rename deluge/ui/gtkui/glade/{remove_torrent_dialog.glade => remove_torrent_dialog.ui} (58%) diff --git a/deluge/ui/gtkui/glade/remove_torrent_dialog.glade b/deluge/ui/gtkui/glade/remove_torrent_dialog.ui similarity index 58% rename from deluge/ui/gtkui/glade/remove_torrent_dialog.glade rename to deluge/ui/gtkui/glade/remove_torrent_dialog.ui index 25ef2c446..3a2f973d1 100644 --- a/deluge/ui/gtkui/glade/remove_torrent_dialog.glade +++ b/deluge/ui/gtkui/glade/remove_torrent_dialog.ui @@ -1,73 +1,84 @@ - - - - - + + + + + + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 False True - GTK_WIN_POS_CENTER_ON_PARENT + center-on-parent True - GDK_WINDOW_TYPE_HINT_DIALOG - False + dialog - + True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 2 - + True + False 10 - + True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 gtk-dialog-warning - 6 - + 6 + False False + 0 - + True + False 5 - + True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 <big><b>Remove the selected torrent?</b></big> True True - + False + True + 0 - + True + False 0 If you remove the data, it will be lost permanently. - + False False 1 - + + True + True 1 - + False False @@ -76,105 +87,141 @@ - + True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_BUTTONBOX_CENTER + center - + + gtk-cancel True True True - gtk-cancel + False True - -6 - - + + + + False + False + 0 + - + True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 2 - + False + - + True + False 2 - + True + False 1 gtk-delete - + + + True + True + 0 + - + True + False 0 Remove With _Data True True - + + True + True 1 - + - + + False + False 1 - + True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - + False + - + True + False 2 - + True + False 1 gtk-remove - + + + True + True + 0 + - + True + False 0 Remove _Torrent True True - + + True + True 1 - + - + + False + False 2 - + False - GTK_PACK_END + True + end 1 - + - - + + button_cancel + button_data + button_ok + + + diff --git a/deluge/ui/gtkui/removetorrentdialog.py b/deluge/ui/gtkui/removetorrentdialog.py index 7066d2885..5446eae39 100644 --- a/deluge/ui/gtkui/removetorrentdialog.py +++ b/deluge/ui/gtkui/removetorrentdialog.py @@ -35,7 +35,6 @@ import os import gtk -import gtk.glade import logging from deluge.ui.client import client @@ -64,19 +63,20 @@ class RemoveTorrentDialog(object): self.__torrent_ids = torrent_ids - glade = gtk.glade.XML(deluge.common.resource_filename( - "deluge.ui.gtkui", os.path.join("glade", "remove_torrent_dialog.glade")) + builder = gtk.Builder() + builder.add_from_file(deluge.common.resource_filename( + "deluge.ui.gtkui", os.path.join("glade", "remove_torrent_dialog.ui")) ) - self.__dialog = glade.get_widget("remove_torrent_dialog") + self.__dialog = builder.get_object("remove_torrent_dialog") self.__dialog.set_transient_for(component.get("MainWindow").window) self.__dialog.set_title("") if len(self.__torrent_ids) > 1: # We need to pluralize the dialog - label_title = glade.get_widget("label_title") - button_ok = glade.get_widget("button_ok_label") - button_data = glade.get_widget("button_data_label") + label_title = builder.get_object("label_title") + button_ok = builder.get_object("button_ok_label") + button_data = builder.get_object("button_data_label") def pluralize_torrents(text): plural_torrent = _("Torrents")