[gnome-text-editor] gsettings: add indent-width gsetting



commit 3c5c4f3c978ea95c2a87f91e95967fcb563fad22
Author: Christian Hergert <chergert redhat com>
Date:   Wed Oct 27 07:13:28 2021 -0700

    gsettings: add indent-width gsetting
    
    This allows controlling it without affecting tab width.
    
    Related #200

 data/org.gnome.TextEditor.gschema.xml | 7 +++++++
 src/editor-page-gsettings.c           | 2 ++
 2 files changed, 9 insertions(+)
---
diff --git a/data/org.gnome.TextEditor.gschema.xml b/data/org.gnome.TextEditor.gschema.xml
index 1282ed1..fc4bb2c 100644
--- a/data/org.gnome.TextEditor.gschema.xml
+++ b/data/org.gnome.TextEditor.gschema.xml
@@ -31,10 +31,17 @@
       <description>Automatically indent new lines copying the previous line's indentation.</description>
     </key>
     <key name="tab-width" type="u">
+      <range min="1" max="32"/>
       <default>8</default>
       <summary>Tab Width</summary>
       <description>The number of spaces represented by a tab.</description>
     </key>
+    <key name="indent-width" type="i">
+      <range min="-1" max="32"/>
+      <default>-1</default>
+      <summary>Indent Width</summary>
+      <description>The number of spaces to indent or -1 to use tab-width.</description>
+    </key>
     <key name="show-line-numbers" type="b">
       <default>false</default>
       <summary>Show Line Numbers</summary>
diff --git a/src/editor-page-gsettings.c b/src/editor-page-gsettings.c
index 7a4934b..46de5a3 100644
--- a/src/editor-page-gsettings.c
+++ b/src/editor-page-gsettings.c
@@ -41,6 +41,7 @@ editor_page_gsettings_get_##name (EditorPageSettingsProvider *provider, \
   return TRUE;                                                          \
 }
 
+GSETTINGS_GETTER (int, int, indent_width, "indent-width")
 GSETTINGS_GETTER (guint, uint, tab_width, "tab-width")
 GSETTINGS_GETTER (gboolean, boolean, show_right_margin, "show-right-margin")
 GSETTINGS_GETTER (gboolean, boolean, show_line_numbers, "show-line-numbers")
@@ -172,6 +173,7 @@ page_settings_provider_iface_init (EditorPageSettingsProviderInterface *iface)
   iface->get_show_grid = editor_page_gsettings_get_show_grid;
   iface->get_show_right_margin = editor_page_gsettings_get_show_right_margin;
   iface->get_tab_width = editor_page_gsettings_get_tab_width;
+  iface->get_indent_width = editor_page_gsettings_get_indent_width;
   iface->get_use_system_font = editor_page_gsettings_get_use_system_font;
   iface->get_wrap_text = editor_page_gsettings_get_wrap_text;
   iface->get_auto_indent = editor_page_gsettings_get_auto_indent;


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