[omemo] Fix 'Copy to clipboard'

This commit is contained in:
Philipp Hörist
2017-02-28 22:41:05 +01:00
parent 11fb760a4d
commit 547fda1b66
2 changed files with 10 additions and 8 deletions

View File

@@ -292,6 +292,8 @@
<object class="GtkMenuItem" id="copyfprclipboard_item"> <object class="GtkMenuItem" id="copyfprclipboard_item">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Copy to clipboard</property>
<property name="use_underline">True</property>
<signal name="activate" handler="clipboard_button_cb" swapped="no"/> <signal name="activate" handler="clipboard_button_cb" swapped="no"/>
</object> </object>
</child> </child>

View File

@@ -23,7 +23,7 @@ import logging
import os import os
import message_control import message_control
from gi.repository import GObject, Gtk, GdkPixbuf from gi.repository import GObject, Gtk, GdkPixbuf, Gdk
# pylint: disable=import-error # pylint: disable=import-error
import gtkgui_helpers import gtkgui_helpers
@@ -539,7 +539,7 @@ class OMEMOConfigDialog(GajimPluginConfigDialog):
keep_selection = tw.get_selection().path_is_selected(pthinfo[0]) keep_selection = tw.get_selection().path_is_selected(pthinfo[0])
pop = self.B.get_object('fprclipboard_menu') 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=True -> no further processing of click event
# keep_selection=False-> further processing -> GTK usually selects # keep_selection=False-> further processing -> GTK usually selects
@@ -553,9 +553,9 @@ class OMEMOConfigDialog(GajimPluginConfigDialog):
for path in paths: for path in paths:
it = mod.get_iter(path) it = mod.get_iter(path)
jid, fpr = mod.get(it, 1, 3) jid, fpr = mod.get(it, 1, 3)
fprs.append('%s: %s' % (jid, fpr[4:-5])) fprs.append('%s: %s' % (jid, fpr[31:-12]))
Gtk.Clipboard().set_text('\n'.join(fprs)) clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
Gtk.Clipboard(selection='PRIMARY').set_text('\n'.join(fprs)) clipboard.set_text('\n'.join(fprs), -1)
def update_context_list(self): def update_context_list(self):
self.fpr_model.clear() self.fpr_model.clear()
@@ -744,7 +744,7 @@ class FingerprintWindow(Gtk.Dialog):
keep_selection = tw.get_selection().path_is_selected(pthinfo[0]) keep_selection = tw.get_selection().path_is_selected(pthinfo[0])
pop = self.xml.get_object('fprclipboard_menu') 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=True -> no further processing of click event
# keep_selection=False-> further processing -> GTK usually selects # keep_selection=False-> further processing -> GTK usually selects
@@ -762,8 +762,8 @@ class FingerprintWindow(Gtk.Dialog):
it = mod.get_iter(path) it = mod.get_iter(path)
jid, fpr = mod.get(it, 1, 3) jid, fpr = mod.get(it, 1, 3)
fprs.append('%s: %s' % (jid, fpr[31:-12])) fprs.append('%s: %s' % (jid, fpr[31:-12]))
Gtk.Clipboard().set_text('\n'.join(fprs)) clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
Gtk.Clipboard(selection='PRIMARY').set_text('\n'.join(fprs)) clipboard.set_text('\n'.join(fprs), -1)
def update_context_list(self, *args): def update_context_list(self, *args):
self.fpr_model.clear() self.fpr_model.clear()