[gnome-builder/gnome-builder-3-28] file-settings: add setting for auto-indenting a file
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-28] file-settings: add setting for auto-indenting a file
- Date: Mon, 26 Mar 2018 05:25:04 +0000 (UTC)
commit 348491634f12714d3aacbe8fb7aeb93cb0375517
Author: Christian Hergert <chergert redhat com>
Date: Sun Mar 25 22:21:34 2018 -0700
file-settings: add setting for auto-indenting a file
We already have this setting in gsettings, and need a convenient way to
apply it to the source editor. With everything else already proxied from
the IdeFileSettings backends, we might as well store this there too.
src/libide/editor/ide-editor-properties.ui | 2 +-
src/libide/files/ide-file-settings.defs | 11 +++++++++++
src/libide/gsettings/ide-gsettings-file-settings.c | 1 +
src/libide/sourceview/ide-source-view.c | 2 ++
4 files changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/editor/ide-editor-properties.ui b/src/libide/editor/ide-editor-properties.ui
index 2d807e908..423d288bc 100644
--- a/src/libide/editor/ide-editor-properties.ui
+++ b/src/libide/editor/ide-editor-properties.ui
@@ -228,7 +228,7 @@
<property name="margin-top">6</property>
<property name="visible">true</property>
<property name="halign">fill</property>
- <property name="action-name">source-view.auto-indent</property>
+ <property name="action-name">file-settings.auto-indent</property>
<child>
<object class="GtkLabel">
<property name="visible">true</property>
diff --git a/src/libide/files/ide-file-settings.defs b/src/libide/files/ide-file-settings.defs
index 548cc39d0..4682acc0b 100644
--- a/src/libide/files/ide-file-settings.defs
+++ b/src/libide/files/ide-file-settings.defs
@@ -34,6 +34,17 @@ IDE_FILE_SETTINGS_PROPERTY (INDENT_WIDTH, indent_width,
priv->indent_width = indent_width;,
int)
+IDE_FILE_SETTINGS_PROPERTY (AUTO_INDENT, auto_indent,
+ gboolean, gboolean,
+ "auto-indent",
+ g_param_spec_boolean ("auto-indent",
+ "Auto Indent",
+ "If the the auto-indenter should be enabled",
+ FALSE,
+ (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)),
+ priv->auto_indent = !!auto_indent;,
+ boolean)
+
IDE_FILE_SETTINGS_PROPERTY (INSERT_TRAILING_NEWLINE, insert_trailing_newline,
gboolean, gboolean,
"insert-trailing-newline",
diff --git a/src/libide/gsettings/ide-gsettings-file-settings.c
b/src/libide/gsettings/ide-gsettings-file-settings.c
index 17387d9ee..083330be4 100644
--- a/src/libide/gsettings/ide-gsettings-file-settings.c
+++ b/src/libide/gsettings/ide-gsettings-file-settings.c
@@ -89,6 +89,7 @@ spaces_style_get (GValue *value,
}
static SettingsMapping language_mappings [] = {
+ { "auto-indent", "auto-indent", NULL },
{ "indent-width", "indent-width", NULL },
{ "insert-spaces-instead-of-tabs", "indent-style", indent_style_get },
{ "right-margin-position", "right-margin-position", NULL },
diff --git a/src/libide/sourceview/ide-source-view.c b/src/libide/sourceview/ide-source-view.c
index c8749d2fa..8bb16e74e 100644
--- a/src/libide/sourceview/ide-source-view.c
+++ b/src/libide/sourceview/ide-source-view.c
@@ -6718,6 +6718,8 @@ ide_source_view_init (IdeSourceView *self)
0);
priv->file_setting_bindings = dzl_binding_group_new ();
+ dzl_binding_group_bind (priv->file_setting_bindings, "auto-indent",
+ self, "auto-indent", G_BINDING_SYNC_CREATE);
dzl_binding_group_bind (priv->file_setting_bindings, "indent-width",
self, "indent-width", G_BINDING_SYNC_CREATE);
dzl_binding_group_bind (priv->file_setting_bindings, "tab-width",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]