[nautilus] Add eel_g_settings_add_auto_strv
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] Add eel_g_settings_add_auto_strv
- Date: Fri, 23 Jul 2010 10:34:23 +0000 (UTC)
commit 77207d5ff5bade458446d5783fe6a99fc38ac6de
Author: Alexander Larsson <alexl redhat com>
Date: Fri Jul 23 10:55:48 2010 +0200
Add eel_g_settings_add_auto_strv
eel/eel-glib-extensions.c | 26 ++++++++++++++++++++++++++
eel/eel-glib-extensions.h | 3 +++
2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/eel/eel-glib-extensions.c b/eel/eel-glib-extensions.c
index efc1bce..caeae68 100644
--- a/eel/eel-glib-extensions.c
+++ b/eel/eel-glib-extensions.c
@@ -1042,6 +1042,32 @@ eel_g_settings_add_auto_enum (GSettings *settings,
}
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,
gpointer user_data)
diff --git a/eel/eel-glib-extensions.h b/eel/eel-glib-extensions.h
index 2d60caf..cafbbcf 100644
--- a/eel/eel-glib-extensions.h
+++ b/eel/eel-glib-extensions.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]