[gnome-builder] source-view: add IdeSourceView:indent-style
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] source-view: add IdeSourceView:indent-style
- Date: Sat, 2 May 2015 09:00:52 +0000 (UTC)
commit 4383734e70c7948fdcb03f8bc9edf37e98ca8e7e
Author: Christian Hergert <christian hergert me>
Date: Sat May 2 01:55:41 2015 -0700
source-view: add IdeSourceView:indent-style
Helper, write-only gproperty to simplify binding file settings to the
source view.
libide/ide-source-view.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 1b05c52..fcff380 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -170,6 +170,7 @@ enum {
PROP_FONT_NAME,
PROP_FONT_DESC,
PROP_HIGHLIGHT_CURRENT_LINE,
+ PROP_INDENT_STYLE,
PROP_INSERT_MATCHING_BRACE,
PROP_MODE_DISPLAY_NAME,
PROP_OVERWRITE,
@@ -4725,6 +4726,20 @@ ignore_invalid_buffers (GBinding *binding,
}
static void
+ide_source_view_set_indent_style (IdeSourceView *self,
+ IdeIndentStyle indent_style)
+{
+ g_assert (IDE_IS_SOURCE_VIEW (self));
+ g_assert ((indent_style == IDE_INDENT_STYLE_SPACES) ||
+ (indent_style == IDE_INDENT_STYLE_TABS));
+
+ if (indent_style == IDE_INDENT_STYLE_SPACES)
+ gtk_source_view_set_insert_spaces_instead_of_tabs (GTK_SOURCE_VIEW (self), TRUE);
+ else
+ gtk_source_view_set_insert_spaces_instead_of_tabs (GTK_SOURCE_VIEW (self), FALSE);
+}
+
+static void
ide_source_view_dispose (GObject *object)
{
IdeSourceView *self = (IdeSourceView *)object;
@@ -4897,6 +4912,10 @@ ide_source_view_set_property (GObject *object,
ide_source_view_set_highlight_current_line (self, g_value_get_boolean (value));
break;
+ case PROP_INDENT_STYLE:
+ ide_source_view_set_indent_style (self, g_value_get_enum (value));
+ break;
+
case PROP_INSERT_MATCHING_BRACE:
ide_source_view_set_insert_matching_brace (self, g_value_get_boolean (value));
break;
@@ -5076,6 +5095,16 @@ ide_source_view_class_init (IdeSourceViewClass *klass)
PROP_HIGHLIGHT_CURRENT_LINE,
"highlight-current-line");
+ gParamSpecs [PROP_INDENT_STYLE] =
+ g_param_spec_enum ("indent-style",
+ _("Indent Style"),
+ _("Indent Style"),
+ IDE_TYPE_INDENT_STYLE,
+ IDE_INDENT_STYLE_TABS,
+ (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class, PROP_INDENT_STYLE,
+ gParamSpecs [PROP_INDENT_STYLE]);
+
gParamSpecs [PROP_INSERT_MATCHING_BRACE] =
g_param_spec_boolean ("insert-matching-brace",
_("Insert Matching Brace"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]