[gnome-terminal] profile: editor: Add "Allow blinking text" preference



commit 5296b895792251d404079880c43b9c82329f72b7
Author: Egmont Koblinger <egmont gmail com>
Date:   Sat Dec 23 22:54:56 2017 +0100

    profile: editor: Add "Allow blinking text" preference
    
    https://bugzilla.gnome.org/show_bug.cgi?id=579964

 src/org.gnome.Terminal.gschema.xml |   10 +++++
 src/profile-editor.c               |    8 ++++
 src/profile-preferences.ui         |   72 ++++++++++++++++++++++++++++++++---
 src/terminal-schemas.h             |    1 +
 src/terminal-screen.c              |    4 ++
 5 files changed, 88 insertions(+), 7 deletions(-)
---
diff --git a/src/org.gnome.Terminal.gschema.xml b/src/org.gnome.Terminal.gschema.xml
index 27d914d..c8f4c7f 100644
--- a/src/org.gnome.Terminal.gschema.xml
+++ b/src/org.gnome.Terminal.gschema.xml
@@ -87,6 +87,12 @@
     <value nick='ibeam' value='1'/>
     <value nick='underline' value='2'/>
   </enum>
+  <enum id='org.gnome.Terminal.TextBlinkMode'>
+    <value nick='never' value='0'/>
+    <value nick='focused' value='1'/>
+    <value nick='unfocused' value='2'/>
+    <value nick='always' value='3'/>
+  </enum>
 
   <!-- SettingsList base schema -->
 
@@ -260,6 +266,10 @@
       <default>'block'</default>
       <summary>The cursor appearance</summary>
     </key>
+    <key name="text-blink-mode" enum="org.gnome.Terminal.TextBlinkMode">
+      <default>'always'</default>
+      <summary>Possible values are “always” or “never” allow blinking text, or only when the terminal is 
“focused” or “unfocused”.</summary>
+    </key>
     <key name="custom-command" type="s">
       <default>''</default>
       <summary>Custom command to use instead of the shell</summary>
diff --git a/src/profile-editor.c b/src/profile-editor.c
index d94c8ec..b52dd9c 100644
--- a/src/profile-editor.c
+++ b/src/profile-editor.c
@@ -1047,6 +1047,14 @@ terminal_profile_edit (GSettings  *profile,
                                 (GSettingsBindGetMapping) string_to_enum,
                                 (GSettingsBindSetMapping) enum_to_string,
                                 vte_cursor_shape_get_type, NULL);
+  g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_TEXT_BLINK_MODE_KEY,
+                                gtk_builder_get_object (builder,
+                                                        "text-blink-mode-combobox"),
+                                "active",
+                                G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
+                                (GSettingsBindGetMapping) string_to_enum,
+                                (GSettingsBindSetMapping) enum_to_string,
+                                vte_text_blink_mode_get_type, NULL);
   g_settings_bind (profile, TERMINAL_PROFILE_CUSTOM_COMMAND_KEY,
                    gtk_builder_get_object (builder, "custom-command-entry"),
                    "text", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
diff --git a/src/profile-preferences.ui b/src/profile-preferences.ui
index bf79be9..7d895b8 100644
--- a/src/profile-preferences.ui
+++ b/src/profile-preferences.ui
@@ -58,6 +58,26 @@
       </row>
     </data>
   </object>
+  <object class="GtkListStore" id="model5">
+    <columns>
+      <!-- column-name gchararray -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes" comments="Text blink mode">Never</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" comments="Text blink mode">When focused</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" comments="Text blink mode">When unfocused</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" comments="Text blink mode">Always</col>
+      </row>
+    </data>
+  </object>
   <object class="GtkListStore" id="model2">
     <columns>
       <!-- column-name gchararray -->
@@ -174,7 +194,7 @@
                   <object class="GtkTable" id="general-table">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="n_rows">8</property>
+                    <property name="n_rows">9</property>
                     <property name="n_columns">4</property>
                     <property name="column_spacing">12</property>
                     <property name="row_spacing">6</property>
@@ -401,6 +421,44 @@
                       </packing>
                     </child>
                     <child>
+                      <object class="GtkLabel" id="label481">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Allow b_linking text:</property>
+                        <property name="use_underline">True</property>
+                        <property name="margin_left">12</property>
+                        <property name="mnemonic_widget">text-blink-mode-combobox</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="top_attach">6</property>
+                        <property name="bottom_attach">7</property>
+                        <property name="y_options">GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkComboBox" id="text-blink-mode-combobox">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="model">model5</property>
+                        <property name="focus_on_click">False</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="renderer2"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">4</property>
+                        <property name="top_attach">6</property>
+                        <property name="bottom_attach">7</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options">GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
                       <object class="GtkCheckButton" id="rewrap-on-resize-checkbutton">
                         <property name="label" translatable="yes">_Rewrap on resize</property>
                         <property name="visible">True</property>
@@ -413,8 +471,8 @@
                       </object>
                       <packing>
                         <property name="right_attach">4</property>
-                        <property name="top_attach">6</property>
-                        <property name="bottom_attach">7</property>
+                        <property name="top_attach">7</property>
+                        <property name="bottom_attach">8</property>
                         <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
@@ -430,8 +488,8 @@
                         <property name="draw_indicator">True</property>
                       </object>
                       <packing>
-                        <property name="top_attach">7</property>
-                        <property name="bottom_attach">8</property>
+                        <property name="top_attach">8</property>
+                        <property name="bottom_attach">9</property>
                         <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
@@ -447,8 +505,8 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">4</property>
-                        <property name="top_attach">7</property>
-                        <property name="bottom_attach">8</property>
+                        <property name="top_attach">8</property>
+                        <property name="bottom_attach">9</property>
                         <property name="x_options">GTK_FILL</property>
                         <property name="y_options">GTK_FILL</property>
                       </packing>
diff --git a/src/terminal-schemas.h b/src/terminal-schemas.h
index cb97430..46ed321 100644
--- a/src/terminal-schemas.h
+++ b/src/terminal-schemas.h
@@ -65,6 +65,7 @@ G_BEGIN_DECLS
 #define TERMINAL_PROFILE_SCROLLBAR_POLICY_KEY           "scrollbar-policy"
 #define TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE_KEY        "scroll-on-keystroke"
 #define TERMINAL_PROFILE_SCROLL_ON_OUTPUT_KEY           "scroll-on-output"
+#define TERMINAL_PROFILE_TEXT_BLINK_MODE_KEY            "text-blink-mode"
 #define TERMINAL_PROFILE_USE_CUSTOM_COMMAND_KEY         "use-custom-command"
 #define TERMINAL_PROFILE_USE_SKEY_KEY                   "use-skey"
 #define TERMINAL_PROFILE_USE_SYSTEM_FONT_KEY            "use-system-font"
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index bdf99fa..117315e 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -880,6 +880,10 @@ terminal_screen_profile_changed_cb (GSettings     *profile,
     vte_terminal_set_rewrap_on_resize (vte_terminal,
                                        g_settings_get_boolean (profile, 
TERMINAL_PROFILE_REWRAP_ON_RESIZE_KEY));
 
+  if (!prop_name || prop_name == I_(TERMINAL_PROFILE_TEXT_BLINK_MODE_KEY))
+    vte_terminal_set_text_blink_mode (vte_terminal,
+                                      g_settings_get_enum (profile, TERMINAL_PROFILE_TEXT_BLINK_MODE_KEY));
+
   if (!prop_name || prop_name == I_(TERMINAL_PROFILE_WORD_CHAR_EXCEPTIONS_KEY))
     {
       gs_free char *word_char_exceptions;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]