[gtk+] Convert GailContainerCell to GtkContainerCellAccessible
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Convert GailContainerCell to GtkContainerCellAccessible
- Date: Sun, 10 Jul 2011 03:58:02 +0000 (UTC)
commit 1da67a22983cad1e7e6227dcae2af1ed0fee21b7
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jul 9 18:51:27 2011 -0400
Convert GailContainerCell to GtkContainerCellAccessible
Including assorted cleanups and _-prefixing of exported API.
gtk/a11y/Makefile.am | 4 +-
gtk/a11y/gailcontainercell.c | 172 ---------------------------------
gtk/a11y/gailcontainercell.h | 62 ------------
gtk/a11y/gtkcellaccessible.c | 6 +-
gtk/a11y/gtkcontainercellaccessible.c | 149 ++++++++++++++++++++++++++++
gtk/a11y/gtkcontainercellaccessible.h | 60 ++++++++++++
gtk/a11y/gtktreeviewaccessible.c | 22 ++--
7 files changed, 225 insertions(+), 250 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index 89682f2..bd20346 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -14,7 +14,7 @@ gail_c_sources = \
gtkchecksubmenuitemaccessible.c \
gtkcomboboxaccessible.c \
gtkcontaineraccessible.c \
- gailcontainercell.c \
+ gtkcontainercellaccessible.c \
gtkentryaccessible.c \
gtkexpanderaccessible.c \
gtkframeaccessible.c \
@@ -66,7 +66,7 @@ gail_private_h_sources = \
gtkchecksubmenuitemaccessible.h \
gtkcomboboxaccessible.h \
gtkcontaineraccessible.h \
- gailcontainercell.h \
+ gtkcontainercellaccessible.h \
gtkentryaccessible.h \
gtkexpanderaccessible.h \
gtkframeaccessible.h \
diff --git a/gtk/a11y/gtkcellaccessible.c b/gtk/a11y/gtkcellaccessible.c
index d40a525..6d12d60 100644
--- a/gtk/a11y/gtkcellaccessible.c
+++ b/gtk/a11y/gtkcellaccessible.c
@@ -20,7 +20,7 @@
#include "config.h"
#include <gtk/gtk.h>
-#include "gailcontainercell.h"
+#include "gtkcontainercellaccessible.h"
#include "gtkcellaccessible.h"
#include "gailcellparent.h"
@@ -189,7 +189,7 @@ _gtk_cell_accessible_add_state (GtkCellAccessible *cell,
* change to it also
*/
parent = atk_object_get_parent (ATK_OBJECT (cell));
- if (GAIL_IS_CONTAINER_CELL (parent))
+ if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent))
_gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (parent), state_type, emit_signal);
return rc;
@@ -225,7 +225,7 @@ _gtk_cell_accessible_remove_state (GtkCellAccessible *cell,
/* If the parent is a flyweight container cell, propagate the state
* change to it also
*/
- if (GAIL_IS_CONTAINER_CELL (parent))
+ if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent))
_gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (parent), state_type, emit_signal);
return rc;
diff --git a/gtk/a11y/gtkcontainercellaccessible.c b/gtk/a11y/gtkcontainercellaccessible.c
new file mode 100644
index 0000000..ad5bdb4
--- /dev/null
+++ b/gtk/a11y/gtkcontainercellaccessible.c
@@ -0,0 +1,149 @@
+/* GAIL - The GNOME Accessibility Enabling Library
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library 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 of the License, or (at your option) any later version.
+ *
+ * This library 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include "gtkcontainercellaccessible.h"
+
+
+G_DEFINE_TYPE (GtkContainerCellAccessible, _gtk_container_cell_accessible, GTK_TYPE_CELL_ACCESSIBLE)
+
+
+static void
+gtk_container_cell_accessible_finalize (GObject *obj)
+{
+ GtkContainerCellAccessible *container = GTK_CONTAINER_CELL_ACCESSIBLE (obj);
+
+ g_list_free_full (container->children, g_object_unref);
+
+ G_OBJECT_CLASS (_gtk_container_cell_accessible_parent_class)->finalize (obj);
+}
+
+
+static gint
+gtk_container_cell_accessible_get_n_children (AtkObject *obj)
+{
+ GtkContainerCellAccessible *cell = GTK_CONTAINER_CELL_ACCESSIBLE (obj);
+
+ return cell->NChildren;
+}
+
+static AtkObject *
+gtk_container_cell_accessible_ref_child (AtkObject *obj,
+ gint child)
+{
+ GtkContainerCellAccessible *cell = GTK_CONTAINER_CELL_ACCESSIBLE (obj);
+ GList *l;
+
+ l = g_list_nth (cell->children, child);
+ if (l == NULL)
+ return NULL;
+
+ return g_object_ref (ATK_OBJECT (l->data));
+}
+
+static void
+_gtk_container_cell_accessible_class_init (GtkContainerCellAccessibleClass *klass)
+{
+ AtkObjectClass *class = ATK_OBJECT_CLASS(klass);
+ GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
+
+ g_object_class->finalize = gtk_container_cell_accessible_finalize;
+
+ class->get_n_children = gtk_container_cell_accessible_get_n_children;
+ class->ref_child = gtk_container_cell_accessible_ref_child;
+}
+
+static void
+_gtk_container_cell_accessible_init (GtkContainerCellAccessible *cell)
+{
+}
+
+GtkContainerCellAccessible *
+_gtk_container_cell_accessible_new (void)
+{
+ GObject *object;
+ AtkObject *atk_object;
+ GtkContainerCellAccessible *container;
+
+ object = g_object_new (GTK_TYPE_CONTAINER_CELL_ACCESSIBLE, NULL);
+
+ g_return_val_if_fail (object != NULL, NULL);
+
+ atk_object = ATK_OBJECT (object);
+ atk_object->role = ATK_ROLE_TABLE_CELL;
+
+ container = GTK_CONTAINER_CELL_ACCESSIBLE (object);
+ container->children = NULL;
+ container->NChildren = 0;
+ return container;
+}
+
+static void
+recompute_child_indices (GtkContainerCellAccessible *container)
+{
+ gint cur_index = 0;
+ GList *l;
+
+ for (l = container->children; l; l = l->next)
+ {
+ GTK_CELL_ACCESSIBLE (l->data)->index = cur_index;
+ cur_index++;
+ }
+}
+
+static void
+refresh_child_index (GtkCellAccessible *cell)
+{
+ AtkObject *parent;
+
+ parent = atk_object_get_parent (ATK_OBJECT (cell));
+
+ recompute_child_indices (GTK_CONTAINER_CELL_ACCESSIBLE (parent));
+}
+
+void
+_gtk_container_cell_accessible_add_child (GtkContainerCellAccessible *container,
+ GtkCellAccessible *child)
+{
+ gint child_index;
+
+ g_return_if_fail (GTK_IS_CONTAINER_CELL_ACCESSIBLE (container));
+ g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (child));
+
+ child_index = container->NChildren++;
+ container->children = g_list_append (container->children, child);
+ child->index = child_index;
+ atk_object_set_parent (ATK_OBJECT (child), ATK_OBJECT (container));
+ child->refresh_index = refresh_child_index;
+}
+
+void
+_gtk_container_cell_accessible_remove_child (GtkContainerCellAccessible *container,
+ GtkCellAccessible *child)
+{
+ g_return_if_fail (GTK_IS_CONTAINER_CELL_ACCESSIBLE (container));
+ g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (child));
+ g_return_if_fail (container->NChildren > 0);
+
+ container->children = g_list_remove (container->children, child);
+ recompute_child_indices (container);
+ container->NChildren--;
+}
diff --git a/gtk/a11y/gtkcontainercellaccessible.h b/gtk/a11y/gtkcontainercellaccessible.h
new file mode 100644
index 0000000..3690910
--- /dev/null
+++ b/gtk/a11y/gtkcontainercellaccessible.h
@@ -0,0 +1,60 @@
+/* GAIL - The GNOME Accessibility Enabling Library
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTK_CONTAINER_CELL_ACCESSIBLE_H__
+#define __GTK_CONTAINER_CELL_ACCESSIBLE_H__
+
+#include <atk/atk.h>
+#include "gtkcellaccessible.h"
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_CONTAINER_CELL_ACCESSIBLE (_gtk_container_cell_accessible_get_type ())
+#define GTK_CONTAINER_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE, GtkContainerCellAccessible))
+#define GTK_CONTAINER_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE, GtkContainerCellAccessibleClass))
+#define GTK_IS_CONTAINER_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE))
+#define GTK_IS_CONTAINER_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE))
+#define GTK_CONTAINER_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE, GtkContainerCellAccessibleClass))
+
+typedef struct _GtkContainerCellAccessible GtkContainerCellAccessible;
+typedef struct _GtkContainerCellAccessibleClass GtkContainerCellAccessibleClass;
+
+struct _GtkContainerCellAccessible
+{
+ GtkCellAccessible parent;
+ GList *children;
+ gint NChildren;
+};
+
+struct _GtkContainerCellAccessibleClass
+{
+ GtkCellAccessibleClass parent_class;
+};
+
+GType _gtk_container_cell_accessible_get_type (void);
+
+GtkContainerCellAccessible *_gtk_container_cell_accessible_new (void);
+void _gtk_container_cell_accessible_add_child (GtkContainerCellAccessible *container,
+ GtkCellAccessible *child);
+void _gtk_container_cell_accessible_remove_child (GtkContainerCellAccessible *container,
+ GtkCellAccessible *child);
+
+G_END_DECLS
+
+#endif /* __GTK_CONTAINER_CELL_ACCESSIBLE_H__ */
diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c
index 0a093b9..9fda316 100644
--- a/gtk/a11y/gtktreeviewaccessible.c
+++ b/gtk/a11y/gtktreeviewaccessible.c
@@ -28,7 +28,7 @@
#include "gailrenderercell.h"
#include "gailbooleancell.h"
#include "gailimagecell.h"
-#include "gailcontainercell.h"
+#include "gtkcontainercellaccessible.h"
#include "gailtextcell.h"
#include "gailcellparent.h"
@@ -483,7 +483,7 @@ gtk_tree_view_accessible_ref_child (AtkObject *obj,
GtkTreeViewColumn *expander_tv;
GList *renderer_list;
GList *l;
- GailContainerCell *container = NULL;
+ GtkContainerCellAccessible *container = NULL;
GailRendererCell *renderer_cell;
gboolean is_expander, is_expanded, retval;
gboolean editable = FALSE;
@@ -552,7 +552,7 @@ gtk_tree_view_accessible_ref_child (AtkObject *obj,
{
GtkCellAccessible *container_cell;
- container = gail_container_cell_new ();
+ container = _gtk_container_cell_accessible_new ();
container_cell = GTK_CELL_ACCESSIBLE (container);
_gtk_cell_accessible_initialise (container_cell, widget, ATK_OBJECT (accessible), i);
@@ -625,7 +625,7 @@ gtk_tree_view_accessible_ref_child (AtkObject *obj,
_gtk_cell_accessible_initialise (cell, widget, parent, i);
if (container)
- gail_container_cell_add_child (container, cell);
+ _gtk_container_cell_accessible_add_child (container, cell);
else
cell->refresh_index = refresh_cell_index;
@@ -1491,7 +1491,7 @@ gtk_tree_view_accessible_grab_cell_focus (GailCellParent *parent,
tv_col = cell_info->cell_col_ref;
if (parent_cell != ATK_OBJECT (parent))
{
- /* GtkCellAccessible is in a GailContainerCell.
+ /* GtkCellAccessible is in a GtkContainerCellAccessible.
* The GtkTreeViewColumn has multiple renderers;
* find the corresponding one.
*/
@@ -2417,7 +2417,7 @@ update_cell_value (GailRendererCell *renderer_cell,
{
parent = atk_object_get_parent (ATK_OBJECT (cell));
- if (GAIL_IS_CONTAINER_CELL (parent))
+ if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent))
cur_renderer = g_list_nth (renderers, cell->index);
else
cur_renderer = renderers;
@@ -3011,7 +3011,7 @@ set_expand_state (GtkTreeView *tree_view,
_gtk_cell_accessible_remove_state (cell, ATK_STATE_EXPANDED, TRUE);
if (_gtk_cell_accessible_remove_state (cell, ATK_STATE_EXPANDABLE, TRUE))
/* The state may have been propagated to the container cell */
- if (!GAIL_IS_CONTAINER_CELL (cell))
+ if (!GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell))
_gtk_cell_accessible_remove_action_by_name (cell,
"expand or contract");
}
@@ -3056,7 +3056,7 @@ toggle_cell_expanded (GtkCellAccessible *cell)
AtkStateSet *stateset;
parent = atk_object_get_parent (ATK_OBJECT (cell));
- if (GAIL_IS_CONTAINER_CELL (parent))
+ if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent))
parent = atk_object_get_parent (parent);
cell_info = find_cell_info (GTK_TREE_VIEW_ACCESSIBLE (parent), cell, TRUE);
@@ -3088,7 +3088,7 @@ toggle_cell_toggled (GtkCellAccessible *cell)
gboolean is_container_cell = FALSE;
parent = atk_object_get_parent (ATK_OBJECT (cell));
- if (GAIL_IS_CONTAINER_CELL (parent))
+ if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent))
{
is_container_cell = TRUE;
parent = atk_object_get_parent (parent);
@@ -3132,7 +3132,7 @@ edit_cell (GtkCellAccessible *cell)
AtkObject *parent;
parent = atk_object_get_parent (ATK_OBJECT (cell));
- if (GAIL_IS_CONTAINER_CELL (parent))
+ if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent))
parent = atk_object_get_parent (parent);
cell_info = find_cell_info (GTK_TREE_VIEW_ACCESSIBLE (parent), cell, TRUE);
@@ -3156,7 +3156,7 @@ activate_cell (GtkCellAccessible *cell)
AtkObject *parent;
parent = atk_object_get_parent (ATK_OBJECT (cell));
- if (GAIL_IS_CONTAINER_CELL (parent))
+ if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent))
parent = atk_object_get_parent (parent);
cell_info = find_cell_info (GTK_TREE_VIEW_ACCESSIBLE (parent), cell, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]