diff options
author | bertrand <Bertrand.Guiheneuf@aful.org> | 1999-09-05 03:33:31 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-09-05 03:33:31 +0800 |
commit | 0fe7101224105602a18e63eb83af4611648c9d91 (patch) | |
tree | 00aeef71b3dbbca082ddd4039ba1d55359805afe | |
parent | eb1b10897020045933caaca7920f3550b75c13b5 (diff) | |
download | gsoc2013-evolution-0fe7101224105602a18e63eb83af4611648c9d91.tar gsoc2013-evolution-0fe7101224105602a18e63eb83af4611648c9d91.tar.gz gsoc2013-evolution-0fe7101224105602a18e63eb83af4611648c9d91.tar.bz2 gsoc2013-evolution-0fe7101224105602a18e63eb83af4611648c9d91.tar.lz gsoc2013-evolution-0fe7101224105602a18e63eb83af4611648c9d91.tar.xz gsoc2013-evolution-0fe7101224105602a18e63eb83af4611648c9d91.tar.zst gsoc2013-evolution-0fe7101224105602a18e63eb83af4611648c9d91.zip |
started summary implementation. (_open): correct use of open.
1999-09-04 bertrand <Bertrand.Guiheneuf@aful.org>
* camel/providers/MH/camel-mh-folder.c (_create_summary):
started summary implementation.
(_open): correct use of open.
* camel/camel-folder.c (camel_folder_get_summary):
get folder associated summary object.
svn path=/trunk/; revision=1177
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | camel/camel-folder-summary.c | 12 | ||||
-rw-r--r-- | camel/camel-folder-summary.h | 1 | ||||
-rw-r--r-- | camel/camel-folder.c | 6 | ||||
-rw-r--r-- | camel/camel-folder.h | 2 | ||||
-rw-r--r-- | camel/providers/MH/camel-mh-folder.c | 88 |
6 files changed, 94 insertions, 25 deletions
@@ -1,5 +1,15 @@ 1999-09-04 bertrand <Bertrand.Guiheneuf@aful.org> + * camel/providers/MH/camel-mh-folder.c (_create_summary): + started summary implementation. + (_open): correct use of open. + + * camel/camel-folder.c (camel_folder_get_summary): + get folder associated summary object. + + * camel/Makefile.am: + added summary files build + * camel/camel-folder-summary.[ch]: basic summary framework diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index f0a3225ca1..a9f6f0cfa0 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -59,9 +59,11 @@ camel_folder_summary_class_init (CamelFolderSummaryClass *camel_folder_summary_c static void camel_folder_summary_init (gpointer object, gpointer klass) { - CamelFolderSummary *camel_folder_summary = CAMEL_FOLDER_SUMMARY (object); + CamelFolderSummary *summary = CAMEL_FOLDER_SUMMARY (object); CAMEL_LOG_FULL_DEBUG ( "camel_folder_summary_init:: Entering\n"); + summary->subfolder_info_list = NULL; + summary->message_info_list = NULL; CAMEL_LOG_FULL_DEBUG ( "camel_folder_summary_init:: Leaving\n"); } @@ -99,12 +101,18 @@ _finalize (GtkObject *object) CAMEL_LOG_FULL_DEBUG ("Entering CamelFolderSummary::finalize\n"); CAMEL_LOG_FULL_DEBUG ("CamelFolderSummary::finalize, finalizing object %p\n", object); - + parent_class->finalize (object); CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolderSummary::finalize\n"); } +CamelFolderSummary * +camel_folder_summary_new () +{ + return gtk_type_new (CAMEL_FOLDER_SUMMARY_TYPE); +} + static const GList * _get_subfolder_info_list (CamelFolderSummary *summary) { diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h index ded09e739c..293dbdb637 100644 --- a/camel/camel-folder-summary.h +++ b/camel/camel-folder-summary.h @@ -86,6 +86,7 @@ GtkType camel_folder_summary_get_type (void); /* public methods */ +CamelFolderSummary *camel_folder_summary_new (); const GList *camel_folder_summary_get_subfolder_info_list (CamelFolderSummary *summary); const GList *camel_folder_summary_get_message_info_list (CamelFolderSummary *summary); diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 00966a4bf5..49c886dc98 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -971,3 +971,9 @@ camel_folder_has_summary_capability (CamelFolder *folder) return folder->has_summary_capability; } + +const CamelFolderSummary * +camel_folder_get_summary (CamelFolder *folder) +{ + return folder->summary; +} diff --git a/camel/camel-folder.h b/camel/camel-folder.h index e9a4b6a49e..4554cb4b0c 100644 --- a/camel/camel-folder.h +++ b/camel/camel-folder.h @@ -37,6 +37,7 @@ typedef struct _CamelFolder CamelFolder; #include "camel-store.h" #include "camel-mime-message.h" +#include "camel-folder-summary.h" #define CAMEL_FOLDER_TYPE (camel_folder_get_type ()) #define CAMEL_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_FOLDER_TYPE, CamelFolder)) @@ -71,6 +72,7 @@ struct _CamelFolder CamelFolder *parent_folder; GList *permanent_flags; gboolean has_summary_capability; + CamelFolderSummary *summary; GList *message_list; diff --git a/camel/providers/MH/camel-mh-folder.c b/camel/providers/MH/camel-mh-folder.c index 5bab2b6da7..300d8366d3 100644 --- a/camel/providers/MH/camel-mh-folder.c +++ b/camel/providers/MH/camel-mh-folder.c @@ -36,6 +36,7 @@ #include "camel-log.h" #include "camel-stream-fs.h" #include "camel-stream-buffered-fs.h" +#include "camel-folder-summary.h" static CamelFolderClass *parent_class=NULL; @@ -58,6 +59,7 @@ static gint _get_message_count (CamelFolder *folder); static gint _append_message (CamelFolder *folder, CamelMimeMessage *message); static void _expunge (CamelFolder *folder); static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder); +static void _open (CamelFolder *folder, CamelFolderOpenMode mode); static gboolean _is_a_message_file (const gchar *file_name, const gchar *file_path); @@ -81,6 +83,7 @@ camel_mh_folder_class_init (CamelMhFolderClass *camel_mh_folder_class) camel_folder_class->append_message = _append_message; camel_folder_class->expunge = _expunge; camel_folder_class->copy_message_to = _copy_message_to; + camel_folder_class->open = _open; } @@ -116,6 +119,16 @@ camel_mh_folder_get_type (void) +static gint +_message_name_compare (gconstpointer a, gconstpointer b) +{ + gchar *m1 = (gchar *)a; + gchar *m2 = (gchar *)b; + gint len_diff; + + return (atoi (m1) - atoi (m2)); +} + static void _init_with_store (CamelFolder *folder, CamelStore *parent_store) @@ -125,18 +138,62 @@ _init_with_store (CamelFolder *folder, CamelStore *parent_store) folder->can_hold_messages = TRUE; folder->can_hold_folders = TRUE; + folder->has_summary_capability = TRUE; + + folder->summary = camel_folder_summary_new (); } +static void +_create_summary (CamelFolder *folder) +{ + CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder); + CamelMessageInfo *message_info; + CamelFolderSummary *subfolder_info; -static gint -_message_name_compare (gconstpointer a, gconstpointer b) + GList *file_list = mh_folder->file_name_list; + gchar *filename; + + while (file_list) { + + filename = (gchar *)(file_list->data); + message_info = g_new0 (CamelMessageInfo, 1); + message_info->subject = NULL; + + file_list = file_list->next; + } +} + + + +static void +_open (CamelFolder *folder, CamelFolderOpenMode mode) { - gchar *m1 = (gchar *)a; - gchar *m2 = (gchar *)b; - gint len_diff; + CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder); + struct dirent *dir_entry; + DIR *dir_handle; - return (atoi (m1) - atoi (m2)); + if (folder->open_state == FOLDER_OPEN) return; + + + /* create message list */ + /* read the whole folder and sort message names */ + dir_handle = opendir (mh_folder->directory_path); + /* read first entry in the directory */ + dir_entry = readdir (dir_handle); + while (dir_entry != NULL) { + /* tests if the entry correspond to a message file */ + if (_is_a_message_file (dir_entry->d_name, mh_folder->directory_path)) + /* add the file name to the list */ + mh_folder->file_name_list = g_list_insert_sorted (mh_folder->file_name_list, + g_strdup (dir_entry->d_name), + _message_name_compare); + /* read next entry */ + dir_entry = readdir (dir_handle); + } + + closedir (dir_handle); + } /** @@ -155,8 +212,6 @@ _set_name (CamelFolder *folder, const gchar *name) gchar *full_name; const gchar *parent_full_name; gchar separator; - struct dirent *dir_entry; - DIR *dir_handle; CAMEL_LOG_FULL_DEBUG ("Entering CamelMhFolder::set_name\n"); g_assert(folder); @@ -179,21 +234,6 @@ _set_name (CamelFolder *folder, const gchar *name) if (!camel_folder_exists (folder)) return; - /* create message list */ - /* read the whole folder and sort message names */ - dir_handle = opendir (mh_folder->directory_path); - /* read first entry in the directory */ - dir_entry = readdir (dir_handle); - while (dir_entry != NULL) { - /* tests if the entry correspond to a message file */ - if (_is_a_message_file (dir_entry->d_name, mh_folder->directory_path)) - mh_folder->file_name_list = g_list_insert_sorted (mh_folder->file_name_list, g_strdup (dir_entry->d_name), - _message_name_compare); - /* read next entry */ - dir_entry = readdir (dir_handle); - } - - closedir (dir_handle); CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::set_name mh_folder->directory_path is %s\n", mh_folder->directory_path); @@ -660,6 +700,8 @@ _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *d + + /************************************************************************/ /*** Took directly from GNU fileutils-4.0 ***/ |