forked from AuroraMiddleware/gtk
Merge branch 'inspector-navigation' into 'master'
Inspector navigation See merge request GNOME/gtk!2201
This commit is contained in:
commit
86f800e11d
@ -361,7 +361,7 @@ gtk_stack_page_class_init (GtkStackPageClass *class)
|
||||
/**
|
||||
* GtkStackPage:needs-attention:
|
||||
*
|
||||
* Sets a flag specifying whether the oage requires the user attention.
|
||||
* Sets a flag specifying whether the page requires the user attention.
|
||||
* This is used by the #GtkStackSwitcher to change the appearance of the
|
||||
* corresponding button when a page needs attention and it is not the
|
||||
* current one.
|
||||
@ -1240,23 +1240,17 @@ set_visible_child (GtkStack *stack,
|
||||
}
|
||||
|
||||
static void
|
||||
stack_child_visibility_notify_cb (GObject *obj,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
update_child_visible (GtkStack *stack,
|
||||
GtkStackPage *child_info)
|
||||
{
|
||||
GtkStack *stack = GTK_STACK (user_data);
|
||||
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
|
||||
GtkWidget *child = GTK_WIDGET (obj);
|
||||
GtkStackPage *child_info;
|
||||
gboolean visible;
|
||||
|
||||
child_info = find_child_info_for_widget (stack, child);
|
||||
g_return_if_fail (child_info != NULL);
|
||||
visible = child_info->visible && gtk_widget_get_visible (child_info->widget);
|
||||
|
||||
if (priv->visible_child == NULL &&
|
||||
gtk_widget_get_visible (child))
|
||||
if (priv->visible_child == NULL && visible)
|
||||
set_visible_child (stack, child_info, priv->transition_type, priv->transition_duration);
|
||||
else if (priv->visible_child == child_info &&
|
||||
!gtk_widget_get_visible (child))
|
||||
else if (priv->visible_child == child_info && !visible)
|
||||
set_visible_child (stack, NULL, priv->transition_type, priv->transition_duration);
|
||||
|
||||
if (child_info == priv->last_visible_child)
|
||||
@ -1266,6 +1260,20 @@ stack_child_visibility_notify_cb (GObject *obj,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
stack_child_visibility_notify_cb (GObject *obj,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkStack *stack = GTK_STACK (user_data);
|
||||
GtkStackPage *child_info;
|
||||
|
||||
child_info = find_child_info_for_widget (stack, GTK_WIDGET (obj));
|
||||
g_return_if_fail (child_info != NULL);
|
||||
|
||||
update_child_visible (stack, child_info);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_stack_add_titled:
|
||||
* @stack: a #GtkStack
|
||||
@ -2492,6 +2500,10 @@ gtk_stack_page_set_visible (GtkStackPage *self,
|
||||
return;
|
||||
|
||||
self->visible = visible;
|
||||
|
||||
if (self->widget && gtk_widget_get_parent (self->widget))
|
||||
update_child_visible (GTK_STACK (gtk_widget_get_parent (self->widget)), self);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), stack_page_props[CHILD_PROP_VISIBLE]);
|
||||
}
|
||||
|
||||
|
@ -19,10 +19,10 @@
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include "controllers.h"
|
||||
#include "object-tree.h"
|
||||
|
||||
#include "gtkbinlayout.h"
|
||||
#include "gtkdropdown.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkcustomsorter.h"
|
||||
#include "gtkflattenlistmodel.h"
|
||||
#include "gtkframe.h"
|
||||
@ -37,6 +37,7 @@
|
||||
#include "gtkstack.h"
|
||||
#include "gtkstylecontext.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "window.h"
|
||||
|
||||
struct _GtkInspectorControllers
|
||||
{
|
||||
@ -45,7 +46,6 @@ struct _GtkInspectorControllers
|
||||
GtkWidget *listbox;
|
||||
GtkPropertyLookupListModel *model;
|
||||
GtkSizeGroup *sizegroup;
|
||||
GtkInspectorObjectTree *object_tree;
|
||||
};
|
||||
|
||||
struct _GtkInspectorControllersClass
|
||||
@ -53,12 +53,6 @@ struct _GtkInspectorControllersClass
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_OBJECT_TREE
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkInspectorControllers, gtk_inspector_controllers, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
@ -66,10 +60,14 @@ row_activated (GtkListBox *box,
|
||||
GtkListBoxRow *row,
|
||||
GtkInspectorControllers *self)
|
||||
{
|
||||
GtkInspectorWindow *iw;
|
||||
GObject *controller;
|
||||
|
||||
iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (self), GTK_TYPE_INSPECTOR_WINDOW));
|
||||
|
||||
controller = G_OBJECT (g_object_get_data (G_OBJECT (row), "controller"));
|
||||
gtk_inspector_object_tree_select_object (self->object_tree, controller);
|
||||
|
||||
gtk_inspector_window_push_object (iw, controller, CHILD_KIND_CONTROLLER, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -130,7 +128,7 @@ create_controller_widget (gpointer item,
|
||||
const char *phases[5];
|
||||
|
||||
row = gtk_list_box_row_new ();
|
||||
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
||||
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), TRUE);
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 40);
|
||||
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
|
||||
gtk_widget_set_margin_start (box, 10);
|
||||
@ -265,46 +263,6 @@ gtk_inspector_controllers_set_object (GtkInspectorControllers *self,
|
||||
g_object_unref (map_model);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_controllers_get_property (GObject *object,
|
||||
guint param_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkInspectorControllers *self = GTK_INSPECTOR_CONTROLLERS (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_OBJECT_TREE:
|
||||
g_value_take_object (value, self->object_tree);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_controllers_set_property (GObject *object,
|
||||
guint param_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkInspectorControllers *self = GTK_INSPECTOR_CONTROLLERS (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_OBJECT_TREE:
|
||||
self->object_tree = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_controllers_dispose (GObject *object)
|
||||
{
|
||||
@ -321,14 +279,8 @@ gtk_inspector_controllers_class_init (GtkInspectorControllersClass *klass)
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->get_property = gtk_inspector_controllers_get_property;
|
||||
object_class->set_property = gtk_inspector_controllers_set_property;
|
||||
object_class->dispose= gtk_inspector_controllers_dispose;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_OBJECT_TREE,
|
||||
g_param_spec_object ("object-tree", "Widget Tree", "Widget tree",
|
||||
GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
}
|
||||
|
||||
|
@ -92,8 +92,6 @@ select_widget (GtkInspectorWindow *iw,
|
||||
{
|
||||
GtkInspectorObjectTree *wt = GTK_INSPECTOR_OBJECT_TREE (iw->object_tree);
|
||||
|
||||
iw->selected_widget = widget;
|
||||
|
||||
gtk_inspector_object_tree_select_object (wt, G_OBJECT (widget));
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
.list .cell entry,
|
||||
.list .cell spinbutton,
|
||||
.list .cell button,
|
||||
.list .cell dropdown
|
||||
.list .cell combobox {
|
||||
min-height: 24px;
|
||||
min-width: 0;
|
||||
@ -42,6 +43,11 @@
|
||||
|
||||
.list .cell entry,
|
||||
.list .cell button,
|
||||
.list .cell dropdown
|
||||
.list .cell combobox {
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
stacksidebar.object-details {
|
||||
border-top: 1px solid lightgray;
|
||||
}
|
||||
|
@ -20,8 +20,6 @@
|
||||
|
||||
#include "list-data.h"
|
||||
|
||||
#include "object-tree.h"
|
||||
|
||||
#include "gtkcolumnview.h"
|
||||
#include "gtktogglebutton.h"
|
||||
#include "gtklabel.h"
|
||||
@ -31,13 +29,13 @@
|
||||
#include "gtknoselection.h"
|
||||
#include "gtksignallistitemfactory.h"
|
||||
#include "gtklistitem.h"
|
||||
#include "window.h"
|
||||
|
||||
|
||||
struct _GtkInspectorListData
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
||||
GtkInspectorObjectTree *object_tree;
|
||||
GListModel *object;
|
||||
GtkColumnView *view;
|
||||
GtkWidget *items_label;
|
||||
@ -48,12 +46,6 @@ struct _GtkInspectorListDataClass
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_OBJECT_TREE,
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkInspectorListData, gtk_inspector_list_data, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
@ -167,13 +159,15 @@ static void
|
||||
object_properties (GtkWidget *button,
|
||||
GtkListItem *item)
|
||||
{
|
||||
GtkInspectorListData *sl;
|
||||
gpointer obj;
|
||||
GtkInspectorWindow *iw;
|
||||
GObject *obj;
|
||||
guint pos;
|
||||
|
||||
iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_INSPECTOR_WINDOW));
|
||||
|
||||
sl = GTK_INSPECTOR_LIST_DATA (gtk_widget_get_ancestor (button, GTK_TYPE_INSPECTOR_LIST_DATA));
|
||||
obj = gtk_list_item_get_item (item);
|
||||
g_object_set_data (G_OBJECT (sl->object_tree), "next-tab", (gpointer)"properties");
|
||||
gtk_inspector_object_tree_activate_object (sl->object_tree, obj);
|
||||
pos = gtk_list_item_get_position (item);
|
||||
gtk_inspector_window_push_object (iw, obj, CHILD_KIND_LISTITEM, pos);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -192,46 +186,6 @@ unbind_props (GtkSignalListItemFactory *factory,
|
||||
g_signal_handlers_disconnect_by_func (gtk_list_item_get_child (item), object_properties, item);
|
||||
}
|
||||
|
||||
static void
|
||||
get_property (GObject *object,
|
||||
guint param_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkInspectorListData *sl = GTK_INSPECTOR_LIST_DATA (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_OBJECT_TREE:
|
||||
g_value_take_object (value, sl->object_tree);
|
||||
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)
|
||||
{
|
||||
GtkInspectorListData *sl = GTK_INSPECTOR_LIST_DATA (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_OBJECT_TREE:
|
||||
sl->object_tree = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
@ -249,12 +203,6 @@ gtk_inspector_list_data_class_init (GtkInspectorListDataClass *klass)
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->finalize = finalize;
|
||||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_OBJECT_TREE,
|
||||
g_param_spec_object ("object-tree", "Object Tree", "Object tree",
|
||||
GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/list-data.ui");
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorListData, view);
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include "misc-info.h"
|
||||
#include "window.h"
|
||||
#include "object-tree.h"
|
||||
#include "type-info.h"
|
||||
|
||||
#include "gtktypebuiltins.h"
|
||||
@ -35,8 +34,6 @@
|
||||
|
||||
|
||||
struct _GtkInspectorMiscInfoPrivate {
|
||||
GtkInspectorObjectTree *object_tree;
|
||||
|
||||
GObject *object;
|
||||
|
||||
GtkWidget *swin;
|
||||
@ -91,12 +88,6 @@ struct _GtkInspectorMiscInfoPrivate {
|
||||
gint64 last_frame;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_OBJECT_TREE
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorMiscInfo, gtk_inspector_misc_info, GTK_TYPE_WIDGET)
|
||||
|
||||
static gchar *
|
||||
@ -179,53 +170,56 @@ disconnect_each_other (gpointer still_alive,
|
||||
g_object_weak_unref (still_alive, disconnect_each_other, for_science);
|
||||
}
|
||||
|
||||
static void
|
||||
show_object (GtkInspectorMiscInfo *sl,
|
||||
GObject *object,
|
||||
const gchar *tab)
|
||||
{
|
||||
g_object_set_data_full (G_OBJECT (sl->priv->object_tree), "next-tab", g_strdup (tab), g_free);
|
||||
gtk_inspector_object_tree_activate_object (sl->priv->object_tree, object);
|
||||
}
|
||||
|
||||
static void
|
||||
show_mnemonic_label (GtkWidget *button, GtkInspectorMiscInfo *sl)
|
||||
{
|
||||
GtkInspectorWindow *iw;
|
||||
GtkWidget *widget;
|
||||
|
||||
iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_WINDOW));
|
||||
|
||||
widget = g_object_get_data (G_OBJECT (button), "mnemonic-label");
|
||||
if (widget)
|
||||
show_object (sl, G_OBJECT (widget), "properties");
|
||||
gtk_inspector_window_push_object (iw, G_OBJECT (widget), CHILD_KIND_OTHER, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
show_surface (GtkWidget *button, GtkInspectorMiscInfo *sl)
|
||||
{
|
||||
GtkInspectorWindow *iw;
|
||||
GObject *surface;
|
||||
|
||||
iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_WINDOW));
|
||||
|
||||
surface = (GObject *)gtk_native_get_surface (GTK_NATIVE (sl->priv->object));
|
||||
if (surface)
|
||||
show_object (sl, G_OBJECT (surface), "properties");
|
||||
gtk_inspector_window_push_object (iw, surface, CHILD_KIND_OTHER, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
show_renderer (GtkWidget *button, GtkInspectorMiscInfo *sl)
|
||||
{
|
||||
GtkInspectorWindow *iw;
|
||||
GObject *renderer;
|
||||
|
||||
iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_WINDOW));
|
||||
|
||||
renderer = (GObject *)gtk_native_get_renderer (GTK_NATIVE (sl->priv->object));
|
||||
if (renderer)
|
||||
show_object (sl, G_OBJECT (renderer), "properties");
|
||||
gtk_inspector_window_push_object (iw, renderer, CHILD_KIND_OTHER, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
show_frame_clock (GtkWidget *button, GtkInspectorMiscInfo *sl)
|
||||
{
|
||||
GtkInspectorWindow *iw;
|
||||
GObject *clock;
|
||||
|
||||
iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_WINDOW));
|
||||
|
||||
clock = (GObject *)gtk_widget_get_frame_clock (GTK_WIDGET (sl->priv->object));
|
||||
if (clock)
|
||||
show_object (sl, G_OBJECT (clock), "properties");
|
||||
gtk_inspector_window_push_object (iw, clock, CHILD_KIND_OTHER, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -528,46 +522,6 @@ unmap (GtkWidget *widget)
|
||||
GTK_WIDGET_CLASS (gtk_inspector_misc_info_parent_class)->unmap (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
get_property (GObject *object,
|
||||
guint param_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkInspectorMiscInfo *sl = GTK_INSPECTOR_MISC_INFO (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_OBJECT_TREE:
|
||||
g_value_take_object (value, sl->priv->object_tree);
|
||||
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)
|
||||
{
|
||||
GtkInspectorMiscInfo *sl = GTK_INSPECTOR_MISC_INFO (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_OBJECT_TREE:
|
||||
sl->priv->object_tree = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dispose (GObject *o)
|
||||
{
|
||||
@ -584,17 +538,11 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *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->dispose = dispose;
|
||||
|
||||
widget_class->map = map;
|
||||
widget_class->unmap = unmap;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_OBJECT_TREE,
|
||||
g_param_spec_object ("object-tree", "Object Tree", "Object tree",
|
||||
GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/misc-info.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, swin);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, address);
|
||||
|
@ -353,7 +353,7 @@
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label" translatable="yes">Properties</property>
|
||||
<signal name="clicked" handler="show_frame_clock"/>
|
||||
<signal name="clicked" handler="show_renderer"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "prop-editor.h"
|
||||
|
||||
#include "strv-editor.h"
|
||||
#include "object-tree.h"
|
||||
#include "prop-list.h"
|
||||
|
||||
#include "gtkactionable.h"
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "prop-list.h"
|
||||
|
||||
#include "prop-editor.h"
|
||||
#include "object-tree.h"
|
||||
|
||||
#include "gtkcelllayout.h"
|
||||
#include "gtktreeview.h"
|
||||
@ -45,11 +44,11 @@
|
||||
#include "gtkgestureclick.h"
|
||||
#include "gtkstylecontext.h"
|
||||
#include "prop-holder.h"
|
||||
#include "window.h"
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_OBJECT_TREE,
|
||||
PROP_SEARCH_ENTRY
|
||||
};
|
||||
|
||||
@ -57,7 +56,6 @@ struct _GtkInspectorPropListPrivate
|
||||
{
|
||||
GObject *object;
|
||||
gulong notify_handler_id;
|
||||
GtkInspectorObjectTree *object_tree;
|
||||
GtkWidget *search_entry;
|
||||
GtkWidget *search_stack;
|
||||
GtkWidget *list;
|
||||
@ -156,10 +154,6 @@ get_property (GObject *object,
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_OBJECT_TREE:
|
||||
g_value_take_object (value, pl->priv->object_tree);
|
||||
break;
|
||||
|
||||
case PROP_SEARCH_ENTRY:
|
||||
g_value_take_object (value, pl->priv->search_entry);
|
||||
break;
|
||||
@ -180,10 +174,6 @@ set_property (GObject *object,
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_OBJECT_TREE:
|
||||
pl->priv->object_tree = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
case PROP_SEARCH_ENTRY:
|
||||
pl->priv->search_entry = g_value_get_object (value);
|
||||
break;
|
||||
@ -201,9 +191,10 @@ show_object (GtkInspectorPropEditor *editor,
|
||||
const gchar *tab,
|
||||
GtkInspectorPropList *pl)
|
||||
{
|
||||
g_object_set_data_full (G_OBJECT (pl->priv->object_tree), "next-tab", g_strdup (tab), g_free);
|
||||
gtk_inspector_object_tree_select_object (pl->priv->object_tree, object);
|
||||
gtk_inspector_object_tree_activate_object (pl->priv->object_tree, object);
|
||||
GtkInspectorWindow *iw;
|
||||
|
||||
iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (pl), GTK_TYPE_INSPECTOR_WINDOW));
|
||||
gtk_inspector_window_push_object (iw, object, CHILD_KIND_PROPERTY, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -390,12 +381,25 @@ bind_origin_cb (GtkSignalListItemFactory *factory,
|
||||
gtk_label_set_label (GTK_LABEL (label), origin);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_value_cb (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *list_item,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_add_css_class (widget, "cell");
|
||||
gtk_list_item_set_child (list_item, widget);
|
||||
}
|
||||
|
||||
static void
|
||||
bind_value_cb (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *list_item,
|
||||
gpointer data)
|
||||
{
|
||||
GObject *item;
|
||||
GtkWidget *editor;
|
||||
GtkWidget *widget;
|
||||
GObject *object;
|
||||
const char *name;
|
||||
@ -405,10 +409,10 @@ bind_value_cb (GtkSignalListItemFactory *factory,
|
||||
object = prop_holder_get_object (PROP_HOLDER (item));
|
||||
name = prop_holder_get_name (PROP_HOLDER (item));
|
||||
|
||||
widget = gtk_inspector_prop_editor_new (object, name, NULL);
|
||||
g_signal_connect (widget, "show-object", G_CALLBACK (show_object), data);
|
||||
gtk_list_item_set_child (list_item, widget);
|
||||
gtk_widget_add_css_class (widget, "cell");
|
||||
editor = gtk_inspector_prop_editor_new (object, name, NULL);
|
||||
g_signal_connect (editor, "show-object", G_CALLBACK (show_object), data);
|
||||
widget = gtk_list_item_get_child (list_item);
|
||||
gtk_box_append (GTK_BOX (widget), editor);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -416,7 +420,10 @@ unbind_value_cb (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *list_item,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_list_item_set_child (list_item, NULL);
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_list_item_get_child (list_item);
|
||||
gtk_box_remove (GTK_BOX (widget), gtk_widget_get_first_child (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -435,10 +442,6 @@ gtk_inspector_prop_list_class_init (GtkInspectorPropListClass *klass)
|
||||
widget_class->root = root;
|
||||
widget_class->unroot = unroot;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_OBJECT_TREE,
|
||||
g_param_spec_object ("object-tree", "Object Tree", "Object tree",
|
||||
GTK_TYPE_WIDGET, 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));
|
||||
@ -454,6 +457,7 @@ gtk_inspector_prop_list_class_init (GtkInspectorPropListClass *klass)
|
||||
gtk_widget_class_bind_template_callback (widget_class, bind_type_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, setup_origin_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, bind_origin_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, setup_value_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, bind_value_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, unbind_value_cb);
|
||||
}
|
||||
|
@ -57,6 +57,7 @@
|
||||
<property name="expand">1</property>
|
||||
<property name="factory">
|
||||
<object class="GtkSignalListItemFactory">
|
||||
<signal name="setup" handler="setup_value_cb"/>
|
||||
<signal name="bind" handler="bind_value_cb"/>
|
||||
<signal name="unbind" handler="unbind_value_cb"/>
|
||||
</object>
|
||||
|
@ -120,14 +120,10 @@ on_object_activated (GtkInspectorObjectTree *wt,
|
||||
GObject *selected,
|
||||
GtkInspectorWindow *iw)
|
||||
{
|
||||
const gchar *tab;
|
||||
|
||||
if (!set_selected_object (iw, selected))
|
||||
return;
|
||||
|
||||
tab = g_object_get_data (G_OBJECT (wt), "next-tab");
|
||||
if (tab)
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (iw->object_details), tab);
|
||||
if (GTK_IS_WIDGET (selected))
|
||||
gtk_inspector_window_set_object (iw, selected, CHILD_KIND_WIDGET, 0);
|
||||
else
|
||||
gtk_inspector_window_set_object (iw, selected, CHILD_KIND_OTHER, 0);
|
||||
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (iw->object_stack), "object-details");
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (iw->object_buttons), "details");
|
||||
@ -180,8 +176,7 @@ open_object_details (GtkWidget *button, GtkInspectorWindow *iw)
|
||||
|
||||
selected = gtk_inspector_object_tree_get_selected (GTK_INSPECTOR_OBJECT_TREE (iw->object_tree));
|
||||
|
||||
if (!set_selected_object (iw, selected))
|
||||
return;
|
||||
gtk_inspector_window_set_object (iw, selected, CHILD_KIND_WIDGET, 0);
|
||||
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (iw->object_stack), "object-details");
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (iw->object_buttons), "details");
|
||||
@ -206,12 +201,21 @@ translate_visible_child_name (GBinding *binding,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GObject *object;
|
||||
ChildKind kind;
|
||||
guint position;
|
||||
} ChildData;
|
||||
|
||||
static void
|
||||
gtk_inspector_window_init (GtkInspectorWindow *iw)
|
||||
{
|
||||
GIOExtensionPoint *extension_point;
|
||||
GList *l, *extensions;
|
||||
|
||||
iw->objects = g_array_new (FALSE, FALSE, sizeof (ChildData));
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (iw));
|
||||
|
||||
g_object_bind_property_full (iw->object_details, "visible-child-name",
|
||||
@ -299,6 +303,7 @@ gtk_inspector_window_dispose (GObject *object)
|
||||
g_object_set_data (G_OBJECT (iw->inspected_display), "-gtk-inspector", NULL);
|
||||
|
||||
g_clear_object (&iw->flash_overlay);
|
||||
g_clear_pointer (&iw->objects, g_array_unref);
|
||||
|
||||
G_OBJECT_CLASS (gtk_inspector_window_parent_class)->dispose (object);
|
||||
}
|
||||
@ -312,20 +317,199 @@ object_details_changed (GtkWidget *combo,
|
||||
}
|
||||
|
||||
static void
|
||||
toggle_sidebar (GtkWidget *button,
|
||||
go_up_cb (GtkWidget *button,
|
||||
GtkInspectorWindow *iw)
|
||||
{
|
||||
if (gtk_revealer_get_child_revealed (GTK_REVEALER (iw->sidebar_revealer)))
|
||||
if (iw->objects->len > 1)
|
||||
{
|
||||
gtk_revealer_set_reveal_child (GTK_REVEALER (iw->sidebar_revealer), FALSE);
|
||||
gtk_button_set_icon_name (GTK_BUTTON (button), "go-next-symbolic");
|
||||
gtk_inspector_window_pop_object (iw);
|
||||
return;
|
||||
}
|
||||
else if (iw->objects->len > 0)
|
||||
{
|
||||
ChildData *data = &g_array_index (iw->objects, ChildData, 0);
|
||||
GtkWidget *widget = (GtkWidget *)data->object;
|
||||
if (GTK_IS_WIDGET (widget) && gtk_widget_get_parent (widget))
|
||||
{
|
||||
GObject *obj = G_OBJECT (gtk_widget_get_parent (widget));
|
||||
gtk_inspector_window_replace_object (iw, obj, CHILD_KIND_WIDGET, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_error_bell (GTK_WIDGET (iw));
|
||||
}
|
||||
|
||||
static void
|
||||
go_down_cb (GtkWidget *button,
|
||||
GtkInspectorWindow *iw)
|
||||
{
|
||||
ChildData *data;
|
||||
GObject *object;
|
||||
|
||||
if (iw->objects->len < 1)
|
||||
{
|
||||
gtk_widget_error_bell (GTK_WIDGET (iw));
|
||||
return;
|
||||
}
|
||||
|
||||
data = &g_array_index (iw->objects, ChildData, iw->objects->len - 1);
|
||||
object = data->object;
|
||||
|
||||
if (GTK_IS_WIDGET (object))
|
||||
{
|
||||
GtkWidget *child = gtk_widget_get_first_child (GTK_WIDGET (object));
|
||||
|
||||
if (child)
|
||||
{
|
||||
gtk_inspector_window_push_object (iw, G_OBJECT (child), CHILD_KIND_WIDGET, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (G_IS_LIST_MODEL (object))
|
||||
{
|
||||
GObject *item = g_list_model_get_item (G_LIST_MODEL (object), 0);
|
||||
if (item)
|
||||
{
|
||||
gtk_inspector_window_push_object (iw, item, CHILD_KIND_LISTITEM, 0);
|
||||
g_object_unref (item);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_error_bell (GTK_WIDGET (iw));
|
||||
}
|
||||
|
||||
static void
|
||||
go_previous_cb (GtkWidget *button,
|
||||
GtkInspectorWindow *iw)
|
||||
{
|
||||
ChildData *data;
|
||||
GObject *object;
|
||||
GObject *parent;
|
||||
|
||||
if (iw->objects->len < 1)
|
||||
{
|
||||
gtk_widget_error_bell (GTK_WIDGET (iw));
|
||||
return;
|
||||
}
|
||||
|
||||
if (iw->objects->len > 1)
|
||||
{
|
||||
data = &g_array_index (iw->objects, ChildData, iw->objects->len - 2);
|
||||
parent = data->object;
|
||||
}
|
||||
else
|
||||
parent = NULL;
|
||||
|
||||
data = &g_array_index (iw->objects, ChildData, iw->objects->len - 1);
|
||||
object = data->object;
|
||||
|
||||
switch (data->kind)
|
||||
{
|
||||
gtk_revealer_set_reveal_child (GTK_REVEALER (iw->sidebar_revealer), TRUE);
|
||||
gtk_button_set_icon_name (GTK_BUTTON (button), "go-previous-symbolic");
|
||||
case CHILD_KIND_WIDGET:
|
||||
{
|
||||
GtkWidget *sibling = gtk_widget_get_prev_sibling (GTK_WIDGET (object));
|
||||
if (sibling)
|
||||
{
|
||||
gtk_inspector_window_replace_object (iw, (GObject*)sibling, CHILD_KIND_WIDGET, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CHILD_KIND_LISTITEM:
|
||||
{
|
||||
GObject *item;
|
||||
|
||||
if (parent && data->position > 0)
|
||||
item = g_list_model_get_item (G_LIST_MODEL (parent), data->position - 1);
|
||||
else
|
||||
item = NULL;
|
||||
|
||||
if (item)
|
||||
{
|
||||
gtk_inspector_window_replace_object (iw, item, CHILD_KIND_LISTITEM, data->position - 1);
|
||||
g_object_unref (item);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CHILD_KIND_CONTROLLER:
|
||||
case CHILD_KIND_PROPERTY:
|
||||
case CHILD_KIND_OTHER:
|
||||
default: ;
|
||||
}
|
||||
|
||||
gtk_widget_error_bell (GTK_WIDGET (iw));
|
||||
}
|
||||
|
||||
static void
|
||||
go_next_cb (GtkWidget *button,
|
||||
GtkInspectorWindow *iw)
|
||||
{
|
||||
ChildData *data;
|
||||
GObject *object;
|
||||
GObject *parent;
|
||||
|
||||
if (iw->objects->len < 1)
|
||||
{
|
||||
gtk_widget_error_bell (GTK_WIDGET (iw));
|
||||
return;
|
||||
}
|
||||
|
||||
if (iw->objects->len > 1)
|
||||
{
|
||||
data = &g_array_index (iw->objects, ChildData, iw->objects->len - 2);
|
||||
parent = data->object;
|
||||
}
|
||||
else
|
||||
parent = NULL;
|
||||
|
||||
data = &g_array_index (iw->objects, ChildData, iw->objects->len - 1);
|
||||
object = data->object;
|
||||
|
||||
switch (data->kind)
|
||||
{
|
||||
case CHILD_KIND_WIDGET:
|
||||
{
|
||||
GtkWidget *sibling = gtk_widget_get_next_sibling (GTK_WIDGET (object));
|
||||
if (sibling)
|
||||
{
|
||||
gtk_inspector_window_replace_object (iw, (GObject*)sibling, CHILD_KIND_WIDGET, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CHILD_KIND_LISTITEM:
|
||||
{
|
||||
GObject *item;
|
||||
|
||||
if (parent &&
|
||||
data->position + 1 < g_list_model_get_n_items (G_LIST_MODEL (parent)))
|
||||
item = g_list_model_get_item (G_LIST_MODEL (parent), data->position + 1);
|
||||
else
|
||||
item = NULL;
|
||||
|
||||
if (item)
|
||||
{
|
||||
gtk_inspector_window_replace_object (iw, item, CHILD_KIND_LISTITEM, data->position + 1);
|
||||
g_object_unref (item);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CHILD_KIND_CONTROLLER:
|
||||
case CHILD_KIND_PROPERTY:
|
||||
case CHILD_KIND_OTHER:
|
||||
default: ;
|
||||
}
|
||||
|
||||
gtk_widget_error_bell (GTK_WIDGET (iw));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_window_realize (GtkWidget *widget)
|
||||
@ -461,6 +645,12 @@ gtk_inspector_window_class_init (GtkInspectorWindowClass *klass)
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, general);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, logs);
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, go_up_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, go_down_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, go_previous_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, list_position_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, go_next_button);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, gtk_inspector_on_inspect);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_object_activated);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_object_selected);
|
||||
@ -468,7 +658,10 @@ gtk_inspector_window_class_init (GtkInspectorWindowClass *klass)
|
||||
gtk_widget_class_bind_template_callback (widget_class, close_object_details);
|
||||
gtk_widget_class_bind_template_callback (widget_class, object_details_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, notify_node);
|
||||
gtk_widget_class_bind_template_callback (widget_class, toggle_sidebar);
|
||||
gtk_widget_class_bind_template_callback (widget_class, go_previous_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, go_up_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, go_down_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, go_next_cb);
|
||||
}
|
||||
|
||||
static GdkDisplay *
|
||||
@ -669,5 +862,176 @@ gtk_inspector_window_get_inspected_display (GtkInspectorWindow *iw)
|
||||
return iw->inspected_display;
|
||||
}
|
||||
|
||||
static void
|
||||
update_go_button (GtkWidget *button,
|
||||
gboolean enabled,
|
||||
const char *tooltip)
|
||||
{
|
||||
gtk_widget_set_sensitive (button, enabled);
|
||||
gtk_widget_set_tooltip_text (button, tooltip);
|
||||
}
|
||||
|
||||
static void
|
||||
update_go_buttons (GtkInspectorWindow *iw)
|
||||
{
|
||||
GObject *parent;
|
||||
GObject *object;
|
||||
ChildKind kind;
|
||||
guint position;
|
||||
|
||||
if (iw->objects->len > 1)
|
||||
{
|
||||
ChildData *data = &g_array_index (iw->objects, ChildData, iw->objects->len - 2);
|
||||
parent = data->object;
|
||||
}
|
||||
else
|
||||
{
|
||||
parent = NULL;
|
||||
}
|
||||
|
||||
if (iw->objects->len > 0)
|
||||
{
|
||||
ChildData *data = &g_array_index (iw->objects, ChildData, iw->objects->len - 1);
|
||||
object = data->object;
|
||||
kind = data->kind;
|
||||
position = data->position;
|
||||
}
|
||||
else
|
||||
{
|
||||
object = NULL;
|
||||
kind = CHILD_KIND_OTHER;
|
||||
}
|
||||
|
||||
if (parent)
|
||||
{
|
||||
char *text;
|
||||
text = g_strdup_printf ("Go to %s", G_OBJECT_TYPE_NAME (parent));
|
||||
update_go_button (iw->go_up_button, TRUE, text);
|
||||
g_free (text);
|
||||
}
|
||||
else
|
||||
{
|
||||
update_go_button (iw->go_up_button, GTK_IS_WIDGET (object) && !GTK_IS_ROOT (object), "Parent widget");
|
||||
}
|
||||
|
||||
switch (kind)
|
||||
{
|
||||
case CHILD_KIND_WIDGET:
|
||||
update_go_button (iw->go_down_button, gtk_widget_get_first_child (GTK_WIDGET (object)) != NULL, "First child");
|
||||
update_go_button (iw->go_previous_button, gtk_widget_get_prev_sibling (GTK_WIDGET (object)) != NULL, "Previous sibling");
|
||||
update_go_button (iw->go_next_button, gtk_widget_get_next_sibling (GTK_WIDGET (object)) != NULL, "Next sibling");
|
||||
gtk_widget_hide (iw->list_position_label);
|
||||
break;
|
||||
case CHILD_KIND_LISTITEM:
|
||||
update_go_button (iw->go_down_button, FALSE, NULL);
|
||||
update_go_button (iw->go_previous_button, position > 0, "Previous list item");
|
||||
update_go_button (iw->go_next_button, position + 1 < g_list_model_get_n_items (G_LIST_MODEL (parent)), "Next list item");
|
||||
{
|
||||
char *text = g_strdup_printf ("%u", position);
|
||||
gtk_label_set_label (GTK_LABEL (iw->list_position_label), text);
|
||||
g_free (text);
|
||||
gtk_widget_show (iw->list_position_label);
|
||||
}
|
||||
break;
|
||||
case CHILD_KIND_PROPERTY:
|
||||
case CHILD_KIND_CONTROLLER:
|
||||
case CHILD_KIND_OTHER:
|
||||
update_go_button (iw->go_down_button, FALSE, NULL);
|
||||
update_go_button (iw->go_previous_button, FALSE, NULL);
|
||||
update_go_button (iw->go_next_button, FALSE, NULL);
|
||||
gtk_widget_hide (iw->list_position_label);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
show_object_details (GtkInspectorWindow *iw,
|
||||
GObject *object,
|
||||
const char *tab)
|
||||
{
|
||||
set_selected_object (iw, object);
|
||||
|
||||
if (tab)
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (iw->object_details), tab);
|
||||
if (!gtk_stack_get_visible_child_name (GTK_STACK (iw->object_details)))
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (iw->object_details), "properties");
|
||||
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (iw->object_stack), "object-details");
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (iw->object_buttons), "details");
|
||||
}
|
||||
|
||||
void
|
||||
gtk_inspector_window_push_object (GtkInspectorWindow *iw,
|
||||
GObject *object,
|
||||
ChildKind kind,
|
||||
guint position)
|
||||
{
|
||||
ChildData data;
|
||||
|
||||
data.kind = kind;
|
||||
data.object = object;
|
||||
data.position = position;
|
||||
g_array_append_val (iw->objects, data);
|
||||
show_object_details (iw, object, "properties");
|
||||
update_go_buttons (iw);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_inspector_window_pop_object (GtkInspectorWindow *iw)
|
||||
{
|
||||
ChildData *data;
|
||||
const char *tabs[] = {
|
||||
"properties",
|
||||
"controllers",
|
||||
"properties",
|
||||
"list-data",
|
||||
"misc",
|
||||
};
|
||||
const char *tab;
|
||||
|
||||
if (iw->objects->len < 2)
|
||||
{
|
||||
gtk_widget_error_bell (GTK_WIDGET (iw));
|
||||
return;
|
||||
}
|
||||
|
||||
data = &g_array_index (iw->objects, ChildData, iw->objects->len - 1);
|
||||
tab = tabs[data->kind];
|
||||
g_array_remove_index (iw->objects, iw->objects->len - 1);
|
||||
data = &g_array_index (iw->objects, ChildData, iw->objects->len - 1);
|
||||
show_object_details (iw, data->object, tab);
|
||||
update_go_buttons (iw);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_inspector_window_replace_object (GtkInspectorWindow *iw,
|
||||
GObject *object,
|
||||
ChildKind kind,
|
||||
guint position)
|
||||
{
|
||||
ChildData *data;
|
||||
|
||||
data = &g_array_index (iw->objects, ChildData, iw->objects->len - 1);
|
||||
g_assert (data->kind == kind);
|
||||
data->object = object;
|
||||
data->position = position;
|
||||
show_object_details (iw, object, NULL);
|
||||
update_go_buttons (iw);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_inspector_window_set_object (GtkInspectorWindow *iw,
|
||||
GObject *object,
|
||||
ChildKind kind,
|
||||
guint position)
|
||||
{
|
||||
g_array_set_size (iw->objects, 0);
|
||||
gtk_inspector_window_push_object (iw, object, kind, position);
|
||||
update_go_buttons (iw);
|
||||
}
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
||||
|
@ -78,7 +78,11 @@ typedef struct
|
||||
GtkWidget *general;
|
||||
GtkWidget *logs;
|
||||
|
||||
GtkWidget *selected_widget;
|
||||
GtkWidget *go_up_button;
|
||||
GtkWidget *go_down_button;
|
||||
GtkWidget *go_previous_button;
|
||||
GtkWidget *list_position_label;
|
||||
GtkWidget *go_next_button;
|
||||
|
||||
GList *extra_pages;
|
||||
|
||||
@ -88,6 +92,8 @@ typedef struct
|
||||
gint flash_count;
|
||||
gint flash_cnx;
|
||||
|
||||
GArray *objects;
|
||||
|
||||
GList *overlays;
|
||||
|
||||
GdkDisplay *inspected_display;
|
||||
@ -119,6 +125,29 @@ void gtk_inspector_window_remove_overlay
|
||||
void gtk_inspector_window_select_widget_under_pointer (GtkInspectorWindow *iw);
|
||||
GdkDisplay * gtk_inspector_window_get_inspected_display (GtkInspectorWindow *iw);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CHILD_KIND_WIDGET,
|
||||
CHILD_KIND_CONTROLLER,
|
||||
CHILD_KIND_PROPERTY,
|
||||
CHILD_KIND_LISTITEM,
|
||||
CHILD_KIND_OTHER
|
||||
} ChildKind;
|
||||
|
||||
void gtk_inspector_window_push_object (GtkInspectorWindow *iw,
|
||||
GObject *object,
|
||||
ChildKind kind,
|
||||
guint position);
|
||||
void gtk_inspector_window_pop_object (GtkInspectorWindow *iw);
|
||||
void gtk_inspector_window_set_object (GtkInspectorWindow *iw,
|
||||
GObject *object,
|
||||
ChildKind kind,
|
||||
guint position);
|
||||
void gtk_inspector_window_replace_object (GtkInspectorWindow *iw,
|
||||
GObject *object,
|
||||
ChildKind kind,
|
||||
guint position);
|
||||
|
||||
gboolean gtk_inspector_is_recording (GtkWidget *widget);
|
||||
GskRenderNode * gtk_inspector_prepare_render (GtkWidget *widget,
|
||||
GskRenderer *renderer,
|
||||
@ -127,7 +156,6 @@ GskRenderNode * gtk_inspector_prepare_render
|
||||
GskRenderNode *node);
|
||||
gboolean gtk_inspector_handle_event (GdkEvent *event);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
|
@ -207,17 +207,6 @@
|
||||
<property name="name">object-details</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkRevealer" id="sidebar_revealer">
|
||||
<property name="transition-type">slide-right</property>
|
||||
<property name="reveal-child">1</property>
|
||||
<child>
|
||||
<object class="GtkStackSidebar">
|
||||
<property name="stack">object_details</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
@ -226,17 +215,16 @@
|
||||
<child type="start">
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">go-previous-symbolic</property>
|
||||
<object class="GtkToggleButton" id="sidebar_toggle">
|
||||
<property name="icon-name">open-menu-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Toggle Sidebar</property>
|
||||
<property name="has-frame">0</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="margin-top">6</property>
|
||||
<property name="margin-bottom">6</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<signal name="clicked" handler="toggle_sidebar"/>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -339,6 +327,73 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">6</property>
|
||||
<property name="margin-end">6</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="go_up_button">
|
||||
<property name="icon-name">go-up-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Previous object</property>
|
||||
<property name="has-frame">0</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<signal name="clicked" handler="go_up_cb"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="go_down_button">
|
||||
<property name="icon-name">go-down-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Child object</property>
|
||||
<property name="has-frame">0</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<signal name="clicked" handler="go_down_cb"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="go_previous_button">
|
||||
<property name="icon-name">go-previous-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Previous sibling</property>
|
||||
<property name="has-frame">0</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<signal name="clicked" handler="go_previous_cb"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="list_position_label">
|
||||
<property name="tooltip-text" translatable="yes">List Position</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="go_next_button">
|
||||
<property name="icon-name">go-next-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Next sibling</property>
|
||||
<property name="has-frame">0</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<signal name="clicked" handler="go_next_cb"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkRevealer" id="sidebar_revealer">
|
||||
<property name="transition-type">slide-right</property>
|
||||
<property name="reveal-child" bind-source="sidebar_toggle" bind-property="active" bind-flags="sync-create"/>
|
||||
<child>
|
||||
<object class="GtkStackSidebar">
|
||||
<property name="stack">object_details</property>
|
||||
<style>
|
||||
<class name="object-details"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -350,7 +405,6 @@
|
||||
<property name="title" translatable="yes">Miscellaneous</property>
|
||||
<property name="child">
|
||||
<object class="GtkInspectorMiscInfo" id="misc_info">
|
||||
<property name="object-tree">object_tree</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@ -361,7 +415,6 @@
|
||||
<property name="title" translatable="yes">Properties</property>
|
||||
<property name="child">
|
||||
<object class="GtkInspectorPropList" id="prop_list">
|
||||
<property name="object-tree">object_tree</property>
|
||||
<property name="search-entry">prop_search_entry</property>
|
||||
</object>
|
||||
</property>
|
||||
@ -373,7 +426,6 @@
|
||||
<property name="title" translatable="yes">Layout</property>
|
||||
<property name="child">
|
||||
<object class="GtkInspectorPropList" id="layout_prop_list">
|
||||
<property name="object-tree">object_tree</property>
|
||||
<property name="search-entry">layout_prop_search_entry</property>
|
||||
</object>
|
||||
</property>
|
||||
@ -414,7 +466,6 @@
|
||||
<property name="title" translatable="yes">Data</property>
|
||||
<property name="child">
|
||||
<object class="GtkInspectorListData" id="list_data">
|
||||
<property name="object-tree">object_tree</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@ -445,7 +496,6 @@
|
||||
<property name="title" translatable="yes">Controllers</property>
|
||||
<property name="child">
|
||||
<object class="GtkInspectorControllers" id="controllers">
|
||||
<property name="object-tree">object_tree</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@ -476,6 +526,8 @@
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
|
Loading…
Reference in New Issue
Block a user