Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Mielniczuk <marmistrz.dev@zoho.eu>2019-04-07 23:25:14 +0300
committerPhilipp Hörist <philipp@hoerist.com>2019-04-09 21:58:16 +0300
commitdb942378a166b7d4cd25e21d9258d3b14b675429 (patch)
treeaebebee7bcb5e8313ee0f0bdde278f133cfe6b66
parentbf804f18d4e0cccc109c19f2156ee32a861b987e (diff)
Add the possibility to paste as quote
-rw-r--r--gajim/chat_control_base.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/gajim/chat_control_base.py b/gajim/chat_control_base.py
index 2fa6cf210..29c93598c 100644
--- a/gajim/chat_control_base.py
+++ b/gajim/chat_control_base.py
@@ -559,14 +559,27 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
id_ = item.connect('activate', self.msg_textview.clear)
self.handlers[id_] = item
+ paste_item = Gtk.MenuItem.new_with_label(_('Paste as quote'))
+ id_ = paste_item.connect('activate', self.paste_clipboard_as_quote)
+ self.handlers[id_] = paste_item
+ menu.append(paste_item)
+
menu.show_all()
- def on_quote(self, widget, text):
+ def insert_as_quote(self, text: str) -> None:
self.msg_textview.remove_placeholder()
- text = '>' + text.replace('\n', '\n>') + '\n'
+ text = '> ' + text.replace('\n', '\n> ') + '\n'
message_buffer = self.msg_textview.get_buffer()
message_buffer.insert_at_cursor(text)
+ def paste_clipboard_as_quote(self, _item: Gtk.MenuItem) -> None:
+ clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
+ text = clipboard.wait_for_text()
+ self.insert_as_quote(text)
+
+ def on_quote(self, widget, text):
+ self.insert_as_quote(text)
+
# moved from ChatControl
def _on_banner_eventbox_button_press_event(self, widget, event):
"""