[Xfce4-commits] [apps/xfce4-terminal] 01/01: Add option to automatically copy selection to the clipboard
noreply at xfce.org
noreply at xfce.org
Thu Nov 10 08:55:41 CET 2016
This is an automated email from the git hooks/post-receive script.
f2404 pushed a commit to branch master
in repository apps/xfce4-terminal.
commit 6be731794154e2b0721ed6210a5013d58fe23f0c
Author: Kresp <maximillionmail at gmail.com>
Date: Thu Nov 10 09:54:14 2016 +0200
Add option to automatically copy selection to the clipboard
https://bugzilla.xfce.org/show_bug.cgi?id=12931
Signed-off-by: Igor <f2404 at yandex.ru>
---
terminal/terminal-preferences-dialog.c | 16 ++++++++--------
terminal/terminal-preferences.c | 11 +++++++++++
terminal/terminal-preferences.glade | 16 ++++++++++++++++
terminal/terminal-screen.c | 8 ++++++++
4 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index d6f5846..be6b689 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -144,14 +144,14 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
"font-allow-bold", "misc-menubar-default",
"misc-toolbar-default", "misc-borders-default",
"misc-tab-close-middle-click", "misc-mouse-autohide",
- "misc-rewrap-on-resize", "shortcuts-no-helpkey",
- "shortcuts-no-mnemonics", "shortcuts-no-menukey",
- "binding-backspace", "binding-delete",
- "background-mode", "background-image-style",
- "color-background-vary", "dropdown-keep-open-default",
- "dropdown-keep-above", "dropdown-toggle-focus",
- "dropdown-status-icon", "dropdown-move-to-active",
- "dropdown-always-show-tabs"
+ "misc-rewrap-on-resize", "misc-copy-on-select",
+ "shortcuts-no-helpkey", "shortcuts-no-mnemonics",
+ "shortcuts-no-menukey", "binding-backspace",
+ "binding-delete", "background-mode",
+ "background-image-style", "color-background-vary",
+ "dropdown-keep-open-default", "dropdown-keep-above",
+ "dropdown-toggle-focus", "dropdown-status-icon",
+ "dropdown-move-to-active", "dropdown-always-show-tabs"
};
const gchar *props_color[] = { "color-foreground", "color-cursor",
"color-background", "tab-activity-color",
diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index d6c70ae..08d38e4 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -93,6 +93,7 @@ enum
PROP_MISC_TAB_POSITION,
PROP_MISC_HIGHLIGHT_URLS,
PROP_MISC_MIDDLE_CLICK_OPENS_URI,
+ PROP_MISC_COPY_ON_SELECT,
PROP_MISC_DEFAULT_WORKING_DIR,
PROP_MISC_REWRAP_ON_RESIZE,
PROP_MISC_SHIFT_ARROWS_SCROLL,
@@ -836,6 +837,16 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
+ * TerminalPreferences:misc-copy-on-select:
+ **/
+ preferences_props[PROP_MISC_COPY_ON_SELECT] =
+ g_param_spec_boolean ("misc-copy-on-select",
+ NULL,
+ "MiscCopyOnSelect",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+ /**
* TerminalPreferences:misc-default-working-dir:
**/
preferences_props[PROP_MISC_DEFAULT_WORKING_DIR] =
diff --git a/terminal/terminal-preferences.glade b/terminal/terminal-preferences.glade
index 63b7294..fef456c 100644
--- a/terminal/terminal-preferences.glade
+++ b/terminal/terminal-preferences.glade
@@ -3042,6 +3042,22 @@ when double clicking:</property>
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="misc-copy-on-select">
+ <property name="label" translatable="yes">Automatically copy selection to clipboard</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 9b1c74f..82f6556 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -1199,9 +1199,17 @@ static void
terminal_screen_vte_selection_changed (VteTerminal *terminal,
TerminalScreen *screen)
{
+ gboolean copy_on_select;
+
terminal_return_if_fail (VTE_IS_TERMINAL (terminal));
terminal_return_if_fail (TERMINAL_IS_SCREEN (screen));
+ /* copy vte selection to GDK_SELECTION_CLIPBOARD if option is set */
+ g_object_get (G_OBJECT (screen->preferences),
+ "misc-copy-on-select", ©_on_select, NULL);
+ if (copy_on_select)
+ vte_terminal_copy_clipboard (terminal);
+
g_signal_emit (G_OBJECT (screen), screen_signals[SELECTION_CHANGED], 0);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list