aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-02-25 00:43:09 +0800
committerDan Winship <danw@src.gnome.org>2000-02-25 00:43:09 +0800
commit4ec5c4b998528e2854aa52cbaf107e5b6f22ee6e (patch)
treeecbe56a984d8c4e96ebf41b80742ac0b5ad0bb45 /camel
parent55e6218d5907cc9f27ad81a15d750e7c3d2d5d75 (diff)
downloadgsoc2013-evolution-4ec5c4b998528e2854aa52cbaf107e5b6f22ee6e.tar.gz
gsoc2013-evolution-4ec5c4b998528e2854aa52cbaf107e5b6f22ee6e.tar.zst
gsoc2013-evolution-4ec5c4b998528e2854aa52cbaf107e5b6f22ee6e.zip
Move "separator" from camel-store to camel-folder, since it can vary from
location to location in an IMAP store. Rename CamelFolder::init_with_store to init and add parent_folder, name, and separator arguments. svn path=/trunk/; revision=1919
Diffstat (limited to 'camel')
-rw-r--r--camel/camel-folder.c39
-rw-r--r--camel/camel-folder.h7
-rw-r--r--camel/camel-store.c49
-rw-r--r--camel/camel-store.h6
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c11
-rw-r--r--camel/providers/mbox/camel-mbox-store.c10
6 files changed, 37 insertions, 85 deletions
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index b516216381..4b90328919 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -38,9 +38,9 @@ static GtkObjectClass *parent_class=NULL;
-static void _init_with_store (CamelFolder *folder,
- CamelStore *parent_store,
- CamelException *ex);
+static void _init (CamelFolder *folder, CamelStore *parent_store,
+ CamelFolder *parent_folder, const gchar *name,
+ gchar separator, CamelException *ex);
static void _finalize (GtkObject *object);
@@ -141,7 +141,7 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class)
parent_class = gtk_type_class (gtk_object_get_type ());
/* virtual method definition */
- camel_folder_class->init_with_store = _init_with_store;
+ camel_folder_class->init = _init;
camel_folder_class->open = _open;
#ifdef FOLDER_ASYNC_TEST
camel_folder_class->open_async = _open_async;
@@ -224,6 +224,8 @@ _finalize (GtkObject *object)
if (camel_folder->parent_store)
gtk_object_unref (GTK_OBJECT (camel_folder->parent_store));
+ if (camel_folder->parent_folder)
+ gtk_object_unref (GTK_OBJECT (camel_folder->parent_folder));
GTK_OBJECT_CLASS (parent_class)->finalize (object);
CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolder::finalize\n");
@@ -231,16 +233,21 @@ _finalize (GtkObject *object)
/**
- * _init_with_store: init the folder by setting its parent store.
+ * _init: init the folder
* @folder: folder object to initialize
* @parent_store: parent store object of the folder
+ * @parent_folder: parent folder of the folder (may be NULL)
+ * @name: (short) name of the folder
+ * @separator: separator between the parent folder name and this name
*
- *
+ * Initalizes the folder by setting the parent store, parent folder,
+ * and name.
**/
static void
-_init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex)
+_init (CamelFolder *folder, CamelStore *parent_store,
+ CamelFolder *parent_folder, const gchar *name,
+ gchar separator, CamelException *ex)
{
-
g_assert (folder != NULL);
g_assert (parent_store != NULL);
g_assert (folder->parent_store == NULL);
@@ -248,10 +255,14 @@ _init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException
folder->parent_store = parent_store;
gtk_object_ref (GTK_OBJECT (parent_store));
+ folder->parent_folder = parent_folder;
+ if (parent_folder)
+ gtk_object_ref (GTK_OBJECT (parent_folder));
+
folder->open_mode = FOLDER_OPEN_UNKNOWN;
folder->open_state = FOLDER_CLOSE;
- folder->name = NULL;
- folder->full_name = NULL;
+ folder->separator = separator;
+ camel_folder_set_name (folder, name, ex);
}
@@ -415,7 +426,6 @@ _set_name (CamelFolder *folder,
const gchar *name,
CamelException *ex)
{
- gchar separator;
gchar *full_name;
const gchar *parent_full_name;
@@ -435,18 +445,15 @@ _set_name (CamelFolder *folder,
CAMEL_LOG_FULL_DEBUG ("CamelFolder::set_name, folder name is %s\n",
name);
- separator = camel_store_get_separator (folder->parent_store, ex);
- if (camel_exception_get_id (ex)) return;
-
if (folder->parent_folder) {
parent_full_name =
camel_folder_get_full_name (folder->parent_folder, ex);
if (camel_exception_get_id (ex)) return;
full_name = g_strdup_printf ("%s%c%s", parent_full_name,
- separator, name);
+ folder->separator, name);
} else {
- full_name = g_strdup_printf ("%c%s", separator, name);
+ full_name = g_strdup_printf ("%c%s", folder->separator, name);
}
CAMEL_LOG_FULL_DEBUG ("CamelFolder::set_name, folder full name "
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
index c18d2404ff..6b55f5aa72 100644
--- a/camel/camel-folder.h
+++ b/camel/camel-folder.h
@@ -68,6 +68,7 @@ struct _CamelFolder
CamelFolderState open_state;
gchar *name;
gchar *full_name;
+ gchar separator;
CamelStore *parent_store;
CamelFolder *parent_folder;
GList *permanent_flags;
@@ -86,9 +87,9 @@ typedef struct {
GtkObjectClass parent_class;
/* Virtual methods */
- void (*init_with_store) (CamelFolder *folder,
- CamelStore *parent_store,
- CamelException *ex);
+ void (*init) (CamelFolder *folder, CamelStore *parent_store,
+ CamelFolder *parent_store, const gchar *name,
+ gchar separator, CamelException *ex);
void (*open) (CamelFolder *folder,
CamelFolderOpenMode mode,
diff --git a/camel/camel-store.c b/camel/camel-store.c
index dee1ef295c..5428dde2e2 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -37,7 +37,6 @@ static void _set_separator(CamelStore *store, gchar sep, CamelException *ex);
static CamelFolder *_get_root_folder(CamelStore *store, CamelException *ex);
static CamelFolder *_get_default_folder(CamelStore *store, CamelException *ex);
static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex);
-static gchar _get_separator (CamelStore *store, CamelException *ex);
static void
camel_store_class_init (CamelStoreClass *camel_store_class)
@@ -46,8 +45,6 @@ camel_store_class_init (CamelStoreClass *camel_store_class)
parent_class = gtk_type_class (camel_service_get_type ());
/* virtual method definition */
- camel_store_class->set_separator = _set_separator;
- camel_store_class->get_separator = _get_separator;
camel_store_class->get_folder = _get_folder;
camel_store_class->get_root_folder = _get_root_folder;
camel_store_class->get_default_folder = _get_default_folder;
@@ -86,52 +83,6 @@ camel_store_get_type (void)
-/**
- * camel_store_set_separator: set the character which separates this folder path from the folders names in a lower level of hierarchy.
- *
- * @store:
- * @sep:
- *
- **/
-static void
-_set_separator (CamelStore *store, gchar sep, CamelException *ex)
-{
- store->separator = sep;
-}
-
-
-
-
-
-static gchar
-_get_separator (CamelStore *store, CamelException *ex)
-{
- g_assert(store);
- return store->separator;
-}
-
-
-
-/**
- * camel_store_get_separator: return the character which separates this folder path from the folders names in a lower level of hierarchy.
- * @store: store
- *
- *
- *
- * Return value: the separator
- **/
-gchar
-camel_store_get_separator (CamelStore *store, CamelException *ex)
-{
- return CS_CLASS(store)->get_separator (store, ex);
-}
-
-
-
-
-
-
-
static CamelFolder *
_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex)
{
diff --git a/camel/camel-store.h b/camel/camel-store.h
index d9ffb74b74..afcc308317 100644
--- a/camel/camel-store.h
+++ b/camel/camel-store.h
@@ -48,7 +48,6 @@ struct _CamelStore
{
CamelService parent_object;
- gchar separator;
};
@@ -56,10 +55,6 @@ struct _CamelStore
typedef struct {
CamelServiceClass parent_class;
- void (*set_separator) (CamelStore *store, gchar sep,
- CamelException *ex);
- gchar (*get_separator) (CamelStore *store,
- CamelException *ex);
CamelFolder * (*get_folder) (CamelStore *store,
const gchar *folder_name,
CamelException *ex);
@@ -77,7 +72,6 @@ typedef struct {
GtkType camel_store_get_type (void);
CamelFolder * camel_store_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex);
-gchar camel_store_get_separator (CamelStore *store, CamelException *ex);
#ifdef __cplusplus
}
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
index 593f5699eb..5b8d182838 100644
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ b/camel/providers/mbox/camel-mbox-folder.c
@@ -349,7 +349,6 @@ _set_name (CamelFolder *folder, const gchar *name, CamelException *ex)
const gchar *root_dir_path;
//gchar *full_name;
//const gchar *parent_full_name;
- gchar separator;
CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::set_name\n");
@@ -361,17 +360,15 @@ _set_name (CamelFolder *folder, const gchar *name, CamelException *ex)
g_free (mbox_folder->folder_dir_path);
g_free (mbox_folder->index_file_path);
- separator = camel_store_get_separator (folder->parent_store, ex);
root_dir_path = camel_mbox_store_get_toplevel_dir (CAMEL_MBOX_STORE(folder->parent_store));
CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::set_name full_name is %s\n", folder->full_name);
CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::set_name root_dir_path is %s\n", root_dir_path);
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::separator is %c\n", separator);
- mbox_folder->folder_file_path = g_strdup_printf ("%s%c%s", root_dir_path, separator, folder->full_name);
- mbox_folder->summary_file_path = g_strdup_printf ("%s%c%s-ev-summary", root_dir_path, separator, folder->full_name);
- mbox_folder->folder_dir_path = g_strdup_printf ("%s%c%s.sdb", root_dir_path, separator, folder->full_name);
- mbox_folder->index_file_path = g_strdup_printf ("%s%c%s.ibex", root_dir_path, separator, folder->full_name);
+ mbox_folder->folder_file_path = g_strdup_printf ("%s/%s", root_dir_path, folder->full_name);
+ mbox_folder->summary_file_path = g_strdup_printf ("%s/%s-ev-summary", root_dir_path, folder->full_name);
+ mbox_folder->folder_dir_path = g_strdup_printf ("%s/%s.sdb", root_dir_path, folder->full_name);
+ mbox_folder->index_file_path = g_strdup_printf ("%s/%s.ibex", root_dir_path, folder->full_name);
CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::set_name mbox_folder->folder_file_path is %s\n",
mbox_folder->folder_file_path);
diff --git a/camel/providers/mbox/camel-mbox-store.c b/camel/providers/mbox/camel-mbox-store.c
index 76ceed282a..d0eea3f996 100644
--- a/camel/providers/mbox/camel-mbox-store.c
+++ b/camel/providers/mbox/camel-mbox-store.c
@@ -52,10 +52,8 @@ camel_mbox_store_class_init (CamelMboxStoreClass *camel_mbox_store_class)
static void
camel_mbox_store_init (gpointer object, gpointer klass)
{
- CamelStore *store = CAMEL_STORE (object);
CamelService *service = CAMEL_SERVICE (object);
- store->separator = '/';
service->url_flags = CAMEL_SERVICE_URL_NEED_PATH;
}
@@ -112,8 +110,12 @@ _get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex)
new_mbox_folder = gtk_type_new (CAMEL_MBOX_FOLDER_TYPE);
new_folder = CAMEL_FOLDER (new_mbox_folder);
- CF_CLASS (new_folder)->init_with_store (new_folder, store, ex);
- CF_CLASS (new_folder)->set_name (new_folder, folder_name, ex);
+ /* XXX We shouldn't be passing NULL here, but it's equivalent to
+ * what was there before, and there's no
+ * CamelMboxFolder::get_subfolder yet anyway...
+ */
+ CF_CLASS (new_folder)->init (new_folder, store, NULL,
+ folder_name, '/', ex);
CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxStore::get_folder\n");