From fe5f9c560b1a20f28ba71cde2a5f7d17c226b81b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 22 Nov 2014 13:26:53 -0500 Subject: [PATCH] inspector: Show object title in the css tab --- gtk/inspector/css-editor.c | 19 +++++++++++------- gtk/inspector/css-editor.ui | 39 +++++++++++++++++++++++++++++++------ 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/gtk/inspector/css-editor.c b/gtk/inspector/css-editor.c index 0f032d03ef..ce1d1a00df 100644 --- a/gtk/inspector/css-editor.c +++ b/gtk/inspector/css-editor.c @@ -31,7 +31,8 @@ #include "gtktextview.h" #include "gtkmessagedialog.h" #include "gtkfilechooserdialog.h" -#include "gtktoggletoolbutton.h" +#include "gtktogglebutton.h" +#include "gtklabel.h" #define GTK_INSPECTOR_CSS_EDITOR_TEXT "inspector-css-editor-text" #define GTK_INSPECTOR_CSS_EDITOR_PROVIDER "inspector-css-editor-provider" @@ -57,13 +58,13 @@ typedef struct struct _GtkInspectorCssEditorPrivate { - GtkWidget *toolbar; GtkWidget *view; + GtkWidget *object_title; GtkTextBuffer *text; GtkCssProvider *provider; gboolean global; GtkStyleContext *context; - GtkToggleToolButton *disable_button; + GtkToggleButton *disable_button; guint timeout; }; @@ -102,10 +103,10 @@ set_initial_text (GtkInspectorCssEditor *ce) } static void -disable_toggled (GtkToggleToolButton *button, +disable_toggled (GtkToggleButton *button, GtkInspectorCssEditor *ce) { - if (gtk_toggle_tool_button_get_active (button)) + if (gtk_toggle_button_get_active (button)) { if (ce->priv->global) gtk_style_context_remove_provider_for_screen (gdk_screen_get_default (), @@ -187,7 +188,7 @@ save_response (GtkWidget *dialog, } static void -save_clicked (GtkToolButton *button, +save_clicked (GtkButton *button, GtkInspectorCssEditor *ce) { GtkWidget *dialog; @@ -439,10 +440,10 @@ gtk_inspector_css_editor_class_init (GtkInspectorCssEditorClass *klass) TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/css-editor.ui"); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, toolbar); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, text); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, view); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, disable_button); + gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, object_title); gtk_widget_class_bind_template_callback (widget_class, disable_toggled); gtk_widget_class_bind_template_callback (widget_class, save_clicked); gtk_widget_class_bind_template_callback (widget_class, text_changed); @@ -463,6 +464,7 @@ gtk_inspector_css_editor_set_object (GtkInspectorCssEditor *ce, { gchar *text; GtkCssProvider *provider; + const gchar *title; g_return_if_fail (GTK_INSPECTOR_IS_CSS_EDITOR (ce)); g_return_if_fail (!ce->priv->global); @@ -485,6 +487,9 @@ gtk_inspector_css_editor_set_object (GtkInspectorCssEditor *ce, gtk_widget_show (GTK_WIDGET (ce)); + title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title"); + gtk_label_set_label (GTK_LABEL (ce->priv->object_title), title); + ce->priv->context = gtk_widget_get_style_context (GTK_WIDGET (object)); provider = g_object_get_data (G_OBJECT (ce->priv->context), GTK_INSPECTOR_CSS_EDITOR_PROVIDER); diff --git a/gtk/inspector/css-editor.ui b/gtk/inspector/css-editor.ui index e046c96391..3e92f2a7c0 100644 --- a/gtk/inspector/css-editor.ui +++ b/gtk/inspector/css-editor.ui @@ -19,29 +19,56 @@