summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamiro Estrugo <ramiro@src.gnome.org>2001-01-22 04:44:51 +0000
committerRamiro Estrugo <ramiro@src.gnome.org>2001-01-22 04:44:51 +0000
commitf41ae58ca2c3ec5a574b74697a4036a51da8d153 (patch)
treef6760a691458048c02994cccda6a8fa3742a0dc7
parent1589c575e239228d8f3d4183cb33d0ee56d65255 (diff)
downloadnautilus-f41ae58ca2c3ec5a574b74697a4036a51da8d153.tar.gz
reviewed by: Pavel Cisler <pavel@eazel.com>
Fix bug 5809 - Nautilus is slow to startup because of prefernces setup code. The reason for the slowdown was the constant suggestion to gconf to sync. Now, we sync only after setters that ara result of an operation in Nautilus. All internal setters, such as defaults and visibilities happen with no sync in between each one, making things a lot faster. * libnautilus-extensions/nautilus-gconf-extensions.c: (nautilus_gconf_set_boolean), (nautilus_gconf_set_integer), (nautilus_gconf_set_string), (nautilus_gconf_set_string_list), (nautilus_gconf_monitor_directory), (nautilus_gconf_suggest_sync): * libnautilus-extensions/nautilus-gconf-extensions.h: Dont suggest a sync after each set. Instead make a new function to let callers decide when to suggest a sync. For example, after a batch of many operations. * libnautilus-extensions/nautilus-global-preferences.c: (global_preferences_install_descriptions), (global_preferences_install_defaults), (global_preferences_get_dialog), (global_preferences_install_sidebar_panel_defaults), (global_preferences_install_sidebar_panel_descriptions), (global_preferences_install_home_location_defaults), (nautilus_global_preferences_initialize): Don't install the descriptions until needed when the dialog is about to be created. Split the sidebar defaults installer into a defaults and a descriptions installer. Remove the proxy defaults installer which was superfluous. My last change simplified the usage of proxy settings and a whole separate function for that is no longer needed. * libnautilus-extensions/nautilus-preferences.c: (nautilus_preferences_set_boolean), (nautilus_preferences_set_integer), (nautilus_preferences_set), (nautilus_preferences_set_string_list), (nautilus_preferences_set_user_level): Suggest a gconf sync right after all the setters. (preferences_something_changed_notice): Add a fixme. Also remove unused variables and tweak a tiny bit.
-rw-r--r--ChangeLog43
-rw-r--r--libnautilus-extensions/nautilus-gconf-extensions.c31
-rw-r--r--libnautilus-extensions/nautilus-gconf-extensions.h1
-rw-r--r--libnautilus-extensions/nautilus-global-preferences.c113
-rw-r--r--libnautilus-extensions/nautilus-preferences.c43
-rw-r--r--libnautilus-private/nautilus-gconf-extensions.c31
-rw-r--r--libnautilus-private/nautilus-gconf-extensions.h1
-rw-r--r--libnautilus-private/nautilus-global-preferences.c113
-rw-r--r--libnautilus-private/nautilus-preferences.c43
9 files changed, 243 insertions, 176 deletions
diff --git a/ChangeLog b/ChangeLog
index bf1cf0880..fbc416ecc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,46 @@
+2001-01-21 Ramiro Estrugo <ramiro@eazel.com>
+
+ reviewed by: Pavel Cisler <pavel@eazel.com>
+
+ Fix bug 5809 - Nautilus is slow to startup because of prefernces
+ setup code. The reason for the slowdown was the constant
+ suggestion to gconf to sync. Now, we sync only after setters that
+ ara result of an operation in Nautilus. All internal setters, such
+ as defaults and visibilities happen with no sync in between each
+ one, making things a lot faster.
+
+ * libnautilus-extensions/nautilus-gconf-extensions.c:
+ (nautilus_gconf_set_boolean), (nautilus_gconf_set_integer),
+ (nautilus_gconf_set_string), (nautilus_gconf_set_string_list),
+ (nautilus_gconf_monitor_directory), (nautilus_gconf_suggest_sync):
+ * libnautilus-extensions/nautilus-gconf-extensions.h:
+ Dont suggest a sync after each set. Instead make a new function
+ to let callers decide when to suggest a sync. For example, after
+ a batch of many operations.
+ * libnautilus-extensions/nautilus-global-preferences.c:
+ (global_preferences_install_descriptions),
+ (global_preferences_install_defaults),
+ (global_preferences_get_dialog),
+ (global_preferences_install_sidebar_panel_defaults),
+ (global_preferences_install_sidebar_panel_descriptions),
+ (global_preferences_install_home_location_defaults),
+ (nautilus_global_preferences_initialize):
+ Don't install the descriptions until needed when the dialog is
+ about to be created. Split the sidebar defaults installer into a
+ defaults and a descriptions installer. Remove the proxy defaults
+ installer which was superfluous. My last change simplified the
+ usage of proxy settings and a whole separate function for that is
+ no longer needed.
+
+ * libnautilus-extensions/nautilus-preferences.c:
+ (nautilus_preferences_set_boolean),
+ (nautilus_preferences_set_integer), (nautilus_preferences_set),
+ (nautilus_preferences_set_string_list),
+ (nautilus_preferences_set_user_level):
+ Suggest a gconf sync right after all the setters.
+ (preferences_something_changed_notice): Add a fixme. Also remove
+ unused variables and tweak a tiny bit.
+
2001-01-21 Eskil Heyn Olsen <eskil@eazel.com>
* components/services/install/command-line/Makefile.am:
diff --git a/libnautilus-extensions/nautilus-gconf-extensions.c b/libnautilus-extensions/nautilus-gconf-extensions.c
index a8a728341..cd1513071 100644
--- a/libnautilus-extensions/nautilus-gconf-extensions.c
+++ b/libnautilus-extensions/nautilus-gconf-extensions.c
@@ -115,10 +115,6 @@ nautilus_gconf_set_boolean (const char *key,
gconf_client_set_bool (client, key, boolean_value, &error);
nautilus_gconf_handle_error (&error);
- error = NULL;
-
- gconf_client_suggest_sync (client, &error);
- nautilus_gconf_handle_error (&error);
}
gboolean
@@ -156,10 +152,6 @@ nautilus_gconf_set_integer (const char *key,
gconf_client_set_int (client, key, int_value, &error);
nautilus_gconf_handle_error (&error);
- error = NULL;
-
- gconf_client_suggest_sync (client, &error);
- nautilus_gconf_handle_error (&error);
}
int
@@ -197,10 +189,6 @@ nautilus_gconf_set_string (const char *key,
gconf_client_set_string (client, key, string_value, &error);
nautilus_gconf_handle_error (&error);
- error = NULL;
-
- gconf_client_suggest_sync (client, &error);
- nautilus_gconf_handle_error (&error);
}
char *
@@ -238,10 +226,6 @@ nautilus_gconf_set_string_list (const char *key,
gconf_client_set_list (client, key, GCONF_VALUE_STRING, string_list_value, &error);
nautilus_gconf_handle_error (&error);
- error = NULL;
-
- gconf_client_suggest_sync (client, &error);
- nautilus_gconf_handle_error (&error);
}
GSList *
@@ -308,10 +292,23 @@ nautilus_gconf_monitor_directory (const char *directory)
directory,
GCONF_CLIENT_PRELOAD_NONE,
&error);
-
+
if (nautilus_gconf_handle_error (&error)) {
return FALSE;
}
return TRUE;
}
+
+void
+nautilus_gconf_suggest_sync (void)
+{
+ GConfClient *client;
+ GError *error = NULL;
+
+ client = nautilus_gconf_client_get_global ();
+ g_return_if_fail (client != NULL);
+
+ gconf_client_suggest_sync (client, &error);
+ nautilus_gconf_handle_error (&error);
+}
diff --git a/libnautilus-extensions/nautilus-gconf-extensions.h b/libnautilus-extensions/nautilus-gconf-extensions.h
index e594a08ec..b5901bf5f 100644
--- a/libnautilus-extensions/nautilus-gconf-extensions.h
+++ b/libnautilus-extensions/nautilus-gconf-extensions.h
@@ -47,6 +47,7 @@ void nautilus_gconf_set_string_list (const char *key,
GSList *string_list_value);
gboolean nautilus_gconf_is_default (const char *key);
gboolean nautilus_gconf_monitor_directory (const char *directory);
+void nautilus_gconf_suggest_sync (void);
END_GNOME_DECLS
diff --git a/libnautilus-extensions/nautilus-global-preferences.c b/libnautilus-extensions/nautilus-global-preferences.c
index 558b6898a..dd85fbb7c 100644
--- a/libnautilus-extensions/nautilus-global-preferences.c
+++ b/libnautilus-extensions/nautilus-global-preferences.c
@@ -57,9 +57,9 @@ static GList * global_preferences_get_sidebar_panel_view_identifiers (void);
static gboolean global_preferences_close_dialog_callback (GtkWidget *dialog,
gpointer user_data);
static void global_preferences_install_sidebar_panel_defaults (void);
+static void global_preferences_install_sidebar_panel_descriptions (void);
static void global_preferences_install_defaults (void);
static void global_preferences_install_visibility (void);
-static void global_preferences_install_proxy_defaults (void);
static void global_preferences_install_speed_tradeoff_descriptions (const char *name,
const char *description);
static void global_preferences_install_home_location_defaults (void);
@@ -189,14 +189,18 @@ global_preferences_install_descriptions (void)
nautilus_preferences_set_description (NAUTILUS_PREFERENCES_HIDE_BUILT_IN_BOOKMARKS,
_("Don't include the built-in bookmarks"));
- /* Sidebar panels */
- global_preferences_install_sidebar_panel_defaults ();
-
- /* Proxy */
- global_preferences_install_proxy_defaults ();
/* Home location */
- global_preferences_install_home_location_defaults ();
+ nautilus_preferences_set_description (NAUTILUS_PREFERENCES_HOME_URI,
+ _("Home Location"));
+
+ /* Sidebar panel descriptions */
+ global_preferences_install_sidebar_panel_descriptions ();
+
+ /* Proxy descriptions */
+ nautilus_preferences_set_description (USE_PROXY_KEY, _("Use HTTP Proxy"));
+ nautilus_preferences_set_description (PROXY_HOST_KEY, _("HTTP Proxy"));
+ nautilus_preferences_set_description (PROXY_PORT_KEY, _("HTTP Proxy Port"));
}
/**
@@ -324,6 +328,23 @@ global_preferences_install_defaults (void)
nautilus_preferences_default_set_boolean (NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES,
NAUTILUS_USER_LEVEL_NOVICE,
FALSE);
+
+ /* Add the gnome-vfs path to the list of monitored directories - for proxy settings */
+ nautilus_preferences_monitor_directory (SYSTEM_GNOME_VFS_PATH);
+
+ /* Proxy defaults */
+ nautilus_preferences_default_set_boolean (USE_PROXY_KEY,
+ NAUTILUS_USER_LEVEL_NOVICE,
+ FALSE);
+ nautilus_preferences_default_set_integer (PROXY_PORT_KEY,
+ NAUTILUS_USER_LEVEL_NOVICE,
+ 8080);
+
+ /* Sidebar panel defaults */
+ global_preferences_install_sidebar_panel_defaults ();
+
+ /* Home location */
+ global_preferences_install_home_location_defaults ();
}
/**
@@ -779,6 +800,11 @@ global_preferences_get_dialog (void)
nautilus_global_preferences_initialize ();
if (global_prefs_dialog == NULL) {
+ /* Install descriptions right before creating the dialog.
+ * The descriptions are only used within the preferences
+ * dialog.
+ */
+ global_preferences_install_descriptions ();
global_prefs_dialog = global_preferences_create_dialog ();
}
@@ -808,29 +834,8 @@ static struct
static void
global_preferences_install_sidebar_panel_defaults (void)
{
- GList *view_identifiers;
- GList *p;
guint i;
- /* Install the descriptions for the available sidebar panels */
- view_identifiers = global_preferences_get_sidebar_panel_view_identifiers ();
-
- for (p = view_identifiers; p != NULL; p = p->next) {
- NautilusViewIdentifier *identifier;
- char *key;
-
- identifier = p->data;
- g_return_if_fail (identifier != NULL);
-
- key = global_preferences_get_sidebar_panel_key (identifier->iid);
- g_return_if_fail (key != NULL);
-
- nautilus_preferences_set_description (key, identifier->name);
- g_free (key);
- }
-
- nautilus_view_identifier_list_free (view_identifiers);
-
/* Install the user level on/off defaults for known sidebar panels */
for (i = 0; i < NAUTILUS_N_ELEMENTS (known_sidebar_panels); i++) {
char *key = global_preferences_get_sidebar_panel_key (known_sidebar_panels[i].name);
@@ -852,6 +857,32 @@ global_preferences_install_sidebar_panel_defaults (void)
}
}
+static void
+global_preferences_install_sidebar_panel_descriptions (void)
+{
+ GList *view_identifiers;
+ GList *iterator;
+
+ /* Install the descriptions for the available sidebar panels */
+ view_identifiers = global_preferences_get_sidebar_panel_view_identifiers ();
+
+ for (iterator = view_identifiers; iterator != NULL; iterator = iterator->next) {
+ NautilusViewIdentifier *identifier;
+ char *key;
+
+ identifier = iterator->data;
+ g_return_if_fail (identifier != NULL);
+
+ key = global_preferences_get_sidebar_panel_key (identifier->iid);
+ g_return_if_fail (key != NULL);
+
+ nautilus_preferences_set_description (key, identifier->name);
+ g_free (key);
+ }
+
+ nautilus_view_identifier_list_free (view_identifiers);
+}
+
static char *
global_preferences_get_sidebar_panel_key (const char *panel_iid)
{
@@ -904,33 +935,12 @@ global_preferences_install_speed_tradeoff_descriptions (const char *name,
}
static void
-global_preferences_install_proxy_defaults (void)
-{
- /* Add the gnome-vfs path to the list of monitored directories */
- nautilus_preferences_monitor_directory (SYSTEM_GNOME_VFS_PATH);
-
- nautilus_preferences_default_set_boolean (USE_PROXY_KEY,
- NAUTILUS_USER_LEVEL_NOVICE,
- FALSE);
- nautilus_preferences_default_set_integer (PROXY_PORT_KEY,
- NAUTILUS_USER_LEVEL_NOVICE,
- 8080);
-
- nautilus_preferences_set_description (USE_PROXY_KEY, _("Use HTTP Proxy"));
- nautilus_preferences_set_description (PROXY_HOST_KEY, _("HTTP Proxy"));
- nautilus_preferences_set_description (PROXY_PORT_KEY, _("HTTP Proxy Port"));
-}
-
-static void
global_preferences_install_home_location_defaults (void)
{
char *default_novice_home_uri;
char *default_intermediate_home_uri;
char *user_main_directory;
- nautilus_preferences_set_description (NAUTILUS_PREFERENCES_HOME_URI,
- _("Home Location"));
-
user_main_directory = nautilus_get_user_main_directory ();
default_novice_home_uri = gnome_vfs_get_uri_from_local_path (user_main_directory);
@@ -993,7 +1003,7 @@ void
nautilus_global_preferences_initialize (void)
{
static gboolean initialized = FALSE;
-
+
if (initialized) {
return;
}
@@ -1005,7 +1015,4 @@ nautilus_global_preferences_initialize (void)
/* Install visiblities */
global_preferences_install_visibility ();
-
- /* Install descriptions */
- global_preferences_install_descriptions ();
}
diff --git a/libnautilus-extensions/nautilus-preferences.c b/libnautilus-extensions/nautilus-preferences.c
index 87d3bfcbb..eb8e636d0 100644
--- a/libnautilus-extensions/nautilus-preferences.c
+++ b/libnautilus-extensions/nautilus-preferences.c
@@ -411,6 +411,8 @@ nautilus_preferences_set_boolean (const char *name,
key = preferences_key_make (name);
nautilus_gconf_set_boolean (key, boolean_value);
g_free (key);
+
+ nautilus_gconf_suggest_sync ();
}
static char *
@@ -455,6 +457,8 @@ nautilus_preferences_set_integer (const char *name,
key = preferences_key_make (name);
nautilus_gconf_set_integer (key, int_value);
g_free (key);
+
+ nautilus_gconf_suggest_sync ();
}
int
@@ -484,6 +488,8 @@ nautilus_preferences_set (const char *name,
key = preferences_key_make (name);
nautilus_gconf_set_string (key, string_value);
g_free (key);
+
+ nautilus_gconf_suggest_sync ();
}
char *
@@ -516,6 +522,8 @@ nautilus_preferences_set_string_list (const char *name,
key = preferences_key_make (name);
nautilus_gconf_set_string_list (key, string_list_value);
g_free (key);
+
+ nautilus_gconf_suggest_sync ();
}
GSList *
@@ -577,6 +585,8 @@ nautilus_preferences_set_user_level (int user_level)
user_level_key = preferences_get_user_level_key ();
nautilus_gconf_set_string (user_level_key, user_level_names_for_storage[user_level]);
g_free (user_level_key);
+
+ nautilus_gconf_suggest_sync ();
}
void
@@ -722,28 +732,25 @@ preferences_callback_entry_invoke_function (gpointer data,
static void
preferences_something_changed_notice (GConfClient *client,
- guint connection_id,
- GConfEntry *gconf_entry,
- gpointer user_data)
+ guint connection_id,
+ GConfEntry *entry,
+ gpointer notice_data)
{
- PreferencesEntry *entry;
- GError *error = NULL;
- const char *key;
+ PreferencesEntry *preferences_entry;
- g_return_if_fail (user_data != NULL);
- g_return_if_fail (gconf_entry != NULL);
- g_return_if_fail (gconf_entry->key != NULL);
- g_return_if_fail (user_data != NULL);
+ g_return_if_fail (entry != NULL);
+ g_return_if_fail (entry->key != NULL);
+ g_return_if_fail (notice_data != NULL);
- entry = user_data;
- key = gconf_entry->key;
-
- gconf_client_suggest_sync (client, &error);
- nautilus_gconf_handle_error (&error);
-
+ preferences_entry = notice_data;
+
+ /* FIXME bugzilla.eazel.com 5875:
+ * We need to make sure that the value has actually changed before
+ * invoking the callbacks.
+ */
/* Invoke callbacks for this entry */
- if (entry->callback_list) {
- g_list_foreach (entry->callback_list,
+ if (preferences_entry->callback_list) {
+ g_list_foreach (preferences_entry->callback_list,
preferences_callback_entry_invoke_function,
NULL);
}
diff --git a/libnautilus-private/nautilus-gconf-extensions.c b/libnautilus-private/nautilus-gconf-extensions.c
index a8a728341..cd1513071 100644
--- a/libnautilus-private/nautilus-gconf-extensions.c
+++ b/libnautilus-private/nautilus-gconf-extensions.c
@@ -115,10 +115,6 @@ nautilus_gconf_set_boolean (const char *key,
gconf_client_set_bool (client, key, boolean_value, &error);
nautilus_gconf_handle_error (&error);
- error = NULL;
-
- gconf_client_suggest_sync (client, &error);
- nautilus_gconf_handle_error (&error);
}
gboolean
@@ -156,10 +152,6 @@ nautilus_gconf_set_integer (const char *key,
gconf_client_set_int (client, key, int_value, &error);
nautilus_gconf_handle_error (&error);
- error = NULL;
-
- gconf_client_suggest_sync (client, &error);
- nautilus_gconf_handle_error (&error);
}
int
@@ -197,10 +189,6 @@ nautilus_gconf_set_string (const char *key,
gconf_client_set_string (client, key, string_value, &error);
nautilus_gconf_handle_error (&error);
- error = NULL;
-
- gconf_client_suggest_sync (client, &error);
- nautilus_gconf_handle_error (&error);
}
char *
@@ -238,10 +226,6 @@ nautilus_gconf_set_string_list (const char *key,
gconf_client_set_list (client, key, GCONF_VALUE_STRING, string_list_value, &error);
nautilus_gconf_handle_error (&error);
- error = NULL;
-
- gconf_client_suggest_sync (client, &error);
- nautilus_gconf_handle_error (&error);
}
GSList *
@@ -308,10 +292,23 @@ nautilus_gconf_monitor_directory (const char *directory)
directory,
GCONF_CLIENT_PRELOAD_NONE,
&error);
-
+
if (nautilus_gconf_handle_error (&error)) {
return FALSE;
}
return TRUE;
}
+
+void
+nautilus_gconf_suggest_sync (void)
+{
+ GConfClient *client;
+ GError *error = NULL;
+
+ client = nautilus_gconf_client_get_global ();
+ g_return_if_fail (client != NULL);
+
+ gconf_client_suggest_sync (client, &error);
+ nautilus_gconf_handle_error (&error);
+}
diff --git a/libnautilus-private/nautilus-gconf-extensions.h b/libnautilus-private/nautilus-gconf-extensions.h
index e594a08ec..b5901bf5f 100644
--- a/libnautilus-private/nautilus-gconf-extensions.h
+++ b/libnautilus-private/nautilus-gconf-extensions.h
@@ -47,6 +47,7 @@ void nautilus_gconf_set_string_list (const char *key,
GSList *string_list_value);
gboolean nautilus_gconf_is_default (const char *key);
gboolean nautilus_gconf_monitor_directory (const char *directory);
+void nautilus_gconf_suggest_sync (void);
END_GNOME_DECLS
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index 558b6898a..dd85fbb7c 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -57,9 +57,9 @@ static GList * global_preferences_get_sidebar_panel_view_identifiers (void);
static gboolean global_preferences_close_dialog_callback (GtkWidget *dialog,
gpointer user_data);
static void global_preferences_install_sidebar_panel_defaults (void);
+static void global_preferences_install_sidebar_panel_descriptions (void);
static void global_preferences_install_defaults (void);
static void global_preferences_install_visibility (void);
-static void global_preferences_install_proxy_defaults (void);
static void global_preferences_install_speed_tradeoff_descriptions (const char *name,
const char *description);
static void global_preferences_install_home_location_defaults (void);
@@ -189,14 +189,18 @@ global_preferences_install_descriptions (void)
nautilus_preferences_set_description (NAUTILUS_PREFERENCES_HIDE_BUILT_IN_BOOKMARKS,
_("Don't include the built-in bookmarks"));
- /* Sidebar panels */
- global_preferences_install_sidebar_panel_defaults ();
-
- /* Proxy */
- global_preferences_install_proxy_defaults ();
/* Home location */
- global_preferences_install_home_location_defaults ();
+ nautilus_preferences_set_description (NAUTILUS_PREFERENCES_HOME_URI,
+ _("Home Location"));
+
+ /* Sidebar panel descriptions */
+ global_preferences_install_sidebar_panel_descriptions ();
+
+ /* Proxy descriptions */
+ nautilus_preferences_set_description (USE_PROXY_KEY, _("Use HTTP Proxy"));
+ nautilus_preferences_set_description (PROXY_HOST_KEY, _("HTTP Proxy"));
+ nautilus_preferences_set_description (PROXY_PORT_KEY, _("HTTP Proxy Port"));
}
/**
@@ -324,6 +328,23 @@ global_preferences_install_defaults (void)
nautilus_preferences_default_set_boolean (NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES,
NAUTILUS_USER_LEVEL_NOVICE,
FALSE);
+
+ /* Add the gnome-vfs path to the list of monitored directories - for proxy settings */
+ nautilus_preferences_monitor_directory (SYSTEM_GNOME_VFS_PATH);
+
+ /* Proxy defaults */
+ nautilus_preferences_default_set_boolean (USE_PROXY_KEY,
+ NAUTILUS_USER_LEVEL_NOVICE,
+ FALSE);
+ nautilus_preferences_default_set_integer (PROXY_PORT_KEY,
+ NAUTILUS_USER_LEVEL_NOVICE,
+ 8080);
+
+ /* Sidebar panel defaults */
+ global_preferences_install_sidebar_panel_defaults ();
+
+ /* Home location */
+ global_preferences_install_home_location_defaults ();
}
/**
@@ -779,6 +800,11 @@ global_preferences_get_dialog (void)
nautilus_global_preferences_initialize ();
if (global_prefs_dialog == NULL) {
+ /* Install descriptions right before creating the dialog.
+ * The descriptions are only used within the preferences
+ * dialog.
+ */
+ global_preferences_install_descriptions ();
global_prefs_dialog = global_preferences_create_dialog ();
}
@@ -808,29 +834,8 @@ static struct
static void
global_preferences_install_sidebar_panel_defaults (void)
{
- GList *view_identifiers;
- GList *p;
guint i;
- /* Install the descriptions for the available sidebar panels */
- view_identifiers = global_preferences_get_sidebar_panel_view_identifiers ();
-
- for (p = view_identifiers; p != NULL; p = p->next) {
- NautilusViewIdentifier *identifier;
- char *key;
-
- identifier = p->data;
- g_return_if_fail (identifier != NULL);
-
- key = global_preferences_get_sidebar_panel_key (identifier->iid);
- g_return_if_fail (key != NULL);
-
- nautilus_preferences_set_description (key, identifier->name);
- g_free (key);
- }
-
- nautilus_view_identifier_list_free (view_identifiers);
-
/* Install the user level on/off defaults for known sidebar panels */
for (i = 0; i < NAUTILUS_N_ELEMENTS (known_sidebar_panels); i++) {
char *key = global_preferences_get_sidebar_panel_key (known_sidebar_panels[i].name);
@@ -852,6 +857,32 @@ global_preferences_install_sidebar_panel_defaults (void)
}
}
+static void
+global_preferences_install_sidebar_panel_descriptions (void)
+{
+ GList *view_identifiers;
+ GList *iterator;
+
+ /* Install the descriptions for the available sidebar panels */
+ view_identifiers = global_preferences_get_sidebar_panel_view_identifiers ();
+
+ for (iterator = view_identifiers; iterator != NULL; iterator = iterator->next) {
+ NautilusViewIdentifier *identifier;
+ char *key;
+
+ identifier = iterator->data;
+ g_return_if_fail (identifier != NULL);
+
+ key = global_preferences_get_sidebar_panel_key (identifier->iid);
+ g_return_if_fail (key != NULL);
+
+ nautilus_preferences_set_description (key, identifier->name);
+ g_free (key);
+ }
+
+ nautilus_view_identifier_list_free (view_identifiers);
+}
+
static char *
global_preferences_get_sidebar_panel_key (const char *panel_iid)
{
@@ -904,33 +935,12 @@ global_preferences_install_speed_tradeoff_descriptions (const char *name,
}
static void
-global_preferences_install_proxy_defaults (void)
-{
- /* Add the gnome-vfs path to the list of monitored directories */
- nautilus_preferences_monitor_directory (SYSTEM_GNOME_VFS_PATH);
-
- nautilus_preferences_default_set_boolean (USE_PROXY_KEY,
- NAUTILUS_USER_LEVEL_NOVICE,
- FALSE);
- nautilus_preferences_default_set_integer (PROXY_PORT_KEY,
- NAUTILUS_USER_LEVEL_NOVICE,
- 8080);
-
- nautilus_preferences_set_description (USE_PROXY_KEY, _("Use HTTP Proxy"));
- nautilus_preferences_set_description (PROXY_HOST_KEY, _("HTTP Proxy"));
- nautilus_preferences_set_description (PROXY_PORT_KEY, _("HTTP Proxy Port"));
-}
-
-static void
global_preferences_install_home_location_defaults (void)
{
char *default_novice_home_uri;
char *default_intermediate_home_uri;
char *user_main_directory;
- nautilus_preferences_set_description (NAUTILUS_PREFERENCES_HOME_URI,
- _("Home Location"));
-
user_main_directory = nautilus_get_user_main_directory ();
default_novice_home_uri = gnome_vfs_get_uri_from_local_path (user_main_directory);
@@ -993,7 +1003,7 @@ void
nautilus_global_preferences_initialize (void)
{
static gboolean initialized = FALSE;
-
+
if (initialized) {
return;
}
@@ -1005,7 +1015,4 @@ nautilus_global_preferences_initialize (void)
/* Install visiblities */
global_preferences_install_visibility ();
-
- /* Install descriptions */
- global_preferences_install_descriptions ();
}
diff --git a/libnautilus-private/nautilus-preferences.c b/libnautilus-private/nautilus-preferences.c
index 87d3bfcbb..eb8e636d0 100644
--- a/libnautilus-private/nautilus-preferences.c
+++ b/libnautilus-private/nautilus-preferences.c
@@ -411,6 +411,8 @@ nautilus_preferences_set_boolean (const char *name,
key = preferences_key_make (name);
nautilus_gconf_set_boolean (key, boolean_value);
g_free (key);
+
+ nautilus_gconf_suggest_sync ();
}
static char *
@@ -455,6 +457,8 @@ nautilus_preferences_set_integer (const char *name,
key = preferences_key_make (name);
nautilus_gconf_set_integer (key, int_value);
g_free (key);
+
+ nautilus_gconf_suggest_sync ();
}
int
@@ -484,6 +488,8 @@ nautilus_preferences_set (const char *name,
key = preferences_key_make (name);
nautilus_gconf_set_string (key, string_value);
g_free (key);
+
+ nautilus_gconf_suggest_sync ();
}
char *
@@ -516,6 +522,8 @@ nautilus_preferences_set_string_list (const char *name,
key = preferences_key_make (name);
nautilus_gconf_set_string_list (key, string_list_value);
g_free (key);
+
+ nautilus_gconf_suggest_sync ();
}
GSList *
@@ -577,6 +585,8 @@ nautilus_preferences_set_user_level (int user_level)
user_level_key = preferences_get_user_level_key ();
nautilus_gconf_set_string (user_level_key, user_level_names_for_storage[user_level]);
g_free (user_level_key);
+
+ nautilus_gconf_suggest_sync ();
}
void
@@ -722,28 +732,25 @@ preferences_callback_entry_invoke_function (gpointer data,
static void
preferences_something_changed_notice (GConfClient *client,
- guint connection_id,
- GConfEntry *gconf_entry,
- gpointer user_data)
+ guint connection_id,
+ GConfEntry *entry,
+ gpointer notice_data)
{
- PreferencesEntry *entry;
- GError *error = NULL;
- const char *key;
+ PreferencesEntry *preferences_entry;
- g_return_if_fail (user_data != NULL);
- g_return_if_fail (gconf_entry != NULL);
- g_return_if_fail (gconf_entry->key != NULL);
- g_return_if_fail (user_data != NULL);
+ g_return_if_fail (entry != NULL);
+ g_return_if_fail (entry->key != NULL);
+ g_return_if_fail (notice_data != NULL);
- entry = user_data;
- key = gconf_entry->key;
-
- gconf_client_suggest_sync (client, &error);
- nautilus_gconf_handle_error (&error);
-
+ preferences_entry = notice_data;
+
+ /* FIXME bugzilla.eazel.com 5875:
+ * We need to make sure that the value has actually changed before
+ * invoking the callbacks.
+ */
/* Invoke callbacks for this entry */
- if (entry->callback_list) {
- g_list_foreach (entry->callback_list,
+ if (preferences_entry->callback_list) {
+ g_list_foreach (preferences_entry->callback_list,
preferences_callback_entry_invoke_function,
NULL);
}