diff options
author | Stefano Karapetsas <[email protected]> | 2012-09-05 20:21:31 +0200 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2012-09-05 20:21:31 +0200 |
commit | db145cb919be1242260d06095660405f415774d6 (patch) | |
tree | 1126098c09993d7e4406115cf3178b9891fffdcd /eel/eel-glib-extensions.c | |
parent | 23061821f52497d45a066da966cef5c9e6024cab (diff) | |
download | caja-db145cb919be1242260d06095660405f415774d6.tar.bz2 caja-db145cb919be1242260d06095660405f415774d6.tar.xz |
add eel_g_settings_add_auto_strv
Diffstat (limited to 'eel/eel-glib-extensions.c')
-rw-r--r-- | eel/eel-glib-extensions.c | 26 |
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, |