summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-04-12 15:07:01 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-04-12 15:08:01 -0400
commita2db956492da9471b7d25e5b1e4b4a3d57aefd7a (patch)
treeeeee8757ad8f882606ac1b6378ab447d73e8702b
parent8d51038cb16c2a4b4cabe0210e4b7534a8455f97 (diff)
downloadgtk+-a2db956492da9471b7d25e5b1e4b4a3d57aefd7a.tar.gz
inspector: Show readonly property values
-rw-r--r--gtk/inspector/prop-editor.c23
-rw-r--r--gtk/inspector/prop-list.c2
-rw-r--r--gtk/inspector/prop-list.h5
3 files changed, 28 insertions, 2 deletions
diff --git a/gtk/inspector/prop-editor.c b/gtk/inspector/prop-editor.c
index 75ccede57c..1c1b5541ac 100644
--- a/gtk/inspector/prop-editor.c
+++ b/gtk/inspector/prop-editor.c
@@ -21,6 +21,7 @@
#include "prop-editor.h"
#include "strv-editor.h"
#include "object-tree.h"
+#include "prop-list.h"
#include "gtkactionable.h"
#include "gtkadjustment.h"
@@ -1555,7 +1556,27 @@ constructed (GObject *object)
can_modify = TRUE;
if (!can_modify)
- return;
+ {
+ GValue gvalue = {0};
+ gchar *value;
+ gchar *type;
+
+ g_value_init (&gvalue, spec->value_type);
+ g_object_get_property (editor->priv->object, spec->name, &gvalue);
+ strdup_value_contents (&gvalue, &value, &type);
+
+ label = gtk_label_new (value);
+ gtk_style_context_add_class (gtk_widget_get_style_context (label), GTK_STYLE_CLASS_DIM_LABEL);
+ gtk_container_add (GTK_CONTAINER (box), label);
+
+ g_free (value);
+ g_free (type);
+
+ if (editor->priv->size_group)
+ gtk_size_group_add_widget (editor->priv->size_group, box);
+ gtk_container_add (GTK_CONTAINER (editor), box);
+ return;
+ }
editor->priv->editor = property_editor (editor->priv->object, spec, editor);
gtk_container_add (GTK_CONTAINER (box), editor->priv->editor);
diff --git a/gtk/inspector/prop-list.c b/gtk/inspector/prop-list.c
index 9e6391dca6..f1cbeb23b8 100644
--- a/gtk/inspector/prop-list.c
+++ b/gtk/inspector/prop-list.c
@@ -252,7 +252,7 @@ gtk_inspector_prop_list_class_init (GtkInspectorPropListClass *klass)
}
/* Like g_strdup_value_contents, but keeps the type name separate */
-static void
+void
strdup_value_contents (const GValue *value,
gchar **contents,
gchar **type)
diff --git a/gtk/inspector/prop-list.h b/gtk/inspector/prop-list.h
index ad7219f13b..ef7896e550 100644
--- a/gtk/inspector/prop-list.h
+++ b/gtk/inspector/prop-list.h
@@ -56,6 +56,11 @@ gboolean gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
void gtk_inspector_prop_list_set_layout_child (GtkInspectorPropList *pl,
GObject *object);
+void strdup_value_contents (const GValue *value,
+ gchar **contents,
+ gchar **type);
+
+
G_END_DECLS