summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-11-22 13:26:53 -0500
committerMatthias Clasen <mclasen@redhat.com>2014-11-22 21:38:47 -0500
commitfe5f9c560b1a20f28ba71cde2a5f7d17c226b81b (patch)
tree3ed00304290eda59ccea1967221c2de33b310b65
parentc2326aa5cf7ed6826a0942e684c51f2a924851f5 (diff)
downloadgtk+-fe5f9c560b1a20f28ba71cde2a5f7d17c226b81b.tar.gz
inspector: Show object title in the css tab
-rw-r--r--gtk/inspector/css-editor.c19
-rw-r--r--gtk/inspector/css-editor.ui39
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 @@
<template class="GtkInspectorCssEditor" parent="GtkBox">
<property name="orientation">vertical</property>
<child>
- <object class="GtkToolbar" id="toolbar">
+ <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="GtkToggleToolButton" id="disable_button">
+ <object class="GtkToggleButton" id="disable_button">
<property name="visible">True</property>
- <property name="icon-name">media-playback-pause-symbolic</property>
+ <property name="relief">none</property>
<property name="tooltip-text" translatable="yes">Disable this custom CSS</property>
<signal name="toggled" handler="disable_toggled"/>
<style>
<class name="image-button"/>
</style>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">media-playback-pause-symbolic</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="pack-type">start</property>
+ </packing>
</child>
<child>
- <object class="GtkToolButton" id="save_button">
+ <object class="GtkButton" id="save_button">
<property name="visible">True</property>
- <property name="icon-name">document-save-symbolic</property>
+ <property name="relief">none</property>
<property name="tooltip-text" translatable="yes">Save the current CSS</property>
<signal name="clicked" handler="save_clicked"/>
<style>
<class name="image-button"/>
</style>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">document-save-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>