[gtk+] Make GtkTextAttributes private



commit 745c348ff8f07815abaf8b437fb5c914f5c60c85
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Oct 27 13:39:01 2016 -0400

    Make GtkTextAttributes private
    
    This is a problematic struct, and giving direct access to it
    has kept us from making improvements to GtkTextView. Drop it
    from the public API, together with the auxiliary APIs. If
    it turns out that this functionality is needed, we should add
    individual getters.

 gtk/Makefile.am                  |   10 ++----
 gtk/a11y/gtktextviewaccessible.c |    1 +
 gtk/gtktextiter.c                |   69 ++++++++++++++-----------------------
 gtk/gtktextview.c                |   15 --------
 gtk/gtktextview.h                |    4 --
 gtk/gtktextviewprivate.h         |    4 ++
 6 files changed, 34 insertions(+), 69 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 8e17336..8078bcb 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -302,7 +302,6 @@ gtk_public_h_sources =              \
        gtkstyleprovider.h      \
        gtkswitch.h             \
        gtktestutils.h          \
-       gtktextattributes.h     \
        gtktextbuffer.h         \
        gtktextbufferrichtext.h \
        gtktextchild.h          \
@@ -348,11 +347,6 @@ gtk_unix_print_public_h_sources =  \
        gtkunixprint.h
 endif
 
-# Installed header files without compatibility guarantees
-# that are not included in gtk/gtk.h
-gtk_semi_private_h_sources = \
-       gtktextlayout.h
-
 gtk_private_type_h_sources =   \
        gtkcsstypesprivate.h    \
        gtktexthandleprivate.h
@@ -553,12 +547,14 @@ gtk_private_h_sources =           \
        gtkstylepropertyprivate.h \
        gtkstyleproviderprivate.h \
        gtktextattributesprivate.h \
+       gtktextattributes.h     \
        gtktextbtree.h          \
        gtktextbufferprivate.h \
        gtktextbufferserialize.h \
        gtktextchildprivate.h   \
        gtktexthandleprivate.h  \
        gtktextiterprivate.h    \
+       gtktextlayout.h         \
        gtktextmarkprivate.h    \
        gtktextsegment.h        \
        gtktexttagprivate.h     \
@@ -1364,7 +1360,7 @@ gtktestutils.c: gtktypefuncs.c
 lib_LTLIBRARIES = libgtk-4.la
 
 gtkincludedir = $(includedir)/gtk-4.0/gtk
-gtkinclude_HEADERS = $(gtk_public_h_sources) $(gtk_semi_private_h_sources) $(gtk_built_public_sources) 
gtkversion.h
+gtkinclude_HEADERS = $(gtk_public_h_sources) $(gtk_built_public_sources) gtkversion.h
 
 a11yincludedir = $(includedir)/gtk-4.0/gtk/a11y
 a11yinclude_HEADERS= $(a11y_h_sources)
diff --git a/gtk/a11y/gtktextviewaccessible.c b/gtk/a11y/gtktextviewaccessible.c
index 7adcc62..9ff6e14 100644
--- a/gtk/a11y/gtktextviewaccessible.c
+++ b/gtk/a11y/gtktextviewaccessible.c
@@ -30,6 +30,7 @@
 #include <gtk/gtk.h>
 #include "gtktextviewaccessibleprivate.h"
 #include "gtktextbufferprivate.h"
+#include "gtktextviewprivate.h"
 #include "gtk/gtkwidgetprivate.h"
 
 struct _GtkTextViewAccessiblePrivate
diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c
index 3e13d80..e02bf89 100644
--- a/gtk/gtktextiter.c
+++ b/gtk/gtktextiter.c
@@ -1458,6 +1458,32 @@ gtk_text_iter_can_insert (const GtkTextIter *iter,
     }
 }
 
+gboolean
+gtk_text_iter_get_attributes (const GtkTextIter  *iter,
+                              GtkTextAttributes  *values)
+{
+  GtkTextTag** tags;
+  gint tag_count = 0;
+
+  /* Get the tags at this spot */
+  tags = _gtk_text_btree_get_tags (iter, &tag_count);
+
+  /* No tags, use default style */
+  if (tags == NULL || tag_count == 0)
+    {
+      g_free (tags);
+
+      return FALSE;
+    }
+
+  _gtk_text_attributes_fill_from_tags (values,
+                                       tags,
+                                       tag_count);
+
+  g_free (tags);
+
+  return TRUE;
+}
 
 /**
  * gtk_text_iter_get_language:
@@ -1743,49 +1769,6 @@ gtk_text_iter_get_bytes_in_line (const GtkTextIter   *iter)
   return count;
 }
 
-/**
- * gtk_text_iter_get_attributes:
- * @iter: an iterator
- * @values: (out): a #GtkTextAttributes to be filled in
- *
- * Computes the effect of any tags applied to this spot in the
- * text. The @values parameter should be initialized to the default
- * settings you wish to use if no tags are in effect. You’d typically
- * obtain the defaults from gtk_text_view_get_default_attributes().
- *
- * gtk_text_iter_get_attributes() will modify @values, applying the
- * effects of any tags present at @iter. If any tags affected @values,
- * the function returns %TRUE.
- *
- * Returns: %TRUE if @values was modified
- **/
-gboolean
-gtk_text_iter_get_attributes (const GtkTextIter  *iter,
-                              GtkTextAttributes  *values)
-{
-  GtkTextTag** tags;
-  gint tag_count = 0;
-
-  /* Get the tags at this spot */
-  tags = _gtk_text_btree_get_tags (iter, &tag_count);
-
-  /* No tags, use default style */
-  if (tags == NULL || tag_count == 0)
-    {
-      g_free (tags);
-
-      return FALSE;
-    }
-
-  _gtk_text_attributes_fill_from_tags (values,
-                                       tags,
-                                       tag_count);
-
-  g_free (tags);
-
-  return TRUE;
-}
-
 /*
  * Increments/decrements
  */
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index f0d8cb3..75b50b9 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -7928,21 +7928,6 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
     }
 }
 
-/**
- * gtk_text_view_get_default_attributes:
- * @text_view: a #GtkTextView
- * 
- * Obtains a copy of the default text attributes. These are the
- * attributes used for text unless a tag overrides them.
- * You’d typically pass the default attributes in to
- * gtk_text_iter_get_attributes() in order to get the
- * attributes in effect at a given text position.
- *
- * The return value is a copy owned by the caller of this function,
- * and should be freed with gtk_text_attributes_unref().
- * 
- * Returns: a new #GtkTextAttributes
- **/
 GtkTextAttributes*
 gtk_text_view_get_default_attributes (GtkTextView *text_view)
 {
diff --git a/gtk/gtktextview.h b/gtk/gtktextview.h
index cf57944..7d1f9be 100644
--- a/gtk/gtktextview.h
+++ b/gtk/gtktextview.h
@@ -431,10 +431,6 @@ void             gtk_text_view_set_tabs               (GtkTextView      *text_vi
 GDK_AVAILABLE_IN_ALL
 PangoTabArray*   gtk_text_view_get_tabs               (GtkTextView      *text_view);
 
-/* note that the return value of this changes with the theme */
-GDK_AVAILABLE_IN_ALL
-GtkTextAttributes* gtk_text_view_get_default_attributes (GtkTextView    *text_view);
-
 GDK_AVAILABLE_IN_3_6
 void             gtk_text_view_set_input_purpose      (GtkTextView      *text_view,
                                                        GtkInputPurpose   purpose);
diff --git a/gtk/gtktextviewprivate.h b/gtk/gtktextviewprivate.h
index 9eddfd8..1f23cc4 100644
--- a/gtk/gtktextviewprivate.h
+++ b/gtk/gtktextviewprivate.h
@@ -20,6 +20,7 @@
 #define __GTK_TEXT_VIEW_PRIVATE_H__
 
 #include "gtktextview.h"
+#include "gtktextattributes.h"
 #include "gtkcssnodeprivate.h"
 
 G_BEGIN_DECLS
@@ -27,6 +28,9 @@ G_BEGIN_DECLS
 GtkCssNode *    gtk_text_view_get_text_node             (GtkTextView *text_view);
 GtkCssNode *    gtk_text_view_get_selection_node        (GtkTextView *text_view);
 
+GtkTextAttributes * gtk_text_view_get_default_attributes (GtkTextView *text_view);
+
+
 G_END_DECLS
 
 #endif /* __GTK_TEXT_VIEW_PRIVATE_H__ */


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