[gtksourceview] style: publicize gtk_source_style_apply()



commit dbfae912bcac21b0464e5935411c514a805c89cb
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Jun 3 14:11:19 2016 +0200

    style: publicize gtk_source_style_apply()
    
    Improve also a little the documentation.
    
    Rationale:
    https://bugzilla.gnome.org/show_bug.cgi?id=626745

 docs/reference/gtksourceview-3.0-sections.txt |    1 +
 gtksourceview/gtksourcebuffer.c               |    6 +++---
 gtksourceview/gtksourcecontextengine.c        |    8 ++++----
 gtksourceview/gtksourcesearchcontext.c        |    6 +++---
 gtksourceview/gtksourcestyle-private.h        |    5 -----
 gtksourceview/gtksourcestyle.c                |   21 ++++++++++++---------
 gtksourceview/gtksourcestyle.h                |    6 +++++-
 gtksourceview/gtksourcestylescheme.c          |    1 +
 8 files changed, 29 insertions(+), 25 deletions(-)
---
diff --git a/docs/reference/gtksourceview-3.0-sections.txt b/docs/reference/gtksourceview-3.0-sections.txt
index f411703..dda07f2 100644
--- a/docs/reference/gtksourceview-3.0-sections.txt
+++ b/docs/reference/gtksourceview-3.0-sections.txt
@@ -713,6 +713,7 @@ gtk_source_search_settings_get_type
 <TITLE>GtkSourceStyle</TITLE>
 GtkSourceStyle
 gtk_source_style_copy
+gtk_source_style_apply
 <SUBSECTION Standard>
 GtkSourceStyleClass
 GTK_SOURCE_TYPE_STYLE
diff --git a/gtksourceview/gtksourcebuffer.c b/gtksourceview/gtksourcebuffer.c
index 6efbbce..5e1dfc1 100644
--- a/gtksourceview/gtksourcebuffer.c
+++ b/gtksourceview/gtksourcebuffer.c
@@ -38,9 +38,9 @@
 #include "gtksourcelanguage-private.h"
 #include "gtksourceundomanager.h"
 #include "gtksourceundomanagerdefault.h"
+#include "gtksourcestyle.h"
 #include "gtksourcestylescheme.h"
 #include "gtksourcestyleschememanager.h"
-#include "gtksourcestyle-private.h"
 #include "gtksourcemark.h"
 #include "gtksourcemarkssequence.h"
 #include "gtksourcesearchcontext.h"
@@ -813,7 +813,7 @@ update_bracket_match_style (GtkSourceBuffer *buffer)
                style = _gtk_source_style_scheme_get_matching_brackets_style (buffer->priv->style_scheme);
        }
 
-       _gtk_source_style_apply (style, buffer->priv->bracket_match_tag);
+       gtk_source_style_apply (style, buffer->priv->bracket_match_tag);
 }
 
 static GtkTextTag *
@@ -3116,7 +3116,7 @@ sync_invalid_char_tag (GtkSourceBuffer *buffer,
                style = gtk_source_style_scheme_get_style (buffer->priv->style_scheme, "def:error");
        }
 
-       _gtk_source_style_apply (style, buffer->priv->invalid_char_tag);
+       gtk_source_style_apply (style, buffer->priv->invalid_char_tag);
 }
 
 static void
diff --git a/gtksourceview/gtksourcecontextengine.c b/gtksourceview/gtksourcecontextengine.c
index 5dcbd31..3500080 100644
--- a/gtksourceview/gtksourcecontextengine.c
+++ b/gtksourceview/gtksourcecontextengine.c
@@ -33,9 +33,9 @@
 #include "gtksourcelanguage-private.h"
 #include "gtksourcebuffer.h"
 #include "gtksourceregex.h"
-#include "gtksourcestyle-private.h"
-#include "gtksourceview-utils.h"
+#include "gtksourcestyle.h"
 #include "gtksourcestylescheme.h"
+#include "gtksourceview-utils.h"
 
 #undef ENABLE_DEBUG
 #undef ENABLE_PROFILE
@@ -645,7 +645,7 @@ set_tag_style (GtkSourceContextEngine *ce,
        g_return_if_fail (GTK_IS_TEXT_TAG (tag));
        g_return_if_fail (style_id != NULL);
 
-       _gtk_source_style_apply (NULL, tag);
+       gtk_source_style_apply (NULL, tag);
 
        if (ce->priv->style_scheme == NULL)
                return;
@@ -675,7 +675,7 @@ set_tag_style (GtkSourceContextEngine *ce,
        /* not having style is fine, since parser checks validity of every style reference,
         * so we don't need to spit a warning here */
        if (style != NULL)
-               _gtk_source_style_apply (style, tag);
+               gtk_source_style_apply (style, tag);
 }
 
 static GtkTextTag *
diff --git a/gtksourceview/gtksourcesearchcontext.c b/gtksourceview/gtksourcesearchcontext.c
index 5aa996c..9676642 100644
--- a/gtksourceview/gtksourcesearchcontext.c
+++ b/gtksourceview/gtksourcesearchcontext.c
@@ -27,8 +27,8 @@
 #include "gtksourcesearchsettings.h"
 #include "gtksourcebuffer.h"
 #include "gtksourcebuffer-private.h"
+#include "gtksourcestyle.h"
 #include "gtksourcestylescheme.h"
-#include "gtksourcestyle-private.h"
 #include "gtksourceutils.h"
 #include "gtksourceregion.h"
 #include "gtksourceview-i18n.h"
@@ -395,7 +395,7 @@ sync_found_tag (GtkSourceSearchContext *search)
 
        if (!search->priv->highlight)
        {
-               _gtk_source_style_apply (NULL, search->priv->found_tag);
+               gtk_source_style_apply (NULL, search->priv->found_tag);
                return;
        }
 
@@ -414,7 +414,7 @@ sync_found_tag (GtkSourceSearchContext *search)
                g_warning ("No match style defined nor 'search-match' style available.");
        }
 
-       _gtk_source_style_apply (style, search->priv->found_tag);
+       gtk_source_style_apply (style, search->priv->found_tag);
 }
 
 static void
diff --git a/gtksourceview/gtksourcestyle-private.h b/gtksourceview/gtksourcestyle-private.h
index 15fefa3..e2c4b58 100644
--- a/gtksourceview/gtksourcestyle-private.h
+++ b/gtksourceview/gtksourcestyle-private.h
@@ -22,7 +22,6 @@
 #ifndef GTK_SOURCE_STYLE_PRIVATE_H
 #define GTK_SOURCE_STYLE_PRIVATE_H
 
-#include "gtksourcestyle.h"
 #include <gtk/gtk.h>
 
 G_BEGIN_DECLS
@@ -68,10 +67,6 @@ struct _GtkSourceStyle
        guint mask : 12;
 };
 
-G_GNUC_INTERNAL
-void            _gtk_source_style_apply        (const GtkSourceStyle *style,
-                                                GtkTextTag           *tag);
-
 G_END_DECLS
 
 #endif  /* GTK_SOURCE_STYLE_PRIVATE_H */
diff --git a/gtksourceview/gtksourcestyle.c b/gtksourceview/gtksourcestyle.c
index 1fffe5f..3713f76 100644
--- a/gtksourceview/gtksourcestyle.c
+++ b/gtksourceview/gtksourcestyle.c
@@ -547,20 +547,23 @@ gtk_source_style_copy (const GtkSourceStyle *style)
 }
 
 /**
- * _gtk_source_style_apply:
- * @style: (allow-none): a #GtkSourceStyle to apply.
+ * gtk_source_style_apply:
+ * @style: (nullable): a #GtkSourceStyle to apply, or %NULL.
  * @tag: a #GtkTextTag to apply styles to.
  *
- * Applies text styles set in @style if it's not %NULL, or
- * unsets style fields in @tag set with _gtk_source_style_apply()
- * if @style is %NULL. Note that it does not touch fields which
- * are not set in @style. To reset everything use @style == %NULL.
+ * This function modifies the #GtkTextTag properties that are related to the
+ * #GtkSourceStyle properties. Other #GtkTextTag properties are left untouched.
  *
- * Since: 2.0
+ * If @style is non-%NULL, applies @style to @tag.
+ *
+ * If @style is %NULL, the related *-set properties of #GtkTextTag are set to
+ * %FALSE.
+ *
+ * Since: 3.22
  */
 void
-_gtk_source_style_apply (const GtkSourceStyle *style,
-                        GtkTextTag           *tag)
+gtk_source_style_apply (const GtkSourceStyle *style,
+                       GtkTextTag           *tag)
 {
        g_return_if_fail (GTK_IS_TEXT_TAG (tag));
 
diff --git a/gtksourceview/gtksourcestyle.h b/gtksourceview/gtksourcestyle.h
index 50da352..9ffa47e 100644
--- a/gtksourceview/gtksourcestyle.h
+++ b/gtksourceview/gtksourcestyle.h
@@ -22,7 +22,7 @@
 #ifndef GTK_SOURCE_STYLE_H
 #define GTK_SOURCE_STYLE_H
 
-#include <glib-object.h>
+#include <gtk/gtk.h>
 #include <gtksourceview/gtksourcetypes.h>
 
 G_BEGIN_DECLS
@@ -42,6 +42,10 @@ GType                 gtk_source_style_get_type      (void) G_GNUC_CONST;
 GTK_SOURCE_AVAILABLE_IN_ALL
 GtkSourceStyle *gtk_source_style_copy          (const GtkSourceStyle *style);
 
+GTK_SOURCE_AVAILABLE_IN_3_22
+void            gtk_source_style_apply         (const GtkSourceStyle *style,
+                                                GtkTextTag           *tag);
+
 G_END_DECLS
 
 #endif  /* GTK_SOURCE_STYLE_H */
diff --git a/gtksourceview/gtksourcestylescheme.c b/gtksourceview/gtksourcestylescheme.c
index ea638de..ffcb8a8 100644
--- a/gtksourceview/gtksourcestylescheme.c
+++ b/gtksourceview/gtksourcestylescheme.c
@@ -25,6 +25,7 @@
 
 #include "gtksourcestylescheme.h"
 #include "gtksourcestyleschememanager.h"
+#include "gtksourcestyle.h"
 #include "gtksourcestyle-private.h"
 #include "gtksourceview.h"
 #include "gtksourcelanguage-private.h"


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