summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-theme.c
diff options
context:
space:
mode:
authorRamiro Estrugo <ramiro@src.gnome.org>2001-02-07 12:55:09 +0000
committerRamiro Estrugo <ramiro@src.gnome.org>2001-02-07 12:55:09 +0000
commite46f32bed42a3c00109b27a39ba3df16896f8e85 (patch)
tree81fc5141978b53e67e8d90a5bfd883a4f306aad4 /libnautilus-private/nautilus-theme.c
parent1d87a73e66e20e2dc41302cd9760374040e4a819 (diff)
downloadnautilus-e46f32bed42a3c00109b27a39ba3df16896f8e85.tar.gz
reviewed by: Pavel Cisler <pavel@eazel.com>
* libnautilus-extensions/nautilus-directory-async.c: (show_hidden_files_changed_callback), (show_backup_files_changed_callback), (get_filter_options_for_directory_count): * libnautilus-extensions/nautilus-file.c: (show_text_in_icons_changed_callback), (show_directory_item_count_changed_callback), (get_speed_tradeoff_preference_for_file), (nautilus_file_should_show_directory_item_count), (nautilus_file_should_get_top_left_text): * libnautilus-extensions/nautilus-theme.c: (theme_changed_callback), (nautilus_theme_get_theme), (nautilus_theme_get_theme_data), (nautilus_theme_get_image_path): * src/file-manager/fm-directory-view.c: (confirm_trash_changed_callback), (real_update_menus): * src/file-manager/fm-icon-text-window.c: (icon_captions_changed_callback), (fm_get_text_attribute_names_preference_or_default): Use calllbacks for some preferences values instead of peeking diectly. The preferences in question here are peeked a lot during large directory loads, even though they hardly ever change. This should get preferences stuff mostly out of Pavel's profiles. Now, im still working on bug 6054 which is about making peeking preferences in general faster.
Diffstat (limited to 'libnautilus-private/nautilus-theme.c')
-rw-r--r--libnautilus-private/nautilus-theme.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/libnautilus-private/nautilus-theme.c b/libnautilus-private/nautilus-theme.c
index e8d09616e..fbf8ef060 100644
--- a/libnautilus-private/nautilus-theme.c
+++ b/libnautilus-private/nautilus-theme.c
@@ -48,11 +48,33 @@ static char *last_theme_name = NULL;
static xmlDocPtr last_theme_document = NULL;
static xmlDocPtr default_theme_document = NULL;
+static char *theme_from_preferences = NULL;
+
+static void
+theme_changed_callback (gpointer callback_data)
+{
+ g_free (theme_from_preferences);
+ theme_from_preferences = nautilus_preferences_get (NAUTILUS_PREFERENCES_THEME);
+}
+
/* return the current theme by asking the preferences machinery */
char *
nautilus_theme_get_theme (void)
{
- return nautilus_preferences_get (NAUTILUS_PREFERENCES_THEME);
+ static gboolean theme_changed_callback_installed = FALSE;
+
+ /* Add the callback once for the life of our process */
+ if (!theme_changed_callback_installed) {
+ nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_THEME,
+ theme_changed_callback,
+ NULL);
+ theme_changed_callback_installed = TRUE;
+
+ /* Peek for the first time */
+ theme_changed_callback (NULL);
+ }
+
+ return g_strdup (theme_from_preferences);
}
/* set the current theme */
@@ -198,7 +220,7 @@ nautilus_theme_get_theme_data (const char *resource_name, const char *property_n
{
char *result;
char *theme_name;
- theme_name = nautilus_preferences_get (NAUTILUS_PREFERENCES_THEME);
+ theme_name = nautilus_theme_get_theme ();
result = nautilus_theme_get_theme_data_from_theme (resource_name, property_name, theme_name);
g_free (theme_name);
return result;
@@ -290,7 +312,7 @@ nautilus_theme_get_image_path (const char *image_name)
{
char *theme_name, *image_path;
- theme_name = nautilus_preferences_get (NAUTILUS_PREFERENCES_THEME);
+ theme_name = nautilus_theme_get_theme ();
image_path = nautilus_theme_get_image_path_from_theme (image_name, theme_name);
g_free (theme_name);