glade3 r1760 - in branches/builder: . gladeui plugins/gtk+
- From: tvb svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r1760 - in branches/builder: . gladeui plugins/gtk+
- Date: Wed, 2 Apr 2008 10:38:00 +0100 (BST)
Author: tvb
Date: Wed Apr 2 10:37:59 2008
New Revision: 1760
URL: http://svn.gnome.org/viewvc/glade3?rev=1760&view=rev
Log:
- Implemented atk relations
* gladeui/glade-widget-adaptor.c, gladeui/glade-signal.c:
Implemented loading of signals.
Modified:
branches/builder/ChangeLog
branches/builder/gladeui/glade-property-class.c
branches/builder/gladeui/glade-signal.c
branches/builder/gladeui/glade-signal.h
branches/builder/gladeui/glade-widget-adaptor.c
branches/builder/gladeui/glade-widget.c
branches/builder/gladeui/glade-xml-utils.h
branches/builder/plugins/gtk+/glade-gtk.c
Modified: branches/builder/gladeui/glade-property-class.c
==============================================================================
--- branches/builder/gladeui/glade-property-class.c (original)
+++ branches/builder/gladeui/glade-property-class.c Wed Apr 2 10:37:59 2008
@@ -53,102 +53,6 @@
#define NUMERICAL_PAGE_INCREMENT 10
#define NUMERICAL_PAGE_SIZE 1
-
-/* Hardcoded recognized atk actions
- */
-typedef struct {
- gchar *prop_name;
- gchar *id;
- gchar *name;
- gchar *tooltip;
-} GPCAtkPropertyTab;
-
-static const GPCAtkPropertyTab action_names_table[] = {
- { "click", "atk-click", N_("Click"),
- N_("Set the description of the Click atk action") },
- { "press", "atk-press", N_("Press"),
- N_("Set the description of the Press atk action") },
- { "release", "atk-release", N_("Release"),
- N_("Set the description of the Release atk action") },
- { "activate", "atk-activate", N_("Activate"),
- N_("Set the description of the Activate atk action") }
-};
-
-static const GPCAtkPropertyTab relation_names_table[] = {
- { "controlled-by", "atk-controlled-by", N_("Controlled By"),
- N_("Indicates an object controlled by one or more target objects") },
-
- { "controlled-for", "atk-controlled-for", N_("Controller For"),
- N_("Indicates an object is a controller for one or more target objects") },
-
- { "labelled-by", "atk-labelled-by", N_("Labelled By"),
- N_("Indicates an object is labelled by one or more target objects") },
-
- { "label-for", "atk-label-for", N_("Label For"),
- N_("Indicates an object is a label for one or more target objects") },
-
- { "member-of", "atk-member-of", N_("Member Of"),
- N_("Indicates an object is a member of a group of one or more target objects") },
-
- { "child-node-of", "atk-child-node-of", N_("Child Node Of"),
- N_("Indicates an object is a cell in a treetable which is displayed "
- "because a cell in the same column is expanded and identifies that cell") },
-
- { "flows-to", "atk-flows-to", N_("Flows To"),
- N_("Indicates that the object has content that flows logically to another "
- "AtkObject in a sequential way (text-flow, for instance).") },
-
- { "flows-from", "atk-flows-from", N_("Flows From"),
- N_("Indicates that the object has content that flows logically from another "
- "AtkObject in a sequential way, (for instance text-flow)") },
-
- { "subwindow-of", "atk-subwindow-of", N_("Subwindow Of"),
- N_("Indicates a subwindow attached to a component but otherwise has no "
- "connection in the UI hierarchy to that component") },
-
- { "embeds", "atk-embeds", N_("Embeds"),
- N_("Indicates that the object visually embeds another object's content, "
- "i.e. this object's content flows around another's content") },
-
- { "embedded-by", "atk-embedded-by", N_("Embedded By"),
- N_("Inverse of 'Embeds', indicates that this object's content "
- "is visually embedded in another object") },
-
- { "popup-for", "atk-popup-for", N_("Popup For"),
- N_("Indicates that an object is a popup for another object") },
-
- { "parent-window-of", "atk-parent-window-of", N_("Parent Window Of"),
- N_("Indicates that an object is a parent window of another object") }
-};
-
-
-/**
- * glade_property_class_atk_realname:
- * @atk_name: The id of the atk property
- *
- * Translates a GladePropertyClass->id to the name that should be
- * saved into the glade file.
- *
- * Returns: a pointer to a constant string.
- */
-G_CONST_RETURN gchar *
-glade_property_class_atk_realname (const gchar *atk_name)
-{
- gint i;
-
- g_return_val_if_fail (atk_name != NULL, NULL);
-
- for (i = 0; i < G_N_ELEMENTS (action_names_table); i++)
- if (!strcmp (action_names_table[i].id, atk_name))
- return action_names_table[i].prop_name;
-
- for (i = 0; i < G_N_ELEMENTS (relation_names_table); i++)
- if (!strcmp (relation_names_table[i].id, atk_name))
- return relation_names_table[i].prop_name;
-
- return atk_name;
-}
-
/**
* glade_property_class_new:
* @handle: A generic pointer (i.e. a #GladeWidgetClass)
@@ -1152,6 +1056,7 @@
if (spec->flags & G_PARAM_CONSTRUCT_ONLY)
property_class->construct_only = TRUE;
+ /* XXXX Is this still valid ??? NO !*/
if (g_type_is_a (spec->owner_type, ATK_TYPE_OBJECT))
{
property_class->type = GPC_ATK_PROPERTY;
Modified: branches/builder/gladeui/glade-signal.c
==============================================================================
--- branches/builder/gladeui/glade-signal.c (original)
+++ branches/builder/gladeui/glade-signal.c Wed Apr 2 10:37:59 2008
@@ -146,25 +146,37 @@
return TRUE;
}
+#endif // LOADING_WAS_IMPLEMENTED
+
/*
* Returns a new GladeSignal with the attributes defined in node
*/
-GladeSignal *glade_signal_new_from_signal_info (GladeSignalInfo *info)
+GladeSignal *
+glade_signal_read (GladeXmlNode *node)
{
GladeSignal *signal;
+ gchar *name, *handler;
- g_return_val_if_fail (info != NULL, NULL);
+ g_return_val_if_fail (glade_xml_node_verify_silent
+ (node, GLADE_XML_TAG_SIGNAL), NULL);
- signal = g_new0 (GladeSignal, 1);
- signal->name = g_strdup (info->name);
- glade_util_replace (signal->name, '_', '-');
- signal->handler = g_strdup (info->handler);
- signal->after = info->after;
- signal->userdata = g_strdup (info->object);
+ if (!(name =
+ glade_xml_get_property_string_required (node, GLADE_XML_TAG_NAME, NULL)))
+ return NULL;
+ glade_util_replace (name, '_', '-');
- if (!signal->name)
+ if (!(handler =
+ glade_xml_get_property_string_required (node, GLADE_XML_TAG_HANDLER, NULL)))
+ {
+ g_free (name);
return NULL;
+ }
+
+ signal = g_new0 (GladeSignal, 1);
+ signal->name = name;
+ signal->handler = handler;
+ signal->after = glade_xml_get_property_boolean (node, GLADE_XML_TAG_AFTER, FALSE);
+ signal->userdata = glade_xml_get_property_string (node, GLADE_XML_TAG_OBJECT);
return signal;
}
-#endif // LOADING_WAS_IMPLEMENTED
Modified: branches/builder/gladeui/glade-signal.h
==============================================================================
--- branches/builder/gladeui/glade-signal.h (original)
+++ branches/builder/gladeui/glade-signal.h Wed Apr 2 10:37:59 2008
@@ -34,6 +34,9 @@
gboolean glade_signal_equal (GladeSignal *sig1, GladeSignal *sig2);
+GladeSignal *glade_signal_read (GladeXmlNode *node);
+
+
/* XXX gboolean glade_signal_write (GladeSignalInfo *info, GladeSignal *signal, */
/* GladeInterface *interface); */
Modified: branches/builder/gladeui/glade-widget-adaptor.c
==============================================================================
--- branches/builder/gladeui/glade-widget-adaptor.c (original)
+++ branches/builder/gladeui/glade-widget-adaptor.c Wed Apr 2 10:37:59 2008
@@ -760,16 +760,11 @@
GladeWidget *widget,
GladeXmlNode *node)
{
+ GladeXmlNode *sig_node;
GList *props;
- /* XXX Here were looking at a GladeWidget object built with native
- * defaults
- */
-
- /* first all the properties */
- g_print ("reading widget '%s' of class '%s'\n",
- widget->name, adaptor->name);
+ GladeSignal *signal;
- /* Get the packing properties */
+ /* Read in the properties */
for (props = widget->properties;
props; props = props->next)
{
@@ -779,8 +774,18 @@
widget->project, node, TRUE);
}
- /* then all the signals */
+ /* Read in the signals */
+ for (sig_node = glade_xml_node_get_children (node);
+ sig_node; sig_node = glade_xml_node_next (sig_node))
+ {
+ if (!glade_xml_node_verify_silent (sig_node, GLADE_XML_TAG_SIGNAL))
+ continue;
+
+ if (!(signal = glade_signal_read (sig_node)))
+ continue;
+ glade_widget_add_signal_handler (widget, signal);
+ }
}
static GType
Modified: branches/builder/gladeui/glade-widget.c
==============================================================================
--- branches/builder/gladeui/glade-widget.c (original)
+++ branches/builder/gladeui/glade-widget.c Wed Apr 2 10:37:59 2008
@@ -1918,7 +1918,7 @@
}
}
- /* Signals */
+ /* Signals XXX */
for (i = 0; i < info->n_signals; ++i)
{
GladeSignal *signal;
Modified: branches/builder/gladeui/glade-xml-utils.h
==============================================================================
--- branches/builder/gladeui/glade-xml-utils.h (original)
+++ branches/builder/gladeui/glade-xml-utils.h Wed Apr 2 10:37:59 2008
@@ -28,10 +28,10 @@
#define GLADE_XML_TAG_ID "id"
#define GLADE_XML_TAG_SIGNAL "signal"
#define GLADE_XML_TAG_HANDLER "handler"
+#define GLADE_XML_TAG_AFTER "after"
+#define GLADE_XML_TAG_OBJECT "object"
#define GLADE_XML_TAG_NAME "name"
#define GLADE_XML_TAG_CHILD "child"
-#define GLADE_XML_TAG_SIGNAL "signal"
-#define GLADE_XML_TAG_AFTER "after"
#define GLADE_XML_TAG_PACKING "packing"
#define GLADE_XML_TAG_PLACEHOLDER "placeholder"
#define GLADE_XML_TAG_INTERNAL_CHILD "internal-child"
Modified: branches/builder/plugins/gtk+/glade-gtk.c
==============================================================================
--- branches/builder/plugins/gtk+/glade-gtk.c (original)
+++ branches/builder/plugins/gtk+/glade-gtk.c Wed Apr 2 10:37:59 2008
@@ -253,6 +253,28 @@
#define GLADE_TAG_A11Y_PROPERTY "atkproperty"
#define GLADE_TAG_A11Y_ACTION_NAME "action_name" /* We should make -/_ synonymous */
#define GLADE_TAG_A11Y_DESC "description"
+#define GLADE_TAG_A11Y_RELATION "atkrelation"
+#define GLADE_TAG_A11Y_TARGET "target"
+#define GLADE_TAG_A11Y_TYPE "type"
+
+static const gchar *atk_relations_list[] = {
+ "controlled-by",
+ "controller-for",
+ "labelled-by",
+ "label-for",
+ "member-of",
+ "node-child-of",
+ "flows-to",
+ "flows-from",
+ "subwindow-of",
+ "embeds",
+ "embedded-by",
+ "popup-for",
+ "parent-window-of",
+ "described-by",
+ "description-for",
+ NULL
+};
static GdkModifierType
@@ -414,9 +436,6 @@
if ((property = glade_widget_get_property (widget, id)) != NULL)
{
-
- g_print ("Found property '%s'\n", id);
-
/* Complex statement just getting the value here... */
if ((!is_action &&
!(value = glade_xml_get_content (prop))) ||
@@ -429,10 +448,6 @@
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);
@@ -464,10 +479,72 @@
}
static void
+glade_gtk_parse_atk_relation (GladeProperty *property,
+ GladeXmlNode *node)
+{
+ GladeXmlNode *prop;
+ gchar *type, *target, *id, *tmp;
+ gchar *string = NULL;
+
+ 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_RELATION))
+ continue;
+
+ if (!(type =
+ glade_xml_get_property_string_required
+ (prop, GLADE_TAG_A11Y_TYPE, NULL)))
+ continue;
+
+ if (!(target =
+ glade_xml_get_property_string_required
+ (prop, GLADE_TAG_A11Y_TARGET, NULL)))
+ {
+ g_free (type);
+ continue;
+ }
+
+ id = glade_util_read_prop_name (type);
+
+ if (!strcmp (id, property->klass->id))
+ {
+ if (string == NULL)
+ string = g_strdup (target);
+ else
+ {
+ tmp = g_strdup_printf ("%s%s%s", string,
+ GPC_OBJECT_DELIMITER, target);
+ string = (g_free (string), tmp);
+ }
+
+ }
+
+ g_free (id);
+ g_free (type);
+ g_free (target);
+ }
+
+
+ /* we must synchronize this directly after loading this project
+ * (i.e. lookup the actual objects after they've been parsed and
+ * are present). this is a feature of object and object list properties
+ * that needs a better api.
+ */
+ if (string)
+ {
+ g_object_set_data_full (G_OBJECT (property), "glade-loaded-object",
+ g_strdup (string), g_free);
+ }
+}
+
+static void
glade_gtk_widget_read_atk_props (GladeWidget *widget,
GladeXmlNode *node)
{
- GladeXmlNode *atk_node;
+ GladeXmlNode *atk_node;
+ GladeProperty *property;
+ gint i;
if ((atk_node =
glade_xml_search_child (node, GLADE_TAG_A11Y_A11Y)) != NULL)
@@ -476,9 +553,17 @@
glade_gtk_parse_atk_props (widget, atk_node);
/* Relations */
-
+ for (i = 0; atk_relations_list[i]; i++)
+ {
+ if ((property =
+ glade_widget_get_property (widget,
+ atk_relations_list[i])))
+ glade_gtk_parse_atk_relation (property, atk_node);
+ else
+ g_warning ("Couldnt find atk relation %s",
+ atk_relations_list[i]);
+ }
}
-
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]