[gtk+] inspector: Show object title in the classes tab



commit 85380f22f34f28a85b20054e691c5fc1c60f9f09
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Nov 22 13:41:21 2014 -0500

    inspector: Show object title in the classes tab

 gtk/inspector/classes-list.c  |    7 ++++++
 gtk/inspector/classes-list.ui |   45 +++++++++++++++++++++++++++++++++++-----
 2 files changed, 46 insertions(+), 6 deletions(-)
---
diff --git a/gtk/inspector/classes-list.c b/gtk/inspector/classes-list.c
index 1fc3130..04fe934 100644
--- a/gtk/inspector/classes-list.c
+++ b/gtk/inspector/classes-list.c
@@ -31,6 +31,7 @@
 #include "gtkbutton.h"
 #include "gtkdialog.h"
 #include "gtkstylecontext.h"
+#include "gtklabel.h"
 
 enum
 {
@@ -49,6 +50,7 @@ struct _GtkInspectorClassesListPrivate
 {
   GtkListStore *model;
   GtkStyleContext *context;
+  GtkWidget *object_title;
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorClassesList, gtk_inspector_classes_list, GTK_TYPE_BOX)
@@ -257,6 +259,7 @@ gtk_inspector_classes_list_set_object (GtkInspectorClassesList *cl,
   GHashTable *hash_context;
   GtkTreeIter tree_iter;
   GtkInspectorClassesListByContext *c;
+  const gchar *title;
 
   cleanup_context (cl);
 
@@ -272,6 +275,9 @@ gtk_inspector_classes_list_set_object (GtkInspectorClassesList *cl,
 
   g_object_weak_ref (G_OBJECT (cl->priv->context), gtk_inspector_classes_list_remove_dead_object, cl);
 
+  title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
+  gtk_label_set_label (GTK_LABEL (cl->priv->object_title), title);
+
   hash_context = get_hash_context (cl);
   if (hash_context)
     {
@@ -313,6 +319,7 @@ gtk_inspector_classes_list_class_init (GtkInspectorClassesListClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/classes-list.ui");
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, model);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, object_title);
   gtk_widget_class_bind_template_callback (widget_class, add_clicked);
   gtk_widget_class_bind_template_callback (widget_class, restore_defaults_clicked);
   gtk_widget_class_bind_template_callback (widget_class, enabled_toggled);
diff --git a/gtk/inspector/classes-list.ui b/gtk/inspector/classes-list.ui
index 05e08fa..0414dd4 100644
--- a/gtk/inspector/classes-list.ui
+++ b/gtk/inspector/classes-list.ui
@@ -10,23 +10,56 @@
   <template class="GtkInspectorClassesList" parent="GtkBox">
     <property name="orientation">vertical</property>
     <child>
-      <object class="GtkToolbar">
+      <object class="GtkBox">
         <property name="visible">True</property>
-        <property name="icon-size">small-toolbar</property>
+        <property name="orientation">horizontal</property>
+        <property name="spacing">6</property>
+        <property name="margin">6</property>
         <child>
-          <object class="GtkToolButton">
+          <object class="GtkButton">
             <property name="visible">True</property>
-            <property name="icon-name">list-add-symbolic</property>
+            <property name="relief">none</property>
             <property name="tooltip-text" translatable="yes">Add a class</property>
             <signal name="clicked" handler="add_clicked"/>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage">
+                <property name="visible">True</property>
+                <property name="icon-name">list-add-symbolic</property>
+                <property name="icon-size">1</property>
+              </object>
+            </child>
           </object>
+          <packing>
+            <property name="pack-type">start</property>
+          </packing>
         </child>
         <child>
-          <object class="GtkToolButton">
+          <object class="GtkButton">
             <property name="visible">True</property>
-            <property name="icon-name">edit-undo-symbolic</property>
+            <property name="relief">none</property>
             <property name="tooltip-text" translatable="yes">Restore defaults for this widget</property>
             <signal name="clicked" handler="restore_defaults_clicked"/>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage">
+                <property name="visible">True</property>
+                <property name="icon-name">edit-undo-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>


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