[gtk+] Add gtk_settings_reset_property



commit 2f0d4b6868679dd1494868d11f78f5ddcc0a94e2
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Sep 17 19:13:39 2015 -0400

    Add gtk_settings_reset_property
    
    This api undoes an application-specific override and makes the
    setting follow the system-wide values again.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755008

 docs/reference/gtk/gtk3-sections.txt |    1 +
 gtk/gtksettings.c                    |   28 ++++++++++++++++++++++++++++
 gtk/gtksettings.h                    |    3 +++
 3 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index e9c8ddc..60d3eb8 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -3294,6 +3294,7 @@ gtk_settings_set_property_value
 gtk_settings_set_string_property
 gtk_settings_set_long_property
 gtk_settings_set_double_property
+gtk_settings_reset_property
 GtkIMPreeditStyle
 GtkIMStatusStyle
 <SUBSECTION Standard>
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index cc74a06..e4e91fb 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -3395,3 +3395,31 @@ _gtk_settings_get_setting_source (GtkSettings *settings,
 
   return priv->property_values[pspec->param_id - 1].source;  
 }
+
+/**
+ * gtk_settings_reset_property:
+ * @settings: a #GtkSettings object
+ * @name: the name of the setting to reset
+ *
+ * Undoes the effect of calling g_object_set() to install an
+ * application-specific value for a setting. After this call,
+ * the setting will again follow the session-wide value for
+ * this setting.
+ *
+ * Since: 3.20
+ */
+void
+gtk_settings_reset_property (GtkSettings *settings,
+                             const gchar *name)
+{
+  GtkSettingsPrivate *priv = settings->priv;
+  GParamSpec *pspec;
+
+  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), name);
+
+  g_return_if_fail (pspec != NULL);
+
+  g_param_value_set_default (pspec, &priv->property_values[pspec->param_id - 1].value);
+
+  priv->property_values[pspec->param_id - 1].source = GTK_SETTINGS_SOURCE_DEFAULT;
+}
diff --git a/gtk/gtksettings.h b/gtk/gtksettings.h
index 95fe638..4b05a8b 100644
--- a/gtk/gtksettings.h
+++ b/gtk/gtksettings.h
@@ -140,6 +140,9 @@ void     gtk_settings_set_double_property  (GtkSettings            *settings,
                                             gdouble                 v_double,
                                             const gchar            *origin);
 
+GDK_AVAILABLE_IN_3_20
+void     gtk_settings_reset_property       (GtkSettings            *settings,
+                                            const gchar            *name);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]