From 547fda1b667312a2b3d8e201cd42efd30571ddf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Tue, 28 Feb 2017 22:41:05 +0100 Subject: [PATCH] [omemo] Fix 'Copy to clipboard' --- omemo/fpr_dialog.ui | 2 ++ omemo/ui.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/omemo/fpr_dialog.ui b/omemo/fpr_dialog.ui index 969aebe..73c18d4 100644 --- a/omemo/fpr_dialog.ui +++ b/omemo/fpr_dialog.ui @@ -292,6 +292,8 @@ True False + Copy to clipboard + True diff --git a/omemo/ui.py b/omemo/ui.py index 464913c..1da35f0 100644 --- a/omemo/ui.py +++ b/omemo/ui.py @@ -23,7 +23,7 @@ import logging import os import message_control -from gi.repository import GObject, Gtk, GdkPixbuf +from gi.repository import GObject, Gtk, GdkPixbuf, Gdk # pylint: disable=import-error import gtkgui_helpers @@ -539,7 +539,7 @@ class OMEMOConfigDialog(GajimPluginConfigDialog): keep_selection = tw.get_selection().path_is_selected(pthinfo[0]) pop = self.B.get_object('fprclipboard_menu') - pop.popup(None, None, None, event.button, event.time) + pop.popup(None, None, None, None, event.button, event.time) # keep_selection=True -> no further processing of click event # keep_selection=False-> further processing -> GTK usually selects @@ -553,9 +553,9 @@ class OMEMOConfigDialog(GajimPluginConfigDialog): for path in paths: it = mod.get_iter(path) jid, fpr = mod.get(it, 1, 3) - fprs.append('%s: %s' % (jid, fpr[4:-5])) - Gtk.Clipboard().set_text('\n'.join(fprs)) - Gtk.Clipboard(selection='PRIMARY').set_text('\n'.join(fprs)) + fprs.append('%s: %s' % (jid, fpr[31:-12])) + clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) + clipboard.set_text('\n'.join(fprs), -1) def update_context_list(self): self.fpr_model.clear() @@ -744,7 +744,7 @@ class FingerprintWindow(Gtk.Dialog): keep_selection = tw.get_selection().path_is_selected(pthinfo[0]) pop = self.xml.get_object('fprclipboard_menu') - pop.popup(None, None, None, event.button, event.time) + pop.popup(None, None, None, None, event.button, event.time) # keep_selection=True -> no further processing of click event # keep_selection=False-> further processing -> GTK usually selects @@ -762,8 +762,8 @@ class FingerprintWindow(Gtk.Dialog): it = mod.get_iter(path) jid, fpr = mod.get(it, 1, 3) fprs.append('%s: %s' % (jid, fpr[31:-12])) - Gtk.Clipboard().set_text('\n'.join(fprs)) - Gtk.Clipboard(selection='PRIMARY').set_text('\n'.join(fprs)) + clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) + clipboard.set_text('\n'.join(fprs), -1) def update_context_list(self, *args): self.fpr_model.clear()