inspector: Improve css node UI

All the other object pages have a title, this one was missing it.
Add one, so the page fits in with the rest.
This commit is contained in:
Matthias Clasen 2015-10-25 09:20:43 -04:00
parent 1e112ca75e
commit 4305aa1def
2 changed files with 19 additions and 2 deletions

View File

@ -26,7 +26,8 @@
#include "css-node-tree.h"
#include "gtktreemodelcssnode.h"
#include <gtk/gtktreeview.h>
#include "gtk/gtktreeview.h"
#include "gtk/gtklabel.h"
#include "gtk/gtkwidgetprivate.h"
enum {
@ -43,6 +44,7 @@ struct _GtkInspectorCssNodeTreePrivate
{
GtkWidget *tree_view;
GtkTreeModel *model;
GtkWidget *object_title;
};
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorCssNodeTree, gtk_inspector_css_node_tree, GTK_TYPE_BOX)
@ -65,6 +67,7 @@ gtk_inspector_css_node_tree_class_init (GtkInspectorCssNodeTreeClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/css-node-tree.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, tree_view);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, object_title);
}
static int
@ -154,11 +157,15 @@ gtk_inspector_css_node_tree_set_object (GtkInspectorCssNodeTree *cnt,
GObject *object)
{
GtkInspectorCssNodeTreePrivate *priv;
const gchar *title;
g_return_if_fail (GTK_INSPECTOR_IS_CSS_NODE_TREE (cnt));
priv = cnt->priv;
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
gtk_label_set_label (GTK_LABEL (priv->object_title), title);
if (!GTK_IS_WIDGET (object))
{
gtk_tree_model_css_node_set_root_node (GTK_TREE_MODEL_CSS_NODE (priv->model), NULL);

View File

@ -2,6 +2,15 @@
<interface domain="gtk30">
<template class="GtkInspectorCssNodeTree" 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>
@ -11,6 +20,7 @@
<child>
<object class="GtkTreeView" id="tree_view">
<property name="visible">True</property>
<property name="enable-search">False</property>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>