Commit 77207d5f authored by Alexander Larsson's avatar Alexander Larsson

Add eel_g_settings_add_auto_strv

parent 1f2e9750
......@@ -1041,6 +1041,32 @@ eel_g_settings_add_auto_enum (GSettings *settings,
storage);
}
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);
}
static void
update_auto_strv_as_quarks (GSettings *settings,
const gchar *key,
......
......@@ -134,6 +134,9 @@ void eel_g_settings_add_auto_int (GSettings *settings,
void eel_g_settings_add_auto_boolean (GSettings *settings,
const char *key,
gboolean *storage);
void eel_g_settings_add_auto_strv (GSettings *settings,
const char *key,
char ***storage);
void eel_g_settings_add_auto_strv_as_quarks (GSettings *settings,
const char *key,
GQuark **storage);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment