Fix copy on selection to work on already open terminals

This commit is contained in:
Stephen Boddy 2015-11-29 03:07:07 +01:00
parent edee76f78e
commit 4d8b6acad2
1 changed files with 6 additions and 4 deletions

View File

@ -339,6 +339,10 @@ class Terminal(gtk.VBox):
self.vte.match_remove(self.matches[name]) self.vte.match_remove(self.matches[name])
del(self.matches[name]) del(self.matches[name])
def maybe_copy_clipboard(self):
if self.config['copy_on_selection']:
self.vte.copy_clipboard()
def connect_signals(self): def connect_signals(self):
"""Connect all the gtk signals and drag-n-drop mechanics""" """Connect all the gtk signals and drag-n-drop mechanics"""
@ -375,10 +379,8 @@ class Terminal(gtk.VBox):
self.vte.connect('drag-data-received', self.vte.connect('drag-data-received',
self.on_drag_data_received, self) self.on_drag_data_received, self)
# FIXME: Shouldn't this be in configure()? self.cnxids.new(self.vte, 'selection-changed',
if self.config['copy_on_selection']: lambda widget: self.maybe_copy_clipboard())
self.cnxids.new(self.vte, 'selection-changed',
lambda widget: self.vte.copy_clipboard())
if self.composite_support: if self.composite_support:
self.vte.connect('composited-changed', self.reconfigure) self.vte.connect('composited-changed', self.reconfigure)