[gtk+] Convert GailBooleanCell to GtkBooleanCellAccessible
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Convert GailBooleanCell to GtkBooleanCellAccessible
- Date: Sun, 10 Jul 2011 03:58:07 +0000 (UTC)
commit 3688c1a2d3d2066a7ff2eda889a825ea07b58078
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jul 9 19:02:42 2011 -0400
Convert GailBooleanCell to GtkBooleanCellAccessible
Including assorted cleanups and _-prefixing of exported API.
gtk/a11y/Makefile.am | 4 +-
gtk/a11y/gailbooleancell.c | 119 -----------------------------------
gtk/a11y/gailbooleancell.h | 56 ----------------
gtk/a11y/gtkbooleancellaccessible.c | 111 ++++++++++++++++++++++++++++++++
gtk/a11y/gtkbooleancellaccessible.h | 55 ++++++++++++++++
gtk/a11y/gtktreeviewaccessible.c | 6 +-
6 files changed, 171 insertions(+), 180 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index bd20346..a91d44c 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -5,7 +5,7 @@ noinst_LTLIBRARIES = libgail.la
gail_c_sources = \
gail.c \
gtkarrowaccessible.c \
- gailbooleancell.c \
+ gtkbooleancellaccessible.c \
gtkboxaccessible.c \
gtkbuttonaccessible.c \
gtkcellaccessible.c \
@@ -57,7 +57,7 @@ libgailincludedir=$(includedir)/gail-3.0/gail
gail_private_h_sources = \
gtkarrowaccessible.h \
- gailbooleancell.h \
+ gtkbooleancellaccessible.h \
gtkboxaccessible.h \
gtkbuttonaccessible.h \
gtkcellaccessible.h \
diff --git a/gtk/a11y/gtkbooleancellaccessible.c b/gtk/a11y/gtkbooleancellaccessible.c
new file mode 100644
index 0000000..8874b60
--- /dev/null
+++ b/gtk/a11y/gtkbooleancellaccessible.c
@@ -0,0 +1,111 @@
+/* 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 "gtkbooleancellaccessible.h"
+
+
+static gchar *property_list[] = {
+ "active",
+ "radio",
+ "sensitive",
+ NULL
+};
+
+G_DEFINE_TYPE (GtkBooleanCellAccessible, _gtk_boolean_cell_accessible, GAIL_TYPE_RENDERER_CELL)
+
+
+static gboolean
+gtk_boolean_cell_accessible_update_cache (GailRendererCell *cell,
+ gboolean emit_change_signal)
+{
+ GtkBooleanCellAccessible *boolean_cell = GTK_BOOLEAN_CELL_ACCESSIBLE (cell);
+ gboolean rv = FALSE;
+ gboolean active;
+ gboolean sensitive;
+
+ g_object_get (G_OBJECT (cell->renderer),
+ "active", &active,
+ "sensitive", &sensitive,
+ NULL);
+
+ if (boolean_cell->cell_value != active)
+ {
+ rv = TRUE;
+ boolean_cell->cell_value = !boolean_cell->cell_value;
+
+ if (active)
+ _gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_CHECKED, emit_change_signal);
+ else
+ _gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_CHECKED, emit_change_signal);
+ }
+
+ if (boolean_cell->cell_sensitive != sensitive)
+ {
+ rv = TRUE;
+ boolean_cell->cell_sensitive = !boolean_cell->cell_sensitive;
+
+ if (sensitive)
+ _gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_SENSITIVE, emit_change_signal);
+ else
+ _gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_SENSITIVE, emit_change_signal);
+ }
+
+ return rv;
+}
+
+static void
+_gtk_boolean_cell_accessible_class_init (GtkBooleanCellAccessibleClass *klass)
+{
+ GailRendererCellClass *renderer_cell_class = GAIL_RENDERER_CELL_CLASS (klass);
+
+ renderer_cell_class->update_cache = gtk_boolean_cell_accessible_update_cache;
+ renderer_cell_class->property_list = property_list;
+}
+
+static void
+_gtk_boolean_cell_accessible_init (GtkBooleanCellAccessible *cell)
+{
+}
+
+AtkObject *
+_gtk_boolean_cell_accessible_new (void)
+{
+ GObject *object;
+ AtkObject *atk_object;
+ GailRendererCell *cell;
+ GtkBooleanCellAccessible *boolean_cell;
+
+ object = g_object_new (GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE, NULL);
+
+ atk_object = ATK_OBJECT (object);
+ atk_object->role = ATK_ROLE_TABLE_CELL;
+
+ cell = GAIL_RENDERER_CELL (object);
+ cell->renderer = gtk_cell_renderer_toggle_new ();
+ g_object_ref_sink (cell->renderer);
+
+ boolean_cell = GTK_BOOLEAN_CELL_ACCESSIBLE (object);
+ boolean_cell->cell_value = FALSE;
+ boolean_cell->cell_sensitive = TRUE;
+
+ return atk_object;
+}
diff --git a/gtk/a11y/gtkbooleancellaccessible.h b/gtk/a11y/gtkbooleancellaccessible.h
new file mode 100644
index 0000000..cd457e8
--- /dev/null
+++ b/gtk/a11y/gtkbooleancellaccessible.h
@@ -0,0 +1,55 @@
+/* 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_BOOLEAN_CELL_ACCESSIBLE_H__
+#define __GTK_BOOLEAN_CELL_ACCESSIBLE_H__
+
+#include <atk/atk.h>
+#include "gailrenderercell.h"
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE (_gtk_boolean_cell_accessible_get_type ())
+#define GTK_BOOLEAN_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE, GtkBooleanCellAccessible))
+#define GTK_BOOLEAN_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_BOOLEAN_CELL, GtkBooleanCellAccessibleClass))
+#define GTK_IS_BOOLEAN_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE))
+#define GTK_IS_BOOLEAN_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE))
+#define GTK_BOOLEAN_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE, GtkBooleanCellAccessibleClass))
+
+typedef struct _GtkBooleanCellAccessible GtkBooleanCellAccessible;
+typedef struct _GtkBooleanCellAccessibleClass GtkBooleanCellAccessibleClass;
+
+struct _GtkBooleanCellAccessible
+{
+ GailRendererCell parent;
+ gboolean cell_value;
+ gboolean cell_sensitive;
+};
+
+struct _GtkBooleanCellAccessibleClass
+{
+ GailRendererCellClass parent_class;
+};
+
+GType _gtk_boolean_cell_accessible_get_type (void);
+AtkObject *_gtk_boolean_cell_accessible_new (void);
+
+G_END_DECLS
+
+#endif /* __GAIL_TREE_VIEW_BOOLEAN_CELL_H__ */
diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c
index 9fda316..5b981f9 100644
--- a/gtk/a11y/gtktreeviewaccessible.c
+++ b/gtk/a11y/gtktreeviewaccessible.c
@@ -26,7 +26,7 @@
#endif
#include "gtktreeviewaccessible.h"
#include "gailrenderercell.h"
-#include "gailbooleancell.h"
+#include "gtkbooleancellaccessible.h"
#include "gailimagecell.h"
#include "gtkcontainercellaccessible.h"
#include "gailtextcell.h"
@@ -610,7 +610,7 @@ gtk_tree_view_accessible_ref_child (AtkObject *obj,
child = gail_text_cell_new ();
}
else if (GTK_IS_CELL_RENDERER_TOGGLE (renderer))
- child = gail_boolean_cell_new ();
+ child = _gtk_boolean_cell_accessible_new ();
else if (GTK_IS_CELL_RENDERER_PIXBUF (renderer))
child = gail_image_cell_new ();
else
@@ -3033,7 +3033,7 @@ static void
add_cell_actions (GtkCellAccessible *cell,
gboolean editable)
{
- if (GAIL_IS_BOOLEAN_CELL (cell))
+ if (GTK_IS_BOOLEAN_CELL_ACCESSIBLE (cell))
_gtk_cell_accessible_add_action (cell,
"toggle", "toggles the cell",
NULL, toggle_cell_toggled);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]