diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2003-01-11 02:06:37 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2003-01-11 02:06:37 +0800 |
commit | ccad8ad56a93e7d59aeae5e314beac555398b289 (patch) | |
tree | 2501af6b9b2029ffb9677c984f504c16e4a4444f /shell | |
parent | 52ce2079e3299a9f55f19154fa954ab82bf8dfd3 (diff) | |
download | gsoc2013-evolution-ccad8ad56a93e7d59aeae5e314beac555398b289.tar gsoc2013-evolution-ccad8ad56a93e7d59aeae5e314beac555398b289.tar.gz gsoc2013-evolution-ccad8ad56a93e7d59aeae5e314beac555398b289.tar.bz2 gsoc2013-evolution-ccad8ad56a93e7d59aeae5e314beac555398b289.tar.lz gsoc2013-evolution-ccad8ad56a93e7d59aeae5e314beac555398b289.tar.xz gsoc2013-evolution-ccad8ad56a93e7d59aeae5e314beac555398b289.tar.zst gsoc2013-evolution-ccad8ad56a93e7d59aeae5e314beac555398b289.zip |
(set_default_folder_physical_uri_from_path): New
function.
(e_setup_check_config): Call it for each of the *_path keys. Do
not set the default for *_path keys as those come from the GConf
schema anyways.
svn path=/trunk/; revision=19404
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 8 | ||||
-rw-r--r-- | shell/e-setup.c | 66 |
2 files changed, 53 insertions, 21 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 9c7b33a70b..f10ca85703 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,5 +1,13 @@ 2003-01-10 Ettore Perazzoli <ettore@ximian.com> + * e-setup.c (set_default_folder_physical_uri_from_path): New + function. + (e_setup_check_config): Call it for each of the *_path keys. Do + not set the default for *_path keys as those come from the GConf + schema anyways. + +2003-01-10 Ettore Perazzoli <ettore@ximian.com> + * apps_evolution_shell.schemas: Set defaults for /apps/evolution/shell/default_folders/... . diff --git a/shell/e-setup.c b/shell/e-setup.c index c9ca711d3f..d7d19a9c37 100644 --- a/shell/e-setup.c +++ b/shell/e-setup.c @@ -31,6 +31,8 @@ #include "e-shell-config.h" #include "e-shell-constants.h" +#include "e-util/e-path.h" + #include <gconf/gconf-client.h> #include <gtk/gtklabel.h> @@ -421,40 +423,62 @@ e_setup (const char *evolution_directory) } +static void +set_default_folder_physical_uri_from_path (GConfClient *client, + const char *evolution_directory, + const char *path_key_name) +{ + char *gconf_path; + char *path_value; + + gconf_path = g_strconcat ("/apps/evolution/shell/default_folders/", path_key_name, NULL); + path_value = gconf_client_get_string (client, gconf_path, NULL); + g_free (gconf_path); + + if (path_value != NULL + && strncmp (path_value, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0 + && strncmp (path_value + E_SHELL_URI_PREFIX_LEN, "/local/", 7) == 0) { + char *key_prefix; + char *local_physical_uri; + char *file_uri_prefix; + + key_prefix = g_strndup (path_key_name, strchr (path_key_name, '_') - path_key_name); + gconf_path = g_strconcat ("/apps/evolution/shell/default_folders/", key_prefix, "_uri", NULL); + file_uri_prefix = g_strconcat ("file://", evolution_directory, "/local", NULL); + local_physical_uri = e_path_to_physical (file_uri_prefix, path_value + E_SHELL_URI_PREFIX_LEN + 6); + + gconf_client_set_string (client, gconf_path, local_physical_uri, NULL); + + g_free (gconf_path); + g_free (key_prefix); + g_free (local_physical_uri); + g_free (file_uri_prefix); + } +} + void e_setup_check_config (const char *evolution_directory) { GConfClient *client; char *tmp; - char *uri; client = gconf_client_get_default (); - tmp = gconf_client_get_string (client, "/apps/evolution/shell/default_folders/mail_path", NULL); + tmp = gconf_client_get_string (client, "/apps/evolution/shell/default_folders/mail_uri", NULL); if (tmp != NULL && *tmp != 0) { g_object_unref (client); return; } - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/mail_path", E_LOCAL_INBOX_URI, NULL); - uri = g_strconcat ("file://", evolution_directory, "/local", strrchr (E_LOCAL_INBOX_URI, '/'), NULL); - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/mail_uri", uri, NULL); - g_free (uri); - - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/contacts_path", E_LOCAL_CONTACTS_URI, NULL); - uri = g_strconcat ("file://", evolution_directory, "/local", strrchr (E_LOCAL_CONTACTS_URI, '/'), NULL); - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/contacts_uri", uri, NULL); - g_free (uri); - - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/tasks_path", E_LOCAL_TASKS_URI, NULL); - uri = g_strconcat ("file://", evolution_directory, "/local", strrchr (E_LOCAL_TASKS_URI, '/'), NULL); - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/tasks_uri", uri, NULL); - g_free (uri); - - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/calendar_path", E_LOCAL_CALENDAR_URI, NULL); - uri = g_strconcat ("file://", evolution_directory, "/local", strrchr (E_LOCAL_CALENDAR_URI, '/'), NULL); - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/calendar_uri", uri, NULL); - g_free (uri); + /* The following ugliness is to initially set up the physical URIs + based on the default path values (which come from GConf). Of + course, this way of configuring the default folders is a bit of a + mess and needs to be cleaned up... */ + + set_default_folder_physical_uri_from_path (client, evolution_directory, "mail_path"); + set_default_folder_physical_uri_from_path (client, evolution_directory, "contacts_path"); + set_default_folder_physical_uri_from_path (client, evolution_directory, "calendar_path"); + set_default_folder_physical_uri_from_path (client, evolution_directory, "tasks_path"); g_object_unref (client); } |