Add/Remove ATK_STATE_SENSITIVE according to cells' state.

Bug #569042.
This commit is contained in:
Joanmarie Diggs 2010-03-05 14:48:23 +08:00 committed by Tristan Van Berkom
parent fe0a89e251
commit 70d2c392ca
2 changed files with 19 additions and 1 deletions

View File

@ -32,6 +32,7 @@ static gboolean gail_boolean_cell_update_cache (GailRendererCell *ce
gchar *gail_boolean_cell_property_list[] = {
"active",
"radio",
"sensitive",
NULL
};
@ -73,6 +74,7 @@ gail_boolean_cell_new (void)
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;
}
@ -83,8 +85,10 @@ gail_boolean_cell_update_cache (GailRendererCell *cell,
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, NULL);
g_object_get (G_OBJECT(cell->renderer), "active", &new_boolean,
"sensitive", &new_sensitive, NULL);
if (boolean_cell->cell_value != new_boolean)
{
@ -99,5 +103,18 @@ gail_boolean_cell_update_cache (GailRendererCell *cell,
gail_cell_remove_state (GAIL_CELL (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)
gail_cell_add_state (GAIL_CELL (cell), ATK_STATE_SENSITIVE, emit_change_signal);
else
gail_cell_remove_state (GAIL_CELL (cell), ATK_STATE_SENSITIVE, emit_change_signal);
}
return rv;
}

View File

@ -39,6 +39,7 @@ struct _GailBooleanCell
{
GailRendererCell parent;
gboolean cell_value;
gboolean cell_sensitive;
};
GType gail_boolean_cell_get_type (void);