New function which sets which state ATK_STATE_FOCUSED, if appropriate.

2003-03-19  Padraig O'Briain  <padraig.obriain@sun.com>

	* libnautilus-private/nautilus-icon-canvas-item.c
	(nautilus_icon_canvas_item_accessible_ref_state_set): New function
	which sets which state ATK_STATE_FOCUSED, if appropriate.

	* libnautilus-private/nautilus-icon-container.c
	(select_one_unselect_others): Call atk_focus_tracker_notify() if
	selection changed.

	This fixes bug #107639.
This commit is contained in:
Padraig O'Briain 2003-03-19 09:09:06 +00:00 committed by Padraig O'Briain
parent e8c0ad97c2
commit 264cea06f9
3 changed files with 66 additions and 0 deletions

View file

@ -1,3 +1,15 @@
2003-03-19 Padraig O'Briain <padraig.obriain@sun.com>
* libnautilus-private/nautilus-icon-canvas-item.c
(nautilus_icon_canvas_item_accessible_ref_state_set): New function
which sets which state ATK_STATE_FOCUSED, if appropriate.
* libnautilus-private/nautilus-icon-container.c
(select_one_unselect_others): Call atk_focus_tracker_notify() if
selection changed.
This fixes bug #107639.
2003-03-18 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-emblem-utils.c:

View file

@ -191,6 +191,7 @@ static void draw_embedded_text (NautilusIconCanvasItem
static NautilusIconCanvasItemClass *parent_class = NULL;
static gpointer accessible_parent_class = NULL;
/* Object initialization function for the icon item. */
static void
@ -1950,14 +1951,63 @@ nautilus_icon_canvas_item_accessible_get_index_in_parent (AtkObject *accessible)
return -1;
}
static AtkStateSet*
nautilus_icon_canvas_item_accessible_ref_state_set (AtkObject *accessible)
{
AtkStateSet *state_set;
NautilusIconCanvasItem *item;
NautilusIconContainer *container;
NautilusIcon *icon;
GList *l;
gboolean one_item_selected;
state_set = ATK_OBJECT_CLASS (accessible_parent_class)->ref_state_set (accessible);
item = eel_accessibility_get_gobject (accessible);
container = NAUTILUS_ICON_CONTAINER (EEL_CANVAS_ITEM (item)->canvas);
if (!item) {
atk_state_set_add_state (state_set, ATK_STATE_DEFUNCT);
} else if (item->details->is_highlighted_as_keyboard_focus) {
atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
} else if (!container->details->keyboard_focus) {
one_item_selected = FALSE;
l = container->details->icons;
while (l) {
icon = l->data;
if (icon->item == item) {
if (icon->is_selected) {
one_item_selected = TRUE;
} else {
break;
}
} else if (icon->is_selected) {
one_item_selected = FALSE;
break;
}
l = l->next;
}
if (one_item_selected) {
atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
}
}
return state_set;
}
static void
nautilus_icon_canvas_item_accessible_class_init (AtkObjectClass *klass)
{
accessible_parent_class = g_type_class_peek_parent (klass);
klass->get_name = nautilus_icon_canvas_item_accessible_get_name;
klass->get_description = nautilus_icon_canvas_item_accessible_get_description;
klass->get_parent = nautilus_icon_canvas_item_accessible_get_parent;
klass->get_index_in_parent = nautilus_icon_canvas_item_accessible_get_index_in_parent;
klass->ref_state_set = nautilus_icon_canvas_item_accessible_ref_state_set;
}

View file

@ -1474,6 +1474,10 @@ select_one_unselect_others (NautilusIconContainer *container,
(container, icon, icon == icon_to_select);
}
if (selection_changed) {
AtkObject *atk_object = eel_accessibility_for_object (icon_to_select->item);
atk_focus_tracker_notify (atk_object);
}
return selection_changed;
}