[gtk/wip/otte/inspector-inspector: 3/3] inspector: Add an "inspect inspector" button
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/inspector-inspector: 3/3] inspector: Add an "inspect inspector" button
- Date: Tue, 21 Jun 2022 00:35:46 +0000 (UTC)
commit 18c2ba9b717bdece2e429019d2e6740a45449825
Author: Benjamin Otte <otte redhat com>
Date: Tue Jun 21 02:33:20 2022 +0200
inspector: Add an "inspect inspector" button
And launch a new inspector.
The location of that button is rather random - I had no idea where to
put it.
gtk/inspector/visual.c | 16 ++++++++++++++--
gtk/inspector/visual.ui | 27 +++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 2 deletions(-)
---
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index 9a2e445354..c3b53bf56d 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -29,6 +29,7 @@
#include "gtkadjustment.h"
#include "gtkbox.h"
+#include "gtkbutton.h"
#include "gtkdropdown.h"
#include "gtkcssproviderprivate.h"
#include "gtkdebug.h"
@@ -1060,13 +1061,23 @@ update_gl_flag (GtkSwitch *sw,
}
static void
-software_gl_activate (GtkSwitch *sw,
- GParamSpec *pspec,
+software_gl_activate (GtkSwitch *sw,
+ GParamSpec *pspec,
GtkInspectorVisual *vis)
{
update_gl_flag (sw, GDK_DEBUG_GL_SOFTWARE, vis);
}
+static void
+inspect_inspector (GtkButton *button,
+ GtkInspectorVisual *vis)
+{
+ GtkWidget *inspector_window;
+
+ inspector_window = gtk_inspector_window_get (gtk_widget_get_display (GTK_WIDGET (button)));
+ gtk_window_present (GTK_WINDOW (inspector_window));
+}
+
static void
gtk_inspector_visual_init (GtkInspectorVisual *vis)
{
@@ -1177,6 +1188,7 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
gtk_widget_class_bind_template_callback (widget_class, layout_activate);
gtk_widget_class_bind_template_callback (widget_class, focus_activate);
gtk_widget_class_bind_template_callback (widget_class, software_gl_activate);
+ gtk_widget_class_bind_template_callback (widget_class, inspect_inspector);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
}
diff --git a/gtk/inspector/visual.ui b/gtk/inspector/visual.ui
index a7ce8fed2e..2915a3685d 100644
--- a/gtk/inspector/visual.ui
+++ b/gtk/inspector/visual.ui
@@ -697,6 +697,32 @@
</child>
</object>
</child>
+ <child>
+ <object class="GtkFrame" id="inspector_frame">
+ <property name="halign">center</property>
+ <child>
+ <object class="GtkListBox">
+ <property name="selection-mode">none</property>
+ <property name="show-separators">1</property>
+ <style>
+ <class name="rich-list"/>
+ </style>
+ <child>
+ <object class="GtkListBoxRow">
+ <child>
+ <object class="GtkButton">
+ <property name="label" translatable="yes">Inspect Inspector</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <signal name="clicked" handler="inspect_inspector"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>
@@ -744,6 +770,7 @@
<widget name="visual_frame"/>
<widget name="debug_frame"/>
<widget name="misc_frame"/>
+ <widget name="inspector_frame"/>
</widgets>
</object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]