[gtk+] inspector: Save some more space



commit 6128082f20f88594b6a6d225b95ca874dbb612de
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Oct 10 16:06:37 2014 -0400

    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 96255cc..dca645e 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 8a8a27c..aca9676 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 c9fec99..ce6fe16 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 35cb17b..50b611d 100644
--- a/gtk/inspector/window.ui
+++ b/gtk/inspector/window.ui
@@ -42,12 +42,17 @@
             <property name="pack-type">start</property>
           </packing>
         </child>
+        <child type="title">
+          <object class="GtkStackSwitcher">
+            <property name="visible">True</property>
+            <property name="stack">top_stack</property>
+          </object>
+        </child>
       </object>
     </child>
     <child>
-      <object class="GtkNotebook" id="top_notebook">
+      <object class="GtkStack" id="top_stack">
         <property name="visible">True</property>
-        <property name="show-border">False</property>
         <child>
           <object class="GtkBox">
             <property name="visible">True</property>
@@ -299,77 +304,47 @@
             </child>
           </object>
           <packing>
-            <property name="tab_expand">True</property>
-            <property name="tab_fill">True</property>
+            <property name="name">objects</property>
+            <property name="title" translatable="yes">Objects</property>
           </packing>
         </child>
-        <child type="tab">
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Objects</property>
-          </object>
-        </child>
         <child>
           <object class="GtkInspectorResourceList">
             <property name="visible">True</property>
           </object>
           <packing>
-            <property name="tab_expand">True</property>
-            <property name="tab_fill">True</property>
+            <property name="name">resources</property>
+            <property name="title" translatable="yes">Resources</property>
           </packing>
         </child>
-        <child type="tab">
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Resources</property>
-          </object>
-        </child>
         <child>
           <object class="GtkInspectorCssEditor">
             <property name="visible">True</property>
             <property name="global">True</property>
           </object>
           <packing>
-            <property name="tab_expand">True</property>
-            <property name="tab_fill">True</property>
+            <property name="name">css</property>
+            <property name="title" translatable="yes">Custom CSS</property>
           </packing>
         </child>
-        <child type="tab">
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Custom CSS</property>
-          </object>
-        </child>
         <child>
           <object class="GtkInspectorVisual">
             <property name="visible">True</property>
           </object>
           <packing>
-            <property name="tab_expand">True</property>
-            <property name="tab_fill">True</property>
+            <property name="name">visual</property>
+            <property name="title" translatable="yes">Visual</property>
           </packing>
         </child>
-        <child type="tab">
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Visual</property>
-          </object>
-        </child>
         <child>
           <object class="GtkInspectorGeneral">
             <property name="visible">True</property>
           </object>
           <packing>
-            <property name="tab_expand">True</property>
-            <property name="tab_fill">True</property>
+            <property name="name">general</property>
+            <property name="title" translatable="yes">General</property>
           </packing>
         </child>
-        <child type="tab">
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">General</property>
-          </object>
-        </child>
       </object>
     </child>
   </template>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]