[gtk+] inspector: Show object title in menu tab



commit 6b95810aaefa73308f2effe43bb53cddac6f117b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Nov 22 21:37:39 2014 -0500

    inspector: Show object title in menu tab

 gtk/inspector/menu.c  |   11 +++++++++++
 gtk/inspector/menu.ui |   10 +++++++++-
 2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/gtk/inspector/menu.c b/gtk/inspector/menu.c
index 98412d9..7720fe4 100644
--- a/gtk/inspector/menu.c
+++ b/gtk/inspector/menu.c
@@ -22,6 +22,8 @@
 
 #include "gtktreestore.h"
 #include "gtkwidgetprivate.h"
+#include "gtklabel.h"
+
 
 enum
 {
@@ -35,6 +37,7 @@ enum
 struct _GtkInspectorMenuPrivate
 {
   GtkTreeStore *model;
+  GtkWidget *object_title;
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorMenu, gtk_inspector_menu, GTK_TYPE_BOX)
@@ -130,6 +133,13 @@ gtk_inspector_menu_set_object (GtkInspectorMenu *sl,
   
   if (G_IS_MENU_MODEL (object))
     add_menu (sl, G_MENU_MODEL (object), NULL);
+
+  if (G_IS_OBJECT (object))
+    {
+      const gchar *title;
+      title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
+      gtk_label_set_label (GTK_LABEL (sl->priv->object_title), title);
+    }
 }
 
 static void
@@ -139,6 +149,7 @@ gtk_inspector_menu_class_init (GtkInspectorMenuClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/menu.ui");
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMenu, model);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMenu, object_title);
 }
 
 // vim: set et sw=2 ts=2:
diff --git a/gtk/inspector/menu.ui b/gtk/inspector/menu.ui
index 07b5be3..2338d95 100644
--- a/gtk/inspector/menu.ui
+++ b/gtk/inspector/menu.ui
@@ -12,12 +12,20 @@
   <template class="GtkInspectorMenu" parent="GtkBox">
     <property name="orientation">vertical</property>
     <child>
+      <object class="GtkLabel" id="object_title">
+        <property name="visible">True</property>
+        <property name="halign">fill</property>
+        <property name="valign">center</property>
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+      </object>
+    </child>
+    <child>
       <object class="GtkScrolledWindow">
         <property name="visible">True</property>
         <property name="expand">True</property>
         <property name="hscrollbar-policy">automatic</property>
         <property name="vscrollbar-policy">always</property>
-        <property name="shadow-type">in</property>
         <child>
           <object class= "GtkTreeView">
             <property name="visible">True</property>


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