[gtk/inspector-display: 14/14] inspector: Make the css tree respect inspected display
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/inspector-display: 14/14] inspector: Make the css tree respect inspected display
- Date: Sat, 7 Dec 2019 20:05:00 +0000 (UTC)
commit 77c3b05856bc6b9ad1c33b4842e4df814ef45297
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Dec 7 12:42:37 2019 -0500
inspector: Make the css tree respect inspected display
The display is used here to force reparsing the theme
on the right settings object.
gtk/inspector/css-node-tree.c | 30 ++++++++++++++----------------
gtk/inspector/css-node-tree.h | 3 +++
gtk/inspector/window.c | 1 +
3 files changed, 18 insertions(+), 16 deletions(-)
---
diff --git a/gtk/inspector/css-node-tree.c b/gtk/inspector/css-node-tree.c
index a95bb84092..11741e7c79 100644
--- a/gtk/inspector/css-node-tree.c
+++ b/gtk/inspector/css-node-tree.c
@@ -24,6 +24,7 @@
#include "css-node-tree.h"
#include "prop-editor.h"
+#include "window.h"
#include "gtktreemodelcssnode.h"
#include "gtktreeview.h"
@@ -221,28 +222,12 @@ gtk_inspector_css_node_tree_finalize (GObject *object)
G_OBJECT_CLASS (gtk_inspector_css_node_tree_parent_class)->finalize (object);
}
-static void
-ensure_css_sections (void)
-{
- GtkSettings *settings;
- gchar *theme_name;
-
- gtk_css_provider_set_keep_css_sections ();
-
- settings = gtk_settings_get_default ();
- g_object_get (settings, "gtk-theme-name", &theme_name, NULL);
- g_object_set (settings, "gtk-theme-name", theme_name, NULL);
- g_free (theme_name);
-}
-
static void
gtk_inspector_css_node_tree_class_init (GtkInspectorCssNodeTreeClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- ensure_css_sections ();
-
object_class->set_property = gtk_inspector_css_node_tree_set_property;
object_class->get_property = gtk_inspector_css_node_tree_get_property;
object_class->finalize = gtk_inspector_css_node_tree_finalize;
@@ -531,4 +516,17 @@ gtk_inspector_css_node_tree_get_node (GtkInspectorCssNodeTree *cnt)
return priv->node;
}
+void
+gtk_inspector_css_node_tree_set_display (GtkInspectorCssNodeTree *cnt,
+ GdkDisplay *display)
+{
+ GtkSettings *settings;
+ gchar *theme_name;
+
+ settings = gtk_settings_get_for_display (display);
+ g_object_get (settings, "gtk-theme-name", &theme_name, NULL);
+ g_object_set (settings, "gtk-theme-name", theme_name, NULL);
+ g_free (theme_name);
+}
+
// vim: set et sw=2 ts=2:
diff --git a/gtk/inspector/css-node-tree.h b/gtk/inspector/css-node-tree.h
index e1357a7dcb..881e433ce1 100644
--- a/gtk/inspector/css-node-tree.h
+++ b/gtk/inspector/css-node-tree.h
@@ -55,6 +55,9 @@ void gtk_inspector_css_node_tree_set_object (GtkInspectorCss
GObject *object);
GtkCssNode * gtk_inspector_css_node_tree_get_node (GtkInspectorCssNodeTree *cnt);
+void gtk_inspector_css_node_tree_set_display (GtkInspectorCssNodeTree *cnt,
+ GdkDisplay *display);
+
G_END_DECLS
diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c
index 2a80507977..2d82629124 100644
--- a/gtk/inspector/window.c
+++ b/gtk/inspector/window.c
@@ -274,6 +274,7 @@ gtk_inspector_window_constructed (GObject *object)
gtk_inspector_visual_set_display (GTK_INSPECTOR_VISUAL (iw->visual), iw->inspected_display);
gtk_inspector_general_set_display (GTK_INSPECTOR_GENERAL (iw->general), iw->inspected_display);
gtk_inspector_logs_set_display (GTK_INSPECTOR_LOGS (iw->logs), iw->inspected_display);
+ gtk_inspector_css_node_tree_set_display (GTK_INSPECTOR_CSS_NODE_TREE (iw->widget_css_node_tree),
iw->inspected_display);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]