[gnome-builder] settings: add option for triming trailing whitespace
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] settings: add option for triming trailing whitespace
- Date: Tue, 2 Dec 2014 04:26:19 +0000 (UTC)
commit 0e3b40b919d378af637dfade46fe876e83433cf0
Author: Christian Hergert <christian hergert me>
Date: Mon Dec 1 20:08:33 2014 -0800
settings: add option for triming trailing whitespace
src/editor/gb-editor-settings-widget.c | 5 +++
src/resources/ui/gb-editor-settings-widget.ui | 41 ++++++++++++++++++++-----
2 files changed, 38 insertions(+), 8 deletions(-)
---
diff --git a/src/editor/gb-editor-settings-widget.c b/src/editor/gb-editor-settings-widget.c
index f3c5824..31a8d0d 100644
--- a/src/editor/gb-editor-settings-widget.c
+++ b/src/editor/gb-editor-settings-widget.c
@@ -35,6 +35,7 @@ struct _GbEditorSettingsWidgetPrivate
GtkCheckButton *smart_home_end;
GtkSpinButton *right_margin_position;
GtkSpinButton *tab_width;
+ GtkCheckButton *trim_trailing_whitespace;
};
G_DEFINE_TYPE_WITH_PRIVATE (GbEditorSettingsWidget, gb_editor_settings_widget,
@@ -111,6 +112,9 @@ gb_editor_settings_widget_set_language (GbEditorSettingsWidget *widget,
g_settings_bind (priv->settings, "tab-width",
priv->tab_width, "value",
G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (priv->settings, "trim-trailing-whitespace",
+ priv->trim_trailing_whitespace, "active",
+ G_SETTINGS_BIND_DEFAULT);
g_object_notify_by_pspec (G_OBJECT (widget), gParamSpecs [PROP_LANGUAGE]);
}
@@ -188,6 +192,7 @@ gb_editor_settings_widget_class_init (GbEditorSettingsWidgetClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GbEditorSettingsWidget, show_right_margin);
gtk_widget_class_bind_template_child_private (widget_class, GbEditorSettingsWidget, smart_home_end);
gtk_widget_class_bind_template_child_private (widget_class, GbEditorSettingsWidget, tab_width);
+ gtk_widget_class_bind_template_child_private (widget_class, GbEditorSettingsWidget,
trim_trailing_whitespace);
gParamSpecs [PROP_LANGUAGE] =
g_param_spec_string ("language",
diff --git a/src/resources/ui/gb-editor-settings-widget.ui b/src/resources/ui/gb-editor-settings-widget.ui
index ca0779b..034084b 100644
--- a/src/resources/ui/gb-editor-settings-widget.ui
+++ b/src/resources/ui/gb-editor-settings-widget.ui
@@ -34,9 +34,10 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
+ <property name="halign">start</property>
<property name="valign">center</property>
<property name="use_underline">True</property>
- <property name="halign">start</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -56,9 +57,10 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
+ <property name="halign">start</property>
<property name="valign">baseline</property>
<property name="use_underline">True</property>
- <property name="halign">start</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -96,9 +98,10 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
+ <property name="halign">start</property>
<property name="valign">center</property>
<property name="use_underline">True</property>
- <property name="halign">start</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -113,8 +116,9 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="valign">center</property>
<property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -123,6 +127,23 @@
<property name="position">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="trim_trailing_whitespace">
+ <property name="label" translatable="yes">Trim trailing whitespace when saving
document</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left_attach">0</property>
@@ -155,10 +176,11 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
+ <property name="halign">start</property>
<property name="valign">center</property>
<property name="margin_start">12</property>
<property name="use_underline">True</property>
- <property name="halign">start</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -173,10 +195,11 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
+ <property name="halign">start</property>
<property name="valign">center</property>
<property name="margin_start">12</property>
<property name="use_underline">True</property>
- <property name="halign">start</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -261,10 +284,11 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
+ <property name="halign">start</property>
<property name="valign">center</property>
<property name="margin_start">12</property>
<property name="use_underline">True</property>
- <property name="halign">start</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -279,10 +303,11 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
+ <property name="halign">start</property>
<property name="valign">center</property>
<property name="margin_start">12</property>
<property name="use_underline">True</property>
- <property name="halign">start</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]