mirror of
https://github.com/codex-storage/deluge.git
synced 2025-03-01 11:30:43 +00:00
clean up adding via url and make enter submit it instead of having to click ok
This commit is contained in:
parent
1d8b9cb402
commit
b16930ea4c
@ -1282,12 +1282,13 @@ trunk/+pots/deluge')
|
|||||||
self.interactive_add_torrent(single)
|
self.interactive_add_torrent(single)
|
||||||
|
|
||||||
def add_torrent_url_clicked(self, obj=None):
|
def add_torrent_url_clicked(self, obj=None):
|
||||||
dlg = gtk.Dialog(title=_("Add torrent from URL"), parent=self.window,
|
dlg = gtk.Dialog(_("Add torrent from URL"), self.window, 0,
|
||||||
buttons=(gtk.STOCK_CANCEL, 0, gtk.STOCK_OK, 1))
|
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,gtk.STOCK_OK, gtk.RESPONSE_OK))
|
||||||
|
dlg.set_default_response(gtk.RESPONSE_OK)
|
||||||
dlg.set_icon(common.get_logo(32))
|
dlg.set_icon(common.get_logo(32))
|
||||||
|
|
||||||
label = gtk.Label(_("Enter the URL of the .torrent to download"))
|
label = gtk.Label(_("Enter the URL of the .torrent to download"))
|
||||||
entry = gtk.Entry()
|
entry = gtk.Entry()
|
||||||
|
entry.connect("activate", lambda w : dlg.response(gtk.RESPONSE_OK))
|
||||||
dlg.vbox.pack_start(label)
|
dlg.vbox.pack_start(label)
|
||||||
dlg.vbox.pack_start(entry)
|
dlg.vbox.pack_start(entry)
|
||||||
if common.windows_check():
|
if common.windows_check():
|
||||||
@ -1304,12 +1305,13 @@ trunk/+pots/deluge')
|
|||||||
if common.is_url(text):
|
if common.is_url(text):
|
||||||
entry.set_text(text)
|
entry.set_text(text)
|
||||||
dlg.show_all()
|
dlg.show_all()
|
||||||
result = dlg.run()
|
response = dlg.run()
|
||||||
url = entry.get_text()
|
if response == gtk.RESPONSE_OK:
|
||||||
|
url = entry.get_text().decode("utf_8")
|
||||||
dlg.destroy()
|
dlg.destroy()
|
||||||
|
|
||||||
if result == 1:
|
|
||||||
self.interactive_add_torrent_url(url)
|
self.interactive_add_torrent_url(url)
|
||||||
|
else:
|
||||||
|
dlg.destroy()
|
||||||
|
|
||||||
def remove_torrent_clicked(self, obj=None):
|
def remove_torrent_clicked(self, obj=None):
|
||||||
glade = gtk.glade.XML(common.get_glade_file("dgtkpopups.glade"),
|
glade = gtk.glade.XML(common.get_glade_file("dgtkpopups.glade"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user