diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-09-19 08:44:21 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-09-22 19:40:49 -0400 |
commit | eb96a7f832de014f570d31bd076ee939d9b28b0d (patch) | |
tree | 876e27f15cceb1d62d189372f137569f39df1835 | |
parent | 18931cf0dbd52f1c96d6f89011aaf7b613e66267 (diff) | |
download | gtk+-eb96a7f832de014f570d31bd076ee939d9b28b0d.tar.gz |
inspector: Show the source of settings
This can be useful at times to see if a setting is coming
from an XSetting, or overridden by the application.
https://bugzilla.gnome.org/show_bug.cgi?id=736971
-rw-r--r-- | gtk/inspector/prop-editor.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/gtk/inspector/prop-editor.c b/gtk/inspector/prop-editor.c index 103434dcad..607297524f 100644 --- a/gtk/inspector/prop-editor.c +++ b/gtk/inspector/prop-editor.c @@ -38,6 +38,7 @@ #include "gtkradiobutton.h" #include "gtkscrolledwindow.h" #include "gtkspinbutton.h" +#include "gtksettingsprivate.h" #include "gtktogglebutton.h" #include "gtkwidgetprivate.h" @@ -1536,6 +1537,48 @@ add_settings_info (GtkInspectorPropEditor *editor) } static void +add_gtk_settings_info (GtkInspectorPropEditor *editor) +{ + GObject *object; + const gchar *name; + GtkWidget *row; + GtkWidget *label; + const gchar *source; + + object = editor->priv->object; + name = editor->priv->name; + + if (!GTK_IS_SETTINGS (object)) + return; + + row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); + gtk_container_add (GTK_CONTAINER (row), gtk_label_new (_("Source:"))); + + switch (_gtk_settings_get_setting_source (GTK_SETTINGS (object), name)) + { + case GTK_SETTINGS_SOURCE_DEFAULT: + source = _("Default"); + break; + case GTK_SETTINGS_SOURCE_THEME: + source = _("Theme"); + break; + case GTK_SETTINGS_SOURCE_XSETTING: + source = _("XSettings"); + break; + case GTK_SETTINGS_SOURCE_APPLICATION: + source = _("Application"); + break; + default: + source = _("Unknown"); + break; + } + gtk_container_add (GTK_CONTAINER (row), gtk_label_new (source)); + + gtk_widget_show_all (row); + gtk_container_add (GTK_CONTAINER (editor), row); +} + +static void constructed (GObject *object) { GtkInspectorPropEditor *editor = GTK_INSPECTOR_PROP_EDITOR (object); @@ -1570,6 +1613,7 @@ constructed (GObject *object) add_binding_info (editor); add_settings_info (editor); + add_gtk_settings_info (editor); } static void |