diff options
author | Mike Gorse <mgorse@novell.com> | 2011-05-29 17:24:38 -0500 |
---|---|---|
committer | Mike Gorse <mgorse@novell.com> | 2011-05-29 17:24:38 -0500 |
commit | 65caa813eda92711d4d6f37f9f2d0709fab35e92 (patch) | |
tree | 251a0f9a5eab474717d107b609025263f79f3aac /atspi/atspi-stateset.c | |
parent | 01127dee25b39b8d9bdb776acbb0ba8160bc1c18 (diff) | |
download | at-spi2-core-65caa813eda92711d4d6f37f9f2d0709fab35e92.tar.gz |
Revert "Remove redundant tables of state and role names"
This reverts commit 73b811b78954dfb0f8b407354c146d9fbd47dea3.
Diffstat (limited to 'atspi/atspi-stateset.c')
-rw-r--r-- | atspi/atspi-stateset.c | 70 |
1 files changed, 58 insertions, 12 deletions
diff --git a/atspi/atspi-stateset.c b/atspi/atspi-stateset.c index 28e272fc..a5bcc51c 100644 --- a/atspi/atspi-stateset.c +++ b/atspi/atspi-stateset.c @@ -28,6 +28,52 @@ static void atspi_state_set_class_init (AtspiStateSetClass *klass); G_DEFINE_TYPE (AtspiStateSet, atspi_state_set, G_TYPE_OBJECT) +static const char *state_names [] = +{ + "invalid", + "active", + "armed", + "busy", + "checked", + "collapsed", + "defunct", + "editable", + "enabled", + "expandable", + "expanded", + "focusable", + "focused", + "has-tool-tip", + "horizontal", + "iconified", + "modal", + "multi-line", + "multiselectable", + "opaque", + "pressed", + "resizable", + "selectable", + "selected", + "sensitive", + "showing", + "singleLine", + "stale", + "transient", + "vertical", + "visible", + "manages-descendants", + "indeterminate", + "required", + "truncated", + "animated", + "invalid-entry", + "supports-autocompletion", + "selectable-text", + "is-default", + "visited", + NULL +}; + static void atspi_state_set_init (AtspiStateSet *set) { @@ -77,25 +123,25 @@ _atspi_state_set_new_internal (AtspiAccessible *accessible, gint64 states) void atspi_state_set_set_by_name (AtspiStateSet *set, const gchar *name, gboolean enabled) { - GTypeClass *type_class; - GEnumValue *value; - - type_class = g_type_class_ref (ATSPI_TYPE_STATE_TYPE); + gint i = 0; if (set->accessible && !(set->accessible->cached_properties & ATSPI_CACHE_STATES)) return; - value = g_enum_get_value_by_nick (G_ENUM_CLASS (type_class), name); - if (!value) + /* TODO: This could perhaps be optimized */ + for (i = 0; state_names [i]; i++) { - g_warning ("AT-SPI: Attempt to set unknown state '%s'", name); + if (!strcmp (state_names [i], name)) + { + if (enabled) + set->states |= ((gint64)1 << i); + else + set->states &= ~((gint64)1 << i); + return; + } } - - if (enabled) - set->states |= ((gint64)1 << value->value); - else - set->states &= ~((gint64)1 << value->value); + g_warning ("at-spi: Attempt to set unknown state '%s'", name); } static void |