From a129392bb4cd92aaa9be3ab8a1e8a9fb0511a424 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 26 Jun 2011 22:13:15 -0400 Subject: [PATCH] Convert GailFrame to GtkFrameAccessible --- gtk/a11y/Makefile.am | 4 +- gtk/a11y/gail.c | 3 -- gtk/a11y/gailframe.c | 85 ----------------------------------- gtk/a11y/gailframe.h | 51 --------------------- gtk/a11y/gtkframeaccessible.c | 67 +++++++++++++++++++++++++++ gtk/a11y/gtkframeaccessible.h | 51 +++++++++++++++++++++ gtk/gtkframe.c | 3 ++ 7 files changed, 123 insertions(+), 141 deletions(-) delete mode 100644 gtk/a11y/gailframe.c delete mode 100644 gtk/a11y/gailframe.h create mode 100644 gtk/a11y/gtkframeaccessible.c create mode 100644 gtk/a11y/gtkframeaccessible.h diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am index 6031514c67..a41c16bad6 100644 --- a/gtk/a11y/Makefile.am +++ b/gtk/a11y/Makefile.am @@ -18,7 +18,7 @@ gail_c_sources = \ gailcontainercell.c \ gtkentryaccessible.c \ gailexpander.c \ - gailframe.c \ + gtkframeaccessible.c \ gailimage.c \ gailimagecell.c \ gtklabelaccessible.c \ @@ -70,7 +70,7 @@ gail_private_h_sources = \ gtkentryaccessible.h \ gailexpander.h \ gailfactory.h \ - gailframe.h \ + gtkframeaccessible.h \ gailimage.h \ gailimagecell.h \ gtklabelaccessible.h \ diff --git a/gtk/a11y/gail.c b/gtk/a11y/gail.c index ed1b3e841e..3160cf2a15 100644 --- a/gtk/a11y/gail.c +++ b/gtk/a11y/gail.c @@ -32,7 +32,6 @@ #include "gailcontainer.h" #include "gailcontainercell.h" #include "gailexpander.h" -#include "gailframe.h" #include "gailimage.h" #include "gailimagecell.h" #include "gaillinkbutton.h" @@ -121,7 +120,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_STATUSBAR, GailStatusbar, gail_statusbar, GTK_ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_NOTEBOOK, GailNotebook, gail_notebook, GTK_TYPE_NOTEBOOK) GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_PROGRESS_BAR, GailProgressBar, gail_progress_bar, GTK_TYPE_PROGRESS_BAR) GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_TREE_VIEW, GailTreeView, gail_tree_view, GTK_TYPE_TREE_VIEW) -GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_FRAME, GailFrame, gail_frame, GTK_TYPE_FRAME) GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_RADIO_BUTTON, GailRadioButton, gail_radio_button, GTK_TYPE_RADIO_BUTTON) GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCROLLED_WINDOW, GailScrolledWindow, gail_scrolled_window, GTK_TYPE_SCROLLED_WINDOW) GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_PANED, GailPaned, gail_paned, GTK_TYPE_PANED) @@ -890,7 +888,6 @@ gail_accessibility_module_init (void) GAIL_WIDGET_SET_FACTORY (GTK_TYPE_NOTEBOOK, gail_notebook); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_PROGRESS_BAR, gail_progress_bar); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_TREE_VIEW, gail_tree_view); - GAIL_WIDGET_SET_FACTORY (GTK_TYPE_FRAME, gail_frame); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_TEXT, gail_text_cell); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_TOGGLE, gail_boolean_cell); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_PIXBUF, gail_image_cell); diff --git a/gtk/a11y/gailframe.c b/gtk/a11y/gailframe.c deleted file mode 100644 index 7806837e28..0000000000 --- a/gtk/a11y/gailframe.c +++ /dev/null @@ -1,85 +0,0 @@ -/* GAIL - The GNOME Accessibility Implementation 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 -#include "gailframe.h" - -static void gail_frame_class_init (GailFrameClass *klass); -static void gail_frame_init (GailFrame *frame); -static void gail_frame_initialize (AtkObject *accessible, - gpointer data); -static const gchar* gail_frame_get_name (AtkObject *obj); - -G_DEFINE_TYPE (GailFrame, gail_frame, GAIL_TYPE_CONTAINER) - -static void -gail_frame_class_init (GailFrameClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->initialize = gail_frame_initialize; - class->get_name = gail_frame_get_name; -} - -static void -gail_frame_init (GailFrame *frame) -{ -} - -static void -gail_frame_initialize (AtkObject *accessible, - gpointer data) -{ - ATK_OBJECT_CLASS (gail_frame_parent_class)->initialize (accessible, data); - - accessible->role = ATK_ROLE_PANEL; -} - -static const gchar* -gail_frame_get_name (AtkObject *obj) -{ - const gchar *name; - g_return_val_if_fail (GAIL_IS_FRAME (obj), NULL); - - name = ATK_OBJECT_CLASS (gail_frame_parent_class)->get_name (obj); - if (name != NULL) - { - return name; - } - else - { - /* - * Get the text on the label - */ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - { - /* - * State is defunct - */ - return NULL; - } - return gtk_frame_get_label (GTK_FRAME (widget)); - } -} diff --git a/gtk/a11y/gailframe.h b/gtk/a11y/gailframe.h deleted file mode 100644 index 61b61b4fd5..0000000000 --- a/gtk/a11y/gailframe.h +++ /dev/null @@ -1,51 +0,0 @@ -/* GAIL - The GNOME Accessibility Implementation 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_FRAME_H__ -#define __GAIL_FRAME_H__ - -#include "gailcontainer.h" - -G_BEGIN_DECLS - -#define GAIL_TYPE_FRAME (gail_frame_get_type ()) -#define GAIL_FRAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_FRAME, GailFrame)) -#define GAIL_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_FRAME, GailFrameClass)) -#define GAIL_IS_FRAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_FRAME)) -#define GAIL_IS_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_FRAME)) -#define GAIL_FRAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_FRAME, GailFrameClass)) - -typedef struct _GailFrame GailFrame; -typedef struct _GailFrameClass GailFrameClass; - -struct _GailFrame -{ - GailContainer parent; -}; - -GType gail_frame_get_type (void); - -struct _GailFrameClass -{ - GailContainerClass parent_class; -}; - -G_END_DECLS - -#endif /* __GAIL_FRAME_H__ */ diff --git a/gtk/a11y/gtkframeaccessible.c b/gtk/a11y/gtkframeaccessible.c new file mode 100644 index 0000000000..964ddb99dc --- /dev/null +++ b/gtk/a11y/gtkframeaccessible.c @@ -0,0 +1,67 @@ +/* GAIL - The GNOME Accessibility Implementation 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 +#include "gtkframeaccessible.h" + + +G_DEFINE_TYPE (GtkFrameAccessible, gtk_frame_accessible, GAIL_TYPE_CONTAINER) + +static void +gtk_frame_accessible_initialize (AtkObject *accessible, + gpointer data) +{ + ATK_OBJECT_CLASS (gtk_frame_accessible_parent_class)->initialize (accessible, data); + + accessible->role = ATK_ROLE_PANEL; +} + +static const gchar * +gtk_frame_accessible_get_name (AtkObject *obj) +{ + const gchar *name; + GtkWidget *widget; + + widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); + if (widget == NULL) + return NULL; + + name = ATK_OBJECT_CLASS (gtk_frame_accessible_parent_class)->get_name (obj); + if (name != NULL) + return name; + + return gtk_frame_get_label (GTK_FRAME (widget)); +} + +static void +gtk_frame_accessible_class_init (GtkFrameAccessibleClass *klass) +{ + AtkObjectClass *class = ATK_OBJECT_CLASS (klass); + + class->initialize = gtk_frame_accessible_initialize; + class->get_name = gtk_frame_accessible_get_name; +} + +static void +gtk_frame_accessible_init (GtkFrameAccessible *frame) +{ +} diff --git a/gtk/a11y/gtkframeaccessible.h b/gtk/a11y/gtkframeaccessible.h new file mode 100644 index 0000000000..02e638eed2 --- /dev/null +++ b/gtk/a11y/gtkframeaccessible.h @@ -0,0 +1,51 @@ +/* GAIL - The GNOME Accessibility Implementation 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_FRAME_ACCESSIBLE_H__ +#define __GTK_FRAME_ACCESSIBLE_H__ + +#include "gailcontainer.h" + +G_BEGIN_DECLS + +#define GTK_TYPE_FRAME_ACCESSIBLE (gtk_frame_accessible_get_type ()) +#define GTK_FRAME_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FRAME_ACCESSIBLE, GtkFrameAccessible)) +#define GTK_FRAME_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FRAME_ACCESSIBLE, GtkFrameAccessibleClass)) +#define GTK_IS_FRAME_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FRAME_ACCESSIBLE)) +#define GTK_IS_FRAME_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FRAME_ACCESSIBLE)) +#define GTK_FRAME_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FRAME_ACCESSIBLE, GtkFrameAccessibleClass)) + +typedef struct _GtkFrameAccessible GtkFrameAccessible; +typedef struct _GtkFrameAccessibleClass GtkFrameAccessibleClass; + +struct _GtkFrameAccessible +{ + GailContainer parent; +}; + +struct _GtkFrameAccessibleClass +{ + GailContainerClass parent_class; +}; + +GType gtk_frame_accessible_get_type (void); + +G_END_DECLS + +#endif /* __GTK_FRAME_ACCESSIBLE_H__ */ diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c index f63de8091e..07393dea2d 100644 --- a/gtk/gtkframe.c +++ b/gtk/gtkframe.c @@ -33,6 +33,7 @@ #include "gtkintl.h" #include "gtkbuildable.h" +#include "a11y/gtkframeaccessible.h" /** * SECTION:gtkframe @@ -221,6 +222,8 @@ gtk_frame_class_init (GtkFrameClass *class) class->compute_child_allocation = gtk_frame_real_compute_child_allocation; g_type_class_add_private (class, sizeof (GtkFramePrivate)); + + gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_FRAME_ACCESSIBLE); } static void