diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am index bd20346706..a91d44cce1 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/gailbooleancell.c b/gtk/a11y/gailbooleancell.c deleted file mode 100644 index 81069e8ef8..0000000000 --- a/gtk/a11y/gailbooleancell.c +++ /dev/null @@ -1,119 +0,0 @@ -/* 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 -#include "gailbooleancell.h" - -static void gail_boolean_cell_class_init (GailBooleanCellClass *klass); -static void gail_boolean_cell_init (GailBooleanCell *cell); -/* Misc */ - -static gboolean gail_boolean_cell_update_cache (GailRendererCell *cell, - gboolean emit_change_signal); - -gchar *gail_boolean_cell_property_list[] = { - "active", - "radio", - "sensitive", - NULL -}; - -G_DEFINE_TYPE (GailBooleanCell, gail_boolean_cell, GAIL_TYPE_RENDERER_CELL) - -static void -gail_boolean_cell_class_init (GailBooleanCellClass *klass) -{ - GailRendererCellClass *renderer_cell_class = GAIL_RENDERER_CELL_CLASS (klass); - - renderer_cell_class->update_cache = gail_boolean_cell_update_cache; - renderer_cell_class->property_list = gail_boolean_cell_property_list; -} - -static void -gail_boolean_cell_init (GailBooleanCell *cell) -{ -} - -AtkObject* -gail_boolean_cell_new (void) -{ - GObject *object; - AtkObject *atk_object; - GailRendererCell *cell; - GailBooleanCell *boolean_cell; - - object = g_object_new (GAIL_TYPE_BOOLEAN_CELL, NULL); - - g_return_val_if_fail (object != NULL, NULL); - - atk_object = ATK_OBJECT (object); - atk_object->role = ATK_ROLE_TABLE_CELL; - - cell = GAIL_RENDERER_CELL(object); - boolean_cell = GAIL_BOOLEAN_CELL(object); - - cell->renderer = gtk_cell_renderer_toggle_new (); - g_object_ref_sink (cell->renderer); - boolean_cell->cell_value = FALSE; - boolean_cell->cell_sensitive = TRUE; - return atk_object; -} - -static gboolean -gail_boolean_cell_update_cache (GailRendererCell *cell, - gboolean emit_change_signal) -{ - GailBooleanCell *boolean_cell = GAIL_BOOLEAN_CELL (cell); - gboolean rv = FALSE; - gboolean new_boolean; - gboolean new_sensitive; - - g_object_get (G_OBJECT(cell->renderer), "active", &new_boolean, - "sensitive", &new_sensitive, NULL); - - if (boolean_cell->cell_value != new_boolean) - { - rv = TRUE; - boolean_cell->cell_value = !(boolean_cell->cell_value); - - /* Update cell's state */ - - if (new_boolean) - _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 != new_sensitive) - { - rv = TRUE; - boolean_cell->cell_sensitive = !(boolean_cell->cell_sensitive); - - /* Update cell's state */ - - if (new_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; -} diff --git a/gtk/a11y/gailbooleancell.h b/gtk/a11y/gailbooleancell.h deleted file mode 100644 index 8274c8c4bc..0000000000 --- a/gtk/a11y/gailbooleancell.h +++ /dev/null @@ -1,56 +0,0 @@ -/* 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 __GAIL_BOOLEAN_CELL_H__ -#define __GAIL_BOOLEAN_CELL_H__ - -#include -#include "gailrenderercell.h" - -G_BEGIN_DECLS - -#define GAIL_TYPE_BOOLEAN_CELL (gail_boolean_cell_get_type ()) -#define GAIL_BOOLEAN_CELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_BOOLEAN_CELL, GailBooleanCell)) -#define GAIL_BOOLEAN_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_BOOLEAN_CELL, GailBooleanCellClass)) -#define GAIL_IS_BOOLEAN_CELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_BOOLEAN_CELL)) -#define GAIL_IS_BOOLEAN_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_BOOLEAN_CELL)) -#define GAIL_BOOLEAN_CELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_BOOLEAN_CELL, GailBooleanCellClass)) - -typedef struct _GailBooleanCell GailBooleanCell; -typedef struct _GailBooleanCellClass GailBooleanCellClass; - -struct _GailBooleanCell -{ - GailRendererCell parent; - gboolean cell_value; - gboolean cell_sensitive; -}; - - GType gail_boolean_cell_get_type (void); - -struct _GailBooleanCellClass -{ - GailRendererCellClass parent_class; -}; - -AtkObject *gail_boolean_cell_new (void); - -G_END_DECLS - -#endif /* __GAIL_TREE_VIEW_BOOLEAN_CELL_H__ */ diff --git a/gtk/a11y/gtkbooleancellaccessible.c b/gtk/a11y/gtkbooleancellaccessible.c new file mode 100644 index 0000000000..8874b60c21 --- /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 +#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 0000000000..cd457e8858 --- /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 +#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 9fda31683c..5b981f9ce4 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);