inspector: UI refresh

The sidebar in the object page was using up more space than it deserves.
Replace it with a combo box in the subheader. Now that we have more space,
put the CSS node tree and the style properties in the same page again.
This commit is contained in:
Matthias Clasen 2016-03-06 20:41:28 -05:00
parent 4b5bcdeaa5
commit aa193ce4a4
27 changed files with 780 additions and 591 deletions

View File

@ -8,6 +8,7 @@ inspector_c_sources = \
inspector/general.c \
inspector/gestures.c \
inspector/graphdata.c \
inspector/gtkstackcombo.c \
inspector/gtktreemodelcssnode.c \
inspector/init.c \
inspector/inspect-button.c \
@ -38,6 +39,7 @@ inspector_h_sources = \
inspector/general.h \
inspector/gestures.h \
inspector/graphdata.h \
inspector/gtkstackcombo.h \
inspector/gtktreemodelcssnode.h \
inspector/init.h \
inspector/magnifier.h \

View File

@ -44,7 +44,6 @@ struct _GtkInspectorActionsPrivate
GtkListStore *model;
GHashTable *groups;
GHashTable *iters;
GtkWidget *object_title;
};
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorActions, gtk_inspector_actions, GTK_TYPE_BOX)
@ -231,13 +230,6 @@ gtk_inspector_actions_set_object (GtkInspectorActions *sl,
g_free (prefixes);
}
}
if (G_IS_OBJECT (object))
{
const gchar *title;
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
gtk_label_set_label (GTK_LABEL (sl->priv->object_title), title);
}
}
static void
@ -286,7 +278,6 @@ gtk_inspector_actions_class_init (GtkInspectorActionsClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/actions.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorActions, model);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorActions, object_title);
gtk_widget_class_bind_template_callback (widget_class, row_activated);
}

View File

@ -12,15 +12,6 @@
</object>
<template class="GtkInspectorActions" parent="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="object_title">
<property name="visible">True</property>
<property name="halign">fill</property>
<property name="valign">center</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>

View File

@ -65,15 +65,10 @@ enum
struct _GtkInspectorCssNodeTreePrivate
{
GtkWidget *node_tree;
GtkWidget *stack;
GtkWidget *node_list_button;
GtkWidget *prop_list_button;
GtkWidget *css_node_info;
GtkTreeModel *node_model;
GtkTreeViewColumn *node_name_column;
GtkTreeViewColumn *node_id_column;
GtkTreeViewColumn *node_classes_column;
GtkWidget *object_title;
GtkListStore *prop_model;
GtkWidget *prop_tree;
GtkTreeViewColumn *prop_name_column;
@ -140,22 +135,6 @@ row_activated (GtkTreeView *tv,
show_node_prop_editor (&npe);
}
static void
switch_to_node_list (GtkInspectorCssNodeTree *cnt)
{
gtk_stack_set_visible_child_name (GTK_STACK (cnt->priv->stack), "node-list");
gtk_widget_show (cnt->priv->prop_list_button);
gtk_widget_hide (cnt->priv->node_list_button);
}
static void
switch_to_prop_list (GtkInspectorCssNodeTree *cnt)
{
gtk_stack_set_visible_child_name (GTK_STACK (cnt->priv->stack), "prop-list");
gtk_widget_show (cnt->priv->node_list_button);
gtk_widget_hide (cnt->priv->prop_list_button);
}
static void
show_node_popover (GtkInspectorCssNodeTree *cnt,
gdouble x,
@ -228,7 +207,6 @@ show_node_popover (GtkInspectorCssNodeTree *cnt,
"visible", TRUE,
"text", _("CSS properties"),
NULL);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (switch_to_prop_list), cnt);
gtk_container_add (GTK_CONTAINER (box), button);
gtk_tree_path_free (path);
@ -331,23 +309,16 @@ gtk_inspector_css_node_tree_class_init (GtkInspectorCssNodeTreeClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/css-node-tree.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, node_tree);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, object_title);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, node_name_column);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, node_id_column);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, node_classes_column);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, prop_name_column);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, prop_model);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, prop_name_column);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, stack);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, prop_list_button);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, node_list_button);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, css_node_info);
gtk_widget_class_bind_template_callback (widget_class, row_activated);
gtk_widget_class_bind_template_callback (widget_class, selection_changed);
gtk_widget_class_bind_template_callback (widget_class, button_pressed);
gtk_widget_class_bind_template_callback (widget_class, switch_to_node_list);
gtk_widget_class_bind_template_callback (widget_class, switch_to_prop_list);
}
static int
@ -486,7 +457,6 @@ gtk_inspector_css_node_tree_set_object (GtkInspectorCssNodeTree *cnt,
GObject *object)
{
GtkInspectorCssNodeTreePrivate *priv;
const gchar *title;
GtkCssNode *node, *root;
GtkTreePath *path;
GtkTreeIter iter;
@ -495,9 +465,6 @@ gtk_inspector_css_node_tree_set_object (GtkInspectorCssNodeTree *cnt,
priv = cnt->priv;
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
gtk_label_set_label (GTK_LABEL (priv->object_title), title);
if (!GTK_IS_WIDGET (object))
{
gtk_widget_hide (GTK_WIDGET (cnt));
@ -506,8 +473,6 @@ gtk_inspector_css_node_tree_set_object (GtkInspectorCssNodeTree *cnt,
gtk_widget_show (GTK_WIDGET (cnt));
switch_to_node_list (cnt);
root = node = gtk_widget_get_css_node (GTK_WIDGET (object));
while (gtk_css_node_get_parent (root))
root = gtk_css_node_get_parent (root);
@ -585,11 +550,6 @@ gtk_inspector_css_node_tree_set_node (GtkInspectorCssNodeTree *cnt,
GtkCssNode *node)
{
GtkInspectorCssNodeTreePrivate *priv = cnt->priv;
GString *s;
GType type;
const gchar *name;
gchar **strv;
gint i;
if (priv->node == node)
return;
@ -604,37 +564,6 @@ gtk_inspector_css_node_tree_set_node (GtkInspectorCssNodeTree *cnt,
priv->node = node;
g_signal_connect (node, "style-changed", G_CALLBACK (gtk_inspector_css_node_tree_update_style_cb), cnt);
s = g_string_new ("");
type = gtk_css_node_get_widget_type (node);
if (type != G_TYPE_NONE && type != G_TYPE_INVALID)
g_string_append (s, g_type_name (type));
name = gtk_css_node_get_name (node);
if (name)
{
if (s->len > 0)
g_string_append (s, "");
g_string_append (s, name);
}
strv = gtk_css_node_get_classes (node);
if (strv[0] != NULL)
{
strv_sort (strv);
if (s->len > 0)
g_string_append (s, "");
for (i = 0; strv[i]; i++)
{
if (i > 0)
g_string_append (s, " ");
g_string_append (s, strv[i]);
}
}
gtk_label_set_label (GTK_LABEL (cnt->priv->css_node_info), s->str);
g_strfreev (strv);
g_string_free (s, TRUE);
}
// vim: set et sw=2 ts=2:

View File

@ -11,65 +11,11 @@
<template class="GtkInspectorCssNodeTree" parent="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<object class="GtkPaned" id="paned">
<property name="visible">1</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<child type="center">
<object class="GtkLabel" id="object_title">
<property name="visible">1</property>
<property name="valign">center</property>
<property name="margin">12</property>
</object>
</child>
<child>
<object class="GtkButton" id="node_list_button">
<property name="valign">center</property>
<property name="no-show-all">1</property>
<property name="relief">none</property>
<property name="tooltip-text" translatable="yes">Show all CSS nodes</property>
<signal name="clicked" handler="switch_to_node_list" swapped="1"/>
<child>
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">pan-start-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<style>
<class name="image-button"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="prop_list_button">
<property name="visible">1</property>
<property name="valign">center</property>
<property name="no-show-all">1</property>
<property name="relief">none</property>
<property name="tooltip-text" translatable="yes">Show CSS properties</property>
<signal name="clicked" handler="switch_to_prop_list" swapped="1"/>
<child>
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">pan-end-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<style>
<class name="image-button"/>
</style>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkStack" id="stack">
<property name="visible">1</property>
<property name="transition-type">slide-left-right</property>
<property name="wide-handle">1</property>
<property name="orientation">horizontal</property>
<property name="position">300</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">1</property>
@ -143,32 +89,11 @@
</object>
</child>
</object>
<packing>
<property name="name">node-list</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">1</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">1</property>
<property name="orientation">horizontal</property>
<property name="margin">12</property>
<child>
<object class="GtkLabel">
<property name="visible">1</property>
<property name="label" translatable="yes">Node:</property>
</object>
</child>
<child type="center">
<object class="GtkLabel" id="css_node_info">
<property name="visible">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">1</property>
@ -233,9 +158,6 @@
</object>
</child>
</object>
<packing>
<property name="name">prop-list</property>
</packing>
</child>
</object>
</child>

View File

@ -53,7 +53,8 @@ gtk_inspector_gestures_init (GtkInspectorGestures *sl)
"orientation", GTK_ORIENTATION_VERTICAL,
"margin-start", 60,
"margin-end", 60,
"margin-bottom", 60,
"margin-top", 60,
"margin-bottom", 30,
"spacing", 10,
NULL);
}
@ -182,8 +183,6 @@ gtk_inspector_gestures_set_object (GtkInspectorGestures *sl,
GHashTableIter iter;
GList *list, *l;
gint phase;
const gchar *title;
GtkWidget *label;
clear_all (sl);
gtk_widget_hide (GTK_WIDGET (sl));
@ -191,16 +190,6 @@ gtk_inspector_gestures_set_object (GtkInspectorGestures *sl,
if (!GTK_IS_WIDGET (object))
return;
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
label = gtk_label_new (title);
gtk_widget_set_halign (label, GTK_ALIGN_FILL);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_margin_top (label, 12);
gtk_widget_set_margin_bottom (label, 30);
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (sl), label);
hash = g_hash_table_new (g_direct_hash, g_direct_equal);
for (phase = GTK_PHASE_NONE; phase <= GTK_PHASE_TARGET; phase++)
{

View File

@ -0,0 +1,239 @@
/*
* Copyright (c) 2016 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "config.h"
#include "gtkstackcombo.h"
#include "gtkbox.h"
#include "gtkstack.h"
#include "gtkcomboboxtext.h"
#include "gtkprivate.h"
#include "gtkintl.h"
struct _GtkStackCombo
{
GtkBox box;
GtkComboBox *combo;
GtkStack *stack;
GBinding *binding;
};
struct _GtkStackComboClass {
GtkBoxClass parent_class;
};
enum {
PROP_0,
PROP_STACK
};
G_DEFINE_TYPE (GtkStackCombo, gtk_stack_combo, GTK_TYPE_BOX)
static void
gtk_stack_combo_init (GtkStackCombo *self)
{
self->stack = NULL;
self->combo = GTK_COMBO_BOX (gtk_combo_box_text_new ());
gtk_widget_show (GTK_WIDGET (self->combo));
gtk_box_pack_start (GTK_BOX (self), GTK_WIDGET (self->combo), FALSE, FALSE, 0);
}
static void gtk_stack_combo_set_stack (GtkStackCombo *self,
GtkStack *stack);
static void
rebuild_combo (GtkStackCombo *self)
{
gtk_stack_combo_set_stack (self, self->stack);
}
static void
on_child_visible_changed (GtkStackCombo *self)
{
rebuild_combo (self);
}
static void
add_child (GtkWidget *widget,
GtkStackCombo *self)
{
g_signal_handlers_disconnect_by_func (widget, G_CALLBACK (on_child_visible_changed), self);
g_signal_connect_swapped (widget, "notify::visible", G_CALLBACK (on_child_visible_changed), self);
if (gtk_widget_get_visible (widget))
{
char *name, *title;
gtk_container_child_get (GTK_CONTAINER (self->stack), widget,
"name", &name,
"title", &title,
NULL);
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (self->combo), name, title);
g_free (name);
g_free (title);
}
}
static void
populate_combo (GtkStackCombo *self)
{
gtk_container_foreach (GTK_CONTAINER (self->stack), (GtkCallback)add_child, self);
}
static void
clear_combo (GtkStackCombo *self)
{
gtk_combo_box_text_remove_all (GTK_COMBO_BOX_TEXT (self->combo));
}
static void
on_stack_child_added (GtkContainer *container,
GtkWidget *widget,
GtkStackCombo *self)
{
rebuild_combo (self);
}
static void
on_stack_child_removed (GtkContainer *container,
GtkWidget *widget,
GtkStackCombo *self)
{
g_signal_handlers_disconnect_by_func (widget, G_CALLBACK (on_child_visible_changed), self);
rebuild_combo (self);
}
static void
disconnect_stack_signals (GtkStackCombo *self)
{
g_binding_unbind (self->binding);
self->binding = NULL;
g_signal_handlers_disconnect_by_func (self->stack, on_stack_child_added, self);
g_signal_handlers_disconnect_by_func (self->stack, on_stack_child_removed, self);
g_signal_handlers_disconnect_by_func (self->stack, disconnect_stack_signals, self);
}
static void
connect_stack_signals (GtkStackCombo *self)
{
g_signal_connect_after (self->stack, "add", G_CALLBACK (on_stack_child_added), self);
g_signal_connect_after (self->stack, "remove", G_CALLBACK (on_stack_child_removed), self);
g_signal_connect_swapped (self->stack, "destroy", G_CALLBACK (disconnect_stack_signals), self);
self->binding = g_object_bind_property (self->stack, "visible-child-name", self->combo, "active-id", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
}
static void
gtk_stack_combo_set_stack (GtkStackCombo *self,
GtkStack *stack)
{
if (stack)
g_object_ref (stack);
if (self->stack)
{
disconnect_stack_signals (self);
clear_combo (self);
g_clear_object (&self->stack);
}
if (stack)
{
self->stack = stack;
populate_combo (self);
connect_stack_signals (self);
}
}
static void
gtk_stack_combo_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkStackCombo *self = GTK_STACK_COMBO (object);
switch (prop_id)
{
case PROP_STACK:
g_value_set_object (value, self->stack);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_stack_combo_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkStackCombo *self = GTK_STACK_COMBO (object);
switch (prop_id)
{
case PROP_STACK:
if (self->stack != g_value_get_object (value))
{
gtk_stack_combo_set_stack (self, g_value_get_object (value));
g_object_notify (G_OBJECT (self), "stack");
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_stack_combo_dispose (GObject *object)
{
GtkStackCombo *self = GTK_STACK_COMBO (object);
gtk_stack_combo_set_stack (self, NULL);
G_OBJECT_CLASS (gtk_stack_combo_parent_class)->dispose (object);
}
static void
gtk_stack_combo_class_init (GtkStackComboClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->get_property = gtk_stack_combo_get_property;
object_class->set_property = gtk_stack_combo_set_property;
object_class->dispose = gtk_stack_combo_dispose;
g_object_class_install_property (object_class,
PROP_STACK,
g_param_spec_object ("stack",
P_("Stack"),
P_("Stack"),
GTK_TYPE_STACK,
GTK_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
gtk_widget_class_set_css_name (widget_class, "stackcombo");
}

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2016 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __GTK_STACK_COMBO_H__
#define __GTK_STACK_COMBO_H__
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkcombobox.h>
#include <gtk/gtkstack.h>
G_BEGIN_DECLS
#define GTK_TYPE_STACK_COMBO (gtk_stack_combo_get_type ())
#define GTK_STACK_COMBO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_STACK_COMBO, GtkStackCombo))
#define GTK_STACK_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_STACK_COMBO, GtkStackComboClass))
#define GTK_IS_STACK_COMBO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_STACK_COMBO))
#define GTK_IS_STACK_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STACK_COMBO))
#define GTK_STACK_COMBO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STACK_COMBO, GtkStackComboClass))
typedef struct _GtkStackCombo GtkStackCombo;
typedef struct _GtkStackComboClass GtkStackComboClass;
GType gtk_stack_combo_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GTK_STACK_COMBO_H__ */

View File

@ -45,6 +45,7 @@
#include "statistics.h"
#include "visual.h"
#include "window.h"
#include "gtkstackcombo.h"
#include "gtkmagnifierprivate.h"
@ -77,6 +78,7 @@ gtk_inspector_init (void)
g_type_ensure (GTK_TYPE_INSPECTOR_STATISTICS);
g_type_ensure (GTK_TYPE_INSPECTOR_VISUAL);
g_type_ensure (GTK_TYPE_INSPECTOR_WINDOW);
g_type_ensure (GTK_TYPE_STACK_COMBO);
if (extension_point == NULL)
{

View File

@ -23,13 +23,19 @@
#include "gtkmagnifierprivate.h"
#include "gtklabel.h"
#include "gtkadjustment.h"
enum
{
PROP_0,
PROP_ADJUSTMENT
};
struct _GtkInspectorMagnifierPrivate
{
GtkWidget *object;
GtkWidget *magnifier;
GtkWidget *object_title;
GtkAdjustment *adjustment;
};
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorMagnifier, gtk_inspector_magnifier, GTK_TYPE_BOX)
@ -45,8 +51,6 @@ void
gtk_inspector_magnifier_set_object (GtkInspectorMagnifier *sl,
GObject *object)
{
const gchar *title;
sl->priv->object = NULL;
if (!GTK_IS_WIDGET (object) || !gtk_widget_is_visible (GTK_WIDGET (object)))
@ -56,9 +60,6 @@ gtk_inspector_magnifier_set_object (GtkInspectorMagnifier *sl,
return;
}
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
gtk_label_set_label (GTK_LABEL (sl->priv->object_title), title);
gtk_widget_show (GTK_WIDGET (sl));
sl->priv->object = GTK_WIDGET (object);
@ -67,14 +68,72 @@ gtk_inspector_magnifier_set_object (GtkInspectorMagnifier *sl,
_gtk_magnifier_set_coords (GTK_MAGNIFIER (sl->priv->magnifier), 0, 0);
}
static void
get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec)
{
GtkInspectorMagnifier *sl = GTK_INSPECTOR_MAGNIFIER (object);
switch (param_id)
{
case PROP_ADJUSTMENT:
g_value_take_object (value, sl->priv->adjustment);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
static void
set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec)
{
GtkInspectorMagnifier *sl = GTK_INSPECTOR_MAGNIFIER (object);
switch (param_id)
{
case PROP_ADJUSTMENT:
sl->priv->adjustment = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
static void
constructed (GObject *object)
{
GtkInspectorMagnifier *sl = GTK_INSPECTOR_MAGNIFIER (object);
g_object_bind_property (sl->priv->adjustment, "value",
sl->priv->magnifier, "magnification",
G_BINDING_SYNC_CREATE);
}
static void
gtk_inspector_magnifier_class_init (GtkInspectorMagnifierClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->get_property = get_property;
object_class->set_property = set_property;
object_class->constructed = constructed;
g_object_class_install_property (object_class, PROP_ADJUSTMENT,
g_param_spec_object ("adjustment", NULL, NULL,
GTK_TYPE_ADJUSTMENT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/magnifier.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMagnifier, magnifier);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMagnifier, object_title);
}
// vim: set et sw=2 ts=2:

View File

@ -2,38 +2,6 @@
<interface domain="gtk30">
<template class="GtkInspectorMagnifier" parent="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="spacing">6</property>
<property name="margin">6</property>
<child>
<object class="GtkScale" id="magnification">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="width-request">150</property>
<property name="draw-value">False</property>
<property name="adjustment">adjustment</property>
<marks>
<mark value="1.0" position="bottom"/>
<mark value="2.0" position="bottom"/>
<mark value="3.0" position="bottom"/>
<mark value="4.0" position="bottom"/>
<mark value="5.0" position="bottom"/>
</marks>
</object>
<packing>
<property name="pack-type">start</property>
</packing>
</child>
<child type="center">
<object class="GtkLabel" id="object_title">
<property name="visible">True</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
@ -45,18 +13,9 @@
<object class="GtkMagnifier" id="magnifier">
<property name="visible">True</property>
<property name="resize">True</property>
<property name="magnification" bind-source="adjustment" bind-property="value" bind-flags="sync-create"/>
</object>
</child>
</object>
</child>
</template>
<object class="GtkAdjustment" id="adjustment">
<property name="lower">1.0</property>
<property name="upper">5.0</property>
<property name="page-size">0.0</property>
<property name="page-increment">0.1</property>
<property name="step-increment">0.1</property>
<property name="value">2.0</property>
</object>
</interface>

View File

@ -37,7 +37,6 @@ enum
struct _GtkInspectorMenuPrivate
{
GtkTreeStore *model;
GtkWidget *object_title;
};
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorMenu, gtk_inspector_menu, GTK_TYPE_BOX)
@ -133,13 +132,6 @@ gtk_inspector_menu_set_object (GtkInspectorMenu *sl,
if (G_IS_MENU_MODEL (object))
add_menu (sl, G_MENU_MODEL (object), NULL);
if (G_IS_OBJECT (object))
{
const gchar *title;
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
gtk_label_set_label (GTK_LABEL (sl->priv->object_title), title);
}
}
static void
@ -149,7 +141,6 @@ gtk_inspector_menu_class_init (GtkInspectorMenuClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/menu.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMenu, model);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMenu, object_title);
}
// vim: set et sw=2 ts=2:

View File

@ -11,15 +11,6 @@
</object>
<template class="GtkInspectorMenu" parent="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="object_title">
<property name="visible">True</property>
<property name="halign">fill</property>
<property name="valign">center</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>

View File

@ -79,7 +79,6 @@ struct _GtkInspectorMiscInfoPrivate {
GtkWidget *is_toplevel;
GtkWidget *child_visible_row;
GtkWidget *child_visible;
GtkWidget *object_title;
guint update_source_id;
gint64 last_frame;
@ -393,8 +392,6 @@ void
gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
GObject *object)
{
const gchar *title;
if (sl->priv->object)
{
g_signal_handlers_disconnect_by_func (sl->priv->object, state_flags_changed, sl);
@ -411,9 +408,6 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
g_object_weak_ref (G_OBJECT (sl), disconnect_each_other, object);
g_object_weak_ref (object, disconnect_each_other, sl);
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
gtk_label_set_label (GTK_LABEL (sl->priv->object_title), title);
if (GTK_IS_WIDGET (object))
{
gtk_widget_show (sl->priv->refcount_row);
@ -621,7 +615,6 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, is_toplevel);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, child_visible_row);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, child_visible);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, object_title);
gtk_widget_class_bind_template_callback (widget_class, show_default_widget);
gtk_widget_class_bind_template_callback (widget_class, show_focus_widget);

View File

@ -7,17 +7,9 @@
<property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">30</property>
<property name="margin-bottom">60</property>
<property name="spacing">10</property>
<child>
<object class="GtkLabel" id="object_title">
<property name="visible">True</property>
<property name="halign">fill</property>
<property name="valign">center</property>
<property name="margin-top">12</property>
<property name="margin-bottom">30</property>
</object>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>

View File

@ -40,7 +40,6 @@ struct _GtkInspectorObjectHierarchyPrivate
{
GtkTreeStore *model;
GtkTreeView *tree;
GtkWidget *object_title;
};
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorObjectHierarchy, gtk_inspector_object_hierarchy, GTK_TYPE_BOX)
@ -60,7 +59,6 @@ gtk_inspector_object_hierarchy_class_init (GtkInspectorObjectHierarchyClass *kla
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/object-hierarchy.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, model);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, tree);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, object_title);
}
void
@ -75,7 +73,6 @@ gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
GHashTableIter hit;
GType *ifaces;
gint i;
const gchar *title;
gtk_tree_store_clear (oh->priv->model);
@ -85,9 +82,6 @@ gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
interfaces = g_hash_table_new (g_str_hash, g_str_equal);
type = ((GTypeInstance*)object)->g_class->g_type;
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
gtk_label_set_label (GTK_LABEL (oh->priv->object_title), title);
do
{
class_name = g_type_name (type);

View File

@ -7,15 +7,6 @@
</object>
<template class="GtkInspectorObjectHierarchy" parent="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="object_title">
<property name="visible">True</property>
<property name="halign">fill</property>
<property name="valign">center</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
@ -27,6 +18,7 @@
<property name="visible">True</property>
<property name="model">model</property>
<property name="enable-search">False</property>
<property name="headers-visible">False</property>
<property name="enable-tree-lines">1</property>
<property name="show-expanders">0</property>
<property name="level-indentation">18</property>
@ -37,7 +29,6 @@
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Class Hierarchy</property>
<child>
<object class="GtkCellRendererText">
<property name="scale">0.8</property>

View File

@ -51,7 +51,8 @@ enum
{
PROP_0,
PROP_OBJECT_TREE,
PROP_CHILD_PROPERTIES
PROP_CHILD_PROPERTIES,
PROP_SEARCH_ENTRY
};
struct _GtkInspectorPropListPrivate
@ -67,7 +68,6 @@ struct _GtkInspectorPropListPrivate
GtkWidget *tree;
GtkWidget *search_entry;
GtkWidget *search_stack;
GtkWidget *object_title;
};
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorPropList, gtk_inspector_prop_list, GTK_TYPE_BOX)
@ -90,7 +90,7 @@ key_press_event (GtkWidget *window,
if (gtk_search_entry_handle_event (GTK_SEARCH_ENTRY (pl->priv->search_entry), event))
{
gtk_stack_set_visible_child_name (GTK_STACK (pl->priv->search_stack), "search");
gtk_stack_set_visible_child (GTK_STACK (pl->priv->search_stack), pl->priv->search_entry);
return GDK_EVENT_STOP;
}
return GDK_EVENT_PROPAGATE;
@ -114,8 +114,6 @@ gtk_inspector_prop_list_init (GtkInspectorPropList *pl)
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (pl->priv->model),
COLUMN_NAME,
GTK_SORT_ASCENDING);
gtk_tree_view_set_search_entry (GTK_TREE_VIEW (pl->priv->tree),
GTK_ENTRY (pl->priv->search_entry));
pl->priv->prop_iters = g_hash_table_new_full (g_str_hash,
g_str_equal,
NULL,
@ -140,6 +138,10 @@ get_property (GObject *object,
g_value_set_boolean (value, pl->priv->child_properties);
break;
case PROP_SEARCH_ENTRY:
g_value_take_object (value, pl->priv->search_entry);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@ -164,6 +166,10 @@ set_property (GObject *object,
pl->priv->child_properties = g_value_get_boolean (value);
break;
case PROP_SEARCH_ENTRY:
pl->priv->search_entry = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@ -249,6 +255,20 @@ finalize (GObject *object)
G_OBJECT_CLASS (gtk_inspector_prop_list_parent_class)->finalize (object);
}
static void
constructed (GObject *object)
{
GtkInspectorPropList *pl = GTK_INSPECTOR_PROP_LIST (object);
pl->priv->search_stack = gtk_widget_get_parent (pl->priv->search_entry);
gtk_tree_view_set_search_entry (GTK_TREE_VIEW (pl->priv->tree),
GTK_ENTRY (pl->priv->search_entry));
g_signal_connect (pl->priv->search_entry, "stop-search",
G_CALLBACK (search_close_clicked), pl);
}
static void
gtk_inspector_prop_list_class_init (GtkInspectorPropListClass *klass)
{
@ -258,6 +278,7 @@ gtk_inspector_prop_list_class_init (GtkInspectorPropListClass *klass)
object_class->finalize = finalize;
object_class->get_property = get_property;
object_class->set_property = set_property;
object_class->constructed = constructed;
g_object_class_install_property (object_class, PROP_OBJECT_TREE,
g_param_spec_object ("object-tree", "Object Tree", "Object tree",
@ -266,13 +287,14 @@ gtk_inspector_prop_list_class_init (GtkInspectorPropListClass *klass)
g_param_spec_boolean ("child-properties", "Child properties", "Child properties",
FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_SEARCH_ENTRY,
g_param_spec_object ("search-entry", "Search Entry", "Search Entry",
GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/prop-list.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, model);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, attribute_column);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, tree);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, search_entry);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, search_stack);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, object_title);
gtk_widget_class_bind_template_callback (widget_class, row_activated);
gtk_widget_class_bind_template_callback (widget_class, search_close_clicked);
gtk_widget_class_bind_template_callback (widget_class, hierarchy_changed);
@ -383,7 +405,6 @@ gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
GParamSpec **props;
guint num_properties;
guint i;
const gchar *title;
if (!object)
return FALSE;
@ -393,9 +414,6 @@ gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
cleanup_object (pl);
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
gtk_label_set_label (GTK_LABEL (pl->priv->object_title), title);
gtk_entry_set_text (GTK_ENTRY (pl->priv->search_entry), "");
gtk_stack_set_visible_child_name (GTK_STACK (pl->priv->search_stack), "title");

View File

@ -13,63 +13,6 @@
<template class="GtkInspectorPropList" parent="GtkBox">
<property name="orientation">vertical</property>
<signal name="hierarchy-changed" handler="hierarchy_changed"/>
<child>
<object class="GtkStack" id="search_stack">
<property name="visible">True</property>
<property name="hhomogeneous">True</property>
<property name="vhomogeneous">True</property>
<property name="transition-type">crossfade</property>
<child>
<object class="GtkBox" id="search_box">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="spacing">6</property>
<property name="margin">6</property>
<child type="center">
<object class="GtkSearchEntry" id="search_entry">
<property name="visible">True</property>
<property name="max-width-chars">40</property>
<signal name="stop-search" handler="search_close_clicked"/>
</object>
</child>
<child>
<object class="GtkButton" id="search_close_button">
<property name="visible">True</property>
<property name="relief">none</property>
<signal name="clicked" handler="search_close_clicked"/>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">window-close-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
</object>
<packing>
<property name="name">search</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="object_title">
<property name="visible">True</property>
<property name="margin">10</property>
<property name="halign">fill</property>
<property name="valign">center</property>
</object>
<packing>
<property name="name">title</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>

View File

@ -36,7 +36,6 @@ struct _GtkInspectorSelectorPrivate
{
GtkTreeStore *model;
GtkTreeView *tree;
GtkWidget *object_title;
};
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorSelector, gtk_inspector_selector, GTK_TYPE_BOX)
@ -56,7 +55,6 @@ gtk_inspector_selector_class_init (GtkInspectorSelectorClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/selector.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSelector, model);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSelector, tree);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSelector, object_title);
}
void
@ -67,7 +65,6 @@ gtk_inspector_selector_set_object (GtkInspectorSelector *oh,
gint i;
GtkWidget *widget;
gchar *path, **words;
const gchar *title;
gtk_tree_store_clear (oh->priv->model);
@ -77,9 +74,6 @@ gtk_inspector_selector_set_object (GtkInspectorSelector *oh,
return;
}
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
gtk_label_set_label (GTK_LABEL (oh->priv->object_title), title);
widget = GTK_WIDGET (object);
path = gtk_widget_path_to_string (gtk_widget_get_path (widget));

View File

@ -7,15 +7,6 @@
</object>
<template class="GtkInspectorSelector" parent="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="object_title">
<property name="visible">True</property>
<property name="halign">fill</property>
<property name="valign">center</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
@ -27,6 +18,7 @@
<property name="visible">True</property>
<property name="model">model</property>
<property name="enable-search">False</property>
<property name="headers-visible">False</property>
<property name="show-expanders">False</property>
<property name="level-indentation">18</property>
<child internal-child="selection">

View File

@ -38,6 +38,13 @@ enum
COLUMN_HOOK_ID
};
enum
{
PROP_0,
PROP_TRACE_BUTTON,
PROP_CLEAR_BUTTON
};
struct _GtkInspectorSignalsListPrivate
{
GtkWidget *view;
@ -46,7 +53,6 @@ struct _GtkInspectorSignalsListPrivate
GtkWidget *log_win;
GtkWidget *trace_button;
GtkWidget *clear_button;
GtkWidget *object_title;
GtkTreeViewColumn *count_column;
GtkCellRenderer *count_renderer;
GObject *object;
@ -150,14 +156,7 @@ gtk_inspector_signals_list_set_object (GtkInspectorSignalsList *sl,
sl->priv->object = object;
if (object)
{
const gchar *title;
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
gtk_label_set_label (GTK_LABEL (sl->priv->object_title), title);
read_signals_from_object (sl, object);
}
read_signals_from_object (sl, object);
}
static void
@ -337,11 +336,83 @@ clear_log (GtkButton *button, GtkInspectorSignalsList *sl)
gtk_tree_model_foreach (GTK_TREE_MODEL (sl->priv->model), clear_log_cb, sl);
}
static void
get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec)
{
GtkInspectorSignalsList *sl = GTK_INSPECTOR_SIGNALS_LIST (object);
switch (param_id)
{
case PROP_TRACE_BUTTON:
g_value_take_object (value, sl->priv->trace_button);
break;
case PROP_CLEAR_BUTTON:
g_value_take_object (value, sl->priv->trace_button);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
static void
set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec)
{
GtkInspectorSignalsList *sl = GTK_INSPECTOR_SIGNALS_LIST (object);
switch (param_id)
{
case PROP_TRACE_BUTTON:
sl->priv->trace_button = g_value_get_object (value);
break;
case PROP_CLEAR_BUTTON:
sl->priv->clear_button = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
static void
constructed (GObject *object)
{
GtkInspectorSignalsList *sl = GTK_INSPECTOR_SIGNALS_LIST (object);
g_signal_connect (sl->priv->trace_button, "toggled",
G_CALLBACK (toggle_tracing), sl);
g_signal_connect (sl->priv->clear_button, "clicked",
G_CALLBACK (clear_log), sl);
}
static void
gtk_inspector_signals_list_class_init (GtkInspectorSignalsListClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->constructed = constructed;
object_class->get_property = get_property;
object_class->set_property = set_property;
g_object_class_install_property (object_class, PROP_TRACE_BUTTON,
g_param_spec_object ("trace-button", NULL, NULL,
GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_CLEAR_BUTTON,
g_param_spec_object ("clear-button", NULL, NULL,
GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/signals-list.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSignalsList, view);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSignalsList, model);
@ -349,11 +420,6 @@ gtk_inspector_signals_list_class_init (GtkInspectorSignalsListClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSignalsList, log_win);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSignalsList, count_column);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSignalsList, count_renderer);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSignalsList, trace_button);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSignalsList, clear_button);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSignalsList, object_title);
gtk_widget_class_bind_template_callback (widget_class, toggle_tracing);
gtk_widget_class_bind_template_callback (widget_class, clear_log);
}
// vim: set et sw=2 ts=2:

View File

@ -19,61 +19,6 @@
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="visible">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="spacing">6</property>
<property name="margin">6</property>
<child>
<object class="GtkToggleButton" id="trace_button">
<property name="visible">True</property>
<property name="relief">none</property>
<property name="tooltip-text" translatable="yes">Trace signal emissions on this object</property>
<signal name="toggled" handler="toggle_tracing"/>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">media-record-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
<packing>
<property name="pack-type">start</property>
</packing>
</child>
<child>
<object class="GtkButton" id="clear_button">
<property name="visible">True</property>
<property name="relief">none</property>
<property name="tooltip-text" translatable="yes">Clear log</property>
<signal name="clicked" handler="clear_log"/>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">edit-clear-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
<packing>
<property name="pack-type">start</property>
</packing>
</child>
<child type="center">
<object class="GtkLabel" id="object_title">
<property name="visible">True</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
@ -88,7 +33,7 @@
<property name="enable-grid-lines">vertical</property>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Name</property>
<property name="title" translatable="yes">Signal</property>
<property name="sort-column-id">0</property>
<child>
<object class="GtkCellRendererText">

View File

@ -274,8 +274,6 @@ gtk_inspector_size_groups_set_object (GtkInspectorSizeGroups *sl,
GObject *object)
{
GSList *groups, *l;
const gchar *title;
GtkWidget *label;
clear_view (sl);
@ -285,16 +283,6 @@ gtk_inspector_size_groups_set_object (GtkInspectorSizeGroups *sl,
return;
}
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
label = gtk_label_new (title);
gtk_widget_set_halign (label, GTK_ALIGN_FILL);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_margin_top (label, 12);
gtk_widget_set_margin_bottom (label, 30);
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (sl), label);
groups = _gtk_widget_get_sizegroups (GTK_WIDGET (object));
if (groups)
gtk_widget_show (GTK_WIDGET (sl));
@ -313,6 +301,7 @@ gtk_inspector_size_groups_init (GtkInspectorSizeGroups *sl)
"margin-start", 60,
"margin-end", 60,
"margin-bottom", 60,
"margin-bottom", 30,
"spacing", 10,
NULL);
}

View File

@ -58,10 +58,14 @@ set_selected_object (GtkInspectorWindow *iw,
GObject *selected)
{
GList *l;
const char *title;
if (!gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->prop_list), selected))
return FALSE;
title = (const char *)g_object_get_data (selected, "gtk-inspector-object-title");
gtk_label_set_label (GTK_LABEL (iw->object_title), title);
gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->child_prop_list), selected);
gtk_inspector_signals_list_set_object (GTK_INSPECTOR_SIGNALS_LIST (iw->signals_list), selected);
gtk_inspector_object_hierarchy_set_object (GTK_INSPECTOR_OBJECT_HIERARCHY (iw->object_hierarchy), selected);
@ -131,6 +135,25 @@ open_object_details (GtkWidget *button, GtkInspectorWindow *iw)
gtk_stack_set_visible_child_name (GTK_STACK (iw->object_buttons), "details");
}
static gboolean
translate_visible_child_name (GBinding *binding,
const GValue *from,
GValue *to,
gpointer user_data)
{
GtkInspectorWindow *iw = user_data;
const char *name;
name = g_value_get_string (from);
if (gtk_stack_get_child_by_name (GTK_STACK (iw->object_start_stack), name))
g_value_set_string (to, name);
else
g_value_set_string (to, "empty");
return TRUE;
}
static void
gtk_inspector_window_init (GtkInspectorWindow *iw)
{
@ -139,6 +162,14 @@ gtk_inspector_window_init (GtkInspectorWindow *iw)
gtk_widget_init_template (GTK_WIDGET (iw));
g_object_bind_property_full (iw->object_details, "visible-child-name",
iw->object_start_stack, "visible-child-name",
G_BINDING_SYNC_CREATE,
translate_visible_child_name,
NULL,
iw,
NULL);
gtk_window_group_add_window (gtk_window_group_new (), GTK_WINDOW (iw));
extension_point = g_io_extension_point_lookup ("gtk-inspector-page");
@ -188,7 +219,6 @@ gtk_inspector_window_init (GtkInspectorWindow *iw)
g_free (title);
}
}
static void
@ -201,6 +231,14 @@ gtk_inspector_window_constructed (GObject *object)
gtk_inspector_object_tree_scan (GTK_INSPECTOR_OBJECT_TREE (iw->object_tree), NULL);
}
static void
object_details_changed (GtkWidget *combo,
GParamSpec *pspec,
GtkInspectorWindow *iw)
{
gtk_stack_set_visible_child_name (GTK_STACK (iw->object_center_stack), "title");
}
static void
gtk_inspector_window_class_init (GtkInspectorWindowClass *klass)
{
@ -216,6 +254,8 @@ gtk_inspector_window_class_init (GtkInspectorWindowClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_stack);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_tree);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_details);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_start_stack);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_center_stack);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_buttons);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_details_button);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, select_object);
@ -224,6 +264,7 @@ gtk_inspector_window_class_init (GtkInspectorWindowClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, signals_list);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_css_node_tree);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_hierarchy);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_title);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, selector);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, size_groups);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, data_list);
@ -238,6 +279,7 @@ gtk_inspector_window_class_init (GtkInspectorWindowClass *klass)
gtk_widget_class_bind_template_callback (widget_class, on_object_selected);
gtk_widget_class_bind_template_callback (widget_class, open_object_details);
gtk_widget_class_bind_template_callback (widget_class, close_object_details);
gtk_widget_class_bind_template_callback (widget_class, object_details_changed);
}
static GdkScreen *

View File

@ -50,6 +50,9 @@ typedef struct
GtkWidget *object_buttons;
GtkWidget *object_details_button;
GtkWidget *select_object;
GtkWidget *object_start_stack;
GtkWidget *object_center_stack;
GtkWidget *object_title;
GtkWidget *prop_list;
GtkWidget *child_prop_list;
GtkWidget *selector;

View File

@ -1,26 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk30">
<object class="GtkAdjustment" id="magnification_adjustment">
<property name="lower">1.0</property>
<property name="upper">5.0</property>
<property name="page-size">0.0</property>
<property name="page-increment">0.1</property>
<property name="step-increment">0.1</property>
<property name="value">2.0</property>
</object>
<template class="GtkInspectorWindow" parent="GtkWindow">
<property name="default-height">500</property>
<property name="default-width">800</property>
<property name="icon">resource:///org/gtk/libgtk/inspector/logo.png</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="show-close-button">True</property>
<property name="visible">1</property>
<property name="show-close-button">1</property>
<child>
<object class="GtkStack" id="button_stack">
<property name="visible">True</property>
<property name="visible">1</property>
<property name="visible-child-name" bind-source="top_stack" bind-property="visible-child-name"/>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="visible">1</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="select_object">
<property name="visible">True</property>
<property name="focus-on-click">False</property>
<property name="visible">1</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Select an Object</property>
<property name="halign">center</property>
<property name="valign">center</property>
@ -30,7 +37,7 @@
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="visible">1</property>
<property name="icon-name">find-location-symbolic</property>
<property name="icon-size">1</property>
</object>
@ -39,11 +46,11 @@
</child>
<child>
<object class="GtkStack" id="object_buttons">
<property name="visible">True</property>
<property name="visible">1</property>
<child>
<object class="GtkButton" id="object_details_button">
<property name="visible">True</property>
<property name="focus-on-click">False</property>
<property name="visible">1</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Show Details</property>
<property name="halign">center</property>
<property name="valign">center</property>
@ -53,7 +60,7 @@
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="visible">1</property>
<property name="icon-name">dialog-information-symbolic</property>
<property name="icon-size">1</property>
</object>
@ -65,8 +72,8 @@
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="focus-on-click">False</property>
<property name="visible">1</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Show all Objects</property>
<property name="halign">center</property>
<property name="valign">center</property>
@ -76,7 +83,7 @@
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="visible">1</property>
<property name="icon-name">view-list-symbolic</property>
<property name="icon-size">1</property>
</object>
@ -95,8 +102,8 @@
</child>
<child>
<object class="GtkToggleButton" id="record_statistics_button">
<property name="visible">True</property>
<property name="focus-on-click">False</property>
<property name="visible">1</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Collect Statistics</property>
<property name="halign">start</property>
<property name="valign">center</property>
@ -105,7 +112,7 @@
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="visible">1</property>
<property name="icon-name">media-record-symbolic</property>
<property name="icon-size">1</property>
</object>
@ -117,13 +124,13 @@
</child>
<child>
<object class="GtkStack" id="resource_buttons">
<property name="visible">True</property>
<property name="visible">1</property>
<property name="halign">start</property>
<property name="valign">center</property>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="focus-on-click">False</property>
<property name="visible">1</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Show Details</property>
<property name="halign">center</property>
<property name="valign">center</property>
@ -132,7 +139,7 @@
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="visible">1</property>
<property name="icon-name">dialog-information-symbolic</property>
<property name="icon-size">1</property>
</object>
@ -144,8 +151,8 @@
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="focus-on-click">False</property>
<property name="visible">1</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Show all Resources</property>
<property name="halign">center</property>
<property name="valign">center</property>
@ -154,7 +161,7 @@
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="visible">1</property>
<property name="icon-name">view-list-symbolic</property>
<property name="icon-size">1</property>
</object>
@ -171,7 +178,7 @@
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="visible">1</property>
</object>
<packing>
<property name="name">css</property>
@ -179,7 +186,7 @@
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="visible">1</property>
</object>
<packing>
<property name="name">visual</property>
@ -187,20 +194,17 @@
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="visible">1</property>
</object>
<packing>
<property name="name">general</property>
</packing>
</child>
</object>
<packing>
<property name="pack-type">start</property>
</packing>
</child>
<child type="title">
<object class="GtkStackSwitcher">
<property name="visible">True</property>
<property name="visible">1</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="stack">top_stack</property>
@ -210,10 +214,10 @@
</child>
<child>
<object class="GtkStack" id="top_stack">
<property name="visible">True</property>
<property name="visible">1</property>
<child>
<object class="GtkStack" id="object_stack">
<property name="visible">True</property>
<property name="visible">1</property>
<child>
<object class="GtkInspectorObjectTree" id="object_tree">
<property name="visible">True</property>
@ -226,141 +230,253 @@
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="visible">1</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="visible">1</property>
<property name="spacing">10</property>
<child>
<object class="GtkStackSidebar">
<object class="GtkStackCombo" id="stackcombo">
<property name="visible">True</property>
<property name="margin">6</property>
<property name="stack">object_details</property>
</object>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="orientation">vertical</property>
</object>
</child>
<child>
<object class="GtkStack" id="object_details">
<object class="GtkStack" id="object_start_stack">
<property name="visible">True</property>
<child>
<object class="GtkInspectorMiscInfo" id="misc_info">
<object class="GtkBox">
<property name="visible">True</property>
<property name="object-tree">object_tree</property>
</object>
<packing>
<property name="name">misc</property>
<property name="title" translatable="yes">Miscellaneous</property>
<property name="name">empty</property>
</packing>
</child>
<child>
<object class="GtkInspectorPropList" id="prop_list">
<property name="visible">True</property>
<property name="child-properties">False</property>
<property name="object-tree">object_tree</property>
</object>
<packing>
<property name="name">properties</property>
<property name="title" translatable="yes">Properties</property>
</packing>
</child>
<child>
<object class="GtkInspectorSignalsList" id="signals_list">
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="spacing">6</property>
<property name="margin">6</property>
<child>
<object class="GtkToggleButton" id="signals_trace_button">
<property name="visible">True</property>
<property name="relief">none</property>
<property name="tooltip-text" translatable="yes">Trace signal emissions on this object</property>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">media-record-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="signals_clear_button">
<property name="visible">True</property>
<property name="relief">none</property>
<property name="tooltip-text" translatable="yes">Clear log</property>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">edit-clear-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="name">signals</property>
<property name="title" translatable="yes">Signals</property>
</packing>
</child>
<child>
<object class="GtkInspectorPropList" id="child_prop_list">
<property name="child-properties">True</property>
<property name="object-tree">object_tree</property>
</object>
<packing>
<property name="name">child-properties</property>
<property name="title" translatable="yes">Child Properties</property>
</packing>
</child>
<child>
<object class="GtkInspectorObjectHierarchy" id="object_hierarchy">
<object class="GtkScale">
<property name="visible">True</property>
</object>
<packing>
<property name="name">hierarchy</property>
<property name="title" translatable="yes">Hierarchy</property>
</packing>
</child>
<child>
<object class="GtkInspectorSelector" id="selector">
<property name="visible">True</property>
</object>
<packing>
<property name="name">selector</property>
<property name="title" translatable="yes">Selector</property>
</packing>
</child>
<child>
<object class="GtkInspectorCssNodeTree" id="widget_css_node_tree">
<property name="visible">True</property>
</object>
<packing>
<property name="name">css-nodes</property>
<property name="title" translatable="yes">CSS nodes</property>
</packing>
</child>
<child>
<object class="GtkInspectorSizeGroups" id="size_groups"/>
<packing>
<property name="name">size-groups</property>
<property name="title" translatable="yes">Size Groups</property>
</packing>
</child>
<child>
<object class="GtkInspectorDataList" id="data_list"/>
<packing>
<property name="name">data</property>
<property name="title" translatable="yes">Data</property>
</packing>
</child>
<child>
<object class="GtkInspectorActions" id="actions"/>
<packing>
<property name="name">actions</property>
<property name="title" translatable="yes">Actions</property>
</packing>
</child>
<child>
<object class="GtkInspectorMenu" id="menu"/>
<packing>
<property name="name">menu</property>
<property name="title" translatable="yes">Menu</property>
</packing>
</child>
<child>
<object class="GtkInspectorGestures" id="gestures">
<property name="object-tree">object_tree</property>
</object>
<packing>
<property name="name">gestures</property>
<property name="title" translatable="yes">Gestures</property>
</packing>
</child>
<child>
<object class="GtkInspectorMagnifier" id="magnifier">
<property name="orientation">horizontal</property>
<property name="width-request">150</property>
<property name="draw-value">False</property>
<property name="adjustment">magnification_adjustment</property>
<marks>
<mark value="1.0" position="bottom"/>
<mark value="2.0" position="bottom"/>
<mark value="3.0" position="bottom"/>
<mark value="4.0" position="bottom"/>
<mark value="5.0" position="bottom"/>
</marks>
</object>
<packing>
<property name="name">magnifier</property>
<property name="title" translatable="yes">Magnifier</property>
</packing>
</child>
</object>
</child>
<child type="center">
<object class="GtkStack" id="object_center_stack">
<property name="visible">1</property>
<property name="transition-type">crossfade</property>
<child>
<object class="GtkLabel" id="object_title">
<property name="visible">1</property>
</object>
<packing>
<property name="name">title</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="prop_search_entry">
<property name="visible">1</property>
<property name="margin">6</property>
<property name="max-width-chars">40</property>
</object>
<packing>
<property name="name">prop-search</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="child_prop_search_entry">
<property name="visible">1</property>
<property name="margin">6</property>
<property name="max-width-chars">40</property>
</object>
<packing>
<property name="name">child-prop-search</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkStack" id="object_details">
<property name="visible">1</property>
<signal name="notify::visible-child" handler="object_details_changed"/>
<child>
<object class="GtkInspectorMiscInfo" id="misc_info">
<property name="visible">True</property>
<property name="object-tree">object_tree</property>
</object>
<packing>
<property name="name">misc</property>
<property name="title" translatable="yes">Miscellaneous</property>
</packing>
</child>
<child>
<object class="GtkInspectorPropList" id="prop_list">
<property name="visible">True</property>
<property name="child-properties">False</property>
<property name="object-tree">object_tree</property>
<property name="search-entry">prop_search_entry</property>
</object>
<packing>
<property name="name">properties</property>
<property name="title" translatable="yes">Properties</property>
</packing>
</child>
<child>
<object class="GtkInspectorSignalsList" id="signals_list">
<property name="visible">True</property>
<property name="trace-button">signals_trace_button</property>
<property name="clear-button">signals_clear_button</property>
</object>
<packing>
<property name="name">signals</property>
<property name="title" translatable="yes">Signals</property>
</packing>
</child>
<child>
<object class="GtkInspectorPropList" id="child_prop_list">
<property name="child-properties">True</property>
<property name="object-tree">object_tree</property>
<property name="search-entry">child_prop_search_entry</property>
</object>
<packing>
<property name="name">child-properties</property>
<property name="title" translatable="yes">Child Properties</property>
</packing>
</child>
<child>
<object class="GtkInspectorObjectHierarchy" id="object_hierarchy">
<property name="visible">True</property>
</object>
<packing>
<property name="name">hierarchy</property>
<property name="title" translatable="yes">Class Hierarchy</property>
</packing>
</child>
<child>
<object class="GtkInspectorSelector" id="selector">
<property name="visible">True</property>
</object>
<packing>
<property name="name">selector</property>
<property name="title" translatable="yes">CSS Selector</property>
</packing>
</child>
<child>
<object class="GtkInspectorCssNodeTree" id="widget_css_node_tree">
<property name="visible">True</property>
</object>
<packing>
<property name="name">css-nodes</property>
<property name="title" translatable="yes">CSS nodes</property>
</packing>
</child>
<child>
<object class="GtkInspectorSizeGroups" id="size_groups"/>
<packing>
<property name="name">size-groups</property>
<property name="title" translatable="yes">Size Groups</property>
</packing>
</child>
<child>
<object class="GtkInspectorDataList" id="data_list"/>
<packing>
<property name="name">data</property>
<property name="title" translatable="yes">Data</property>
</packing>
</child>
<child>
<object class="GtkInspectorActions" id="actions"/>
<packing>
<property name="name">actions</property>
<property name="title" translatable="yes">Actions</property>
</packing>
</child>
<child>
<object class="GtkInspectorMenu" id="menu"/>
<packing>
<property name="name">menu</property>
<property name="title" translatable="yes">Menu</property>
</packing>
</child>
<child>
<object class="GtkInspectorGestures" id="gestures">
<property name="object-tree">object_tree</property>
</object>
<packing>
<property name="name">gestures</property>
<property name="title" translatable="yes">Gestures</property>
</packing>
</child>
<child>
<object class="GtkInspectorMagnifier" id="magnifier">
<property name="adjustment">magnification_adjustment</property>
</object>
<packing>
<property name="name">magnifier</property>
<property name="title" translatable="yes">Magnifier</property>
</packing>
</child>
</object>
</child>
</object>