From 6128082f20f88594b6a6d225b95ca874dbb612de Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 10 Oct 2014 16:06:37 -0400 Subject: [PATCH] inspector: Save some more space Instead of nesting two notebooks, use a stack switcher in the headerbar for the outer notebook. This saves valuable vertical space. --- gtk/inspector/inspect-button.c | 4 +-- gtk/inspector/window.c | 8 +---- gtk/inspector/window.h | 2 +- gtk/inspector/window.ui | 59 ++++++++++------------------------ 4 files changed, 21 insertions(+), 52 deletions(-) diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c index 96255ccdcb..dca645e1fb 100644 --- a/gtk/inspector/inspect-button.c +++ b/gtk/inspector/inspect-button.c @@ -27,7 +27,7 @@ #include "window.h" #include "widget-tree.h" -#include "gtknotebook.h" +#include "gtkstack.h" #include "gtkmain.h" typedef struct @@ -213,7 +213,7 @@ select_widget (GtkInspectorWindow *iw, iw->selected_widget = widget; - gtk_notebook_set_current_page (GTK_NOTEBOOK (iw->top_notebook), 0); + gtk_stack_set_visible_child_name (GTK_STACK (iw->top_stack), "objects"); if (!gtk_inspector_widget_tree_find_object (wt, G_OBJECT (widget), &iter)) gtk_inspector_widget_tree_scan (wt, gtk_widget_get_toplevel (widget)); diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c index 8a8a27ca12..aca96761be 100644 --- a/gtk/inspector/window.c +++ b/gtk/inspector/window.c @@ -132,16 +132,10 @@ on_send_widget_to_shell_activate (GtkWidget *menuitem, static void gtk_inspector_window_init (GtkInspectorWindow *iw) { - gchar *title; - gtk_widget_init_template (GTK_WIDGET (iw)); gtk_window_group_add_window (gtk_window_group_new (), GTK_WINDOW (iw)); - title = g_strdup_printf (_("GTK+ Inspector — %s"), g_get_application_name ()); - gtk_window_set_title (GTK_WINDOW (iw), title); - g_free (title); - if (gtk_inspector_python_is_enabled ()) { gtk_widget_show (iw->python_shell); @@ -170,7 +164,7 @@ gtk_inspector_window_class_init (GtkInspectorWindowClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/window.ui"); - gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, top_notebook); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, top_stack); gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_tree); gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, prop_list); gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, child_prop_list); diff --git a/gtk/inspector/window.h b/gtk/inspector/window.h index c9fec99e3c..ce6fe16a39 100644 --- a/gtk/inspector/window.h +++ b/gtk/inspector/window.h @@ -41,7 +41,7 @@ typedef struct { GtkWindow parent; - GtkWidget *top_notebook; + GtkWidget *top_stack; GtkWidget *widget_tree; GtkWidget *prop_list; GtkWidget *child_prop_list; diff --git a/gtk/inspector/window.ui b/gtk/inspector/window.ui index 35cb17bd6f..50b611ddd7 100644 --- a/gtk/inspector/window.ui +++ b/gtk/inspector/window.ui @@ -42,12 +42,17 @@ start + + + True + top_stack + + - + True - False True @@ -299,77 +304,47 @@ - True - True + objects + Objects - - - True - Objects - - True - True - True + resources + Resources - - - True - Resources - - True True - True - True + css + Custom CSS - - - True - Custom CSS - - True - True - True + visual + Visual - - - True - Visual - - True - True - True + general + General - - - True - General - -