diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-09-13 02:43:04 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-09-13 02:43:04 +0800 |
commit | 1ed7208ad8a498d2c8a5014ec60c25c01a660e55 (patch) | |
tree | 298e3b446623441da888e9e558f08f40383c7c51 /camel/providers/local/camel-local-folder.c | |
parent | d4690814e8ad33979e6c5a6a86eb42f5c83a29ba (diff) | |
download | gsoc2013-evolution-1ed7208ad8a498d2c8a5014ec60c25c01a660e55.tar gsoc2013-evolution-1ed7208ad8a498d2c8a5014ec60c25c01a660e55.tar.gz gsoc2013-evolution-1ed7208ad8a498d2c8a5014ec60c25c01a660e55.tar.bz2 gsoc2013-evolution-1ed7208ad8a498d2c8a5014ec60c25c01a660e55.tar.lz gsoc2013-evolution-1ed7208ad8a498d2c8a5014ec60c25c01a660e55.tar.xz gsoc2013-evolution-1ed7208ad8a498d2c8a5014ec60c25c01a660e55.tar.zst gsoc2013-evolution-1ed7208ad8a498d2c8a5014ec60c25c01a660e55.zip |
Implements CamelLocalFolder::get_full_path() (publicly namespaced so that
2003-09-12 Jeffrey Stedfast <fejj@ximian.com>
* providers/local/camel-mbox-folder.c
(camel_mbox_folder_get_full_path): Implements
CamelLocalFolder::get_full_path() (publicly namespaced so that
CamelMboxStore can re-use them).
(camel_mbox_folder_get_meta_path): Same.
* providers/local/camel-mbox-store.c (get_folder): Changed the way
the path is constructed, since we now handle subdirectories and
stuff.
(delete_folder): Try deleting the Folder.sbd directory. We also
need to manage our own meta files since CamelLocalStore's impl
constructs paths differently than what we need.
(create_folder): Implemented.
(rename_folder): Implemented.
(scan_dir): Scan an mbox tree
(get_folder_info): Implemented using scan_dir().
* providers/local/camel-local-store.c (delete_folder): Set fi->url
to the correct value, meaning we need to prefix it with the
protocol and the folder_name is not actually part of the path, it
is a separate component to the url.
* providers/local/camel-local-folder.c
(camel_local_folder_construct): Use the new class virtual method
to construct the full folder path and all the meta files.
(local_get_full_path): Implemented default get_full_path method.
(local_get_meta_path): Implemented default get_meta_path method.
svn path=/trunk/; revision=22557
Diffstat (limited to 'camel/providers/local/camel-local-folder.c')
-rw-r--r-- | camel/providers/local/camel-local-folder.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c index e0b3c7b55a..608954af94 100644 --- a/camel/providers/local/camel-local-folder.c +++ b/camel/providers/local/camel-local-folder.c @@ -73,6 +73,9 @@ static int local_setv(CamelObject *object, CamelException *ex, CamelArgV *args); static int local_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex); static void local_unlock(CamelLocalFolder *lf); +static char *local_get_full_path (const char *toplevel_dir, const char *full_name); +static char *local_get_meta_path (const char *toplevel_dir, const char *full_name, const char *ext); + static void local_refresh_info(CamelFolder *folder, CamelException *ex); static void local_sync(CamelFolder *folder, gboolean expunge, CamelException *ex); @@ -110,6 +113,9 @@ camel_local_folder_class_init(CamelLocalFolderClass * camel_local_folder_class) camel_folder_class->delete = local_delete; camel_folder_class->rename = local_rename; + camel_local_folder_class->get_full_path = local_get_full_path; + camel_local_folder_class->get_meta_path = local_get_meta_path; + camel_local_folder_class->lock = local_lock; camel_local_folder_class->unlock = local_unlock; } @@ -236,16 +242,16 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con /* not really sure to do with these for now? */ lf->summary_path = g_strdup_printf("%s.ev-summary", tmp); lf->index_path = g_strdup_printf("%s.ibex", tmp); - statepath = alloca(strlen(tmp)+7); - sprintf(statepath, "%s.cmeta", tmp); + statepath = g_strdup_printf ("%s.cmeta", tmp); } else { - lf->folder_path = g_strdup_printf("%s/%s", root_dir_path, full_name); - lf->summary_path = g_strdup_printf("%s/%s.ev-summary", root_dir_path, full_name); - lf->index_path = g_strdup_printf("%s/%s.ibex", root_dir_path, full_name); - statepath = alloca(strlen(full_name)+strlen(root_dir_path)+8); - sprintf(statepath, "%s/%s.cmeta", root_dir_path, full_name); + lf->folder_path = CLOCALF_CLASS (lf)->get_full_path (root_dir_path, full_name); + lf->summary_path = CLOCALF_CLASS (lf)->get_meta_path (root_dir_path, full_name, ".ev-summary"); + lf->index_path = CLOCALF_CLASS (lf)->get_meta_path (root_dir_path, full_name, ".ibex"); + statepath = CLOCALF_CLASS (lf)->get_meta_path (root_dir_path, full_name, ".cmeta"); } camel_object_set(lf, NULL, CAMEL_OBJECT_STATE_FILE, statepath, NULL); + g_free (statepath); + if (camel_object_state_read(lf) == -1) { /* FIXME: load defaults? */ } @@ -416,7 +422,6 @@ local_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args) static int local_setv(CamelObject *object, CamelException *ex, CamelArgV *args) { - CamelFolder *folder = (CamelFolder *)object; int i; guint32 tag; @@ -440,6 +445,18 @@ local_setv(CamelObject *object, CamelException *ex, CamelArgV *args) return ((CamelObjectClass *)parent_class)->setv(object, ex, args); } +static char * +local_get_full_path (const char *toplevel_dir, const char *full_name) +{ + return g_strdup_printf ("%s/%s", toplevel_dir, full_name); +} + +static char * +local_get_meta_path (const char *toplevel_dir, const char *full_name, const char *ext) +{ + return g_strdup_printf ("%s/%s%s", toplevel_dir, full_name, ext); +} + static int local_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex) { |