[gtksourceview] tag: add accessor to avoid checking GObject properties



commit 89fd556d5303584267dda34700870867f2700083
Author: Christian Hergert <christian hergert me>
Date:   Sat Apr 23 18:55:05 2016 -0700

    tag: add accessor to avoid checking GObject properties
    
    Where we do check this property, we were only checking for draw_spaces_set,
    so this gives us a single check to know if both the field is set and we
    care about using it to draw spaces.

 gtksourceview/Makefile.am            |    1 +
 gtksourceview/gtksourcetag-private.h |   36 ++++++++++++++++++++++++++++++++++
 gtksourceview/gtksourcetag.c         |   11 ++++++++++
 3 files changed, 48 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/Makefile.am b/gtksourceview/Makefile.am
index c6b0946..ad07738 100644
--- a/gtksourceview/Makefile.am
+++ b/gtksourceview/Makefile.am
@@ -115,6 +115,7 @@ libgtksourceview_private_headers =          \
        gtksourcepixbufhelper.h                 \
        gtksourceregex.h                        \
        gtksourcestyle-private.h                \
+       gtksourcetag-private.h                  \
        gtksourcetypes-private.h                \
        gtksourceundomanagerdefault.h           \
        gtksourceview-i18n.h                    \
diff --git a/gtksourceview/gtksourcetag-private.h b/gtksourceview/gtksourcetag-private.h
new file mode 100644
index 0000000..2fec6f5
--- /dev/null
+++ b/gtksourceview/gtksourcetag-private.h
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*- */
+/* gtksourcetag-private.h
+ * This file is part of GtkSourceView
+ *
+ * Copyright (C) 2016 - Christian Hergert <chergert redhat com>
+ *
+ * GtkSourceView is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * GtkSourceView is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __GTK_SOURCE_TAG_PRIVATE_H__
+#define __GTK_SOURCE_TAG_PRIVATE_H__
+
+#include <gtk/gtk.h>
+#include "gtksourcetypes.h"
+#include "gtksourcetypes-private.h"
+
+G_BEGIN_DECLS
+
+GTK_SOURCE_INTERNAL
+gboolean _gtk_source_tag_effects_spaces (GtkSourceTag *tag);
+
+G_END_DECLS
+
+#endif /* __GTK_SOURCE_TAG_PRIVATE_H__ */
diff --git a/gtksourceview/gtksourcetag.c b/gtksourceview/gtksourcetag.c
index a9f297b..7603b21 100644
--- a/gtksourceview/gtksourcetag.c
+++ b/gtksourceview/gtksourcetag.c
@@ -26,6 +26,7 @@
 #endif
 
 #include "gtksourcetag.h"
+#include "gtksourcetag-private.h"
 
 /**
  * SECTION:tag
@@ -184,3 +185,13 @@ gtk_source_tag_new (const gchar *name)
                             "name", name,
                             NULL);
 }
+
+gboolean
+_gtk_source_tag_effects_spaces (GtkSourceTag *tag)
+{
+       GtkSourceTagPrivate *priv;
+
+       priv = gtk_source_tag_get_instance_private (tag);
+
+       return priv->draw_spaces_set && priv->draw_spaces;
+}


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