aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2005-12-17 20:19:36 +0800
committerTor Lillqvist <tml@src.gnome.org>2005-12-17 20:19:36 +0800
commitd8fc2ee08bf048d48f01d9c08583f5c1b4f2b4ed (patch)
treef51d1ec22a8e786ccde75fb0aa19e4c39e52c540 /calendar/conduits
parent6067bff47dc1c85434f567c44ae430415a355db9 (diff)
downloadgsoc2013-evolution-d8fc2ee08bf048d48f01d9c08583f5c1b4f2b4ed.tar.gz
gsoc2013-evolution-d8fc2ee08bf048d48f01d9c08583f5c1b4f2b4ed.tar.zst
gsoc2013-evolution-d8fc2ee08bf048d48f01d9c08583f5c1b4f2b4ed.zip
Use GLib to construct filenames from URIs and back.
2005-12-17 Tor Lillqvist <tml@novell.com> * conduits/calendar/calendar-conduit.c: Use GLib to construct filenames from URIs and back. svn path=/trunk/; revision=30803
Diffstat (limited to 'calendar/conduits')
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index 531773ef08..e8840ecddd 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -150,22 +150,29 @@ calconduit_load_configuration (guint32 pilot_id)
c->secret = gnome_config_get_bool ("secret=FALSE");
c->multi_day_split = gnome_config_get_bool ("multi_day_split=TRUE");
if ((c->last_uri = gnome_config_get_string ("last_uri")) && !strncmp (c->last_uri, "file://", 7)) {
- const char *path = c->last_uri + 7;
+ char *filename = g_filename_from_uri (c->last_uri, NULL, NULL);
+ const char *path = filename;
const char *home;
home = g_get_home_dir ();
if (!strncmp (path, home, strlen (home))) {
path += strlen (home);
- if (*path == '/')
+ if (G_IS_DIR_SEPARATOR (*path))
path++;
if (!strcmp (path, "evolution/local/Calendar/calendar.ics")) {
+ gchar *new_filename =
+ g_build_filename (home,
+ ".evolution/calendar/local/system/calendar.ics",
+ NULL);
/* need to upgrade the last_uri. yay. */
g_free (c->last_uri);
- c->last_uri = g_strdup_printf ("file://%s/.evolution/calendar/local/system/calendar.ics", home);
+ c->last_uri = g_filename_to_uri (new_filename);
+ g_free (new_filename);
}
}
+ g_free (filename);
}
gnome_config_pop_prefix ();