[gnome-text-editor] page: add gsetting to enable snippets



commit d6b5ed74977452842673122081dfac9d3c6d92d4
Author: Christian Hergert <chergert redhat com>
Date:   Thu Dec 30 12:41:45 2021 -0800

    page: add gsetting to enable snippets
    
    GtkSourceView can provide snippets for the user based on those registered
    in the datadir, specific to the language enabled. This allows the user to
    set a GSetting to enable the behavior.

 data/org.gnome.TextEditor.gschema.xml | 5 +++++
 src/editor-page.c                     | 4 ++++
 2 files changed, 9 insertions(+)
---
diff --git a/data/org.gnome.TextEditor.gschema.xml b/data/org.gnome.TextEditor.gschema.xml
index 955baa1..6df68be 100644
--- a/data/org.gnome.TextEditor.gschema.xml
+++ b/data/org.gnome.TextEditor.gschema.xml
@@ -142,5 +142,10 @@
       <summary>Draw Spaces</summary>
       <description>The various types of spaces to draw in the editor.</description>
     </key>
+    <key name="enable-snippets" type="b">
+      <default>false</default>
+      <summary>Enable Snippets</summary>
+      <description>Enable the use of snippets registered with GtkSourceView from within the 
editor.</description>
+    </key>
   </schema>
 </schemalist>
diff --git a/src/editor-page.c b/src/editor-page.c
index 10112b8..27e29e9 100644
--- a/src/editor-page.c
+++ b/src/editor-page.c
@@ -416,6 +416,10 @@ editor_page_constructed (GObject *object)
                            G_CONNECT_SWAPPED);
   on_draw_spaces_changed (self, "draw-spaces", app->settings);
 
+  g_settings_bind (app->settings, "enable-snippets",
+                   self->view, "enable-snippets",
+                   G_SETTINGS_BIND_GET);
+
   _editor_page_vim_init (self);
 }
 


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