[gnome-builder] GbSourceView: use default auto-indentor if override is not available.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] GbSourceView: use default auto-indentor if override is not available.
- Date: Thu, 18 Dec 2014 06:19:59 +0000 (UTC)
commit 4dfc10b36f9d0b79cd399d718fb8f4c59acbc9ca
Author: Christian Hergert <christian hergert me>
Date: Wed Dec 17 22:19:53 2014 -0800
GbSourceView: use default auto-indentor if override is not available.
src/editor/gb-source-view.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-source-view.c b/src/editor/gb-source-view.c
index 6b88589..d1137ff 100644
--- a/src/editor/gb-source-view.c
+++ b/src/editor/gb-source-view.c
@@ -1071,6 +1071,11 @@ gb_source_view_reload_auto_indenter (GbSourceView *view)
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
language = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (buffer));
+ /*
+ * Disable default auto indenter.
+ */
+ gtk_source_view_set_auto_indent (GTK_SOURCE_VIEW (view), FALSE);
+
if (language)
{
const gchar *lang_id;
@@ -1088,6 +1093,15 @@ gb_source_view_reload_auto_indenter (GbSourceView *view)
g_clear_object (&view->priv->auto_indenter);
view->priv->auto_indenter = auto_indenter;
+
+ /*
+ * Fallback to built in auto indenter if necessary.
+ */
+ if (view->priv->auto_indent && !view->priv->auto_indenter)
+ {
+ g_print ("Falling back to basic auto indent.\n");
+ gtk_source_view_set_auto_indent (GTK_SOURCE_VIEW (view), TRUE);
+ }
}
static void
@@ -1869,6 +1883,7 @@ gb_source_view_set_property (GObject *object,
{
case PROP_AUTO_INDENT:
view->priv->auto_indent = g_value_get_boolean (value);
+ gb_source_view_reload_auto_indenter (view);
break;
case PROP_ENABLE_WORD_COMPLETION:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]