aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/vee
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-09-20 01:27:09 +0800
committerDan Winship <danw@src.gnome.org>2000-09-20 01:27:09 +0800
commit7dcc0325454ed6c71c2532befbb6aadb32391766 (patch)
tree744535557a2ab1e23278778ac464dcab718e03c1 /camel/providers/vee
parent053af645da6e5f74474d13c19ce73d236d9b76a9 (diff)
downloadgsoc2013-evolution-7dcc0325454ed6c71c2532befbb6aadb32391766.tar.gz
gsoc2013-evolution-7dcc0325454ed6c71c2532befbb6aadb32391766.tar.zst
gsoc2013-evolution-7dcc0325454ed6c71c2532befbb6aadb32391766.zip
Removed (camel_folder_init, camel_folder_construct): New object init
* camel-folder.c: (init): Removed (camel_folder_init, camel_folder_construct): New object init function and public object constructor to replace the old init method in a more Gtk-like fashion. (get_parent_folder, camel_folder_get_parent_folder): Removed. No CamelFolder subclass was ever setting the parent_folder member, no code has ever needed to look at it, and fixing it would actually be pretty hard. (get_subfolder_info, camel_folder_get_subfolder_info): Renamed from ..._names. Deals in CamelFolderInfo now. (free_subfolder_info, camel_folder_free_subfolder_info): Likewise. (get_subfolder, camel_folder_get_subfolder): Removed. CamelFolderInfo contains the subfolder's full name, so this is unnecessary now, and removing it lets us get rid of the CamelFolder separator member, which is needed for the default implementation of this function, but not otherwise needed for most providers. Also, lots of code style fixes. * providers/*: Update CamelFolder subclasses for changes, although none of them fill in the message counts in the CamelFolderInfo yet. svn path=/trunk/; revision=5503
Diffstat (limited to 'camel/providers/vee')
-rw-r--r--camel/providers/vee/camel-vee-folder.c105
-rw-r--r--camel/providers/vee/camel-vee-folder.h4
-rw-r--r--camel/providers/vee/camel-vee-store.c7
3 files changed, 55 insertions, 61 deletions
diff --git a/camel/providers/vee/camel-vee-folder.c b/camel/providers/vee/camel-vee-folder.c
index 26e6be2667..0be1f152d1 100644
--- a/camel/providers/vee/camel-vee-folder.c
+++ b/camel/providers/vee/camel-vee-folder.c
@@ -39,10 +39,6 @@ struct _CamelVeeFolderPrivate {
#define _PRIVATE(o) (((CamelVeeFolder *)(o))->priv)
-static void vee_init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar *separator, gboolean path_begins_with_sep,
- CamelException *ex);
static void vee_sync (CamelFolder *folder, gboolean expunge, CamelException *ex);
static GPtrArray *vee_get_uids (CamelFolder *folder);
@@ -95,7 +91,6 @@ camel_vee_folder_class_init (CamelVeeFolderClass *klass)
camel_vee_folder_parent = CAMEL_FOLDER_CLASS(camel_type_get_global_classfuncs (camel_folder_get_type ()));
- folder_class->init = vee_init;
folder_class->sync = vee_sync;
folder_class->get_uids = vee_get_uids;
@@ -120,8 +115,21 @@ static void
camel_vee_folder_init (CamelVeeFolder *obj)
{
struct _CamelVeeFolderPrivate *p;
+ CamelFolder *folder = (CamelFolder *)obj;
p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
+
+ folder->can_hold_messages = TRUE;
+ folder->can_hold_folders = FALSE;
+ folder->has_summary_capability = TRUE;
+ folder->has_search_capability = TRUE;
+
+ /* FIXME: what to do about user flags if the subfolder doesn't support them? */
+ folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
+ CAMEL_MESSAGE_DELETED |
+ CAMEL_MESSAGE_DRAFT |
+ CAMEL_MESSAGE_FLAGGED |
+ CAMEL_MESSAGE_SEEN;
}
static void
@@ -141,16 +149,49 @@ camel_vee_folder_finalise (CamelObject *obj)
/**
* camel_vee_folder_new:
+ * @parent_store: the parent CamelVeeStore
+ * @name: the vfolder name
+ * @ex: a CamelException
*
* Create a new CamelVeeFolder object.
- *
+ *
* Return value: A new CamelVeeFolder widget.
**/
-CamelVeeFolder *
-camel_vee_folder_new (void)
+CamelFolder *
+camel_vee_folder_new (CamelStore *parent_store, const char *name,
+ CamelException *ex)
{
- CamelVeeFolder *new = CAMEL_VEE_FOLDER ( camel_object_new (camel_vee_folder_get_type ()));
- return new;
+ CamelFolder *folder;
+ CamelVeeFolder *vf;
+ char *namepart, *searchpart;
+
+ folder = CAMEL_FOLDER (camel_object_new (camel_vee_folder_get_type()));
+ vf = (CamelVeeFolder *)folder;
+
+ camel_folder_construct (folder, parent_store, name, name);
+
+ namepart = g_strdup(name);
+ searchpart = strchr(namepart, '?');
+ if (searchpart == NULL) {
+ /* no search, no result! */
+ searchpart = "(body-contains \"=some-invalid_string-sequence=xx\")";
+ } else {
+ *searchpart++ = 0;
+ }
+
+ vf->messages = g_ptr_array_new();
+ vf->messages_uid = g_hash_table_new(g_str_hash, g_str_equal);
+
+ vf->expression = g_strdup(searchpart);
+ vf->vname = namepart;
+
+ vee_folder_build(vf, ex);
+ if (camel_exception_is_set (ex)) {
+ camel_object_unref (CAMEL_OBJECT (folder));
+ return NULL;
+ }
+
+ return folder;
}
static void
@@ -211,50 +252,6 @@ camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub)
}
-static void vee_init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar *separator, gboolean path_begins_with_sep,
- CamelException *ex)
-{
- CamelVeeFolder *vf = (CamelVeeFolder *)folder;
- char *namepart, *searchpart;
-
- namepart = g_strdup(name);
- searchpart = strchr(namepart, '?');
- if (searchpart == NULL) {
- /* no search, no result! */
- searchpart = "(body-contains \"=some-invalid_string-sequence=xx\")";
- } else {
- *searchpart++ = 0;
- }
-
- camel_vee_folder_parent->init (folder, parent_store, parent_folder, name, separator, TRUE, ex);
- if (camel_exception_get_id (ex))
- return;
-
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = FALSE;
- folder->has_summary_capability = TRUE;
- folder->has_search_capability = TRUE;
-
- /* FIXME: what to do about user flags if the subfolder doesn't support them? */
- folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
- CAMEL_MESSAGE_DELETED |
- CAMEL_MESSAGE_DRAFT |
- CAMEL_MESSAGE_FLAGGED |
- CAMEL_MESSAGE_SEEN;
-
- vf->messages = g_ptr_array_new();
- vf->messages_uid = g_hash_table_new(g_str_hash, g_str_equal);
-
- vf->expression = g_strdup_printf("(or\n (match-all (user-flag \"%s\"))\n %s\n)", namepart, searchpart);
- vf->vname = g_strdup(namepart);
-
- g_free(namepart);
-
- vee_folder_build(vf, ex);
-}
-
static void
vee_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
{
diff --git a/camel/providers/vee/camel-vee-folder.h b/camel/providers/vee/camel-vee-folder.h
index 6f7c788125..2263854912 100644
--- a/camel/providers/vee/camel-vee-folder.h
+++ b/camel/providers/vee/camel-vee-folder.h
@@ -50,7 +50,9 @@ struct _CamelVeeFolderClass {
};
guint camel_vee_folder_get_type (void);
-CamelVeeFolder *camel_vee_folder_new (void);
+CamelFolder *camel_vee_folder_new (CamelStore *parent_store,
+ const char *name,
+ CamelException *ex);
void camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub);
diff --git a/camel/providers/vee/camel-vee-store.c b/camel/providers/vee/camel-vee-store.c
index 8be8298b2c..201c4b1fd8 100644
--- a/camel/providers/vee/camel-vee-store.c
+++ b/camel/providers/vee/camel-vee-store.c
@@ -91,12 +91,7 @@ camel_vee_store_new (void)
static CamelFolder *
vee_get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelException *ex)
{
- CamelFolder *folder;
-
- folder = CAMEL_FOLDER (camel_object_new (camel_vee_folder_get_type()));
-
- ((CamelFolderClass *)(CAMEL_OBJECT_GET_CLASS(folder)))->init (folder, store, NULL, folder_name, "/", TRUE, ex);
- return folder;
+ return camel_vee_folder_new (store, folder_name, ex);
}
static char *