[gtk+/wip/matthiasc/gskpango] inspector: Move debug nodes option
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/gskpango] inspector: Move debug nodes option
- Date: Fri, 1 Sep 2017 16:03:36 +0000 (UTC)
commit a034cf2e2b4124b51577258215db2e2678965766
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Sep 1 11:55:23 2017 -0400
inspector: Move debug nodes option
Put this option on the recorder page where it makes more sense.
gtk/inspector/recorder.c | 43 +++++++++++++++++++++++++++++++++++++++++++
gtk/inspector/recorder.h | 3 +++
gtk/inspector/recorder.ui | 8 ++++++++
3 files changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c
index 31f548a..e422b9e 100644
--- a/gtk/inspector/recorder.c
+++ b/gtk/inspector/recorder.c
@@ -31,6 +31,8 @@
#include <gsk/gskrendererprivate.h>
#include <gsk/gskrendernodeprivate.h>
+#include "gtk/gtkdebug.h"
+
#include "gtktreemodelrendernode.h"
#include "recording.h"
#include "rendernodeview.h"
@@ -50,6 +52,8 @@ struct _GtkInspectorRecorderPrivate
GtkTreeModel *render_node_properties;
GtkInspectorRecording *recording; /* start recording if recording or NULL if not */
+
+ gboolean debug_nodes;
};
enum {
@@ -62,6 +66,7 @@ enum
{
PROP_0,
PROP_RECORDING,
+ PROP_DEBUG_NODES,
LAST_PROP
};
@@ -428,6 +433,10 @@ gtk_inspector_recorder_get_property (GObject *object,
g_value_set_boolean (value, priv->recording != NULL);
break;
+ case PROP_DEBUG_NODES:
+ g_value_set_boolean (value, priv->debug_nodes);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -448,6 +457,10 @@ gtk_inspector_recorder_set_property (GObject *object,
gtk_inspector_recorder_set_recording (recorder, g_value_get_boolean (value));
break;
+ case PROP_DEBUG_NODES:
+ gtk_inspector_recorder_set_debug_nodes (recorder, g_value_get_boolean (value));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -469,6 +482,12 @@ gtk_inspector_recorder_class_init (GtkInspectorRecorderClass *klass)
"Whether the recorder is currently recording",
FALSE,
G_PARAM_READWRITE);
+ props[PROP_DEBUG_NODES] =
+ g_param_spec_boolean ("debug-nodes",
+ "Debug nodes",
+ "Whether to insert extra debug nodes in the tree",
+ FALSE,
+ G_PARAM_READWRITE);
g_object_class_install_properties (object_class, LAST_PROP, props);
@@ -598,4 +617,28 @@ gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
cairo_region_destroy (clip);
}
+void
+gtk_inspector_recorder_set_debug_nodes (GtkInspectorRecorder *recorder,
+ gboolean debug_nodes)
+{
+ GtkInspectorRecorderPrivate *priv = gtk_inspector_recorder_get_instance_private (recorder);
+ guint flags;
+
+ if (priv->debug_nodes == debug_nodes)
+ return;
+
+ priv->debug_nodes = debug_nodes;
+
+ flags = gtk_get_debug_flags ();
+
+ if (debug_nodes)
+ flags |= GTK_DEBUG_SNAPSHOT;
+ else
+ flags &= ~GTK_DEBUG_SNAPSHOT;
+
+ gtk_set_debug_flags (flags);
+
+ g_object_notify_by_pspec (G_OBJECT (recorder), props[PROP_DEBUG_NODES]);
+}
+
// vim: set et sw=2 ts=2:
diff --git a/gtk/inspector/recorder.h b/gtk/inspector/recorder.h
index d15431d..7515bdc 100644
--- a/gtk/inspector/recorder.h
+++ b/gtk/inspector/recorder.h
@@ -48,6 +48,9 @@ void gtk_inspector_recorder_set_recording (GtkInspectorRec
gboolean record);
gboolean gtk_inspector_recorder_is_recording (GtkInspectorRecorder *recorder);
+void gtk_inspector_recorder_set_debug_nodes (GtkInspectorRecorder *recorder,
+ gboolean debug_nodes);
+
void gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
GtkWidget *widget,
GskRenderer *renderer,
diff --git a/gtk/inspector/recorder.ui b/gtk/inspector/recorder.ui
index b3d1863..2115dc8 100644
--- a/gtk/inspector/recorder.ui
+++ b/gtk/inspector/recorder.ui
@@ -28,6 +28,14 @@
</object>
</child>
<child>
+ <object class="GtkToggleButton">
+ <property name="visible">1</property>
+ <property name="relief">none</property>
+ <property name="icon-name">insert-object-symbolic</property>
+ <property name="active" bind-source="GtkInspectorRecorder" bind-property="debug-nodes"
bind-flags="bidirectional|sync-create"/>
+ </object>
+ </child>
+ <child>
<object class="GtkStackSwitcher">
<property name="visible">1</property>
<property name="stack">render_stack</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]