[Xfce4-commits] [apps/xfce4-terminal] 01/01: Allow to specify text selection background color

noreply at xfce.org noreply at xfce.org
Thu Nov 24 15:38:49 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 7ffd8bad1e4b6b1daadbe664f48c869d61fcca15
Author: Igor <f2404 at yandex.ru>
Date:   Thu Nov 24 17:38:24 2016 +0300

    Allow to specify text selection background color
    
    Fixes https://bugzilla.xfce.org/show_bug.cgi?id=13003
---
 terminal/terminal-preferences-dialog.c |  7 ++++++-
 terminal/terminal-preferences.c        | 11 +++++++++++
 terminal/terminal-preferences.glade    | 28 ++++++++++++++++++++++++++--
 terminal/terminal-screen.c             | 10 ++++++----
 4 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index d011097..1ee26b7 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -158,7 +158,8 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
                                      };
   const gchar      *props_color[] =  { "color-foreground", "color-cursor",
                                        "color-background", "tab-activity-color",
-                                       "color-selection", "color-bold"
+                                       "color-selection", "color-selection-bg",
+                                       "color-bold"
                                      };
   const gchar      *props_value[] =  { "dropdown-height", "dropdown-width",
                                        "dropdown-position", "dropdown-opacity",
@@ -284,6 +285,10 @@ error:
   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-selection-bg");
+  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-bold-custom");
   terminal_return_if_fail (G_IS_OBJECT (object));
diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index ed548d9..42cb4fb 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -55,6 +55,7 @@ enum
   PROP_COLOR_BACKGROUND_VARY,
   PROP_COLOR_CURSOR,
   PROP_COLOR_SELECTION,
+  PROP_COLOR_SELECTION_BG,
   PROP_COLOR_SELECTION_USE_DEFAULT,
   PROP_COLOR_BOLD,
   PROP_COLOR_BOLD_USE_DEFAULT,
@@ -418,6 +419,16 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
   /**
+   * TerminalPreferences:color-selection-bg:
+   **/
+  preferences_props[PROP_COLOR_SELECTION_BG] =
+      g_param_spec_string ("color-selection-bg",
+                           NULL,
+                           "ColorSelectionBackground",
+                           "#ffffff",
+                           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
    * TerminalPreferences:color-selection-use-default:
    **/
   preferences_props[PROP_COLOR_SELECTION_USE_DEFAULT] =
diff --git a/terminal/terminal-preferences.glade b/terminal/terminal-preferences.glade
index 3dfe2dc..ca1ffd4 100644
--- a/terminal/terminal-preferences.glade
+++ b/terminal/terminal-preferences.glade
@@ -2025,7 +2025,7 @@ 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="title" translatable="yes">Choose text selection background color</property>
+                            <property name="title" translatable="yes">Choose text selection foreground color</property>
                             <property name="rgba">rgb(0,0,0)</property>
                             <child internal-child="accessible">
                               <object class="AtkObject" id="color-selection-atkobject">
@@ -2085,6 +2085,30 @@ Opacity setting is not available.</property>
                             <property name="top_attach">1</property>
                           </packing>
                         </child>
+                        <child>
+                          <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="halign">start</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">2</property>
+                            <property name="top_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </object>
                     </child>
                     <child type="label">
@@ -2119,7 +2143,7 @@ Opacity setting is not available.</property>
                         <property name="margin_right">6</property>
                         <property name="margin_top">6</property>
                         <property name="margin_bottom">6</property>
-                        <property name="column_homogeneous">True</property>
+                        <property name="column_spacing">2</property>
                         <child>
                           <object class="GtkColorButton" id="color-palette1">
                             <property name="use_action_appearance">False</property>
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 089d1ca..1af1956 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -1010,10 +1010,12 @@ terminal_screen_update_colors (TerminalScreen *screen)
 
   /* selection color */
   if (!selection_use_default)
-    selection_use_default = !terminal_preferences_get_color (screen->preferences, "color-selection", &selection);
-  vte_terminal_set_color_highlight (VTE_TERMINAL (screen->terminal), selection_use_default ? NULL : &selection);
-  vte_terminal_set_color_highlight_foreground (VTE_TERMINAL (screen->terminal),
-                                               selection_use_default && has_bg ? NULL : &bg);
+    {
+      selection_use_default = !terminal_preferences_get_color (screen->preferences, "color-selection", &selection);
+      vte_terminal_set_color_highlight_foreground (VTE_TERMINAL (screen->terminal), selection_use_default ? NULL : &selection);
+      selection_use_default = !terminal_preferences_get_color (screen->preferences, "color-selection-bg", &selection);
+      vte_terminal_set_color_highlight (VTE_TERMINAL (screen->terminal), selection_use_default ? NULL : &selection);
+    }
 
   /* bold color */
   if (!bold_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