[gtk] inspector: Show readonly property values
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] inspector: Show readonly property values
- Date: Fri, 12 Apr 2019 19:09:06 +0000 (UTC)
commit a2db956492da9471b7d25e5b1e4b4a3d57aefd7a
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Apr 12 15:07:01 2019 -0400
inspector: Show readonly property values
gtk/inspector/prop-editor.c | 23 ++++++++++++++++++++++-
gtk/inspector/prop-list.c | 2 +-
gtk/inspector/prop-list.h | 5 +++++
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]