Compare commits
9 Commits
sort-list-
...
wip/a11y
Author | SHA1 | Date | |
---|---|---|---|
|
1a696408b2 | ||
|
b0e2fd453c | ||
|
6088f59b5e | ||
|
bc907c1471 | ||
|
a1bb39a42b | ||
|
6c68b25008 | ||
|
0c6deef968 | ||
|
8eb20f751e | ||
|
9b933c2a0c |
@@ -103,8 +103,12 @@ gtka11y_private_h_sources = \
|
||||
gtkaccessibilityutil.h \
|
||||
gtkcellaccessibleprivate.h \
|
||||
gtkcolorswatchaccessibleprivate.h \
|
||||
gtkcontaineraccessibleprivate.h \
|
||||
gtkiconviewaccessibleprivate.h \
|
||||
gtklinkbuttonaccessibleprivate.h \
|
||||
gtklockbuttonaccessibleprivate.h \
|
||||
gtkrangeaccessibleprivate.h \
|
||||
gtkstatusbaraccessibleprivate.h \
|
||||
gtktextviewaccessibleprivate.h \
|
||||
gtktreeviewaccessibleprivate.h \
|
||||
gtkwidgetaccessibleprivate.h
|
||||
|
@@ -234,8 +234,8 @@ gtk_button_accessible_class_init (GtkButtonAccessibleClass *klass)
|
||||
|
||||
widget_class->notify_gtk = gtk_button_accessible_notify_gtk;
|
||||
|
||||
container_class->add_gtk = NULL;
|
||||
container_class->remove_gtk = NULL;
|
||||
container_class->add = NULL;
|
||||
container_class->remove = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkcontaineraccessible.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
struct _GtkContainerAccessiblePrivate
|
||||
{
|
||||
@@ -72,85 +73,79 @@ gtk_container_accessible_ref_child (AtkObject *obj,
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_container_accessible_add_gtk (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data)
|
||||
void
|
||||
_gtk_container_accessible_add (GtkContainer *container,
|
||||
GtkWidget *child)
|
||||
{
|
||||
GtkContainerAccessible *accessible = GTK_CONTAINER_ACCESSIBLE (data);
|
||||
GtkContainerAccessible *accessible;
|
||||
GtkContainerAccessibleClass *klass;
|
||||
|
||||
klass = GTK_CONTAINER_ACCESSIBLE_GET_CLASS (accessible);
|
||||
accessible = GTK_CONTAINER_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (container)));
|
||||
if (accessible == NULL)
|
||||
return;
|
||||
|
||||
if (klass->add_gtk)
|
||||
return klass->add_gtk (container, widget, data);
|
||||
else
|
||||
return 1;
|
||||
klass = GTK_CONTAINER_ACCESSIBLE_GET_CLASS (accessible);
|
||||
if (klass->add == NULL)
|
||||
return;
|
||||
|
||||
klass->add (accessible, child);
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_container_accessible_remove_gtk (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data)
|
||||
void
|
||||
_gtk_container_accessible_remove (GtkContainer *container,
|
||||
GtkWidget *child)
|
||||
{
|
||||
GtkContainerAccessible *accessible = GTK_CONTAINER_ACCESSIBLE (data);
|
||||
GtkContainerAccessible *accessible;
|
||||
GtkContainerAccessibleClass *klass;
|
||||
|
||||
klass = GTK_CONTAINER_ACCESSIBLE_GET_CLASS (accessible);
|
||||
accessible = GTK_CONTAINER_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (container)));
|
||||
if (accessible == NULL)
|
||||
return;
|
||||
|
||||
if (klass->remove_gtk)
|
||||
return klass->remove_gtk (container, widget, data);
|
||||
else
|
||||
return 1;
|
||||
klass = GTK_CONTAINER_ACCESSIBLE_GET_CLASS (accessible);
|
||||
if (klass->remove == NULL)
|
||||
return;
|
||||
|
||||
klass->remove (accessible, child);
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_container_accessible_real_add_gtk (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data)
|
||||
static void
|
||||
gtk_container_accessible_real_add (GtkContainerAccessible *accessible,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
AtkObject *atk_parent;
|
||||
GtkContainer *container;
|
||||
AtkObject *atk_child;
|
||||
GtkContainerAccessible *accessible;
|
||||
gint index;
|
||||
|
||||
atk_parent = ATK_OBJECT (data);
|
||||
atk_child = gtk_widget_get_accessible (widget);
|
||||
accessible = GTK_CONTAINER_ACCESSIBLE (atk_parent);
|
||||
container = GTK_CONTAINER (gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)));
|
||||
|
||||
g_object_notify (G_OBJECT (atk_child), "accessible-parent");
|
||||
g_list_free (accessible->priv->children);
|
||||
accessible->priv->children = gtk_container_get_children (container);
|
||||
index = g_list_index (accessible->priv->children, widget);
|
||||
g_signal_emit_by_name (atk_parent, "children-changed::add", index, atk_child, NULL);
|
||||
|
||||
return 1;
|
||||
g_signal_emit_by_name (accessible, "children-changed::add", index, atk_child, NULL);
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_container_accessible_real_remove_gtk (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data)
|
||||
static void
|
||||
gtk_container_accessible_real_remove (GtkContainerAccessible *accessible,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
AtkObject* atk_parent;
|
||||
GtkContainer *container;
|
||||
AtkObject *atk_child;
|
||||
GtkContainerAccessible *accessible;
|
||||
gint index;
|
||||
|
||||
atk_parent = ATK_OBJECT (data);
|
||||
container = GTK_CONTAINER (gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)));
|
||||
atk_child = gtk_widget_get_accessible (widget);
|
||||
if (atk_child == NULL)
|
||||
return 1;
|
||||
accessible = GTK_CONTAINER_ACCESSIBLE (atk_parent);
|
||||
return;
|
||||
|
||||
g_object_notify (G_OBJECT (atk_child), "accessible-parent");
|
||||
index = g_list_index (accessible->priv->children, widget);
|
||||
g_list_free (accessible->priv->children);
|
||||
accessible->priv->children = gtk_container_get_children (container);
|
||||
if (index >= 0 && index <= g_list_length (accessible->priv->children))
|
||||
g_signal_emit_by_name (atk_parent, "children-changed::remove", index, atk_child, NULL);
|
||||
|
||||
return 1;
|
||||
g_signal_emit_by_name (accessible, "children-changed::remove", index, atk_child, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -163,9 +158,6 @@ gtk_container_accessible_real_initialize (AtkObject *obj,
|
||||
|
||||
accessible->priv->children = gtk_container_get_children (GTK_CONTAINER (data));
|
||||
|
||||
g_signal_connect (data, "add", G_CALLBACK (gtk_container_accessible_add_gtk), obj);
|
||||
g_signal_connect (data, "remove", G_CALLBACK (gtk_container_accessible_remove_gtk), obj);
|
||||
|
||||
obj->role = ATK_ROLE_PANEL;
|
||||
}
|
||||
|
||||
@@ -191,8 +183,8 @@ gtk_container_accessible_class_init (GtkContainerAccessibleClass *klass)
|
||||
class->ref_child = gtk_container_accessible_ref_child;
|
||||
class->initialize = gtk_container_accessible_real_initialize;
|
||||
|
||||
klass->add_gtk = gtk_container_accessible_real_add_gtk;
|
||||
klass->remove_gtk = gtk_container_accessible_real_remove_gtk;
|
||||
klass->add = gtk_container_accessible_real_add;
|
||||
klass->remove = gtk_container_accessible_real_remove;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GtkContainerAccessiblePrivate));
|
||||
}
|
||||
|
@@ -49,12 +49,10 @@ struct _GtkContainerAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
|
||||
gint (*add_gtk) (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data);
|
||||
gint (*remove_gtk) (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data);
|
||||
void (*add) (GtkContainerAccessible *container,
|
||||
GtkWidget *child);
|
||||
void (*remove) (GtkContainerAccessible *container,
|
||||
GtkWidget *child);
|
||||
};
|
||||
|
||||
GType gtk_container_accessible_get_type (void);
|
||||
|
30
gtk/a11y/gtkcontaineraccessibleprivate.h
Normal file
30
gtk/a11y/gtkcontaineraccessibleprivate.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright (C) 2002, 2004 Anders Carlsson <andersca@gnu.org>
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_CONTAINER_ACCESSIBLE_PRIVATE_H__
|
||||
#define __GTK_CONTAINER_ACCESSIBLE_PRIVATE_H__
|
||||
|
||||
#include <gtk/a11y/gtkcontaineraccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_container_accessible_add (GtkContainer *container, GtkWidget *child);
|
||||
void _gtk_container_accessible_remove (GtkContainer *container, GtkWidget *child);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_CONTAINER_ACCESSIBLE_PRIVATE_H__ */
|
@@ -17,8 +17,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtklinkbuttonaccessible.h"
|
||||
#include "gtklinkbuttonaccessibleprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
typedef struct _GtkLinkButtonAccessibleLink GtkLinkButtonAccessibleLink;
|
||||
typedef struct _GtkLinkButtonAccessibleLinkClass GtkLinkButtonAccessibleLinkClass;
|
||||
@@ -171,15 +171,6 @@ atk_action_interface_init (AtkActionIface *iface)
|
||||
iface->get_name = gtk_link_button_accessible_link_get_name;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
activate_link (GtkLinkButton *button,
|
||||
AtkHyperlink *atk_link)
|
||||
{
|
||||
g_signal_emit_by_name (atk_link, "link-activated");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static AtkHyperlink *
|
||||
gtk_link_button_accessible_get_hyperlink (AtkHyperlinkImpl *impl)
|
||||
{
|
||||
@@ -188,8 +179,6 @@ gtk_link_button_accessible_get_hyperlink (AtkHyperlinkImpl *impl)
|
||||
if (!button->priv->link)
|
||||
{
|
||||
button->priv->link = gtk_link_button_accessible_link_new (button);
|
||||
g_signal_connect (gtk_accessible_get_widget (GTK_ACCESSIBLE (button)),
|
||||
"activate-link", G_CALLBACK (activate_link), button->priv->link);
|
||||
}
|
||||
|
||||
return g_object_ref (button->priv->link);
|
||||
@@ -232,3 +221,17 @@ atk_hypertext_impl_interface_init (AtkHyperlinkImplIface *iface)
|
||||
{
|
||||
iface->get_hyperlink = gtk_link_button_accessible_get_hyperlink;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_link_button_accessible_activate_link (GtkLinkButton *link_button)
|
||||
{
|
||||
GtkLinkButtonAccessible *accessible;
|
||||
|
||||
accessible = GTK_LINK_BUTTON_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (link_button)));
|
||||
if (accessible == NULL)
|
||||
return;
|
||||
|
||||
if (accessible->priv->link)
|
||||
g_signal_emit_by_name (accessible->priv->link, "link-activated");
|
||||
}
|
||||
|
||||
|
29
gtk/a11y/gtklinkbuttonaccessibleprivate.h
Normal file
29
gtk/a11y/gtklinkbuttonaccessibleprivate.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright (C) 2013 Benjamin Otte <otte@gnome.org>
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_LINK_BUTTON_ACCESSIBLE_PRIVATE_H__
|
||||
#define __GTK_LINK_BUTTON_ACCESSIBLE_PRIVATE_H__
|
||||
|
||||
#include <gtk/a11y/gtklinkbuttonaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_link_button_accessible_activate_link (GtkLinkButton *link_button);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_LINK_BUTTON_ACCESSIBLE_PRIVATE_H__ */
|
@@ -834,8 +834,7 @@ menu_item_add_gtk (GtkContainer *container,
|
||||
parent_widget = gtk_menu_get_attach_widget (GTK_MENU (container));
|
||||
if (GTK_IS_MENU_ITEM (parent_widget))
|
||||
{
|
||||
GTK_CONTAINER_ACCESSIBLE_CLASS (gtk_menu_item_accessible_parent_class)->add_gtk (container, widget, gtk_widget_get_accessible (parent_widget));
|
||||
|
||||
GTK_CONTAINER_ACCESSIBLE_CLASS (gtk_menu_item_accessible_parent_class)->add (GTK_CONTAINER_ACCESSIBLE (gtk_widget_get_accessible (parent_widget)), widget);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -851,7 +850,7 @@ menu_item_remove_gtk (GtkContainer *container,
|
||||
parent_widget = gtk_menu_get_attach_widget (GTK_MENU (container));
|
||||
if (GTK_IS_MENU_ITEM (parent_widget))
|
||||
{
|
||||
GTK_CONTAINER_ACCESSIBLE_CLASS (gtk_menu_item_accessible_parent_class)->remove_gtk (container, widget, gtk_widget_get_accessible (parent_widget));
|
||||
GTK_CONTAINER_ACCESSIBLE_CLASS (gtk_menu_item_accessible_parent_class)->remove (GTK_CONTAINER_ACCESSIBLE (gtk_widget_get_accessible (parent_widget)), widget);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@@ -189,6 +189,18 @@ gtk_notebook_accessible_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (gtk_notebook_accessible_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_notebook_accessible_get_n_children (AtkObject *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return 0;
|
||||
|
||||
return gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_notebook_accessible_ref_child (AtkObject *obj,
|
||||
gint i)
|
||||
@@ -314,14 +326,15 @@ gtk_notebook_accessible_class_init (GtkNotebookAccessibleClass *klass)
|
||||
|
||||
gobject_class->finalize = gtk_notebook_accessible_finalize;
|
||||
|
||||
class->get_n_children = gtk_notebook_accessible_get_n_children;
|
||||
class->ref_child = gtk_notebook_accessible_ref_child;
|
||||
class->initialize = gtk_notebook_accessible_initialize;
|
||||
|
||||
widget_class->notify_gtk = gtk_notebook_accessible_notify_gtk;
|
||||
|
||||
/* we listen to page-added/-removed, so we don't care about these */
|
||||
container_class->add_gtk = NULL;
|
||||
container_class->remove_gtk = NULL;
|
||||
container_class->add = NULL;
|
||||
container_class->remove = NULL;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GtkNotebookAccessiblePrivate));
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkrangeaccessible.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
|
||||
static void atk_action_interface_init (AtkActionIface *iface);
|
||||
@@ -29,90 +30,21 @@ G_DEFINE_TYPE_WITH_CODE (GtkRangeAccessible, gtk_range_accessible, GTK_TYPE_WIDG
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
|
||||
|
||||
static void
|
||||
gtk_range_accessible_value_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
g_object_notify (G_OBJECT (data), "accessible-value");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkRangeAccessible *range = GTK_RANGE_ACCESSIBLE (obj);
|
||||
GtkAdjustment *adj;
|
||||
GtkRange *gtk_range;
|
||||
|
||||
ATK_OBJECT_CLASS (gtk_range_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
gtk_range = GTK_RANGE (data);
|
||||
/*
|
||||
* If a GtkAdjustment already exists for the GtkRange,
|
||||
* create the GailAdjustment
|
||||
*/
|
||||
adj = gtk_range_get_adjustment (gtk_range);
|
||||
if (adj)
|
||||
g_signal_connect (adj, "value-changed",
|
||||
G_CALLBACK (gtk_range_accessible_value_changed),
|
||||
range);
|
||||
|
||||
obj->role = ATK_ROLE_SLIDER;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_finalize (GObject *object)
|
||||
{
|
||||
GtkRangeAccessible *range = GTK_RANGE_ACCESSIBLE (object);
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adj;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (object));
|
||||
if (widget)
|
||||
{
|
||||
adj = gtk_range_get_adjustment (GTK_RANGE (widget));
|
||||
if (adj)
|
||||
g_signal_handlers_disconnect_by_func (adj,
|
||||
gtk_range_accessible_value_changed,
|
||||
range);
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (gtk_range_accessible_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_notify_gtk (GObject *obj,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (obj);
|
||||
GtkAdjustment *adj;
|
||||
AtkObject *range;
|
||||
|
||||
if (strcmp (pspec->name, "adjustment") == 0)
|
||||
{
|
||||
range = gtk_widget_get_accessible (widget);
|
||||
adj = gtk_range_get_adjustment (GTK_RANGE (widget));
|
||||
g_signal_connect (adj, "value-changed",
|
||||
G_CALLBACK (gtk_range_accessible_value_changed),
|
||||
range);
|
||||
}
|
||||
else
|
||||
GTK_WIDGET_ACCESSIBLE_CLASS (gtk_range_accessible_parent_class)->notify_gtk (obj, pspec);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_range_accessible_class_init (GtkRangeAccessibleClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
|
||||
|
||||
widget_class->notify_gtk = gtk_range_accessible_notify_gtk;
|
||||
|
||||
class->initialize = gtk_range_accessible_initialize;
|
||||
|
||||
gobject_class->finalize = gtk_range_accessible_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -313,3 +245,13 @@ atk_action_interface_init (AtkActionIface *iface)
|
||||
iface->get_keybinding = gtk_range_accessible_get_keybinding;
|
||||
iface->get_name = gtk_range_accessible_action_get_name;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_range_accessible_value_changed (GtkRange *range)
|
||||
{
|
||||
AtkObject *accessible;
|
||||
|
||||
accessible = _gtk_widget_peek_accessible (GTK_WIDGET (range));
|
||||
if (accessible)
|
||||
g_object_notify (G_OBJECT (accessible), "accessible-value");
|
||||
}
|
||||
|
29
gtk/a11y/gtkrangeaccessibleprivate.h
Normal file
29
gtk/a11y/gtkrangeaccessibleprivate.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright (C) 2002, 2004 Anders Carlsson <andersca@gnu.org>
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_RANGE_ACCESSIBLE_PRIVATE_H__
|
||||
#define __GTK_RANGE_ACCESSIBLE_PRIVATE_H__
|
||||
|
||||
#include <gtk/a11y/gtkrangeaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_range_accessible_value_changed (GtkRange *range);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_RANGE_ACCESSIBLE_PRIVATE_H__ */
|
@@ -30,28 +30,12 @@ G_DEFINE_TYPE_WITH_CODE (GtkScaleButtonAccessible, gtk_scale_button_accessible,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init));
|
||||
|
||||
static void
|
||||
gtk_scale_button_accessible_value_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
g_object_notify (G_OBJECT (data), "accessible-value");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_button_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
ATK_OBJECT_CLASS (gtk_scale_button_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (data));
|
||||
if (adjustment)
|
||||
g_signal_connect (adjustment,
|
||||
"value-changed",
|
||||
G_CALLBACK (gtk_scale_button_accessible_value_changed),
|
||||
obj);
|
||||
|
||||
obj->role = ATK_ROLE_SLIDER;
|
||||
}
|
||||
|
||||
@@ -60,21 +44,13 @@ gtk_scale_button_accessible_notify_gtk (GObject *obj,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkScaleButton *scale_button;
|
||||
GtkScaleButtonAccessible *accessible;
|
||||
AtkObject *accessible;
|
||||
|
||||
scale_button = GTK_SCALE_BUTTON (obj);
|
||||
accessible = GTK_SCALE_BUTTON_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (scale_button)));
|
||||
accessible = gtk_widget_get_accessible (GTK_WIDGET (scale_button));
|
||||
|
||||
if (strcmp (pspec->name, "adjustment") == 0)
|
||||
{
|
||||
GtkAdjustment* adjustment;
|
||||
|
||||
adjustment = gtk_scale_button_get_adjustment (scale_button);
|
||||
g_signal_connect (adjustment,
|
||||
"value-changed",
|
||||
G_CALLBACK (gtk_scale_button_accessible_value_changed),
|
||||
accessible);
|
||||
}
|
||||
if (strcmp (pspec->name, "value") == 0)
|
||||
g_object_notify (G_OBJECT (accessible), "accessible-value");
|
||||
else
|
||||
{
|
||||
GTK_WIDGET_ACCESSIBLE_CLASS (gtk_scale_button_accessible_parent_class)->notify_gtk (obj, pspec);
|
||||
|
@@ -27,35 +27,12 @@ static void atk_value_interface_init (AtkValueIface *iface);
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkSpinButtonAccessible, gtk_spin_button_accessible, GTK_TYPE_ENTRY_ACCESSIBLE,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
|
||||
|
||||
static void
|
||||
gtk_spin_button_accessible_value_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
GtkSpinButtonAccessible *spin_button;
|
||||
|
||||
if (adjustment == NULL || data == NULL)
|
||||
return;
|
||||
|
||||
spin_button = GTK_SPIN_BUTTON_ACCESSIBLE (data);
|
||||
|
||||
g_object_notify (G_OBJECT (spin_button), "accessible-value");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_spin_button_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
ATK_OBJECT_CLASS (gtk_spin_button_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (data));
|
||||
if (adjustment)
|
||||
g_signal_connect (adjustment,
|
||||
"value-changed",
|
||||
G_CALLBACK (gtk_spin_button_accessible_value_changed),
|
||||
obj);
|
||||
|
||||
obj->role = ATK_ROLE_SPIN_BUTTON;
|
||||
}
|
||||
|
||||
@@ -66,15 +43,8 @@ gtk_spin_button_accessible_notify_gtk (GObject *obj,
|
||||
GtkWidget *widget = GTK_WIDGET (obj);
|
||||
GtkSpinButtonAccessible *spin_button = GTK_SPIN_BUTTON_ACCESSIBLE (gtk_widget_get_accessible (widget));
|
||||
|
||||
if (strcmp (pspec->name, "adjustment") == 0)
|
||||
{
|
||||
GtkAdjustment* adjustment;
|
||||
|
||||
adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
|
||||
g_signal_connect (adjustment, "value-changed",
|
||||
G_CALLBACK (gtk_spin_button_accessible_value_changed),
|
||||
spin_button);
|
||||
}
|
||||
if (strcmp (pspec->name, "value") == 0)
|
||||
g_object_notify (G_OBJECT (spin_button), "accessible-value");
|
||||
else
|
||||
GTK_WIDGET_ACCESSIBLE_CLASS (gtk_spin_button_accessible_parent_class)->notify_gtk (obj, pspec);
|
||||
}
|
||||
|
@@ -17,37 +17,20 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkstatusbaraccessible.h"
|
||||
#include "gtkstatusbaraccessibleprivate.h"
|
||||
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GtkStatusbarAccessible, gtk_statusbar_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE)
|
||||
|
||||
static void
|
||||
text_changed (GtkStatusbar *statusbar,
|
||||
guint context_id,
|
||||
const gchar *text,
|
||||
AtkObject *obj)
|
||||
{
|
||||
if (!obj->name)
|
||||
g_object_notify (G_OBJECT (obj), "accessible-name");
|
||||
g_signal_emit_by_name (obj, "visible-data-changed");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_statusbar_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *statusbar = data;
|
||||
|
||||
ATK_OBJECT_CLASS (gtk_statusbar_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
g_signal_connect_after (statusbar, "text-pushed",
|
||||
G_CALLBACK (text_changed), obj);
|
||||
g_signal_connect_after (statusbar, "text-popped",
|
||||
G_CALLBACK (text_changed), obj);
|
||||
|
||||
obj->role = ATK_ROLE_STATUSBAR;
|
||||
}
|
||||
|
||||
@@ -138,11 +121,25 @@ gtk_statusbar_accessible_class_init (GtkStatusbarAccessibleClass *klass)
|
||||
* As we report the statusbar as having no children
|
||||
* we are not interested in add and remove signals
|
||||
*/
|
||||
container_class->add_gtk = NULL;
|
||||
container_class->remove_gtk = NULL;
|
||||
container_class->add = NULL;
|
||||
container_class->remove = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_statusbar_accessible_init (GtkStatusbarAccessible *bar)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_statusbar_accessible_update_text (GtkStatusbar *statusbar)
|
||||
{
|
||||
AtkObject *obj;
|
||||
|
||||
obj = _gtk_widget_peek_accessible (GTK_WIDGET (statusbar));
|
||||
if (obj == NULL)
|
||||
return;
|
||||
|
||||
if (!obj->name)
|
||||
g_object_notify (G_OBJECT (obj), "accessible-name");
|
||||
g_signal_emit_by_name (obj, "visible-data-changed");
|
||||
}
|
||||
|
29
gtk/a11y/gtkstatusbaraccessibleprivate.h
Normal file
29
gtk/a11y/gtkstatusbaraccessibleprivate.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright (C) 2002, 2004 Anders Carlsson <andersca@gnu.org>
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_STATUSBAR_ACCESSIBLE_PRIVATE_H__
|
||||
#define __GTK_STATUSBAR_ACCESSIBLE_PRIVATE_H__
|
||||
|
||||
#include <gtk/a11y/gtkstatusbaraccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_statusbar_accessible_update_text (GtkStatusbar *statusbar);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_STATUSBAR_ACCESSIBLE_PRIVATE_H__ */
|
@@ -44,7 +44,6 @@ gtk_toplevel_accessible_initialize (AtkObject *accessible,
|
||||
ATK_OBJECT_CLASS (gtk_toplevel_accessible_parent_class)->initialize (accessible, data);
|
||||
|
||||
accessible->role = ATK_ROLE_APPLICATION;
|
||||
accessible->name = g_get_prgname ();
|
||||
accessible->accessible_parent = NULL;
|
||||
}
|
||||
|
||||
@@ -87,6 +86,12 @@ gtk_toplevel_accessible_ref_child (AtkObject *obj,
|
||||
return atk_obj;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_toplevel_accessible_get_name (AtkObject *obj)
|
||||
{
|
||||
return g_get_prgname ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_combo_window (GtkWidget *widget)
|
||||
{
|
||||
@@ -143,6 +148,7 @@ gtk_toplevel_accessible_class_init (GtkToplevelAccessibleClass *klass)
|
||||
class->get_n_children = gtk_toplevel_accessible_get_n_children;
|
||||
class->ref_child = gtk_toplevel_accessible_ref_child;
|
||||
class->get_parent = NULL;
|
||||
class->get_name = gtk_toplevel_accessible_get_name;
|
||||
|
||||
g_object_class->finalize = gtk_toplevel_accessible_object_finalize;
|
||||
|
||||
|
@@ -525,8 +525,8 @@ gtk_tree_view_accessible_class_init (GtkTreeViewAccessibleClass *klass)
|
||||
* we do not represent these as children so we do not want to report
|
||||
* children added or deleted when these changed.
|
||||
*/
|
||||
container_class->add_gtk = NULL;
|
||||
container_class->remove_gtk = NULL;
|
||||
container_class->add = NULL;
|
||||
container_class->remove = NULL;
|
||||
|
||||
gobject_class->finalize = gtk_tree_view_accessible_finalize;
|
||||
|
||||
|
@@ -65,7 +65,7 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
#include "a11y/gtklinkbuttonaccessible.h"
|
||||
#include "a11y/gtklinkbuttonaccessibleprivate.h"
|
||||
|
||||
struct _GtkLinkButtonPrivate
|
||||
{
|
||||
@@ -548,6 +548,8 @@ gtk_link_button_activate_link (GtkLinkButton *link_button)
|
||||
GdkScreen *screen;
|
||||
GError *error;
|
||||
|
||||
_gtk_link_button_accessible_activate_link (link_button);
|
||||
|
||||
if (gtk_widget_has_screen (GTK_WIDGET (link_button)))
|
||||
screen = gtk_widget_get_screen (GTK_WIDGET (link_button));
|
||||
else
|
||||
|
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "gtkadjustment.h"
|
||||
#include "gtkcolorscaleprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtkmarshalers.h"
|
||||
@@ -41,7 +42,7 @@
|
||||
#include "gtkscrollbar.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkwindow.h"
|
||||
#include "a11y/gtkrangeaccessible.h"
|
||||
#include "a11y/gtkrangeaccessibleprivate.h"
|
||||
|
||||
/**
|
||||
* SECTION:gtkrange
|
||||
@@ -3042,6 +3043,8 @@ gtk_range_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
*/
|
||||
|
||||
g_signal_emit (range, signals[VALUE_CHANGED], 0);
|
||||
|
||||
_gtk_range_accessible_value_changed (range);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -37,7 +37,7 @@
|
||||
#include "gtkbuildable.h"
|
||||
#include "gtkorientable.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "a11y/gtkstatusbaraccessible.h"
|
||||
#include "a11y/gtkstatusbaraccessibleprivate.h"
|
||||
|
||||
/**
|
||||
* SECTION:gtkstatusbar
|
||||
@@ -286,6 +286,8 @@ gtk_statusbar_update (GtkStatusbar *statusbar,
|
||||
text = "";
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (priv->label), text);
|
||||
|
||||
_gtk_statusbar_accessible_update_text (statusbar);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -62,6 +62,7 @@
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkplug.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "a11y/gtkcontaineraccessibleprivate.h"
|
||||
#include "a11y/gtkwidgetaccessible.h"
|
||||
|
||||
/**
|
||||
@@ -3865,6 +3866,8 @@ gtk_widget_unparent (GtkWidget *widget)
|
||||
|
||||
/* keep this function in sync with gtk_menu_detach() */
|
||||
|
||||
_gtk_container_accessible_remove (GTK_CONTAINER (priv->parent), widget);
|
||||
|
||||
gtk_widget_push_verify_invariants (widget);
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (widget));
|
||||
@@ -8079,6 +8082,8 @@ gtk_widget_set_parent (GtkWidget *widget,
|
||||
}
|
||||
|
||||
gtk_widget_pop_verify_invariants (widget);
|
||||
|
||||
_gtk_container_accessible_add (GTK_CONTAINER (parent), widget);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user