[Xfce4-commits] [apps/xfce4-terminal] 01/01: Add BackgroundImageShading setting for background image mode

noreply at xfce.org noreply at xfce.org
Mon Sep 26 13:13:26 CEST 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 f992fa02f289d61cce25ddc88d5fcb9428030857
Author: Igor <f2404 at yandex.ru>
Date:   Mon Sep 26 14:09:29 2016 +0300

    Add BackgroundImageShading setting for background image mode
    
    Setting it to 0 will display image with its natural colors; changing it to
    1.0 will completely cover the image by vte widget's background color.
    BackgroundDarkness setting still used in transparent background mode.
---
 terminal/terminal-preferences-dialog.c | 14 ++++++-----
 terminal/terminal-preferences.c        | 11 ++++++++
 terminal/terminal-preferences.glade    | 46 ++++++++++++++++++++++++++++++++++
 terminal/terminal-screen.c             | 15 ++++++-----
 4 files changed, 72 insertions(+), 14 deletions(-)

diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index 0349d15..651cc34 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -235,6 +235,7 @@ error:
   BIND_PROPERTIES ("scrolling-lines", "value");
   BIND_PROPERTIES ("tab-activity-timeout", "value");
   BIND_PROPERTIES ("background-darkness", "value");
+  BIND_PROPERTIES ("background-image-shading", "value");
 
   /* unlimited scrollback button */
   object = gtk_builder_get_object (GTK_BUILDER (dialog), "scrolling-unlimited");
@@ -837,18 +838,19 @@ terminal_preferences_dialog_background_mode (GtkWidget                 *combobox
   terminal_return_if_fail (G_IS_OBJECT (object));
   g_object_set (G_OBJECT (object), "visible", active == 1, NULL);
 
+  object = gtk_builder_get_object (GTK_BUILDER (dialog), "box-shading");
+  terminal_return_if_fail (G_IS_OBJECT (object));
+  g_object_set (G_OBJECT (object), "visible", active == 1, NULL);
+
   object = gtk_builder_get_object (GTK_BUILDER (dialog), "box-opacity");
   terminal_return_if_fail (G_IS_OBJECT (object));
-  g_object_set (G_OBJECT (object), "visible", active > 0, NULL);
-  g_object_set (G_OBJECT (object), "sensitive", active > 0 && composited, NULL);
+  g_object_set (G_OBJECT (object), "visible", active > 1, NULL);
+  g_object_set (G_OBJECT (object), "sensitive", active > 1 && composited, NULL);
 
   object = gtk_builder_get_object (GTK_BUILDER (dialog), "label-opacity-not-available");
   terminal_return_if_fail (G_IS_OBJECT (object));
-  g_object_set (G_OBJECT (object), "visible", active > 0 && !composited, NULL);
+  g_object_set (G_OBJECT (object), "visible", active > 1 && !composited, NULL);
 
-  object = gtk_builder_get_object (GTK_BUILDER (dialog), "opacity-label");
-  terminal_return_if_fail (G_IS_OBJECT (object));
-  g_object_set (G_OBJECT (object), "label", active == 1 ? "_Image\ndarkening:" : "_Opacity:", NULL);
 }
 
 
diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index 2761576..9b8723d 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -47,6 +47,7 @@ enum
   PROP_BACKGROUND_IMAGE_FILE,
   PROP_BACKGROUND_IMAGE_STYLE,
   PROP_BACKGROUND_DARKNESS,
+  PROP_BACKGROUND_IMAGE_SHADING,
   PROP_BINDING_BACKSPACE,
   PROP_BINDING_DELETE,
   PROP_COLOR_FOREGROUND,
@@ -331,6 +332,16 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
   /**
+   * TerminalPreferences:background-image-shading:
+   **/
+  preferences_props[PROP_BACKGROUND_IMAGE_SHADING] =
+      g_param_spec_double ("background-image-shading",
+                           NULL,
+                           "BackgroundImageShading",
+                           0.0, 1.0, 0.5,
+                           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
    * TerminalPreferences:binding-backspace:
    **/
   preferences_props[PROP_BINDING_BACKSPACE] =
diff --git a/terminal/terminal-preferences.glade b/terminal/terminal-preferences.glade
index 8cf3015..914a25e 100644
--- a/terminal/terminal-preferences.glade
+++ b/terminal/terminal-preferences.glade
@@ -9,6 +9,11 @@
     <property name="step_increment">0.01</property>
     <property name="page_increment">0.10000000000000001</property>
   </object>
+  <object class="GtkAdjustment" id="background-image-shading">
+    <property name="upper">1</property>
+    <property name="step_increment">0.01</property>
+    <property name="page_increment">0.10000000000000001</property>
+  </object>
   <object class="GtkAdjustment" id="dropdown-animation-time">
     <property name="upper">500</property>
     <property name="step_increment">1</property>
@@ -1424,6 +1429,47 @@ Opacity setting is not available.</property>
                                 <property name="position">3</property>
                               </packing>
                             </child>
+                            <child>
+                              <object class="GtkBox" id="box-shading">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="spacing">12</property>
+                                <child>
+                                  <object class="GtkLabel" id="shading-label">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label" translatable="yes">_Shading:</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="mnemonic_widget">trans-scale</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkScale" id="shading-scale">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="adjustment">background-image-shading</property>
+                                    <property name="round_digits">2</property>
+                                    <property name="digits">2</property>
+                                    <property name="value_pos">right</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">4</property>
+                              </packing>
+                            </child>
                           </object>
                         </child>
                       </object>
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 1ada4ab..c43aa4a 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -806,22 +806,21 @@ static void
 terminal_screen_update_background (TerminalScreen *screen)
 {
   TerminalBackground background_mode;
-  gdouble            background_darkness;
+  gdouble            background_alpha;
 
   terminal_return_val_if_fail (TERMINAL_IS_SCREEN (screen), FALSE);
   terminal_return_val_if_fail (VTE_IS_TERMINAL (screen->terminal), FALSE);
 
   g_object_get (G_OBJECT (screen->preferences), "background-mode", &background_mode, NULL);
 
-  if (G_UNLIKELY (background_mode == TERMINAL_BACKGROUND_IMAGE ||
-      background_mode == TERMINAL_BACKGROUND_TRANSPARENT))
-    {
-      g_object_get (G_OBJECT (screen->preferences), "background-darkness", &background_darkness, NULL);
-    }
+  if (G_UNLIKELY (background_mode == TERMINAL_BACKGROUND_TRANSPARENT))
+    g_object_get (G_OBJECT (screen->preferences), "background-darkness", &background_alpha, NULL);
+  else if (G_UNLIKELY (background_mode == TERMINAL_BACKGROUND_IMAGE))
+    g_object_get (G_OBJECT (screen->preferences), "background-image-shading", &background_alpha, NULL);
   else
-    background_darkness = 1.0;
+    background_alpha = 1.0;
 
-  screen->background_color.alpha = background_darkness;
+  screen->background_color.alpha = background_alpha;
   vte_terminal_set_color_background (VTE_TERMINAL (screen->terminal), &screen->background_color);
 
   gtk_widget_queue_draw (GTK_WIDGET (screen));

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list