[GTKUI] Autofill infohash entry from clipboard

This commit is contained in:
Calum Lind 2016-10-18 19:20:47 +01:00
parent f57ee74ee2
commit f739269dfd
1 changed files with 6 additions and 0 deletions

View File

@ -738,6 +738,12 @@ class AddTorrentDialog(component.Component):
dialog.set_default_response(gtk.RESPONSE_OK)
dialog.set_transient_for(self.dialog)
entry.grab_focus()
text = (gtk.clipboard_get(selection='PRIMARY').wait_for_text() or
gtk.clipboard_get().wait_for_text()).strip()
if len(text) == 40:
entry.set_text(text)
dialog.show_all()
response = dialog.run()
infohash = entry.get_text().strip()