mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-06 08:40:08 +00:00
inspector: Go to the right tab when changing objects
When going from attribute mapping to model, it makes most sense to go directly to the data tab, and when going from an action name to the owner, we want to show the actions tab. Make it so.
This commit is contained in:
parent
5ed6653859
commit
e4ba5b6ab6
@ -642,7 +642,7 @@ object_properties (GtkInspectorPropEditor *editor)
|
||||
|
||||
g_object_get (editor->priv->object, editor->priv->name, &obj, NULL);
|
||||
if (G_IS_OBJECT (obj))
|
||||
g_signal_emit (editor, signals[SHOW_OBJECT], 0, obj, editor->priv->name);
|
||||
g_signal_emit (editor, signals[SHOW_OBJECT], 0, obj, editor->priv->name, "properties");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1092,7 +1092,7 @@ model_properties (GtkButton *button,
|
||||
GObject *model;
|
||||
|
||||
model = g_object_get_data (G_OBJECT (button), "model");
|
||||
g_signal_emit (editor, signals[SHOW_OBJECT], 0, model, "model");
|
||||
g_signal_emit (editor, signals[SHOW_OBJECT], 0, model, "model", "data");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1258,7 +1258,7 @@ show_action_owner (GtkButton *button,
|
||||
GObject *owner;
|
||||
|
||||
owner = g_object_get_data (G_OBJECT (button), "owner");
|
||||
g_signal_emit (editor, signals[SHOW_OBJECT], 0, owner, NULL);
|
||||
g_signal_emit (editor, signals[SHOW_OBJECT], 0, owner, NULL, "actions");
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
@ -1404,7 +1404,7 @@ gtk_inspector_prop_editor_class_init (GtkInspectorPropEditorClass *klass)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkInspectorPropEditorClass, show_object),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_STRING);
|
||||
G_TYPE_NONE, 3, G_TYPE_OBJECT, G_TYPE_STRING, G_TYPE_STRING);
|
||||
|
||||
g_object_class_install_property (object_class, PROP_OBJECT,
|
||||
g_param_spec_object ("object", "Object", "The object owning the property",
|
||||
|
@ -41,7 +41,10 @@ typedef struct
|
||||
{
|
||||
GtkBoxClass parent;
|
||||
|
||||
void (*show_object) (GtkInspectorPropEditor *editor, GObject *object, const gchar *name);
|
||||
void (*show_object) (GtkInspectorPropEditor *editor,
|
||||
GObject *object,
|
||||
const gchar *name,
|
||||
const gchar *tab);
|
||||
} GtkInspectorPropEditorClass;
|
||||
|
||||
|
||||
|
@ -123,6 +123,7 @@ static void
|
||||
show_object (GtkInspectorPropEditor *editor,
|
||||
GObject *object,
|
||||
const gchar *name,
|
||||
const gchar *tab,
|
||||
GtkInspectorPropList *pl)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
@ -131,6 +132,7 @@ show_object (GtkInspectorPropEditor *editor,
|
||||
popover = gtk_widget_get_ancestor (GTK_WIDGET (editor), GTK_TYPE_POPOVER);
|
||||
gtk_widget_hide (popover);
|
||||
|
||||
g_object_set_data (G_OBJECT (pl->priv->widget_tree), "next-tab", (gpointer)tab);
|
||||
if (gtk_inspector_widget_tree_find_object (pl->priv->widget_tree, object, &iter))
|
||||
{
|
||||
gtk_inspector_widget_tree_select_object (pl->priv->widget_tree, object);
|
||||
|
@ -62,6 +62,9 @@ on_widget_tree_selection_changed (GtkInspectorWidgetTree *wt,
|
||||
GtkInspectorWindow *iw)
|
||||
{
|
||||
GObject *selected = gtk_inspector_widget_tree_get_selected_object (wt);
|
||||
GtkWidget *notebook;
|
||||
const gchar *tab;
|
||||
gint page_num;
|
||||
|
||||
if (!gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->prop_list), selected))
|
||||
return;
|
||||
@ -77,6 +80,24 @@ on_widget_tree_selection_changed (GtkInspectorWidgetTree *wt,
|
||||
gtk_inspector_actions_set_object (GTK_INSPECTOR_ACTIONS (iw->actions), selected);
|
||||
gtk_inspector_gestures_set_object (GTK_INSPECTOR_GESTURES (iw->gestures), selected);
|
||||
|
||||
notebook = gtk_widget_get_parent (iw->prop_list);
|
||||
tab = g_object_get_data (G_OBJECT (iw), "next-tab");
|
||||
if (g_strcmp0 (tab, "properties") == 0)
|
||||
{
|
||||
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (notebook), iw->prop_list);
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), page_num);
|
||||
}
|
||||
else if (g_strcmp0 (tab, "data") == 0)
|
||||
{
|
||||
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (notebook), iw->data_list);
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), page_num);
|
||||
}
|
||||
else if (g_strcmp0 (tab, "actions") == 0)
|
||||
{
|
||||
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (notebook), iw->actions);
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), page_num);
|
||||
}
|
||||
|
||||
if (GTK_IS_WIDGET (selected))
|
||||
gtk_inspector_flash_widget (iw, GTK_WIDGET (selected));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user