summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2010-12-23 00:40:58 -0500
committerMatthias Clasen <mclasen@redhat.com>2010-12-23 00:43:50 -0500
commitaf9d59aaca9331f9c31ae4fec518a522602f6176 (patch)
tree5eb6d0ab182996c802dcb8e19dd77c686254af59
parentf90365d46bffd2b4bf49b69cd1bd9892c0b3b322 (diff)
downloadgtk+-af9d59aaca9331f9c31ae4fec518a522602f6176.tar.gz
Allow inspection of construct-only object properties
The 'Properties' button here is not really modifying the property in any way, so it doesn't make sense to disable it just because the object can only be set at construction. This lets us poke at e.g. the cell area of an icon view.
-rw-r--r--tests/prop-editor.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/tests/prop-editor.c b/tests/prop-editor.c
index bd90e54397..957111eb38 100644
--- a/tests/prop-editor.c
+++ b/tests/prop-editor.c
@@ -909,10 +909,13 @@ property_widget (GObject *object,
gtk_container_add (GTK_CONTAINER (prop_edit), label);
gtk_container_add (GTK_CONTAINER (prop_edit), button);
-
+
g_object_connect_property (object, spec,
G_CALLBACK (object_changed),
prop_edit, G_OBJECT (label));
+
+ /* The Properties button is not really modifying, anyway */
+ can_modify = TRUE;
}
else if (type == G_TYPE_PARAM_BOXED &&
G_PARAM_SPEC_VALUE_TYPE (spec) == GDK_TYPE_COLOR)
@@ -936,6 +939,12 @@ property_widget (GObject *object,
gtk_misc_set_alignment (GTK_MISC (prop_edit), 0.0, 0.5);
}
+ if (!can_modify)
+ gtk_widget_set_sensitive (prop_edit, FALSE);
+
+ if (g_param_spec_get_blurb (spec))
+ gtk_widget_set_tooltip_text (prop_edit, g_param_spec_get_blurb (spec));
+
return prop_edit;
}
@@ -1004,18 +1013,9 @@ properties_from_type (GObject *object,
prop_edit = property_widget (object, spec, can_modify);
gtk_table_attach_defaults (GTK_TABLE (table), prop_edit, 1, 2, i, i + 1);
- if (prop_edit)
- {
- if (!can_modify)
- gtk_widget_set_sensitive (prop_edit, FALSE);
-
- if (g_param_spec_get_blurb (spec))
- gtk_widget_set_tooltip_text (prop_edit, g_param_spec_get_blurb (spec));
+ /* set initial value */
+ g_object_notify (object, spec->name);
- /* set initial value */
- g_object_notify (object, spec->name);
- }
-
++i;
}
@@ -1087,18 +1087,9 @@ child_properties_from_object (GObject *object)
prop_edit = property_widget (object, spec, can_modify);
gtk_table_attach_defaults (GTK_TABLE (table), prop_edit, 1, 2, i, i + 1);
- if (prop_edit)
- {
- if (!can_modify)
- gtk_widget_set_sensitive (prop_edit, FALSE);
-
- if (g_param_spec_get_blurb (spec))
- gtk_widget_set_tooltip_text (prop_edit, g_param_spec_get_blurb (spec));
+ /* set initial value */
+ gtk_widget_child_notify (GTK_WIDGET (object), spec->name);
- /* set initial value */
- gtk_widget_child_notify (GTK_WIDGET (object), spec->name);
- }
-
++i;
}