[Xfce4-commits] [apps/xfce4-terminal] 01/01: Add option to select cursor foreground (text) color
noreply at xfce.org
noreply at xfce.org
Mon Jun 5 03:57:16 CEST 2017
This is an automated email from the git hooks/post-receive script.
f 2 4 0 4 p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-terminal.
commit 7a3d977c8d2a5d7d01a8db4885fbcc709da4c563
Author: Igor <f2404 at yandex.ru>
Date: Sun Jun 4 21:57:06 2017 -0400
Add option to select cursor foreground (text) color
---
terminal/terminal-preferences-dialog.c | 24 ++++-
terminal/terminal-preferences.c | 30 +++++-
terminal/terminal-preferences.glade | 171 +++++++++++++++++++--------------
terminal/terminal-screen.c | 14 ++-
4 files changed, 153 insertions(+), 86 deletions(-)
diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index 64e3eb4..4acda03 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -157,10 +157,10 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
"dropdown-move-to-active", "dropdown-always-show-tabs",
"dropdown-show-borders"
};
- const gchar *props_color[] = { "color-foreground", "color-cursor",
- "color-background", "tab-activity-color",
- "color-selection", "color-selection-bg",
- "color-bold"
+ const gchar *props_color[] = { "color-foreground", "color-background",
+ "tab-activity-color", "color-cursor-fg",
+ "color-cursor", "color-selection",
+ "color-selection-bg", "color-bold"
};
const gchar *props_value[] = { "dropdown-height", "dropdown-width",
"dropdown-position", "dropdown-opacity",
@@ -293,6 +293,22 @@ error:
gtk_scale_add_mark (GTK_SCALE (object), i, GTK_POS_BOTTOM, NULL);
/* inverted custom colors and set sensitivity */
+ object = gtk_builder_get_object (GTK_BUILDER (dialog), "color-cursor-custom");
+ terminal_return_if_fail (G_IS_OBJECT (object));
+ g_object_bind_property (G_OBJECT (dialog->preferences), "color-cursor-use-default",
+ G_OBJECT (object), "active",
+ G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
+ object2 = gtk_builder_get_object (GTK_BUILDER (dialog), "color-cursor-fg");
+ terminal_return_if_fail (G_IS_OBJECT (object2));
+ g_object_bind_property (G_OBJECT (object), "active",
+ G_OBJECT (object2), "sensitive",
+ G_BINDING_SYNC_CREATE);
+ object2 = gtk_builder_get_object (GTK_BUILDER (dialog), "color-cursor");
+ terminal_return_if_fail (G_IS_OBJECT (objec2));
+ g_object_bind_property (G_OBJECT (object), "active",
+ G_OBJECT (object2), "sensitive",
+ G_BINDING_SYNC_CREATE);
+
object = gtk_builder_get_object (GTK_BUILDER (dialog), "color-selection-custom");
terminal_return_if_fail (G_IS_OBJECT (object));
g_object_bind_property (G_OBJECT (dialog->preferences), "color-selection-use-default",
diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index 17091bf..ba27c15 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -54,7 +54,9 @@ enum
PROP_COLOR_FOREGROUND,
PROP_COLOR_BACKGROUND,
PROP_COLOR_BACKGROUND_VARY,
+ PROP_COLOR_CURSOR_FG,
PROP_COLOR_CURSOR,
+ PROP_COLOR_CURSOR_USE_DEFAULT,
PROP_COLOR_SELECTION,
PROP_COLOR_SELECTION_BG,
PROP_COLOR_SELECTION_USE_DEFAULT,
@@ -417,23 +419,43 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
+ * TerminalPreferences:color-cursor-fg:
+ **/
+ preferences_props[PROP_COLOR_CURSOR_FG] =
+ g_param_spec_string ("color-cursor-fg",
+ NULL,
+ "ColorCursorForeground",
+ "",
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+ /**
* TerminalPreferences:color-cursor:
**/
preferences_props[PROP_COLOR_CURSOR] =
g_param_spec_string ("color-cursor",
NULL,
"ColorCursor",
- "#00aa00",
+ "",
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
+ * TerminalPreferences:color-cursor-use-default:
+ **/
+ preferences_props[PROP_COLOR_CURSOR_USE_DEFAULT] =
+ g_param_spec_boolean ("color-cursor-use-default",
+ NULL,
+ "ColorCursorUseDefault",
+ TRUE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+ /**
* TerminalPreferences:color-selection:
**/
preferences_props[PROP_COLOR_SELECTION] =
g_param_spec_string ("color-selection",
NULL,
"ColorSelection",
- "#ffffff",
+ "",
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
@@ -443,7 +465,7 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
g_param_spec_string ("color-selection-bg",
NULL,
"ColorSelectionBackground",
- "#ffffff",
+ "",
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
@@ -463,7 +485,7 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
g_param_spec_string ("color-bold",
NULL,
"ColorBold",
- "#ffffff",
+ "",
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
diff --git a/terminal/terminal-preferences.glade b/terminal/terminal-preferences.glade
index 78f5df8..65d50ae 100644
--- a/terminal/terminal-preferences.glade
+++ b/terminal/terminal-preferences.glade
@@ -1912,6 +1912,7 @@ Opacity setting is not available.</property>
<object class="GtkGrid" id="grid5">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="halign">start</property>
<property name="margin_left">18</property>
<property name="margin_right">12</property>
<property name="margin_top">6</property>
@@ -1937,7 +1938,6 @@ Opacity setting is not available.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="halign">end</property>
<property name="title" translatable="yes">Choose text color</property>
<property name="rgba">rgb(0,0,0)</property>
<child internal-child="accessible">
@@ -1953,37 +1953,20 @@ Opacity setting is not available.</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label35">
+ <object class="GtkCheckButton" id="color-background-vary">
+ <property name="label" translatable="yes">_Vary the background color for each tab</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">The random color is based on the selected background color, keeping the same brightness. </property>
<property name="halign">start</property>
- <property name="label" translatable="yes">Cu_rsor color:</property>
<property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="color-cursor">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="halign">end</property>
- <property name="title" translatable="yes">Choose cursor color</property>
- <property name="rgba">rgb(0,0,0)</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="color-cursor-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Color Selector</property>
- <property name="AtkObject::accessible-description" translatable="yes">Open a dialog to specify the color</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="top_attach">0</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">4</property>
</packing>
</child>
<child>
@@ -1995,8 +1978,8 @@ Opacity setting is not available.</property>
<property name="use_underline">True</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
@@ -2005,7 +1988,6 @@ Opacity setting is not available.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="halign">end</property>
<property name="title" translatable="yes">Choose background color</property>
<property name="rgba">rgb(0,0,0)</property>
<child internal-child="accessible">
@@ -2016,8 +1998,8 @@ Opacity setting is not available.</property>
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
+ <property name="left_attach">3</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
@@ -2029,7 +2011,7 @@ Opacity setting is not available.</property>
<property name="use_underline">True</property>
</object>
<packing>
- <property name="left_attach">2</property>
+ <property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
@@ -2039,7 +2021,6 @@ Opacity setting is not available.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="halign">end</property>
<property name="title" translatable="yes">Choose tab activity color</property>
<property name="rgba">rgb(0,0,0)</property>
<child internal-child="accessible">
@@ -2050,26 +2031,15 @@ Opacity setting is not available.</property>
</child>
</object>
<packing>
- <property name="left_attach">3</property>
+ <property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="color-background-vary">
- <property name="label" translatable="yes">_Vary the background color for each tab</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">The random color is based on the selected background color, keeping the same brightness. </property>
- <property name="halign">start</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- <property name="width">4</property>
- </packing>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
</child>
</object>
</child>
@@ -2101,6 +2071,7 @@ Opacity setting is not available.</property>
<object class="GtkGrid" id="grid6">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="halign">start</property>
<property name="margin_left">18</property>
<property name="margin_right">12</property>
<property name="margin_top">6</property>
@@ -2108,6 +2079,52 @@ Opacity setting is not available.</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
+ <object class="GtkCheckButton" id="color-bold-custom">
+ <property name="label" translatable="yes">B_old text color:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Enable this option to set a custom bold color. If disabled the text color will be used.</property>
+ <property name="halign">start</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="color-bold">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="title" translatable="yes">Choose bold font color</property>
+ <property name="rgba">rgb(0,0,0)</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="color-selection-custom">
+ <property name="label" translatable="yes">Text _selection color:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Enable this option to set custom text and background colors for the selection. If disabled the background and text colors will be reversed.</property>
+ <property name="halign">start</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkColorButton" id="color-selection">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
@@ -2124,30 +2141,36 @@ Opacity setting is not available.</property>
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">0</property>
+ <property name="top_attach">1</property>
</packing>
</child>
<child>
- <object class="GtkColorButton" id="color-bold">
+ <object class="GtkColorButton" id="color-selection-bg">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="title" translatable="yes">Choose bold font color</property>
+ <property name="title" translatable="yes">Choose text selection background color</property>
<property name="rgba">rgb(0,0,0)</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="color-selection-bg-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Color Selector</property>
+ <property name="AtkObject::accessible-description" translatable="yes">Open a dialog to specify the color</property>
+ </object>
+ </child>
</object>
<packing>
- <property name="left_attach">1</property>
+ <property name="left_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="color-selection-custom">
- <property name="label" translatable="yes">Text _selection color:</property>
+ <object class="GtkCheckButton" id="color-cursor-custom">
+ <property name="label" translatable="yes">Cu_rsor color:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Enable this option to set custom text and background colors for the selection. If disabled the background and text colors will be reversed.</property>
+ <property name="tooltip_text" translatable="yes">Enable this option to set custom text and background colors for the cursor. If disabled the background and text colors will be reversed.</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
@@ -2158,39 +2181,42 @@ Opacity setting is not available.</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="color-bold-custom">
- <property name="label" translatable="yes">B_old text color:</property>
+ <object class="GtkColorButton" id="color-cursor">
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Enable this option to set a custom bold color. If disabled the text color will be used.</property>
- <property name="halign">start</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="receives_default">True</property>
+ <property name="title" translatable="yes">Choose cursor background color</property>
+ <property name="rgba">rgb(0,0,0)</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="color-cursor-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Color Selector</property>
+ <property name="AtkObject::accessible-description" translatable="yes">Open a dialog to specify the color</property>
+ </object>
+ </child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
- <object class="GtkColorButton" id="color-selection-bg">
+ <object class="GtkColorButton" id="color-cursor-fg">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="halign">start</property>
- <property name="title" translatable="yes">Choose text selection background color</property>
+ <property name="title" translatable="yes">Choose cursor foreground color</property>
<property name="rgba">rgb(0,0,0)</property>
<child internal-child="accessible">
- <object class="AtkObject" id="color-selection-bg-atkobject">
+ <object class="AtkObject" id="color-cursor-fg-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Color Selector</property>
<property name="AtkObject::accessible-description" translatable="yes">Open a dialog to specify the color</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">2</property>
+ <property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
@@ -2695,8 +2721,7 @@ incorrectly. They are only here to allow you to work around
certain applications and operating systems that expect
different terminal behavior.</property>
<property name="wrap">True</property>
- <property name="ellipsize">none</property>
- <property name="max-width-chars">80</property>
+ <property name="max_width_chars">80</property>
</object>
<packing>
<property name="expand">False</property>
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index af9f888..e300e0a 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -945,12 +945,12 @@ terminal_screen_update_colors (TerminalScreen *screen)
GdkRGBA cursor;
GdkRGBA selection;
GdkRGBA bold;
+ gboolean cursor_use_default;
gboolean selection_use_default;
gboolean bold_use_default;
guint n = 0;
gboolean has_bg;
gboolean has_fg;
- gboolean has_cursor;
gboolean valid_palette = FALSE;
gchar *palette_str;
gchar **colors;
@@ -960,6 +960,7 @@ terminal_screen_update_colors (TerminalScreen *screen)
g_object_get (screen->preferences,
"color-palette", &palette_str,
+ "color-cursor-use-default", &cursor_use_default,
"color-selection-use-default", &selection_use_default,
"color-bold-use-default", &bold_use_default,
"color-background-vary", &vary_bg,
@@ -1037,12 +1038,15 @@ terminal_screen_update_colors (TerminalScreen *screen)
}
/* cursor color */
- has_cursor = terminal_preferences_get_color (screen->preferences, "color-cursor", &cursor);
- vte_terminal_set_color_cursor (VTE_TERMINAL (screen->terminal), has_cursor ? &cursor : NULL);
+ if (!cursor_use_default)
+ {
+ cursor_use_default = !terminal_preferences_get_color (screen->preferences, "color-cursor-fg", &cursor);
#if VTE_CHECK_VERSION (0, 44, 0)
- vte_terminal_set_color_cursor_foreground (VTE_TERMINAL (screen->terminal),
- has_cursor && has_bg ? &bg : NULL);
+ vte_terminal_set_color_cursor_foreground (VTE_TERMINAL (screen->terminal), cursor_use_default ? NULL : &cursor);
#endif
+ cursor_use_default = !terminal_preferences_get_color (screen->preferences, "color-cursor", &cursor);
+ vte_terminal_set_color_cursor (VTE_TERMINAL (screen->terminal), cursor_use_default ? NULL : &cursor);
+ }
/* selection color */
if (!selection_use_default)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list