diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-07-23 05:07:52 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-07-27 20:58:50 +0800 |
commit | 6affbe33e90b4157380eff3dad6a9654c9a24443 (patch) | |
tree | b82de645ced44be6c6aa28a0b0759ba17afb1624 /e-util/e-signature.c | |
parent | eba9b45f9e0e2a7f1a8d2d79f14d9e5f3aded19e (diff) | |
download | gsoc2013-evolution-6affbe33e90b4157380eff3dad6a9654c9a24443.tar.gz gsoc2013-evolution-6affbe33e90b4157380eff3dad6a9654c9a24443.tar.zst gsoc2013-evolution-6affbe33e90b4157380eff3dad6a9654c9a24443.zip |
Migrate ~/.evolution to XDG base directories.
Migration runs just before the main loop starts.
It's just a sequence of local directory and file renames.
Diffstat (limited to 'e-util/e-signature.c')
-rw-r--r-- | e-util/e-signature.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/e-util/e-signature.c b/e-util/e-signature.c index c4ae7ed69d..6eb84c3704 100644 --- a/e-util/e-signature.c +++ b/e-util/e-signature.c @@ -32,6 +32,7 @@ #include <gconf/gconf-client.h> #include <libedataserver/e-uid.h> +#include <libedataserver/e-data-server-util.h> #include "e-signature.h" @@ -493,6 +494,24 @@ e_signature_set_from_xml (ESignature *signature, const gchar *xml) break; } + /* If the signature is not a script, replace the directory + * part with the current signatures directory. This makes + * moving the signatures directory transparent. */ + if (!e_signature_get_is_script (signature)) { + const gchar *user_data_dir; + gchar *basename; + gchar *filename; + + user_data_dir = e_get_user_data_dir (); + + filename = signature->priv->filename; + basename = g_path_get_basename (filename); + signature->priv->filename = g_build_filename ( + user_data_dir, "signatures", basename, NULL); + g_free (basename); + g_free (filename); + } + cur = cur->next; } @@ -544,13 +563,25 @@ e_signature_to_xml (ESignature *signature) string = e_signature_get_filename (signature); if (string != NULL) { - node = xmlNewTextChild ( - root, NULL, (xmlChar *) "filename", - (xmlChar *) string); - if (e_signature_get_is_script (signature)) + + /* For scripts we save the full filename, + * for normal signatures just the basename. */ + if (e_signature_get_is_script (signature)) { + node = xmlNewTextChild ( + root, NULL, (xmlChar *) "filename", + (xmlChar *) string); xmlSetProp ( node, (xmlChar *) "script", (xmlChar *) "true"); + } else { + gchar *basename; + + basename = g_path_get_basename (string); + node = xmlNewTextChild ( + root, NULL, (xmlChar *) "filename", + (xmlChar *) basename); + g_free (basename); + } } } else { /* this is to make Evolution-1.4 and older 1.5 versions happy */ |