glade3 r1758 - in branches/builder: . gladeui plugins/gtk+



Author: tvb
Date: Wed Apr  2 08:38:31 2008
New Revision: 1758
URL: http://svn.gnome.org/viewvc/glade3?rev=1758&view=rev

Log:
	  - Implemented loading of atk properties (not relations or actions yet...)



Modified:
   branches/builder/ChangeLog
   branches/builder/gladeui/glade-property.c
   branches/builder/gladeui/glade-utils.c
   branches/builder/plugins/gtk+/glade-gtk.c
   branches/builder/plugins/gtk+/gtk+.xml.in

Modified: branches/builder/gladeui/glade-property.c
==============================================================================
--- branches/builder/gladeui/glade-property.c	(original)
+++ branches/builder/gladeui/glade-property.c	Wed Apr  2 08:38:31 2008
@@ -1316,9 +1316,9 @@
 				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);

Modified: branches/builder/gladeui/glade-utils.c
==============================================================================
--- branches/builder/gladeui/glade-utils.c	(original)
+++ branches/builder/gladeui/glade-utils.c	Wed Apr  2 08:38:31 2008
@@ -569,15 +569,6 @@
 
 	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;
 }
 

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 08:38:31 2008
@@ -248,6 +248,12 @@
 #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 @@
 		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 @@
 	}
 }
 
+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_accels (widget, node);
 
 	/* Read in atk props */
+	glade_gtk_widget_read_atk_props (widget, node);
 
 }
 

Modified: branches/builder/plugins/gtk+/gtk+.xml.in
==============================================================================
--- branches/builder/plugins/gtk+/gtk+.xml.in	(original)
+++ branches/builder/plugins/gtk+/gtk+.xml.in	Wed Apr  2 08:38:31 2008
@@ -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>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]