Don't paste from clipboard with "-s" (bug 1132)

If an URL is given on the command line via "-s",
do not try to paste an URL from the clipboard.
This commit is contained in:
Thomas Perl 2010-09-27 00:40:24 +02:00
parent 7555f2f59e
commit c73eaa8b22

View file

@ -54,20 +54,22 @@ class gPodderAddPodcast(BuilderWidget):
'HILDON_GTK_INPUT_MODE_FULL')
self.gPodderAddPodcast.show()
# Fill the entry if a valid URL is in the clipboard
clipboard = gtk.Clipboard(selection='PRIMARY')
def receive_clipboard_text(clipboard, text, second_try):
if text is not None:
url = util.normalize_feed_url(text)
if url is not None:
self.entry_url.set_text(url)
self.entry_url.set_position(-1)
return
if not hasattr(self, 'preset_url'):
# Fill the entry if a valid URL is in the clipboard, but
# only if there's no preset_url available (see bug 1132)
clipboard = gtk.Clipboard(selection='PRIMARY')
def receive_clipboard_text(clipboard, text, second_try):
if text is not None:
url = util.normalize_feed_url(text)
if url is not None:
self.entry_url.set_text(url)
self.entry_url.set_position(-1)
return
if not second_try:
clipboard = gtk.Clipboard()
clipboard.request_text(receive_clipboard_text, True)
clipboard.request_text(receive_clipboard_text, False)
if not second_try:
clipboard = gtk.Clipboard()
clipboard.request_text(receive_clipboard_text, True)
clipboard.request_text(receive_clipboard_text, False)
def on_btn_close_clicked(self, widget):
self.gPodderAddPodcast.destroy()