diff options
author | Tristan Van Berkom <tvb@src.gnome.org> | 2008-04-02 07:38:31 +0000 |
---|---|---|
committer | Tristan Van Berkom <tvb@src.gnome.org> | 2008-04-02 07:38:31 +0000 |
commit | d552f8fa0ffc5ad078d8465557f01dbc56de8526 (patch) | |
tree | e6b9dfcfd7bfb43a72e825f5b609adaa7ce73098 | |
parent | 097a7dacf7ab488ba893995379697d1e5f0902b9 (diff) | |
download | glade-d552f8fa0ffc5ad078d8465557f01dbc56de8526.tar.gz |
- Implemented loading of atk properties (not relations or actions yet...)
svn path=/branches/builder/; revision=1758
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | gladeui/glade-property.c | 4 | ||||
-rw-r--r-- | gladeui/glade-utils.c | 9 | ||||
-rw-r--r-- | plugins/gtk+/glade-gtk.c | 92 | ||||
-rw-r--r-- | plugins/gtk+/gtk+.xml.in | 4 |
5 files changed, 99 insertions, 16 deletions
@@ -7,8 +7,10 @@ Moved all accelerater code out of the core and into the plugin, still working on loading glade files with the new parser... - * gladeui/glade-gtk.c: Implemented loading of accelerators. - + * gladeui/glade-gtk.c: + - Implemented loading of accelerators. + - Implemented loading of atk properties (not relations or actions yet...) + 2008-04-01 Tristan Van Berkom <tvb@gnome.org> * gladeui/glade-widget.[ch], gladeui/glade-widget-adaptor.[ch], diff --git a/gladeui/glade-property.c b/gladeui/glade-property.c index 52e0c0d9..b5c0d548 100644 --- a/gladeui/glade-property.c +++ b/gladeui/glade-property.c @@ -1316,9 +1316,9 @@ glade_property_read (GladeProperty *property, gint translatable, has_context; gchar *comment; - translatable = glade_xml_get_property_int + translatable = glade_xml_get_property_boolean (prop, GLADE_TAG_TRANSLATABLE, FALSE); - has_context = glade_xml_get_property_int + has_context = glade_xml_get_property_boolean (prop, GLADE_TAG_HAS_CONTEXT, FALSE); comment = glade_xml_get_property_string (prop, GLADE_TAG_COMMENT); diff --git a/gladeui/glade-utils.c b/gladeui/glade-utils.c index 69d40b53..0a2eec68 100644 --- a/gladeui/glade-utils.c +++ b/gladeui/glade-utils.c @@ -569,15 +569,6 @@ glade_util_read_prop_name (const gchar *str) glade_util_replace (id, '_', '-'); - if (strstr (id, "::")) - { - /* Extract the second half of "AtkObject::accessible_name" - */ - gchar **split = g_strsplit (id, "::", 0); - g_free (id); - id = g_strdup (split[1]); - g_strfreev (split); - } return id; } diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c index 8f34b7e8..6452cf1f 100644 --- a/plugins/gtk+/glade-gtk.c +++ b/plugins/gtk+/glade-gtk.c @@ -248,6 +248,12 @@ glade_gtk_stop_emission_POINTER (gpointer instance, gpointer dummy, gpointer dat #define GLADE_TAG_ACCEL_MODIFIERS "modifiers" #define GLADE_TAG_ACCEL_SIGNAL "signal" +#define GLADE_TAG_A11Y_A11Y "accessibility" +#define GLADE_TAG_A11Y_ACTION "atkaction" +#define GLADE_TAG_A11Y_PROPERTY "atkproperty" + + + static GdkModifierType glade_gtk_parse_modifiers (const gchar *string) { @@ -340,7 +346,6 @@ glade_gtk_widget_read_accels (GladeWidget *widget, ainfo->signal = signal; /* take string ownership... */ ainfo->modifiers = glade_gtk_parse_modifiers (modifiers); - accels = g_list_prepend (accels, ainfo); g_free (modifiers); } @@ -359,6 +364,90 @@ glade_gtk_widget_read_accels (GladeWidget *widget, } } +static void +glade_gtk_parse_atk_props (GladeWidget *widget, + GladeXmlNode *node) +{ + GladeXmlNode *prop; + GladeProperty *property; + GValue *gvalue; + gchar *value, *name, *id, *comment; + gint translatable, has_context; + + for (prop = glade_xml_node_get_children (node); + prop; prop = glade_xml_node_next (prop)) + { + if (!glade_xml_node_verify_silent (prop, GLADE_TAG_A11Y_PROPERTY)) + continue; + + if (!(name = glade_xml_get_property_string_required + (prop, GLADE_XML_TAG_NAME, NULL))) + continue; + + /* Make sure we are working with dashes and + * not underscores ... + */ + id = glade_util_read_prop_name (name); + g_free (name); + + if ((property = glade_widget_get_property (widget, id)) != NULL) + { + if (!(value = glade_xml_get_content (prop))) + { + /* XXX should be glade_xml_get_content_required()... */ + g_free (id); + continue; + } + + /* Set the parsed value on the property ... */ + gvalue = glade_property_class_make_gvalue_from_string + (property->klass, value, widget->project); + glade_property_set_value (property, gvalue); + g_value_unset (gvalue); + g_free (gvalue); + + /* Deal with i18n... */ + translatable = glade_xml_get_property_boolean + (prop, GLADE_TAG_TRANSLATABLE, FALSE); + has_context = glade_xml_get_property_boolean + (prop, GLADE_TAG_HAS_CONTEXT, FALSE); + comment = glade_xml_get_property_string + (prop, GLADE_TAG_COMMENT); + + glade_property_i18n_set_translatable + (property, translatable); + glade_property_i18n_set_has_context + (property, has_context); + glade_property_i18n_set_comment + (property, comment); + + g_free (comment); + g_free (value); + } + + g_free (id); + } +} + +static void +glade_gtk_widget_read_atk_props (GladeWidget *widget, + GladeXmlNode *node) +{ + GladeXmlNode *atk_node; + + if ((atk_node = + glade_xml_search_child (node, GLADE_TAG_A11Y_A11Y)) != NULL) + { + /* Properties */ + glade_gtk_parse_atk_props (widget, atk_node); + + /* Actions */ + + /* Relations */ + + } + +} void glade_gtk_widget_read_widget (GladeWidgetAdaptor *adaptor, @@ -376,6 +465,7 @@ glade_gtk_widget_read_widget (GladeWidgetAdaptor *adaptor, glade_gtk_widget_read_accels (widget, node); /* Read in atk props */ + glade_gtk_widget_read_atk_props (widget, node); } diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in index 13e00937..32e937c7 100644 --- a/plugins/gtk+/gtk+.xml.in +++ b/plugins/gtk+/gtk+.xml.in @@ -92,13 +92,13 @@ </property> <!-- Atk name and description properties --> - <property id="accessible-name" _name="Accessible Name" ignore="True" atk-property="True" translatable="True"> + <property id="AtkObject::accessible-name" _name="Accessible Name" ignore="True" atk-property="True" translatable="True"> <_tooltip>Object instance's name formatted for assistive technology access</_tooltip> <spec>glade_standard_string_spec</spec> <visible-lines>2</visible-lines> </property> - <property id="accessible-description" _name="Accessible Description" ignore="True" atk-property="True" translatable="True"> + <property id="AtkObject::accessible-description" _name="Accessible Description" ignore="True" atk-property="True" translatable="True"> <_tooltip>Description of an object, formatted for assistive technology access</_tooltip> <spec>glade_standard_string_spec</spec> <visible-lines>2</visible-lines> |