summaryrefslogtreecommitdiff
path: root/eel/eel-glib-extensions.c
diff options
context:
space:
mode:
Diffstat (limited to 'eel/eel-glib-extensions.c')
-rw-r--r--eel/eel-glib-extensions.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/eel/eel-glib-extensions.c b/eel/eel-glib-extensions.c
index e0aa93cb..67986b32 100644
--- a/eel/eel-glib-extensions.c
+++ b/eel/eel-glib-extensions.c
@@ -1118,6 +1118,32 @@ update_auto_strv_as_quarks (GSettings *settings,
g_strfreev (value);
}
+static void
+update_auto_strv (GSettings *settings,
+ const gchar *key,
+ gpointer user_data)
+{
+ char ***storage = user_data;
+
+ g_free (*storage);
+ *storage = g_settings_get_strv (settings, key);
+}
+
+void
+eel_g_settings_add_auto_strv (GSettings *settings,
+ const char *key,
+ char ***storage)
+{
+ char *signal;
+
+ *storage = NULL;
+ update_auto_strv (settings, key, storage);
+ signal = g_strconcat ("changed::", key, NULL);
+ g_signal_connect (settings, signal,
+ G_CALLBACK(update_auto_strv),
+ storage);
+}
+
void
eel_g_settings_add_auto_strv_as_quarks (GSettings *settings,
const char *key,