Commit f1594c39 authored by Matthias Clasen's avatar Matthias Clasen

GtkTextViewAccessible: add a private struct

Move instance fields to a private struct, in preparation
for installing a11y headers.
parent d13b70f7
...@@ -31,6 +31,11 @@ ...@@ -31,6 +31,11 @@
#include "gtktextviewaccessible.h" #include "gtktextviewaccessible.h"
#include "gtk/gtkwidgetprivate.h" #include "gtk/gtkwidgetprivate.h"
struct _GtkTextViewAccessiblePrivate
{
gint insert_offset;
gint selection_bound;
};
static void insert_text_cb (GtkTextBuffer *buffer, static void insert_text_cb (GtkTextBuffer *buffer,
GtkTextIter *arg1, GtkTextIter *arg1,
...@@ -152,11 +157,16 @@ _gtk_text_view_accessible_class_init (GtkTextViewAccessibleClass *klass) ...@@ -152,11 +157,16 @@ _gtk_text_view_accessible_class_init (GtkTextViewAccessibleClass *klass)
class->initialize = gtk_text_view_accessible_initialize; class->initialize = gtk_text_view_accessible_initialize;
widget_class->notify_gtk = gtk_text_view_accessible_notify_gtk; widget_class->notify_gtk = gtk_text_view_accessible_notify_gtk;
g_type_class_add_private (klass, sizeof (GtkTextViewAccessiblePrivate));
} }
static void static void
_gtk_text_view_accessible_init (GtkTextViewAccessible *accessible) _gtk_text_view_accessible_init (GtkTextViewAccessible *accessible)
{ {
accessible->priv = G_TYPE_INSTANCE_GET_PRIVATE (accessible,
GTK_TYPE_TEXT_VIEW_ACCESSIBLE,
GtkTextViewAccessiblePrivate);
} }
static gchar * static gchar *
...@@ -569,7 +579,6 @@ gtk_text_view_accessible_get_run_attributes (AtkText *text, ...@@ -569,7 +579,6 @@ gtk_text_view_accessible_get_run_attributes (AtkText *text,
gdouble scale = 1; gdouble scale = 1;
gboolean val_set = FALSE; gboolean val_set = FALSE;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
if (widget == NULL) if (widget == NULL)
return NULL; return NULL;
...@@ -1715,8 +1724,8 @@ gtk_text_view_accessible_update_cursor (GtkTextViewAccessible *accessible, ...@@ -1715,8 +1724,8 @@ gtk_text_view_accessible_update_cursor (GtkTextViewAccessible *accessible,
int insert_offset, selection_bound; int insert_offset, selection_bound;
GtkTextIter iter; GtkTextIter iter;
prev_insert_offset = accessible->insert_offset; prev_insert_offset = accessible->priv->insert_offset;
prev_selection_bound = accessible->selection_bound; prev_selection_bound = accessible->priv->selection_bound;
gtk_text_buffer_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_insert (buffer)); gtk_text_buffer_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_insert (buffer));
insert_offset = gtk_text_iter_get_offset (&iter); insert_offset = gtk_text_iter_get_offset (&iter);
...@@ -1726,8 +1735,8 @@ gtk_text_view_accessible_update_cursor (GtkTextViewAccessible *accessible, ...@@ -1726,8 +1735,8 @@ gtk_text_view_accessible_update_cursor (GtkTextViewAccessible *accessible,
if (prev_insert_offset == insert_offset && prev_selection_bound == selection_bound) if (prev_insert_offset == insert_offset && prev_selection_bound == selection_bound)
return; return;
accessible->insert_offset = insert_offset; accessible->priv->insert_offset = insert_offset;
accessible->selection_bound = selection_bound; accessible->priv->selection_bound = selection_bound;
if (prev_insert_offset != insert_offset) if (prev_insert_offset != insert_offset)
g_signal_emit_by_name (accessible, "text-caret-moved", insert_offset); g_signal_emit_by_name (accessible, "text-caret-moved", insert_offset);
......
...@@ -29,15 +29,15 @@ G_BEGIN_DECLS ...@@ -29,15 +29,15 @@ G_BEGIN_DECLS
#define GTK_IS_TEXT_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_VIEW_ACCESSIBLE)) #define GTK_IS_TEXT_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_VIEW_ACCESSIBLE))
#define GTK_TEXT_VIEW_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT_VIEW_ACCESSIBLE, GtkTextViewAccessibleClass)) #define GTK_TEXT_VIEW_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT_VIEW_ACCESSIBLE, GtkTextViewAccessibleClass))
typedef struct _GtkTextViewAccessible GtkTextViewAccessible; typedef struct _GtkTextViewAccessible GtkTextViewAccessible;
typedef struct _GtkTextViewAccessibleClass GtkTextViewAccessibleClass; typedef struct _GtkTextViewAccessibleClass GtkTextViewAccessibleClass;
typedef struct _GtkTextViewAccessiblePrivate GtkTextViewAccessiblePrivate;
struct _GtkTextViewAccessible struct _GtkTextViewAccessible
{ {
GtkContainerAccessible parent; GtkContainerAccessible parent;
gint insert_offset; GtkTextViewAccessiblePrivate *priv;
gint selection_bound;
}; };
struct _GtkTextViewAccessibleClass struct _GtkTextViewAccessibleClass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment