[gtk+] GtkEntryAccessible: add a private struct
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkEntryAccessible: add a private struct
- Date: Mon, 15 Oct 2012 10:40:05 +0000 (UTC)
commit 4745adaeff82f61d4f7b863892a6ca889c0b02a7
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Oct 14 15:59:58 2012 -0400
GtkEntryAccessible: add a private struct
Move instance fields to a private struct, in preparation
for installing a11y headers.
gtk/a11y/gtkentryaccessible.c | 34 ++++++++++++++++++++++------------
gtk/a11y/gtkentryaccessible.h | 8 ++++----
2 files changed, 26 insertions(+), 16 deletions(-)
---
diff --git a/gtk/a11y/gtkentryaccessible.c b/gtk/a11y/gtkentryaccessible.c
index d5339e2..bac2b02 100644
--- a/gtk/a11y/gtkentryaccessible.c
+++ b/gtk/a11y/gtkentryaccessible.c
@@ -23,6 +23,12 @@
#include "gtkentryprivate.h"
#include "gtkcomboboxaccessible.h"
+struct _GtkEntryAccessiblePrivate
+{
+ gint cursor_position;
+ gint selection_bound;
+};
+
/* Callbacks */
static void insert_text_cb (GtkEditable *editable,
@@ -109,10 +115,9 @@ gtk_entry_accessible_initialize (AtkObject *obj,
gtk_entry_accessible = GTK_ENTRY_ACCESSIBLE (obj);
entry = GTK_ENTRY (data);
- gtk_editable_get_selection_bounds (GTK_EDITABLE (entry),
- &start_pos, &end_pos);
- gtk_entry_accessible->cursor_position = end_pos;
- gtk_entry_accessible->selection_bound = start_pos;
+ gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start_pos, &end_pos);
+ gtk_entry_accessible->priv->cursor_position = end_pos;
+ gtk_entry_accessible->priv->selection_bound = start_pos;
/* Set up signal callbacks */
g_signal_connect (entry, "insert-text", G_CALLBACK (insert_text_cb), NULL);
@@ -146,7 +151,7 @@ gtk_entry_accessible_notify_gtk (GObject *obj,
* The entry cursor position has moved so generate the signal.
*/
g_signal_emit_by_name (atk_obj, "text-caret-moved",
- entry->cursor_position);
+ entry->priv->cursor_position);
}
else if (g_strcmp0 (pspec->name, "selection-bound") == 0)
{
@@ -199,13 +204,18 @@ _gtk_entry_accessible_class_init (GtkEntryAccessibleClass *klass)
class->get_attributes = gtk_entry_accessible_get_attributes;
widget_class->notify_gtk = gtk_entry_accessible_notify_gtk;
+
+ g_type_class_add_private (klass, sizeof (GtkEntryAccessiblePrivate));
}
static void
_gtk_entry_accessible_init (GtkEntryAccessible *entry)
{
- entry->cursor_position = 0;
- entry->selection_bound = 0;
+ entry->priv = G_TYPE_INSTANCE_GET_PRIVATE (entry,
+ GTK_TYPE_ENTRY_ACCESSIBLE,
+ GtkEntryAccessiblePrivate);
+ entry->priv->cursor_position = 0;
+ entry->priv->selection_bound = 0;
}
static gchar *
@@ -889,8 +899,8 @@ check_for_selection_change (GtkEntryAccessible *accessible,
if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start, &end))
{
- if (end != accessible->cursor_position ||
- start != accessible->selection_bound)
+ if (end != accessible->priv->cursor_position ||
+ start != accessible->priv->selection_bound)
/*
* This check is here as this function can be called
* for notification of selection_bound and current_pos.
@@ -903,11 +913,11 @@ check_for_selection_change (GtkEntryAccessible *accessible,
else
{
/* We had a selection */
- ret_val = (accessible->cursor_position != accessible->selection_bound);
+ ret_val = (accessible->priv->cursor_position != accessible->priv->selection_bound);
}
- accessible->cursor_position = end;
- accessible->selection_bound = start;
+ accessible->priv->cursor_position = end;
+ accessible->priv->selection_bound = start;
return ret_val;
}
diff --git a/gtk/a11y/gtkentryaccessible.h b/gtk/a11y/gtkentryaccessible.h
index ec9dbc7..1883cc5 100644
--- a/gtk/a11y/gtkentryaccessible.h
+++ b/gtk/a11y/gtkentryaccessible.h
@@ -29,15 +29,15 @@ G_BEGIN_DECLS
#define GTK_IS_ENTRY_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ENTRY_ACCESSIBLE))
#define GTK_ENTRY_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ENTRY_ACCESSIBLE, GtkEntryAccessibleClass))
-typedef struct _GtkEntryAccessible GtkEntryAccessible;
-typedef struct _GtkEntryAccessibleClass GtkEntryAccessibleClass;
+typedef struct _GtkEntryAccessible GtkEntryAccessible;
+typedef struct _GtkEntryAccessibleClass GtkEntryAccessibleClass;
+typedef struct _GtkEntryAccessiblePrivate GtkEntryAccessiblePrivate;
struct _GtkEntryAccessible
{
GtkWidgetAccessible parent;
- gint cursor_position;
- gint selection_bound;
+ GtkEntryAccessiblePrivate *priv;
};
struct _GtkEntryAccessibleClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]