[nautilus/wip/gaction_] canvas-view-container: don't cache icon captions attributes
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/gaction_] canvas-view-container: don't cache icon captions attributes
- Date: Wed, 21 Jan 2015 18:46:20 +0000 (UTC)
commit fbe97d501e169dff1741f770778549e738f64b8d
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Jan 21 07:21:43 2015 -0800
canvas-view-container: don't cache icon captions attributes
This will lead the code to caching the wrong value.
src/nautilus-canvas-view-container.c | 40 ++++++++++++----------------------
1 files changed, 14 insertions(+), 26 deletions(-)
---
diff --git a/src/nautilus-canvas-view-container.c b/src/nautilus-canvas-view-container.c
index dc1ce19..fdee2ad 100644
--- a/src/nautilus-canvas-view-container.c
+++ b/src/nautilus-canvas-view-container.c
@@ -120,26 +120,18 @@ nautilus_canvas_view_container_prioritize_thumbnailing (NautilusCanvasContainer
}
}
-static void
-update_auto_strv_as_quarks (GSettings *settings,
- const gchar *key,
- gpointer user_data)
+static GQuark *
+get_quark_from_strv (gchar ** value)
{
- GQuark **storage = user_data;
- int i = 0;
- char **value;
-
- value = g_settings_get_strv (settings, key);
-
- g_free (*storage);
- *storage = g_new (GQuark, g_strv_length (value) + 1);
+ GQuark *quark;
+ int i;
+ quark = g_new0 (GQuark, g_strv_length (value) + 1);
for (i = 0; value[i] != NULL; ++i) {
- (*storage)[i] = g_quark_from_string (value[i]);
+ quark[i] = g_quark_from_string (value[i]);
}
- (*storage)[i] = 0;
- g_strfreev (value);
+ return quark;
}
/*
@@ -149,17 +141,13 @@ update_auto_strv_as_quarks (GSettings *settings,
static GQuark *
nautilus_canvas_view_container_get_icon_text_attributes_from_preferences (void)
{
- static GQuark *attributes = NULL;
-
- if (attributes == NULL) {
- update_auto_strv_as_quarks (nautilus_icon_view_preferences,
- NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS,
- &attributes);
- g_signal_connect (nautilus_icon_view_preferences,
- "changed::" NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS,
- G_CALLBACK (update_auto_strv_as_quarks),
- &attributes);
- }
+ GQuark *attributes;
+ gchar **value;
+
+ value = g_settings_get_strv (nautilus_icon_view_preferences,
+ NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS);
+ attributes = get_quark_from_strv (value);
+ g_strfreev (value);
/* We don't need to sanity check the attributes list even though it came
* from preferences.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]