diff options
author | Tristan Van Berkom <tvb@src.gnome.org> | 2008-04-02 08:22:18 +0000 |
---|---|---|
committer | Tristan Van Berkom <tvb@src.gnome.org> | 2008-04-02 08:22:18 +0000 |
commit | c14b27004355a04b50f5f411d90b56882f870d1f (patch) | |
tree | 175f9db125a0e07401e432e6031e67999e6a626c | |
parent | d552f8fa0ffc5ad078d8465557f01dbc56de8526 (diff) | |
download | glade-c14b27004355a04b50f5f411d90b56882f870d1f.tar.gz |
- Implemented loading of atk actions now...
svn path=/branches/builder/; revision=1759
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | gladeui/glade-property-class.c | 51 | ||||
-rw-r--r-- | gladeui/glade-property-class.h | 7 | ||||
-rw-r--r-- | gladeui/glade-widget-adaptor.c | 3 | ||||
-rw-r--r-- | plugins/gtk+/glade-gtk.c | 62 |
5 files changed, 48 insertions, 76 deletions
@@ -10,6 +10,7 @@ * gladeui/glade-gtk.c: - Implemented loading of accelerators. - Implemented loading of atk properties (not relations or actions yet...) + - Implemented loading of atk actions now... 2008-04-01 Tristan Van Berkom <tvb@gnome.org> diff --git a/gladeui/glade-property-class.c b/gladeui/glade-property-class.c index 706adc2e..b8deba28 100644 --- a/gladeui/glade-property-class.c +++ b/gladeui/glade-property-class.c @@ -1100,57 +1100,6 @@ glade_property_class_get_from_gvalue (GladePropertyClass *klass, } /** - * glade_property_class_list_atk_relations: - * @handle: A generic pointer (i.e. a #GladeWidgetClass) - * @owner_type: The #GType of the owning widget class. - * - * Returns: a #GList of newly created atk relation #GladePropertyClass. - */ -GList * -glade_property_class_list_atk_relations (gpointer handle, - GType owner_type) -{ - const GPCAtkPropertyTab *relation_tab = NULL; - GladePropertyClass *property_class; - GList *list = NULL; - gint i; - - /* Loop through our hard-coded table enties */ - for (i = 0; i < G_N_ELEMENTS (relation_names_table); i++) - { - relation_tab = &relation_names_table[i]; - - property_class = glade_property_class_new (handle); - property_class->pspec = - glade_param_spec_objects (relation_tab->id, - _(relation_tab->name), - _(relation_tab->tooltip), - ATK_TYPE_IMPLEMENTOR, - G_PARAM_READWRITE); - - property_class->pspec->owner_type = owner_type; - property_class->id = g_strdup (relation_tab->id); - property_class->name = g_strdup (_(relation_tab->name)); - property_class->tooltip = g_strdup (_(relation_tab->tooltip)); - property_class->type = GPC_ATK_RELATION; - property_class->visible_lines = 2; - property_class->ignore = TRUE; - - property_class->def = - glade_property_class_make_gvalue_from_string - (property_class, "", NULL); - - property_class->orig_def = - glade_property_class_make_gvalue_from_string - (property_class, "", NULL); - - list = g_list_prepend (list, property_class); - } - - return g_list_reverse (list); -} - -/** * glade_property_class_new_from_spec: * @handle: A generic pointer (i.e. a #GladeWidgetClass) * @spec: A #GParamSpec diff --git a/gladeui/glade-property-class.h b/gladeui/glade-property-class.h index 88c500b2..cbe551c3 100644 --- a/gladeui/glade-property-class.h +++ b/gladeui/glade-property-class.h @@ -166,13 +166,6 @@ GladePropertyClass *glade_property_class_new (gpointer GladePropertyClass *glade_property_class_new_from_spec (gpointer handle, GParamSpec *spec); - -GList *glade_property_class_list_atk_relations (gpointer handle, - GType owner_type); - -GladePropertyClass *glade_property_class_accel_property (gpointer handle, - GType owner_type); - GladePropertyClass *glade_property_class_clone (GladePropertyClass *property_class); diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c index 85a30b5e..c40532ba 100644 --- a/gladeui/glade-widget-adaptor.c +++ b/gladeui/glade-widget-adaptor.c @@ -403,9 +403,6 @@ gwa_setup_introspected_props_from_pspecs (GladeWidgetAdaptor *adaptor, g_list_reverse (list)); } -/* XXX Atk relations and accel props disregarded - they should - * be implemented from the gtk+ catalog instead I think. - */ static void gwa_setup_properties (GladeWidgetAdaptor *adaptor, GObjectClass *object_class, diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c index 6452cf1f..b057d8b4 100644 --- a/plugins/gtk+/glade-gtk.c +++ b/plugins/gtk+/glade-gtk.c @@ -243,15 +243,16 @@ glade_gtk_stop_emission_POINTER (gpointer instance, gpointer dummy, gpointer dat } /* ----------------------------- GtkWidget ------------------------------ */ -#define GLADE_TAG_ACCEL "accelerator" -#define GLADE_TAG_ACCEL_KEY "key" -#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" +#define GLADE_TAG_ACCEL "accelerator" +#define GLADE_TAG_ACCEL_KEY "key" +#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" +#define GLADE_TAG_A11Y_ACTION_NAME "action_name" /* We should make -/_ synonymous */ +#define GLADE_TAG_A11Y_DESC "description" static GdkModifierType @@ -373,16 +374,26 @@ glade_gtk_parse_atk_props (GladeWidget *widget, GValue *gvalue; gchar *value, *name, *id, *comment; gint translatable, has_context; + gboolean is_action; 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)) + if (glade_xml_node_verify_silent (prop, GLADE_TAG_A11Y_PROPERTY)) + is_action = FALSE; + else if (glade_xml_node_verify_silent (prop, GLADE_TAG_A11Y_ACTION)) + is_action = TRUE; + else continue; - if (!(name = glade_xml_get_property_string_required + if (!is_action && + !(name = glade_xml_get_property_string_required (prop, GLADE_XML_TAG_NAME, NULL))) continue; + else if (is_action && + !(name = glade_xml_get_property_string_required + (prop, GLADE_TAG_A11Y_ACTION_NAME, NULL))) + continue; /* Make sure we are working with dashes and * not underscores ... @@ -390,15 +401,38 @@ glade_gtk_parse_atk_props (GladeWidget *widget, id = glade_util_read_prop_name (name); g_free (name); + /* We are namespacing the action properties internally + * just incase they clash (all property names must be + * unique...) + */ + if (is_action) + { + name = g_strdup_printf ("atk-%s", id); + g_free (id); + id = name; + } + if ((property = glade_widget_get_property (widget, id)) != NULL) { - if (!(value = glade_xml_get_content (prop))) + + g_print ("Found property '%s'\n", id); + + /* Complex statement just getting the value here... */ + if ((!is_action && + !(value = glade_xml_get_content (prop))) || + (is_action && + !(value = glade_xml_get_property_string_required + (prop, GLADE_TAG_A11Y_DESC, NULL)))) { - /* XXX should be glade_xml_get_content_required()... */ + /* XXX should be a glade_xml_get_content_required()... */ g_free (id); continue; } + + g_print ("got value '%s' for property '%s'\n", value, id); + + /* Set the parsed value on the property ... */ gvalue = glade_property_class_make_gvalue_from_string (property->klass, value, widget->project); @@ -438,11 +472,9 @@ glade_gtk_widget_read_atk_props (GladeWidget *widget, if ((atk_node = glade_xml_search_child (node, GLADE_TAG_A11Y_A11Y)) != NULL) { - /* Properties */ + /* Properties & actions */ glade_gtk_parse_atk_props (widget, atk_node); - /* Actions */ - /* Relations */ } |