Commit 896769df authored by Matthias Clasen's avatar Matthias Clasen

Convert GailExpander to GtkExpanderAccessible

At the same time, drop the AtkText implementation.
Also, reintroduce a GtkBoxAccessible, since the previous
way of setting the role in get_accessible was affecting
GtkBox subclasses negatively.

Adjust expected test output to match.
parent 6087131a
...@@ -6,6 +6,7 @@ gail_c_sources = \ ...@@ -6,6 +6,7 @@ gail_c_sources = \
gail.c \ gail.c \
gtkarrowaccessible.c \ gtkarrowaccessible.c \
gailbooleancell.c \ gailbooleancell.c \
gtkboxaccessible.c \
gailbutton.c \ gailbutton.c \
gailcell.c \ gailcell.c \
gailcellparent.c \ gailcellparent.c \
...@@ -15,7 +16,7 @@ gail_c_sources = \ ...@@ -15,7 +16,7 @@ gail_c_sources = \
gailcontainer.c \ gailcontainer.c \
gailcontainercell.c \ gailcontainercell.c \
gtkentryaccessible.c \ gtkentryaccessible.c \
gailexpander.c \ gtkexpanderaccessible.c \
gtkframeaccessible.c \ gtkframeaccessible.c \
gtkimageaccessible.c \ gtkimageaccessible.c \
gailimagecell.c \ gailimagecell.c \
...@@ -56,6 +57,7 @@ libgailincludedir=$(includedir)/gail-3.0/gail ...@@ -56,6 +57,7 @@ libgailincludedir=$(includedir)/gail-3.0/gail
gail_private_h_sources = \ gail_private_h_sources = \
gtkarrowaccessible.h \ gtkarrowaccessible.h \
gailbooleancell.h \ gailbooleancell.h \
gtkboxaccessible.h \
gailbutton.h \ gailbutton.h \
gailcell.h \ gailcell.h \
gailcellparent.h \ gailcellparent.h \
...@@ -65,7 +67,7 @@ gail_private_h_sources = \ ...@@ -65,7 +67,7 @@ gail_private_h_sources = \
gailcontainercell.h \ gailcontainercell.h \
gailcontainer.h \ gailcontainer.h \
gtkentryaccessible.h \ gtkentryaccessible.h \
gailexpander.h \ gtkexpanderaccessible.h \
gailfactory.h \ gailfactory.h \
gtkframeaccessible.h \ gtkframeaccessible.h \
gtkimageaccessible.h \ gtkimageaccessible.h \
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "gailcheckmenuitem.h" #include "gailcheckmenuitem.h"
#include "gailcontainer.h" #include "gailcontainer.h"
#include "gailcontainercell.h" #include "gailcontainercell.h"
#include "gailexpander.h"
#include "gailimagecell.h" #include "gailimagecell.h"
#include "gailmenu.h" #include "gailmenu.h"
#include "gailmenushell.h" #include "gailmenushell.h"
...@@ -95,7 +94,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_MENU, GailMenu, gail_menu, GTK_TYPE_MENU) ...@@ -95,7 +94,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_MENU, GailMenu, gail_menu, GTK_TYPE_MENU)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_WINDOW, GailWindow, gail_window, GTK_TYPE_BIN) GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_WINDOW, GailWindow, gail_window, GTK_TYPE_BIN)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC (GAIL_TYPE_CHECK_MENU_ITEM, GailCheckMenuItem, gail_check_menu_item, gail_check_menu_item_new) GAIL_IMPLEMENT_FACTORY_WITH_FUNC (GAIL_TYPE_CHECK_MENU_ITEM, GailCheckMenuItem, gail_check_menu_item, gail_check_menu_item_new)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC (GAIL_TYPE_RADIO_MENU_ITEM, GailRadioMenuItem, gail_radio_menu_item, gail_radio_menu_item_new) GAIL_IMPLEMENT_FACTORY_WITH_FUNC (GAIL_TYPE_RADIO_MENU_ITEM, GailRadioMenuItem, gail_radio_menu_item, gail_radio_menu_item_new)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_EXPANDER, GailExpander, gail_expander, GTK_TYPE_EXPANDER)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_RENDERER_CELL, GailRendererCell, gail_renderer_cell, GTK_TYPE_CELL_RENDERER, gail_renderer_cell_new) GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_RENDERER_CELL, GailRendererCell, gail_renderer_cell, GTK_TYPE_CELL_RENDERER, gail_renderer_cell_new)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_BOOLEAN_CELL, GailBooleanCell, gail_boolean_cell, GTK_TYPE_CELL_RENDERER_TOGGLE, gail_boolean_cell_new) GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_BOOLEAN_CELL, GailBooleanCell, gail_boolean_cell, GTK_TYPE_CELL_RENDERER_TOGGLE, gail_boolean_cell_new)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_IMAGE_CELL, GailImageCell, gail_image_cell, GTK_TYPE_CELL_RENDERER_PIXBUF, gail_image_cell_new) GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_IMAGE_CELL, GailImageCell, gail_image_cell, GTK_TYPE_CELL_RENDERER_PIXBUF, gail_image_cell_new)
...@@ -853,7 +851,6 @@ gail_accessibility_module_init (void) ...@@ -853,7 +851,6 @@ gail_accessibility_module_init (void)
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER, gail_renderer_cell); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER, gail_renderer_cell);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CHECK_MENU_ITEM, gail_check_menu_item); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CHECK_MENU_ITEM, gail_check_menu_item);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RADIO_MENU_ITEM, gail_radio_menu_item); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RADIO_MENU_ITEM, gail_radio_menu_item);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_EXPANDER, gail_expander);
atk_focus_tracker_init (gail_focus_tracker_init); atk_focus_tracker_init (gail_focus_tracker_init);
focus_tracker_id = atk_add_focus_tracker (gail_focus_tracker); focus_tracker_id = atk_add_focus_tracker (gail_focus_tracker);
......
/* GAIL - The GNOME Accessibility Implementation Library
* Copyright 2004 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 "gtkboxaccessible.h"
G_DEFINE_TYPE (GtkBoxAccessible, gtk_box_accessible, GAIL_TYPE_CONTAINER)
static void
gtk_box_accessible_initialize (AtkObject *accessible,
gpointer data)
{
ATK_OBJECT_CLASS (gtk_box_accessible_parent_class)->initialize (accessible, data);
accessible->role = ATK_ROLE_FILLER;
}
static void
gtk_box_accessible_class_init (GtkBoxAccessibleClass *klass)
{
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
class->initialize = gtk_box_accessible_initialize;
}
static void
gtk_box_accessible_init (GtkBoxAccessible *scale)
{
}
/* GAIL - The GNOME Accessibility Implementation Library
* Copyright 2004 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_BOX_ACCESSIBLE_H__
#define __GTK_BOX_ACCESSIBLE_H__
#include "gailcontainer.h"
G_BEGIN_DECLS
#define GTK_TYPE_BOX_ACCESSIBLE (gtk_box_accessible_get_type ())
#define GTK_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_BOX_ACCESSIBLE, GtkBoxAccessible))
#define GTK_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_BOX_ACCESSIBLE, GtkBoxAccessibleClass))
#define GTK_IS_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_BOX_ACCESSIBLE))
#define GTK_IS_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BOX_ACCESSIBLE))
#define GTK_BOX_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_BOX_ACCESSIBLE, GtkBoxAccessibleClass))
typedef struct _GtkBoxAccessible GtkBoxAccessible;
typedef struct _GtkBoxAccessibleClass GtkBoxAccessibleClass;
struct _GtkBoxAccessible
{
GailContainer parent;
};
struct _GtkBoxAccessibleClass
{
GailContainerClass parent_class;
};
GType gtk_box_accessible_get_type (void);
G_END_DECLS
#endif /* __GTK_BOX_ACCESSIBLE_H__ */
...@@ -22,109 +22,50 @@ ...@@ -22,109 +22,50 @@
#include <string.h> #include <string.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
#include "gailexpander.h" #include "gtkexpanderaccessible.h"
static void gail_expander_class_init (GailExpanderClass *klass); static void atk_action_interface_init (AtkActionIface *iface);
static void gail_expander_init (GailExpander *expander);
static const gchar* gail_expander_get_name (AtkObject *obj); G_DEFINE_TYPE_WITH_CODE (GtkExpanderAccessible, gtk_expander_accessible, GAIL_TYPE_CONTAINER,
static gint gail_expander_get_n_children (AtkObject *obj)
;
static AtkObject* gail_expander_ref_child (AtkObject *obj,
gint i);
static AtkStateSet* gail_expander_ref_state_set (AtkObject *obj);
static void gail_expander_real_notify_gtk (GObject *obj,
GParamSpec *pspec);
static void gail_expander_map_gtk (GtkWidget *widget,
gpointer data);
static void gail_expander_real_initialize (AtkObject *obj,
gpointer data);
static void gail_expander_finalize (GObject *object);
static void gail_expander_init_textutil (GailExpander *expander,
GtkExpander *widget);
static const gchar* gail_expander_get_full_text (GtkExpander *widget);
static void atk_action_interface_init (AtkActionIface *iface);
static gboolean gail_expander_do_action (AtkAction *action,
gint i);
static gint gail_expander_get_n_actions(AtkAction *action);
static const gchar* gail_expander_get_keybinding
(AtkAction *action,
gint i);
static const gchar* gail_expander_action_get_name
(AtkAction *action,
gint i);
G_DEFINE_TYPE_WITH_CODE (GailExpander, gail_expander, GAIL_TYPE_CONTAINER,
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)) G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init))
static void static const gchar *
gail_expander_class_init (GailExpanderClass *klass) gtk_expander_accessible_get_full_text (GtkExpander *widget)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GtkWidget *label_widget;
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
GailWidgetClass *widget_class;
widget_class = (GailWidgetClass*)klass;
widget_class->notify_gtk = gail_expander_real_notify_gtk;
gobject_class->finalize = gail_expander_finalize;
class->get_name = gail_expander_get_name; label_widget = gtk_expander_get_label_widget (widget);
class->get_n_children = gail_expander_get_n_children;
class->ref_child = gail_expander_ref_child;
class->ref_state_set = gail_expander_ref_state_set;
class->initialize = gail_expander_real_initialize; if (!GTK_IS_LABEL (label_widget))
} return NULL;
static void return gtk_label_get_text (GTK_LABEL (label_widget));
gail_expander_init (GailExpander *expander)
{
expander->activate_keybinding = NULL;
expander->textutil = NULL;
} }
static const gchar* static const gchar *
gail_expander_get_name (AtkObject *obj) gtk_expander_accessible_get_name (AtkObject *obj)
{ {
GtkWidget *widget;
const gchar *name; const gchar *name;
g_return_val_if_fail (GAIL_IS_EXPANDER (obj), NULL);
name = ATK_OBJECT_CLASS (gail_expander_parent_class)->get_name (obj); widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
if (widget == NULL)
return NULL;
name = ATK_OBJECT_CLASS (gtk_expander_accessible_parent_class)->get_name (obj);
if (name != NULL) if (name != NULL)
return name; 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;
g_return_val_if_fail (GTK_IS_EXPANDER (widget), NULL); return gtk_expander_accessible_get_full_text (GTK_EXPANDER (widget));
return gail_expander_get_full_text (GTK_EXPANDER (widget));
}
} }
static gint static gint
gail_expander_get_n_children (AtkObject* obj) gtk_expander_accessible_get_n_children (AtkObject *obj)
{ {
GtkWidget *widget; GtkWidget *widget;
GList *children; GList *children;
gint count = 0; gint count = 0;
g_return_val_if_fail (GAIL_IS_CONTAINER (obj), count);
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
if (widget == NULL) if (widget == NULL)
return 0; return 0;
...@@ -142,9 +83,9 @@ gail_expander_get_n_children (AtkObject* obj) ...@@ -142,9 +83,9 @@ gail_expander_get_n_children (AtkObject* obj)
return count; return count;
} }
static AtkObject* static AtkObject *
gail_expander_ref_child (AtkObject *obj, gtk_expander_accessible_ref_child (AtkObject *obj,
gint i) gint i)
{ {
GList *children, *tmp_list; GList *children, *tmp_list;
AtkObject *accessible; AtkObject *accessible;
...@@ -152,9 +93,6 @@ gail_expander_ref_child (AtkObject *obj, ...@@ -152,9 +93,6 @@ gail_expander_ref_child (AtkObject *obj,
GtkWidget *label; GtkWidget *label;
gint index; gint index;
g_return_val_if_fail (GAIL_IS_CONTAINER (obj), NULL);
g_return_val_if_fail ((i >= 0), NULL);
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
if (widget == NULL) if (widget == NULL)
return NULL; return NULL;
...@@ -165,271 +103,188 @@ gail_expander_ref_child (AtkObject *obj, ...@@ -165,271 +103,188 @@ gail_expander_ref_child (AtkObject *obj,
* since we don't want the label included with the children. * since we don't want the label included with the children.
*/ */
label = gtk_expander_get_label_widget (GTK_EXPANDER (widget)); label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
if (label) { if (label)
for (index = 0; index <= i; index++) { {
tmp_list = g_list_nth (children, index); for (index = 0; index <= i; index++)
if (label == GTK_WIDGET (tmp_list->data)) { {
i += 1; tmp_list = g_list_nth (children, index);
break; if (label == GTK_WIDGET (tmp_list->data))
} {
i += 1;
break;
}
}
} }
}
tmp_list = g_list_nth (children, i); tmp_list = g_list_nth (children, i);
if (!tmp_list) if (!tmp_list)
{ {
g_list_free (children); g_list_free (children);
return NULL; return NULL;
} }
accessible = gtk_widget_get_accessible (GTK_WIDGET (tmp_list->data)); accessible = gtk_widget_get_accessible (GTK_WIDGET (tmp_list->data));
g_list_free (children); g_list_free (children);
g_object_ref (accessible); g_object_ref (accessible);
return accessible; return accessible;
}
static void
gail_expander_real_initialize (AtkObject *obj,
gpointer data)
{
GailExpander *gail_expander = GAIL_EXPANDER (obj);
GtkWidget *expander;
ATK_OBJECT_CLASS (gail_expander_parent_class)->initialize (obj, data);
expander = GTK_WIDGET (data);
if (gtk_widget_get_mapped (expander))
gail_expander_init_textutil (gail_expander, GTK_EXPANDER (expander));
else
g_signal_connect (expander,
"map",
G_CALLBACK (gail_expander_map_gtk),
gail_expander);
obj->role = ATK_ROLE_TOGGLE_BUTTON;
} }
static void static void
gail_expander_map_gtk (GtkWidget *widget, gtk_expander_accessible_initialize (AtkObject *obj,
gpointer data) gpointer data)
{ {
GailExpander *expander; ATK_OBJECT_CLASS (gtk_expander_accessible_parent_class)->initialize (obj, data);
expander = GAIL_EXPANDER (data); obj->role = ATK_ROLE_TOGGLE_BUTTON;
gail_expander_init_textutil (expander, GTK_EXPANDER (widget));
} }
static void static void
gail_expander_real_notify_gtk (GObject *obj, gtk_expander_accessible_notify_gtk (GObject *obj,
GParamSpec *pspec) GParamSpec *pspec)
{ {
AtkObject* atk_obj; AtkObject* atk_obj;
GtkExpander *expander; GtkExpander *expander;
GailExpander *gail_expander;
expander = GTK_EXPANDER (obj); expander = GTK_EXPANDER (obj);
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (expander)); atk_obj = gtk_widget_get_accessible (GTK_WIDGET (expander));
; ;
if (strcmp (pspec->name, "label") == 0) if (strcmp (pspec->name, "label") == 0)
{ {
const gchar* label_text;
label_text = gail_expander_get_full_text (expander);
gail_expander = GAIL_EXPANDER (atk_obj);
if (gail_expander->textutil)
gail_text_util_text_setup (gail_expander->textutil, label_text);
if (atk_obj->name == NULL) if (atk_obj->name == NULL)
{
/*
* The label has changed so notify a change in accessible-name
*/
g_object_notify (G_OBJECT (atk_obj), "accessible-name"); g_object_notify (G_OBJECT (atk_obj), "accessible-name");
}
/*
* The label is the only property which can be changed
*/
g_signal_emit_by_name (atk_obj, "visible_data_changed"); g_signal_emit_by_name (atk_obj, "visible_data_changed");
} }
else if (strcmp (pspec->name, "expanded") == 0) else if (strcmp (pspec->name, "expanded") == 0)
{ {
atk_object_notify_state_change (atk_obj, ATK_STATE_CHECKED, atk_object_notify_state_change (atk_obj, ATK_STATE_CHECKED,
gtk_expander_get_expanded (expander)); gtk_expander_get_expanded (expander));
atk_object_notify_state_change (atk_obj, ATK_STATE_EXPANDED, atk_object_notify_state_change (atk_obj, ATK_STATE_EXPANDED,
gtk_expander_get_expanded (expander)); gtk_expander_get_expanded (expander));
g_signal_emit_by_name (atk_obj, "visible_data_changed"); g_signal_emit_by_name (atk_obj, "visible_data_changed");
} }
else else
GAIL_WIDGET_CLASS (gail_expander_parent_class)->notify_gtk (obj, pspec); GAIL_WIDGET_CLASS (gtk_expander_accessible_parent_class)->notify_gtk (obj, pspec);
} }
static const gchar* static AtkStateSet*
gail_expander_get_full_text (GtkExpander *widget) gtk_expander_accessible_ref_state_set (AtkObject *obj)
{ {
GtkWidget *label_widget; AtkStateSet *state_set;
GtkWidget *widget;
label_widget = gtk_expander_get_label_widget (widget); GtkExpander *expander;
if (!GTK_IS_LABEL (label_widget)) widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
if (widget == NULL)
return NULL; return NULL;
return gtk_label_get_text (GTK_LABEL (label_widget)); state_set = ATK_OBJECT_CLASS (gtk_expander_accessible_parent_class)->ref_state_set (obj);
expander = GTK_EXPANDER (widget);
atk_state_set_add_state (state_set, ATK_STATE_EXPANDABLE);
if (gtk_expander_get_expanded (expander))
{
atk_state_set_add_state (state_set, ATK_STATE_CHECKED);
atk_state_set_add_state (state_set, ATK_STATE_EXPANDED);
}
return state_set;
} }
static void static void
gail_expander_init_textutil (GailExpander *expander, gtk_expander_accessible_class_init (GtkExpanderAccessibleClass *klass)
GtkExpander *widget)
{ {
const gchar *label_text; AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
GailWidgetClass *widget_class = (GailWidgetClass*)klass;
widget_class->notify_gtk = gtk_expander_accessible_notify_gtk;
class->get_name = gtk_expander_accessible_get_name;
class->get_n_children = gtk_expander_accessible_get_n_children;
class->ref_child = gtk_expander_accessible_ref_child;
class->ref_state_set = gtk_expander_accessible_ref_state_set;
expander->textutil = gail_text_util_new (); class->initialize = gtk_expander_accessible_initialize;
label_text = gail_expander_get_full_text (widget);
gail_text_util_text_setup (expander->textutil, label_text);
} }
static void static void
atk_action_interface_init (AtkActionIface *iface) gtk_expander_accessible_init (GtkExpanderAccessible *expander)
{ {
iface->do_action = gail_expander_do_action;
iface->get_n_actions = gail_expander_get_n_actions;
iface->get_keybinding = gail_expander_get_keybinding;
iface->get_name = gail_expander_action_get_name;
} }
static gboolean static gboolean
gail_expander_do_action (AtkAction *action, gtk_expander_accessible_do_action (AtkAction *action,
gint i) gint i)
{ {
GtkWidget *widget; GtkWidget *widget;
gboolean return_value = TRUE;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
if (widget == NULL) if (widget == NULL)
/*
* State is defunct
*/
return FALSE; return FALSE;
if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget)) if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget))
return FALSE; return FALSE;
switch (i) if (i != 0)
{ return FALSE;
case 0:
gtk_widget_activate (widget); gtk_widget_activate (widget);
break; return TRUE;
default:
return_value = FALSE;
break;
}
return return_value;
} }
static gint static gint
gail_expander_get_n_actions (AtkAction *action) gtk_expander_accessible_get_n_actions (AtkAction *action)
{ {
return 1; return 1;
} }
static const gchar* static const gchar *
gail_expander_get_keybinding (AtkAction *action, gtk_expander_accessible_get_keybinding (AtkAction *action,
gint i) gint i)
{ {
GailExpander *expander; GtkExpanderAccessible *expander;
gchar *return_value = NULL; gchar *return_value = NULL;
GtkWidget *widget;
GtkWidget *label;
switch (i) widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
{ if (widget == NULL)
case 0: return NULL;
{
/*
* We look for a mnemonic on the label
*/
GtkWidget *widget;
GtkWidget *label;
expander = GAIL_EXPANDER (action);
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (expander));
if (widget == NULL)
/*
* State is defunct
*/
return NULL;
g_return_val_if_fail (GTK_IS_EXPANDER (widget), NULL);
label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
if (GTK_IS_LABEL (label))
{
guint key_val;
key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label));
if (key_val != GDK_KEY_VoidSymbol)
return_value = gtk_accelerator_name (key_val, GDK_MOD1_MASK);
g_free (expander->activate_keybinding);
expander->activate_keybinding = return_value;
}
break;
}
default:
break;
}
return return_value;
}
static const gchar* if (i != 0)
gail_expander_action_get_name (AtkAction *action, return NULL;
gint i)
{ expander = GTK_EXPANDER_ACCESSIBLE (action);
const gchar *return_value;
switch (i) label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
if (GTK_IS_LABEL (label))
{ {
case 0: guint key_val;
return_value = "activate";
break; key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label));
default: if (key_val != GDK_KEY_VoidSymbol)
return_value = NULL; return_value = gtk_accelerator_name (key_val, GDK_MOD1_MASK);
break;
} }
return return_value;
return return_value;
}