glade3 r2188 - in trunk: . gladeui plugins/gtk+
- From: tvb svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r2188 - in trunk: . gladeui plugins/gtk+
- Date: Wed, 15 Apr 2009 19:11:20 +0000 (UTC)
Author: tvb
Date: Wed Apr 15 19:11:19 2009
New Revision: 2188
URL: http://svn.gnome.org/viewvc/glade3?rev=2188&view=rev
Log:
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in:
Added glade_gtk_cell_renderer_read_widget() and now
glade_gtk_cell_layout_read_child() doesnt load attributes
if the object property has been explicitly specified in
the Glade file (fixes bug 566928).
Modified:
trunk/ChangeLog
trunk/gladeui/glade-property.c
trunk/plugins/gtk+/glade-gtk.c
trunk/plugins/gtk+/gtk+.xml.in
Modified: trunk/gladeui/glade-property.c
==============================================================================
--- trunk/gladeui/glade-property.c (original)
+++ trunk/gladeui/glade-property.c Wed Apr 15 19:11:19 2009
@@ -844,6 +844,8 @@
* @value: a #GValue
*
* Sets the property's value
+ *
+ * Returns: Whether the property was successfully set.
*/
gboolean
glade_property_set_value (GladeProperty *property, const GValue *value)
Modified: trunk/plugins/gtk+/glade-gtk.c
==============================================================================
--- trunk/plugins/gtk+/glade-gtk.c (original)
+++ trunk/plugins/gtk+/glade-gtk.c Wed Apr 15 19:11:19 2009
@@ -10410,23 +10410,35 @@
g_free (attr_prop_name);
}
+static GladeProperty *
+glade_gtk_cell_renderer_attribute_switch (GladeWidget *gwidget,
+ const gchar *property_name)
+{
+ GladeProperty *property;
+ gchar *use_attr_name = g_strdup_printf ("use-attr-%s", property_name);
+
+ property = glade_widget_get_property (gwidget, use_attr_name);
+ g_free (use_attr_name);
+
+ return property;
+}
+
static gboolean
glade_gtk_cell_renderer_property_enabled (GObject *object,
const gchar *property_name)
{
- GladeWidget *gwidget = glade_widget_get_from_gobject (object);
- gchar *use_attr_name = g_strdup_printf ("use-attr-%s", property_name);
GladeProperty *property;
+ GladeWidget *gwidget = glade_widget_get_from_gobject (object);
gboolean use_attr = TRUE;
- if ((property = glade_widget_get_property (gwidget, use_attr_name)) != NULL)
+ if ((property =
+ glade_gtk_cell_renderer_attribute_switch (gwidget, property_name)) != NULL)
glade_property_get (property, &use_attr);
- g_free (use_attr_name);
-
return !use_attr;
}
+
void
glade_gtk_cell_renderer_set_property (GladeWidgetAdaptor *adaptor,
GObject *object,
@@ -10508,6 +10520,49 @@
GWA_GET_CLASS (G_TYPE_OBJECT)->write_widget (adaptor, widget, context, node);
}
+void
+glade_gtk_cell_renderer_read_widget (GladeWidgetAdaptor *adaptor,
+ GladeWidget *widget,
+ GladeXmlNode *node)
+{
+ GladeProperty *property;
+ GList *l;
+ static gint attr_len = 0, use_attr_len = 0;
+
+ if (!glade_xml_node_verify
+ (node, GLADE_XML_TAG_WIDGET (glade_project_get_format (widget->project))))
+ return;
+
+ /* First chain up and read in all the properties... */
+ GWA_GET_CLASS (G_TYPE_OBJECT)->read_widget (adaptor, widget, node);
+
+
+ /* Now set "use-attr-*" everywhere that the object property is non-default */
+ if (!attr_len)
+ {
+ attr_len = strlen ("attr-");
+ use_attr_len = strlen ("use-attr-");
+ }
+
+ for (l = widget->properties; l; l = l->next)
+ {
+ GladeProperty *switch_prop;
+ property = l->data;
+
+ if (strncmp (property->klass->id, "attr-", attr_len) != 0 &&
+ strncmp (property->klass->id, "use-attr-", use_attr_len) != 0 &&
+ (switch_prop =
+ glade_gtk_cell_renderer_attribute_switch (widget, property->klass->id)) != NULL)
+ {
+ if (glade_property_original_default (property))
+ glade_property_set (switch_prop, TRUE);
+ else
+ glade_property_set (switch_prop, FALSE);
+ }
+ }
+
+}
+
/*--------------------------- GtkCellLayout ---------------------------------*/
void
glade_gtk_cell_layout_add_child (GladeWidgetAdaptor *adaptor,
@@ -10642,8 +10697,11 @@
if (attr_prop && use_attr_prop)
{
- glade_property_set (use_attr_prop, TRUE);
- glade_property_set (attr_prop, g_ascii_strtoll (column_str, NULL, 10));
+ gboolean use_attribute = FALSE;
+ glade_property_get (use_attr_prop, &use_attribute);
+
+ if (use_attribute)
+ glade_property_set (attr_prop, g_ascii_strtoll (column_str, NULL, 10));
}
g_free (name);
Modified: trunk/plugins/gtk+/gtk+.xml.in
==============================================================================
--- trunk/plugins/gtk+/gtk+.xml.in (original)
+++ trunk/plugins/gtk+/gtk+.xml.in Wed Apr 15 19:11:19 2009
@@ -2177,6 +2177,7 @@
<create-editable-function>glade_gtk_cell_renderer_create_editable</create-editable-function>
<set-property-function>glade_gtk_cell_renderer_set_property</set-property-function>
<write-widget-function>glade_gtk_cell_renderer_write_widget</write-widget-function>
+ <read-widget-function>glade_gtk_cell_renderer_read_widget</read-widget-function>
<action-activate-function>glade_gtk_cell_renderer_action_activate</action-activate-function>
<actions>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]