aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2008-03-11 23:20:59 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-03-11 23:20:59 +0800
commite0d5ae3e97f318fb60674de189c8eff91477bac9 (patch)
treedf85497e700d8794604fe7730369fe93b16829db
parent9427d2336925fd6cfd0bff849b6d9ac69411c09f (diff)
downloadgsoc2013-evolution-e0d5ae3e97f318fb60674de189c8eff91477bac9.tar
gsoc2013-evolution-e0d5ae3e97f318fb60674de189c8eff91477bac9.tar.gz
gsoc2013-evolution-e0d5ae3e97f318fb60674de189c8eff91477bac9.tar.bz2
gsoc2013-evolution-e0d5ae3e97f318fb60674de189c8eff91477bac9.tar.lz
gsoc2013-evolution-e0d5ae3e97f318fb60674de189c8eff91477bac9.tar.xz
gsoc2013-evolution-e0d5ae3e97f318fb60674de189c8eff91477bac9.tar.zst
gsoc2013-evolution-e0d5ae3e97f318fb60674de189c8eff91477bac9.zip
** Fixes bug #513951
2008-03-11 Matthew Barnes <mbarnes@redhat.com> ** Fixes bug #513951 * addressbook/gui/component/addressbook-component.c (ensure_sources): * addressbook/gui/component/addressbook-migrate.c (addressbook_migrate): * calendar/gui/cal-search-bar.c (cal_search_bar_construct): * calendar/gui/migration.c (create_calendar_sources), (create_task_sources), (migrate_calendars), (migrate_tasks), (create_memo_sources): * calendar/gui/e-memos.c (e_memos_setup_view_menus): * calendar/gui/tasks-component.c (ensure_sources): * calendar/gui/gnome-cal.c (gnome_calendar_setup_view_menus): * calendar/gui/calendar-component.c (ensure_sources): * calendar/gui/memos-component.c (ensure_sources): * mail/mail-config.c (gconf_mime_types_changed): Adapt to new meaning of xxx_component_peek_base_directory(). * addressbook/gui/component/addressbook-component.c (addressbook_component_init): * addressbook/gui/component/addressbook-migrate.c (create_groups): * calendar/gui/tasks-component.c (tasks_component_init): * calendar/gui/calendar-component.c (calendar_component_init): * calendar/gui/memos-component.c (memos_component_init): * composer/e-msg-composer.c (autosave_manager_query_load_orphans), (autosave_init_file): * e-util/e-mktemp.c (get_dir): * e-util/e-util.c (get_lock_filename): * mail/mail-component.c: * plugins/face/face.c (org_gnome_composer_face): * smime/lib/e-cert-db.c (initialize_nss): Use e_get_user_data_dir() instead of constructing the full path. * calendar/gui/migration.c (add_gw_esource): * composer/e-msg-composer.c (e_msg-composer_unrealize), (e_msg_composer_set_view_from), (e_msg_composer_set_view_replyto), (e_msg_composer_set_view_to), (e_msg_composer_set_view_postto), (e_msg_composer_set_view_cc), (e_msg_composer_set_view_bcc): * e-util/e-util.c (e_file_update_save_path), (e_file_get_save_path): Emit warnings if saving to GConf fails. * e-util/e-util.c (e_get_user_data_dir): New function returns the base directory for Evolution user data. This should be the /only/ place in the application where this directory is hard-coded. svn path=/trunk/; revision=35175
-rw-r--r--addressbook/ChangeLog12
-rw-r--r--addressbook/gui/component/addressbook-component.c8
-rw-r--r--addressbook/gui/component/addressbook-migrate.c8
-rw-r--r--calendar/ChangeLog22
-rw-r--r--calendar/gui/cal-search-bar.c12
-rw-r--r--calendar/gui/calendar-component.c12
-rw-r--r--calendar/gui/e-memos.c2
-rw-r--r--calendar/gui/gnome-cal.c2
-rw-r--r--calendar/gui/memos-component.c12
-rw-r--r--calendar/gui/migration.c27
-rw-r--r--calendar/gui/tasks-component.c12
-rw-r--r--composer/ChangeLog14
-rw-r--r--composer/e-msg-composer.c62
-rw-r--r--e-util/ChangeLog16
-rw-r--r--e-util/e-mktemp.c2
-rw-r--r--e-util/e-util.c36
-rw-r--r--e-util/e-util.h2
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/mail-component.c21
-rw-r--r--mail/mail-config.c6
-rw-r--r--plugins/face/ChangeLog7
-rw-r--r--plugins/face/face.c3
-rw-r--r--smime/ChangeLog7
-rw-r--r--smime/lib/e-cert-db.c14
24 files changed, 240 insertions, 89 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index b1b44c4ae7..12e10b7471 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,15 @@
+2008-03-11 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #513951
+
+ * gui/component/addressbook-component.c (ensure_sources):
+ * gui/component/addressbook-migrate.c (addressbook_migrate):
+ Adapt to new meaning of xxx_component_peek_base_directory().
+
+ * gui/component/addressbook-component.c (addressbook_component_init):
+ * gui/component/addressbook-migrate.c (create_groups):
+ Use e_get_user_data_dir() instead of constructing the full path.
+
2008-02-22 Milan Crha <mcrha@redhat.com>
** Part of fix for bug #514836
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index 57de2505c4..8d02ac0d46 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -76,6 +76,7 @@ ensure_sources (AddressbookComponent *component)
ESourceGroup *on_ldap_servers;
ESource *personal_source;
char *base_uri, *base_uri_proto;
+ const gchar *base_dir;
on_this_computer = NULL;
on_ldap_servers = NULL;
@@ -86,9 +87,8 @@ ensure_sources (AddressbookComponent *component)
return;
}
- base_uri = g_build_filename (addressbook_component_peek_base_directory (component),
- "addressbook", "local",
- NULL);
+ base_dir = addressbook_component_peek_base_directory (component);
+ base_uri = g_build_filename (base_dir, "local", NULL);
base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
@@ -486,7 +486,7 @@ addressbook_component_init (AddressbookComponent *component)
/* EPFIXME: Should use a custom one instead? */
priv->gconf_client = gconf_client_get_default ();
- priv->base_directory = g_build_filename (g_get_home_dir (), ".evolution", NULL);
+ priv->base_directory = g_build_filename (e_get_user_data_dir (), "addressbook", NULL);
component->priv = priv;
diff --git a/addressbook/gui/component/addressbook-migrate.c b/addressbook/gui/component/addressbook-migrate.c
index f1169f7547..d7c94e695f 100644
--- a/addressbook/gui/component/addressbook-migrate.c
+++ b/addressbook/gui/component/addressbook-migrate.c
@@ -449,14 +449,14 @@ create_groups (MigrationContext *context,
GSList *groups;
ESourceGroup *group;
char *base_uri, *base_uri_proto;
+ const gchar *base_dir;
*on_this_computer = NULL;
*on_ldap_servers = NULL;
*personal_source = NULL;
- base_uri = g_build_filename (addressbook_component_peek_base_directory (context->component),
- "addressbook", "local",
- NULL);
+ base_dir = addressbook_component_peek_base_directory (context->component);
+ base_uri = g_build_filename (base_dir, "local", NULL);
base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
@@ -1171,7 +1171,7 @@ addressbook_migrate (AddressbookComponent *component, int major, int minor, int
old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Contacts", NULL);
new_path = g_build_filename (addressbook_component_peek_base_directory (component),
- "addressbook", "local", "system", NULL);
+ "local", "system", NULL);
migrate_pilot_data (old_path, new_path);
g_free (new_path);
g_free (old_path);
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index c6f28fdebc..cf258abccc 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,25 @@
+2008-03-11 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #513951
+
+ * gui/cal-search-bar.c (cal_search_bar_construct):
+ * gui/migration.c (create_calendar_sources), (create_task_sources),
+ (migrate_calendars), (migrate_tasks), (create_memo_sources):
+ * gui/e-memos.c (e_memos_setup_view_menus):
+ * gui/tasks-component.c (ensure_sources):
+ * gui/gnome-cal.c (gnome_calendar_setup_view_menus):
+ * gui/calendar-component.c (ensure_sources):
+ * gui/memos-component.c (ensure_sources):
+ Adapt to new meaning of xxx_component_peek_base_directory().
+
+ * gui/tasks-component.c (tasks_component_init):
+ * gui/calendar-component.c (calendar_component_init):
+ * gui/memos-component.c (memos_component_init):
+ Use e_get_user_data_dir() instead of constructing the full path.
+
+ * gui/migration.c (add_gw_esource):
+ Emit warnings when saving to GConf fails.
+
2008-02-25 Chenthill Palanisamy <pchenthill@novell.com>
Fixes #516498
diff --git a/calendar/gui/cal-search-bar.c b/calendar/gui/cal-search-bar.c
index fdaa0ff791..58ba068355 100644
--- a/calendar/gui/cal-search-bar.c
+++ b/calendar/gui/cal-search-bar.c
@@ -37,6 +37,9 @@
#include <filter/rule-editor.h>
#include "cal-search-bar.h"
+#include "calendar-component.h"
+#include "memos-component.h"
+#include "tasks-component.h"
#include "e-util/e-util.h"
#include "e-util/e-error.h"
@@ -736,6 +739,7 @@ cal_search_bar_construct (CalSearchBar *cal_search, guint32 flags)
FilterPart *part;
RuleContext *search_context;
FilterRule *search_rule;
+ const gchar *base_dir;
g_return_val_if_fail (IS_CAL_SEARCH_BAR (cal_search), NULL);
@@ -760,16 +764,18 @@ cal_search_bar_construct (CalSearchBar *cal_search, guint32 flags)
rule_context_add_rule, rule_context_next_rule);
if (flags == CAL_SEARCH_MEMOS_DEFAULT) {
- userfile = g_build_filename (g_get_home_dir (), ".evolution", "memos", "searches.xml", NULL);
+ base_dir = memos_component_peek_base_directory (memos_component_peek ());
xmlfile = g_build_filename (SEARCH_RULE_DIR, "memotypes.xml", NULL);
} else if (flags == CAL_SEARCH_TASKS_DEFAULT) {
- userfile = g_build_filename (g_get_home_dir (), ".evolution", "tasks", "searches.xml", NULL);
+ base_dir = tasks_component_peek_base_directory (tasks_component_peek ());
xmlfile = g_build_filename (SEARCH_RULE_DIR, "tasktypes.xml", NULL);
} else {
- userfile = g_build_filename (g_get_home_dir (), ".evolution", "calendar", "searches.xml", NULL);
+ base_dir = calendar_component_peek_base_directory (calendar_component_peek ());
xmlfile = g_build_filename (SEARCH_RULE_DIR, "caltypes.xml", NULL);
}
+ userfile = g_build_filename (base_dir, "searches.xml", NULL);
+
g_object_set_data_full (G_OBJECT (search_context), "user", userfile, g_free);
g_object_set_data_full (G_OBJECT (search_context), "system", xmlfile, g_free);
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 067fadd21d..9dffb61b43 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -161,6 +161,7 @@ ensure_sources (CalendarComponent *component)
ESource *personal_source;
ESource *birthdays_source;
char *base_uri, *base_uri_proto;
+ const gchar *base_dir;
gchar *create_source;
on_this_computer = NULL;
@@ -175,9 +176,8 @@ ensure_sources (CalendarComponent *component)
return;
}
- base_uri = g_build_filename (calendar_component_peek_base_directory (component),
- "calendar", "local",
- NULL);
+ base_dir = calendar_component_peek_base_directory (component);
+ base_uri = g_build_filename (base_dir, "local", NULL);
base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
@@ -1726,10 +1726,8 @@ calendar_component_init (CalendarComponent *component)
priv = g_new0 (CalendarComponentPrivate, 1);
- priv->base_directory = g_build_filename (g_get_home_dir (), ".evolution", NULL);
- priv->config_directory = g_build_filename (g_get_home_dir (),
- ".evolution", "calendar", "config",
- NULL);
+ priv->base_directory = g_build_filename (e_get_user_data_dir (), "calendar", NULL);
+ priv->config_directory = g_build_filename (priv->base_directory, "config", NULL);
/* EPFIXME: Should use a custom one instead? Also we should add
* calendar_component_peek_gconf_client(). */
diff --git a/calendar/gui/e-memos.c b/calendar/gui/e-memos.c
index ab2a90f825..c62205fff5 100644
--- a/calendar/gui/e-memos.c
+++ b/calendar/gui/e-memos.c
@@ -1155,7 +1155,7 @@ e_memos_setup_view_menus (EMemos *memos, BonoboUIComponent *uic)
"memos",
NULL);
dir1 = g_build_filename (memos_component_peek_base_directory (memos_component_peek ()),
- "memos", "views", NULL);
+ "views", NULL);
gal_view_collection_set_storage_directories (collection,
dir0,
dir1);
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index e955b7be32..5108164c98 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -2386,7 +2386,7 @@ gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic)
"calendar",
NULL);
path1 = g_build_filename (calendar_component_peek_base_directory (calendar_component_peek ()),
- "calendar", "views", NULL);
+ "views", NULL);
gal_view_collection_set_storage_directories (collection,
path0,
path1);
diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c
index 2aa4d7313e..aed668e825 100644
--- a/calendar/gui/memos-component.c
+++ b/calendar/gui/memos-component.c
@@ -132,6 +132,7 @@ ensure_sources (MemosComponent *component)
ESourceGroup *on_the_web;
ESource *personal_source;
char *base_uri, *base_uri_proto;
+ const gchar *base_dir;
on_this_computer = NULL;
on_the_web = NULL;
@@ -142,9 +143,8 @@ ensure_sources (MemosComponent *component)
return;
}
- base_uri = g_build_filename (memos_component_peek_base_directory (component),
- "memos", "local",
- NULL);
+ base_dir = memos_component_peek_base_directory (component);
+ base_uri = g_build_filename (base_dir, "local", NULL);
base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
@@ -1388,10 +1388,8 @@ memos_component_init (MemosComponent *component, MemosComponentClass *klass)
priv = g_new0 (MemosComponentPrivate, 1);
- priv->base_directory = g_build_filename (g_get_home_dir (), ".evolution", NULL);
- priv->config_directory = g_build_filename (g_get_home_dir (),
- ".evolution", "memos", "config",
- NULL);
+ priv->base_directory = g_build_filename (e_get_user_data_dir (), "memos", NULL);
+ priv->config_directory = g_build_filename (priv->base_directory, "config", NULL);
component->priv = priv;
ensure_sources (component);
diff --git a/calendar/gui/migration.c b/calendar/gui/migration.c
index 5a798c8e74..5ac2547d9d 100644
--- a/calendar/gui/migration.c
+++ b/calendar/gui/migration.c
@@ -424,15 +424,15 @@ create_calendar_sources (CalendarComponent *component,
GSList *groups;
ESourceGroup *group;
char *base_uri, *base_uri_proto;
+ const gchar *base_dir;
*on_this_computer = NULL;
*on_the_web = NULL;
*contacts = NULL;
*personal_source = NULL;
- base_uri = g_build_filename (calendar_component_peek_base_directory (component),
- "calendar", "local",
- NULL);
+ base_dir = calendar_component_peek_base_directory (component);
+ base_uri = g_build_filename (base_dir, "local", NULL);
base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
@@ -535,13 +535,14 @@ create_task_sources (TasksComponent *component,
GSList *groups;
ESourceGroup *group;
char *base_uri, *base_uri_proto;
+ const gchar *base_dir;
*on_this_computer = NULL;
*on_the_web = NULL;
*personal_source = NULL;
- base_uri = g_build_filename (tasks_component_peek_base_directory (component),
- "tasks", "local", NULL);
+ base_dir = tasks_component_peek_base_directory (component);
+ base_uri = g_build_filename (base_dir, "local", NULL);
base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
@@ -851,7 +852,7 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis
old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Calendar", NULL);
new_path = g_build_filename (calendar_component_peek_base_directory (component),
- "calendar", "local", "system", NULL);
+ "local", "system", NULL);
migrate_pilot_data ("calendar", "calendar", old_path, new_path);
g_free (new_path);
g_free (old_path);
@@ -993,7 +994,7 @@ migrate_tasks (TasksComponent *component, int major, int minor, int revision, GE
old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Tasks", NULL);
new_path = g_build_filename (tasks_component_peek_base_directory (component),
- "tasks", "local", "system", NULL);
+ "local", "system", NULL);
migrate_pilot_data ("tasks", "todo", old_path, new_path);
g_free (new_path);
g_free (old_path);
@@ -1048,13 +1049,14 @@ create_memo_sources (MemosComponent *component,
GSList *groups;
ESourceGroup *group;
char *base_uri, *base_uri_proto;
+ const gchar *base_dir;
*on_this_computer = NULL;
*on_the_web = NULL;
*personal_source = NULL;
- base_uri = g_build_filename (memos_component_peek_base_directory (component),
- "memos", "local", NULL);
+ base_dir = memos_component_peek_base_directory (component);
+ base_uri = g_build_filename (base_dir, "local", NULL);
base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
@@ -1146,6 +1148,7 @@ add_gw_esource (ESourceList *source_list, const char *group_name, const char *s
ESourceGroup *group;
ESource *source;
GSList *ids, *temp ;
+ GError *error = NULL;
char *relative_uri;
const char *soap_port;
const char * use_ssl;
@@ -1180,7 +1183,11 @@ add_gw_esource (ESourceList *source_list, const char *group_name, const char *s
e_source_set_color_spec (source, "#EEBC60");
e_source_group_add_source (group, source, -1);
- ids = gconf_client_get_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, NULL);
+ ids = gconf_client_get_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, &error);
+ if ( error != NULL ) {
+ g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+ g_error_free(error);
+ }
ids = g_slist_append (ids, g_strdup (e_source_peek_uid (source)));
gconf_client_set_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, ids, NULL);
temp = ids;
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index e1b364c9fa..d843ffef1d 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -128,6 +128,7 @@ ensure_sources (TasksComponent *component)
ESourceGroup *on_the_web;
ESource *personal_source;
char *base_uri, *base_uri_proto;
+ const gchar *base_dir;
on_this_computer = NULL;
on_the_web = NULL;
@@ -138,9 +139,8 @@ ensure_sources (TasksComponent *component)
return;
}
- base_uri = g_build_filename (tasks_component_peek_base_directory (component),
- "tasks", "local",
- NULL);
+ base_dir = tasks_component_peek_base_directory (component);
+ base_uri = g_build_filename (base_dir, "local", NULL);
base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
@@ -1449,10 +1449,8 @@ tasks_component_init (TasksComponent *component, TasksComponentClass *klass)
priv = g_new0 (TasksComponentPrivate, 1);
- priv->base_directory = g_build_filename (g_get_home_dir (), ".evolution", NULL);
- priv->config_directory = g_build_filename (g_get_home_dir (),
- ".evolution", "tasks", "config",
- NULL);
+ priv->base_directory = g_build_filename (e_get_user_data_dir (), "tasks", NULL);
+ priv->config_directory = g_build_filename (priv->base_directory, "config", NULL);
component->priv = priv;
ensure_sources (component);
diff --git a/composer/ChangeLog b/composer/ChangeLog
index f630340f75..c01c8e10b5 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,17 @@
+2008-03-11 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #513951
+
+ * e-msg-composer.c (autosave_manager_query_load_orphans),
+ (autosave_init_file):
+ Use e_get_user_data_dir() instead of constructing the full path.
+
+ * e-msg-composer.c (e_msg-composer_unrealize),
+ (e_msg_composer_set_view_from), (e_msg_composer_set_view_replyto),
+ (e_msg_composer_set_view_to), (e_msg_composer_set_view_postto),
+ (e_msg_composer_set_view_cc), (e_msg_composer_set_view_bcc):
+ Emit warnings if saving to GConf fails.
+
2008-02-25 Johny Jacob <jjohnny@novell.com>
* e-msg-composer.c (e_msg_composer_show_sig_file): Reverting
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 5d1dbe23ab..d346bc2821 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1615,9 +1615,9 @@ autosave_manager_query_load_orphans (AutosaveManager *am, GtkWindow *parent)
GSList *match = NULL;
gint len = strlen (AUTOSAVE_SEED);
gint load = FALSE;
- gchar *dirname;
+ const gchar *dirname;
- dirname = g_build_filename (g_get_home_dir (), ".evolution", NULL);
+ dirname = e_get_user_data_dir ();
dir = g_dir_open (dirname, 0, NULL);
if (!dir) {
return;
@@ -1646,7 +1646,6 @@ autosave_manager_query_load_orphans (AutosaveManager *am, GtkWindow *parent)
}
g_dir_close (dir);
- g_free (dirname);
if (match != NULL)
load = e_error_run(parent, "mail-composer:recover-autosave", NULL) == GTK_RESPONSE_YES;
@@ -1698,7 +1697,7 @@ autosave_init_file (EMsgComposer *composer)
EMsgComposerPrivate *p = composer->priv;
if (p->autosave_file == NULL) {
p->autosave_file = g_build_filename (
- g_get_home_dir (), ".evolution", AUTOSAVE_SEED, NULL);
+ e_get_user_data_dir (), AUTOSAVE_SEED, NULL);
p->autosave_fd = g_mkstemp (p->autosave_file);
return TRUE;
}
@@ -3587,13 +3586,20 @@ e_msg_composer_unrealize (GtkWidget *widget, gpointer data)
{
EMsgComposer *composer = E_MSG_COMPOSER (widget);
GConfClient *gconf;
+ GError *error = NULL;
int width, height;
gtk_window_get_size (GTK_WINDOW (composer), &width, &height);
gconf = gconf_client_get_default ();
- gconf_client_set_int (gconf, "/apps/evolution/mail/composer/width", width, NULL);
- gconf_client_set_int (gconf, "/apps/evolution/mail/composer/height", height, NULL);
+ if (!gconf_client_set_int (gconf, "/apps/evolution/mail/composer/width", width, &error)) {
+ g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+ g_clear_error(&error);
+ }
+ if (!gconf_client_set_int (gconf, "/apps/evolution/mail/composer/height", height, &error)) {
+ g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+ g_error_free(error);
+ }
g_object_unref (gconf);
}
@@ -5734,7 +5740,8 @@ e_msg_composer_set_view_from (EMsgComposer *composer, gboolean view_from)
{
EMsgComposerPrivate *p = composer->priv;
GConfClient *gconf;
-
+ GError *error = NULL;
+
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
if ((p->view_from && view_from) ||
@@ -5746,7 +5753,11 @@ e_msg_composer_set_view_from (EMsgComposer *composer, gboolean view_from)
"state", p->view_from ? "1" : "0", NULL);
gconf = gconf_client_get_default ();
- gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/From", view_from, NULL);
+ if (!gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/From", view_from, &error)) {
+ g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+ g_error_free(error);
+ }
+
g_object_unref (gconf);
e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (p->hdrs),
@@ -5784,7 +5795,8 @@ e_msg_composer_set_view_replyto (EMsgComposer *composer, gboolean view_replyto)
{
EMsgComposerPrivate *p = composer->priv;
GConfClient *gconf;
-
+ GError *error = NULL;
+
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
if ((p->view_replyto && view_replyto) ||
@@ -5797,7 +5809,10 @@ e_msg_composer_set_view_replyto (EMsgComposer *composer, gboolean view_replyto)
/* we do this /only/ if the fields is in the visible_mask */
gconf = gconf_client_get_default ();
- gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/ReplyTo", view_replyto, NULL);
+ if (!gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/ReplyTo", view_replyto, &error)) {
+ g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+ g_error_free(error);
+ }
g_object_unref (gconf);
e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (p->hdrs),
@@ -5835,7 +5850,8 @@ e_msg_composer_set_view_to (EMsgComposer *composer, gboolean view_to)
{
EMsgComposerPrivate *p = composer->priv;
GConfClient *gconf;
-
+ GError *error = NULL;
+
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
if ((p->view_to && view_to) ||
@@ -5848,7 +5864,10 @@ e_msg_composer_set_view_to (EMsgComposer *composer, gboolean view_to)
if ((E_MSG_COMPOSER_HDRS(p->hdrs))->visible_mask & E_MSG_COMPOSER_VISIBLE_TO) {
gconf = gconf_client_get_default ();
- gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/To", view_to, NULL);
+ if (!gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/To", view_to, &error)) {
+ g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+ g_error_free(error);
+ }
g_object_unref (gconf);
}
@@ -5887,6 +5906,8 @@ void
e_msg_composer_set_view_postto (EMsgComposer *composer, gboolean view_postto)
{
GConfClient *gconf;
+ GError *error = NULL;
+
EMsgComposerPrivate *p = composer->priv;
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
@@ -5901,7 +5922,10 @@ e_msg_composer_set_view_postto (EMsgComposer *composer, gboolean view_postto)
if ((E_MSG_COMPOSER_HDRS(p->hdrs))->visible_mask & E_MSG_COMPOSER_VISIBLE_POSTTO) {
gconf = gconf_client_get_default ();
- gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/PostTo", view_postto, NULL);
+ if (!gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/PostTo", view_postto, &error)) {
+ g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+ g_error_free(error);
+ }
g_object_unref (gconf);
}
@@ -5940,6 +5964,7 @@ void
e_msg_composer_set_view_cc (EMsgComposer *composer, gboolean view_cc)
{
GConfClient *gconf;
+ GError *error = NULL;
EMsgComposerPrivate *p = composer->priv;
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
@@ -5954,7 +5979,10 @@ e_msg_composer_set_view_cc (EMsgComposer *composer, gboolean view_cc)
if ((E_MSG_COMPOSER_HDRS (p->hdrs))->visible_mask & E_MSG_COMPOSER_VISIBLE_CC) {
gconf = gconf_client_get_default ();
- gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/Cc", view_cc, NULL);
+ if (!gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/Cc", view_cc, &error)) {
+ g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+ g_error_free(error);
+ }
g_object_unref (gconf);
}
@@ -5994,6 +6022,7 @@ void
e_msg_composer_set_view_bcc (EMsgComposer *composer, gboolean view_bcc)
{
GConfClient *gconf;
+ GError *error = NULL;
EMsgComposerPrivate *p = composer->priv;
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
@@ -6008,7 +6037,10 @@ e_msg_composer_set_view_bcc (EMsgComposer *composer, gboolean view_bcc)
if ((E_MSG_COMPOSER_HDRS (p->hdrs))->visible_mask & E_MSG_COMPOSER_VISIBLE_BCC) {
gconf = gconf_client_get_default ();
- gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/Bcc", view_bcc, NULL);
+ if (!gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/Bcc", view_bcc, &error)) {
+ g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+ g_error_free(error);
+ }
g_object_unref (gconf);
}
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index a52c585e10..8c6978b5e0 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,19 @@
+2008-03-11 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #513951
+
+ * e-mktemp.c (get_dir):
+ * e-util.c (get_lock_filename):
+ Use e_get_user_data_dir() instead of constructing the full path.
+
+ * e-util.c (e_get_user_data_dir):
+ New function returns the base directory for Evolution user data.
+ This should be the /only/ place in the application where this
+ directory is hard-coded.
+
+ * e-util.c (e_file_update_save_path), (e_file_get_save_path):
+ Emit warnings when saving to GConf fails.
+
2008-02-19 Milan Crha <mcrha@redhat.com>
** Fix for bug #209353
diff --git a/e-util/e-mktemp.c b/e-util/e-mktemp.c
index 9ff294f929..e1f6a382bb 100644
--- a/e-util/e-mktemp.c
+++ b/e-util/e-mktemp.c
@@ -110,7 +110,7 @@ get_dir (gboolean make)
#ifdef TEMP_HOME
char *tmpdir = NULL;
- tmpdir = g_build_filename(g_get_home_dir(), ".evolution",
+ tmpdir = g_build_filename(e_get_user_data_dir (),
"cache", "tmp", NULL);
path = g_string_new(tmpdir);
if (make && g_mkdir_with_parents(tmpdir, 0777) == -1) {
diff --git a/e-util/e-util.c b/e-util/e-util.c
index b1634bcfff..87a78341f2 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -50,6 +50,26 @@
#include "e-util-private.h"
/**
+ * e_get_user_data_dir:
+ *
+ * Returns the base directory for Evolution-specific user data.
+ * The string is owned by Evolution and must not be modified or freed.
+ *
+ * Returns: base directory for user data
+ **/
+const gchar *
+e_get_user_data_dir (void)
+{
+ static gchar* dirname = NULL;
+
+ if (G_UNLIKELY (dirname == NULL))
+ dirname = g_build_filename (
+ g_get_home_dir (), ".evolution", NULL);
+
+ return dirname;
+}
+
+/**
* e_str_without_underscores:
* @s: the string to strip underscores from.
*
@@ -989,8 +1009,13 @@ void
e_file_update_save_path (gchar *uri, gboolean free)
{
GConfClient *gconf = gconf_client_get_default();
+ GError *error = NULL;
- gconf_client_set_string(gconf, "/apps/evolution/mail/save_dir", uri, NULL);
+ gconf_client_set_string(gconf, "/apps/evolution/mail/save_dir", uri, &error);
+ if (error != NULL) {
+ g_warning("%s (%s) %s", G_STRLOC, G_STRFUNC, error->message);
+ g_clear_error(&error);
+ }
g_object_unref(gconf);
if (free)
g_free(uri);
@@ -1007,9 +1032,14 @@ gchar *
e_file_get_save_path (void)
{
GConfClient *gconf = gconf_client_get_default();
+ GError *error = NULL;
gchar *uri;
- uri = gconf_client_get_string(gconf, "/apps/evolution/mail/save_dir", NULL);
+ uri = gconf_client_get_string(gconf, "/apps/evolution/mail/save_dir", &error);
+ if (error != NULL) {
+ g_warning("%s (%s) %s", G_STRLOC, G_STRFUNC, error->message);
+ g_clear_error(&error);
+ }
g_object_unref(gconf);
if (uri == NULL)
@@ -1027,7 +1057,7 @@ get_lock_filename (void)
static gchar *filename = NULL;
if (G_UNLIKELY (filename == NULL))
- filename = g_build_filename (g_get_home_dir (), ".evolution", LOCK_FILE, NULL);
+ filename = g_build_filename (e_get_user_data_dir (), LOCK_FILE, NULL);
return filename;
}
diff --git a/e-util/e-util.h b/e-util/e-util.h
index fc8da98b7f..15003d7226 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -44,6 +44,8 @@ typedef enum {
E_FOCUS_END
} EFocus;
+const gchar * e_get_user_data_dir (void);
+
char * e_str_without_underscores (const char *s);
gint e_str_compare (gconstpointer x,
gconstpointer y);
diff --git a/mail/ChangeLog b/mail/ChangeLog
index c20c4b84da..00550adad4 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,13 @@
+2008-03-11 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #513951
+
+ * mail-config.c (gconf_mime_types_changed):
+ Adapt to new meaning of xxx_component_peek_base_directory().
+
+ * mail-component.c:
+ Use e_get_user_data_dir() instead of constructing the full path.
+
2008-03-06 Tobias Mueller <muelli@auftrags-killer.org>
** Fix for bug #520745
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 0e5e19a398..66f0833658 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -49,6 +49,7 @@
#include "e-util/e-icon-factory.h"
#include "misc/e-info-label.h"
+#include "e-util/e-util.h"
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
#include "e-util/e-logger.h"
@@ -281,7 +282,7 @@ mc_setup_local_store(MailComponent *mc)
camel_exception_init(&ex);
url = camel_url_new("mbox:", NULL);
- tmp = g_strdup_printf("%s/mail/local", p->base_directory);
+ tmp = g_build_filename (p->base_directory, "local", NULL);
camel_url_set_path(url, tmp);
g_free(tmp);
tmp = camel_url_to_string(url, 0);
@@ -356,7 +357,7 @@ setup_search_context (MailComponent *component)
MailComponentPrivate *priv = component->priv;
if (priv->search_context == NULL) {
- char *user = g_build_filename(component->priv->base_directory, "mail/searches.xml", NULL);
+ char *user = g_build_filename(component->priv->base_directory, "searches.xml", NULL);
char *system = g_build_filename (EVOLUTION_PRIVDATADIR, "searchtypes.xml", NULL);
priv->search_context = (RuleContext *)em_search_context_new ();
@@ -1046,7 +1047,7 @@ impl_upgradeFromVersion (PortableServer_Servant servant, const short major, cons
component = mail_component_peek ();
camel_exception_init (&ex);
- if (em_migrate (component->priv->base_directory, major, minor, revision, &ex) == -1) {
+ if (em_migrate (e_get_user_data_dir (), major, minor, revision, &ex) == -1) {
GNOME_Evolution_Component_UpgradeFailed *failedex;
failedex = GNOME_Evolution_Component_UpgradeFailed__alloc();
@@ -1208,24 +1209,16 @@ mail_component_init (MailComponent *component)
priv->lock = g_mutex_new();
priv->quit_state = -1;
- priv->base_directory = g_build_filename (g_get_home_dir (), ".evolution", NULL);
-#ifdef G_OS_WIN32
- {
- char *p = priv->base_directory;
- while ((p = strchr(p, '\\')))
- *p++ = '/';
- }
-#endif
- if (g_mkdir_with_parents (priv->base_directory, 0777) == -1 && errno != EEXIST)
+ if (g_mkdir_with_parents (e_get_user_data_dir (), 0777) == -1 && errno != EEXIST)
abort ();
- priv->model = em_folder_tree_model_new (priv->base_directory);
+ priv->model = em_folder_tree_model_new (e_get_user_data_dir ());
priv->logger = e_logger_create ("mail");
priv->activity_handler = e_activity_handler_new ();
e_activity_handler_set_logger (priv->activity_handler, priv->logger);
e_activity_handler_set_error_flush_time (priv->activity_handler, mail_config_get_error_timeout ()*1000);
- mail_session_init (priv->base_directory);
+ mail_session_init (e_get_user_data_dir ());
priv->async_event = mail_async_event_new();
priv->store_hash = g_hash_table_new_full (
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 90de0ec75b..4828187a5b 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -371,13 +371,17 @@ gconf_mime_types_changed (GConfClient *client, guint cnxn_id,
void
mail_config_init (void)
{
+ const gchar *base_dir;
+
if (config)
return;
+ base_dir = mail_component_peek_base_directory (NULL);
+
config = g_new0 (MailConfig, 1);
config->gconf = gconf_client_get_default ();
config->mime_types = g_ptr_array_new ();
- config->gtkrc = g_build_filename (g_get_home_dir (), ".evolution", "mail", "config", "gtkrc-mail-fonts", NULL);
+ config->gtkrc = g_build_filename (base_dir, "config", "gtkrc-mail-fonts", NULL);
mail_config_clear ();
diff --git a/plugins/face/ChangeLog b/plugins/face/ChangeLog
index 2b47cac720..86a2af2140 100644
--- a/plugins/face/ChangeLog
+++ b/plugins/face/ChangeLog
@@ -1,3 +1,10 @@
+2008-03-11 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #513951
+
+ * face.c (org_gnome_composer_face):
+ Use e_get_user_data_dir() instead of constructing the full path.
+
2007-10-09 Matthew Barnes <mbarnes@redhat.com>
** Fixes part of bug #437579
diff --git a/plugins/face/face.c b/plugins/face/face.c
index 54010b625b..45851bee18 100644
--- a/plugins/face/face.c
+++ b/plugins/face/face.c
@@ -29,6 +29,7 @@
#include <glib/gi18n.h>
#include <mail/em-menu.h>
#include <e-util/e-error.h>
+#include <e-util/e-util.h>
#define d(x) x
@@ -42,7 +43,7 @@ void org_gnome_composer_face (EPlugin * ep, EMMenuTargetWidget * t)
GError *error = NULL;
composer = (EMsgComposer *) t->target.widget;
- filename = g_build_filename (g_get_home_dir (), ".evolution", "faces", NULL);
+ filename = g_build_filename (e_get_user_data_dir (), "faces", NULL);
g_file_get_contents (filename, &file_contents, NULL, &error);
if (error) {
diff --git a/smime/ChangeLog b/smime/ChangeLog
index d9703c0efa..ce7e36dd7b 100644
--- a/smime/ChangeLog
+++ b/smime/ChangeLog
@@ -1,3 +1,10 @@
+2008-03-11 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #513951
+
+ * lib/e-cert-db.c (initialize_nss):
+ Use e_get_user_data_dir() instead of constructing the full path.
+
2007-10-09 Matthew Barnes <mbarnes@redhat.com>
** Fixes part of bug #437579
diff --git a/smime/lib/e-cert-db.c b/smime/lib/e-cert-db.c
index 91301052af..a224026335 100644
--- a/smime/lib/e-cert-db.c
+++ b/smime/lib/e-cert-db.c
@@ -87,6 +87,7 @@
#include "plstr.h"
#include "prprf.h"
#include "prmem.h"
+#include "e-util/e-util.h"
#include "e-util/e-dialog-utils.h"
#include "e-util/e-util-private.h"
#include <gtk/gtkmessagedialog.h>
@@ -177,18 +178,11 @@ initialize_nss (void)
char *evolution_dir_path;
gboolean success;
- evolution_dir_path = g_build_filename (g_get_home_dir (), ".evolution", NULL);
-
#ifdef G_OS_WIN32
/* NSS wants filenames in system codepage */
- {
- char *cp_path = g_win32_locale_filename_from_utf8 (evolution_dir_path);
-
- if (cp_path) {
- g_free (evolution_dir_path);
- evolution_dir_path = cp_path;
- }
- }
+ evolution_dir_path = g_win32_locale_filename_from_utf8 (e_get_user_data_dir ());
+#else
+ evolution_dir_path = g_strdup (e_get_user_data_dir ());
#endif
/* we initialize NSS here to make sure it only happens once */