0.9.9claws37
authorChristoph Hohmann <reboot@gmx.ch>
Tue, 2 Mar 2004 21:43:16 +0000 (21:43 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Tue, 2 Mar 2004 21:43:16 +0000 (21:43 +0000)
* src/folder.[ch]
        o add more documentation for FolderClass
        o remove usused FolderClass virtual functions

* src/imap.c
* src/mh.c
* src/news.c
        change creation of FolderClass because static initializations
        for structs suck in C89

ChangeLog.claws
configure.ac
src/folder.c
src/folder.h
src/imap.c
src/mh.c
src/news.c

index aebbeaaa6f732b88dcada4d861a9c36a9ca42752..163f0ab8cfaa80033d0c76187a470d0c39800cc6 100644 (file)
@@ -1,3 +1,15 @@
+2004-03-02 [christoph]         0.9.9claws37
+
+       * src/folder.[ch]
+               o add more documentation for FolderClass
+               o remove usused FolderClass virtual functions
+
+       * src/imap.c
+       * src/mh.c
+       * src/news.c
+               change creation of FolderClass because static initializations
+               for structs suck in C89
+
 2004-03-01 [paul]
 
        * sync with 0.9.10
                fix crash when installing wrong theme and output an
                error message
 
-2003-02-15 [christoph] 0.9.9claws16
+2003-02-16 [christoph] 0.9.9claws16
 
        * src/compose.c
        * src/stock_pixmap.[ch]
index 58382375c140450a745526b8f125db250b50253c..991f1614c2966f912baf2970972c2efab3b38e54 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=9
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=36
+EXTRA_VERSION=37
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index 6a6588186a4b5d76e96137d464571b1381e44cda..e54d78faa1ea6f29da23aab2aaa494350ba8be47 100644 (file)
@@ -2405,9 +2405,6 @@ static gint do_copy_msgs(FolderItem *dest, GSList *msglist, gboolean remove_sour
                }
        }
 
-       if (folder->klass->finished_copy)
-               folder->klass->finished_copy(folder, dest);
-
        g_relation_destroy(relation);
        return lastnum;
 }
@@ -2541,9 +2538,6 @@ gint folder_item_remove_all_msg(FolderItem *item)
        result = folder->klass->remove_all_msg(folder, item);
 
        if (result == 0) {
-               if (folder->klass->finished_remove)
-                       folder->klass->finished_remove(folder, item);
-
                folder_item_free_cache(item);
                item->cache = msgcache_new();
 
index a5a08e46e01d693ec388d1f604fe4ae7208dd9ed..7cea6aff8a04a6fc4d3a83ec62ea3f64824cb555 100644 (file)
@@ -1,3 +1,5 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
  * Copyright (C) 1999-2003 Hiroyuki Yamamoto
@@ -172,103 +174,285 @@ struct _FolderClass
 
        /* Folder funtions */
        /**
-        * Create a new Folder of this FolderClass
+        * Create a new \c Folder of this \c FolderClass.
         *
-        * \param name Name of the new Folder
-        * \param path Path of the new Folder
-        * \return The new Folder, or NULL when creating the Folder failed
+        * \param name The name of the new Folder
+        * \param path The path of the new Folder
+        * \return The new \c Folder, or \c NULL when creating the \c Folder 
+        *         failed
         */
        Folder          *(*new_folder)          (const gchar    *name,
                                                 const gchar    *path);
        /**
-        * Destroy a Folder of this FolderClass, frees all resources allocated by
-         * the Folder
+        * Destroy a \c Folder of this \c FolderClass, frees all resources
+        * allocated by the Folder
         *
-        * \param folder The folder that should be destroyed.
+        * \param folder The \c Folder that should be destroyed.
         */
        void            (*destroy_folder)       (Folder         *folder);
        /**
-        * Set the Folder's internal settings from an XMLTag. Also sets the
-        * parameters of the root-FolderItem of the Folder. If NULL
-        * the default function of the basic FolderClass is used, so it
-        * must not be NULL if one of the parent FolderClasses has a set_xml
-        * function. In that case the parent FolderClass' set_xml function
-        * can be used or it has to be called with the Folder and XMLTag by
+        * Set the Folder's internal attributes from an \c XMLTag. Also sets the
+        * parameters of the root-FolderItem of the \c Folder. If \c NULL
+        * the default function of the basic \ยข FolderClass is used, so it
+        * must not be \c NULL if one of the parent \c FolderClasses has a \c set_xml
+        * function. In that case the parent \c FolderClass' \c set_xml function
+        * can be used or it has to be called with the \c folder and \c tag by
         * the implementation.
         *
-        * \param folder The Folder which's settings should be updated
-        * \param tag The XMLTag containing the settings attributes
+        * \param folder The \c Folder which's attributes should be updated
+        * \param tag The \c XMLTag containing the \c XMLAttrs for the attributes
         */
        void             (*set_xml)             (Folder         *folder,
                                                 XMLTag         *tag);
        /**
-        * Get an \c XMLTag for the settings of the Folder and the root-FolderItem
-        * of the Folder. If \c NULL the default implementation for the basic
-        * FolderClass will be used, so it must not be NULL if one of the
+        * Get an \c XMLTag for the attributes of the \c Folder and the root-FolderItem
+        * of the \c Folder. If \c NULL the default implementation for the basic
+        * FolderClass will be used, so it must not be \c NULL if one of the
         * parent \c FolderClasses has it's own implementation for \c get_xml.
         * In that case the parent FolderClass' \c get_xml function can be
         * used or the \c XMLTag has to be fetched from the parent's \c get_xml
         * function and then the \c FolderClass specific attributes can be
         * added to it.
         *
-        * \param Folder The \c Folder which's settings should be set in the
-        *               \c XMLTag's attributes
-        * \return XMLTag An \c XMLTag with attibutes containing the \c Folder's
-        *                settings.
+        * \param Folder The \c Folder which's attributes should be set in the
+        *               \c XMLTag's \c XMLAttrs
+        * \return XMLTag An \c XMLTag with \c XMLAttrs containing the \c Folder's
+        *                attributes.
         */
        XMLTag          *(*get_xml)             (Folder         *folder);
+       /**
+        * Rebuild the folder tree from the folder's data
+        * \todo New implementations of MH and IMAP are actually syncronizing
+        *       the tree with the folder by reusing the old \c FolderItems.
+        *       Claws still destroys the old tree before calling this function.
+        *
+        * \param folder The folder which's tree should be rebuild
+        * \return 0 on success, a negative number otherwise
+        */
        gint            (*scan_tree)            (Folder         *folder);
 
        gint            (*create_tree)          (Folder         *folder);
 
        /* FolderItem functions */
+       /**
+        * Create a new \c FolderItem structure for the \c FolderClass.
+        * \c FolderClasses can have their own \c FolderItem structure with
+        * extra attributes.
+        *
+        * \param folder The \c Folder for that a \c FolderItem should be
+        *               created
+        * \return The new \c FolderItem or NULL in case of an error
+        */
        FolderItem      *(*item_new)            (Folder         *folder);
+       /**
+        * Destroy a \c FolderItem from this \c FolderClass. The \c FolderClass
+        * has to free all private resources used by the \c FolderItem.
+        *
+        * \param folder The \c Folder of the \c FolderItem
+        * \param item The \c FolderItem that should be destroyed
+        */
        void             (*item_destroy)        (Folder         *folder,
                                                 FolderItem     *item);
+       /**
+        * Set the \c FolderItem's internal attributes from an \c XMLTag. If
+        * \c NULL the default function of the basic \c FolderClass is used, so it
+        * must not be \c NULL if one of the parent \c FolderClasses has a \c item_set_xml
+        * function. In that case the parent \c FolderClass' \c item_set_xml function
+        * can be used or it has to be called with the \c folder, \c item and \c tag by
+        * the implementation.
+        *
+        * \param folder The \c Folder of the \c FolderItem
+        * \param item The \c FolderItems which's attributes should be set
+        * \param tag The \c XMLTag with \c XMLAttrs for the \c FolderItem's
+        *            attributes
+        */
        void             (*item_set_xml)        (Folder         *folder,
                                                 FolderItem     *item,
                                                 XMLTag         *tag);
+       /**
+        * Get an \c XMLTag for the attributes of the \c FolderItem If \c NULL
+        * the default implementation for the basic \c FolderClass will be used,
+        * so it must not be \c NULL if one of the parent \c FolderClasses has
+        * it's own implementation for \c item_get_xml. In that case the parent 
+        * FolderClass' \c item_get_xml function can be used or the \c XMLTag
+        * has to be fetched from the parent's \c item_get_xml function and 
+        * then the \c FolderClass specific attributes can be added to it.
+        *
+        * \param folder The \c Folder of the \c FolderItem
+        * \parem item The \c FolderItem which's attributes should be set in
+        *             the \c XMLTag's \c XMLAttrs
+        * \return An \c XMLTag with \c XMLAttrs containing the \c FolderItem's
+        *         attributes.
+        */
        XMLTag          *(*item_get_xml)        (Folder         *folder,
                                                 FolderItem     *item);
+       /**
+        * Get a local path for the \c FolderItem where Sylpheed can save
+        * it's cache data. For local directory based folders this can be the
+        * real path. For other folders it can be the local cache directory.
+        *
+        * \param folder The \c Folder of the \c FolderItem
+        * \param item The \c FolderItem for that a path should be returned
+        * \return A path for the \c FolderItem
+        */
        gchar           *(*item_get_path)       (Folder         *folder,
                                                 FolderItem     *item);
+       /**
+        * Create a new \c FolderItem. The function must use folder_item_append
+        * to add the new \c FolderItem to the folder tree
+        *
+        * \param folder The \c Folder in which a new \c FolderItem should be
+        *               created
+        * \param parent \c The parent \c FolderItem for the new \c FolderItem
+        * \parem name The name for the new \c FolderItem
+        * \return The new \c FolderItem
+        */
        FolderItem      *(*create_folder)       (Folder         *folder,
                                                 FolderItem     *parent,
                                                 const gchar    *name);
+       /**
+        * Rename a \c FolderItem
+        *
+        * \param folder The \c Folder of the \c FolderItem that should be
+        *               renamed
+        * \param item The \c FolderItem that should be renamed
+        * \param name The new name of the \c FolderItem
+        * \return 0 on success, a negative number otherwise
+        */
        gint             (*rename_folder)       (Folder         *folder,
                                                 FolderItem     *item,
                                                 const gchar    *name);
+       /**
+        * Remove a \c FolderItem from the \c Folder
+        *
+        * \param folder The \c Folder that contains the \c FolderItem
+        * \param item The \c FolderItem that should be removed
+        * \return 0 on sucess, a negative number otherwise
+        */
        gint             (*remove_folder)       (Folder         *folder,
                                                 FolderItem     *item);
+       /**
+        * Close a \c FolderItem. Called when the user deselects a
+        * \c FolderItem.
+        * 
+        * \attention In Sylpheed-Main operations can only be done on the
+        *            \c FolderItem that is opened in the SummaryView. This
+        *            \c FolderItem will be closed when you select a new
+        *            \c FolderItem in the FolderView. In Claws operations can
+        *            be done any time on any folder and you should not expect
+        *            that all \c FolderItems get closed after operations
+        *
+        * \param folder The \c Folder that contains the \c FolderItem
+        * \param item The \c FolderItem that should be closed
+        * \return 0 on success, a negative number otherwise
+        */
        gint             (*close)               (Folder         *folder,
                                                 FolderItem     *item);
+       /**
+        * Get the list of message numbers for the messages in the \c FolderItem
+        *
+        * \param folder The \c Folder that contains the \c FolderItem
+        * \param item The \c FolderItem for which the message numbers should
+        *             be fetched
+        * \param list Pointer to a GSList where message numbers have to be
+        *             added. Because of the implementation of the GSList that
+        *             changes the pointer of the GSList itself when the first
+        *             item is added this is a pointer to a pointer to a
+        *             GSList structure. Use *item = g_slist_...(*item, ...)
+        *             operations to modify the list.
+        * \param old_uids_valid In some \c Folders the old UIDs can be invalid.
+        *                       Set this pointer to a gboolean to TRUE if the
+        *                       old UIDs are still valid, otherwise set it to
+        *                       FALSE and the folder system will discard it's
+        *                       cache data of the previously know UIDs
+        * \return The number of message numbers add to the list on success,
+        *         a negative number otherwise.
+        */
        gint             (*get_num_list)        (Folder         *folder,
                                                 FolderItem     *item,
                                                 GSList        **list,
                                                 gboolean       *old_uids_valid);
-       void            (*update_mark)          (Folder         *folder,
-                                                FolderItem     *item);
-       void            (*finished_copy)        (Folder         *folder,
-                                                FolderItem     *item);
-       void            (*finished_remove)      (Folder         *folder,
-                                                FolderItem     *item);
+       /**
+        * Tell the folder system if a \c FolderItem should be scanned
+        * (cache data syncronized with the folder content) when it is required
+        * because the \c FolderItem's content changed. If NULL the folder
+        * system will not do automatic scanning of \c FolderItems
+        *
+        * \param folder The \c Folder that contains the \c FolderItem
+        * \param item The \c FolderItem which's content should be checked
+        * \return TRUE if the \c FolderItem should be scanned, FALSE otherwise
+        */
        gboolean        (*scan_required)        (Folder         *folder,
                                                 FolderItem     *item);
 
        /* Message functions */
+       /**
+        * Get a MsgInfo for a message in a \c FolderItem
+        *
+        * \param folder The \c Folder containing the message
+        * \param item The \c FolderItem containing the message
+        * \param num The message number of the message
+        * \return A pointer to a \c MsgInfo decribing the message or \c 
+        *         NULL in case of an error
+        */
        MsgInfo         *(*get_msginfo)         (Folder         *folder,
                                                 FolderItem     *item,
                                                 gint            num);
-       GSList          *(*get_msginfos)        (Folder         *folder,
+       /**
+        * Get \c MsgInfos for a list of message numbers
+        *
+        * \param folder The \c Folder containing the message
+        * \param item The \c FolderItem containing the message
+        * \param msgnum_list A list of message numbers for which the
+        *                    \c MsgInfos should be fetched
+        * \return A list of \c MsgInfos for the messages in the \c msgnum_list
+        *         that really exist. Messages that are not found can simply
+        *         be left out.
+        */
+       MsgInfoList     *(*get_msginfos)        (Folder         *folder,
                                                 FolderItem     *item,
                                                 MsgNumberList  *msgnum_list);
+       /**
+        * Get the filename for a message. This can either be the real message
+        * file for local folders or a temporary file for remote folders.
+        *
+        * \param folder The \c Folder containing the message
+        * \param item The \c FolderItem containing the message
+        * \param num The message number of the message
+        * \return A string with the filename of the message file. The returned
+        *         string has to be freed with \c g_free(). If message is not
+        *         available return NULL.
+        */
        gchar           *(*fetch_msg)           (Folder         *folder,
                                                 FolderItem     *item,
                                                 gint            num);
+       /**
+        * Add a single message file to a folder with the given flags (if
+        * flag handling is supported by the folder)
+        *
+        * \param folder The target \c Folder for the message
+        * \param dest the target \c FolderItem for the message
+        * \param file The file that contains the message
+        * \param flags The flags the new message should have in the folder
+        * \return 0 on success, a negative number otherwise
+        */
        gint            (*add_msg)              (Folder         *folder,
                                                 FolderItem     *dest,
                                                 const gchar    *file,
                                                 MsgFlags       *flags);
+       /**
+        * Add multiple messages to a \c FolderItem. If NULL the folder
+        * system will add messages with \c add_msg one by one
+        *
+        * \param folder The target \c Folder for the messages
+        * \param dest the target \c FolderItem for the messages
+        * \param file_list A list of \c MsgFileInfos which contain the
+        *                  filenames and flags for the new messages
+        * \param relation Insert tuples of (MsgFileInfo, new message number) to
+        *                 provide feedback for the folder system which new
+        *                 message number a \c MsgFileInfo got in dest. Insert
+        *                 0 if the new message number is unknown.
+        */
        gint            (*add_msgs)             (Folder         *folder,
                                                 FolderItem     *dest,
                                                 GSList         *file_list,
@@ -288,27 +472,50 @@ struct _FolderClass
                                                 FolderItem     *dest,
                                                 MsgInfo        *msginfo);
        /**
-        * Copy multiple messages to a \c FolderItem. If \c NULL the folder system
-        * will use \c copy_msg to copy messages one by one.
+        * Copy multiple messages to a \c FolderItem. If \c NULL the folder
+        * system will use \c copy_msg to copy messages one by one.
         *
         * \param folder The \c Folder of the destination FolderItem
         * \param dest The destination \c FolderItem for the message
         * \param msglist A list of \c MsgInfos which should be copied to dest
         * \param relation Insert tuples of (MsgInfo, new message number) to
         *                 provide feedback for the folder system which new
-        *                 message number a \c MsgInfo has got in dest. Insert
-        *                 0 for the message number of unknown.
+        *                 message number a \c MsgInfo got in dest. Insert
+        *                 0 if the new message number is unknown.
         * \return 0 on success, a negative number otherwise
         */
        gint            (*copy_msgs)            (Folder         *folder,
                                                 FolderItem     *dest,
                                                 MsgInfoList    *msglist,
                                                 GRelation      *relation);
+       /**
+        * Remove a message from a \c FolderItem.
+        *
+        * \param folder The \c Folder of the message
+        * \param item The \c FolderItem containing the message
+        * \param num The message number of the message
+        * \return 0 on success, a negative number otherwise
+        */
        gint            (*remove_msg)           (Folder         *folder,
                                                 FolderItem     *item,
                                                 gint            num);
+       /**
+        * Remove all messages in a \ c FolderItem
+        *
+        * \param folder The \c Folder of the \c FolderItem
+        * \param item The \FolderItem which's messages should be deleted
+        * \return 0 on succes, a negative number otherwise
+        */
        gint            (*remove_all_msg)       (Folder         *folder,
                                                 FolderItem     *item);
+       /**
+        * Check if a message has been modified by someone else
+        *
+        * \param folder The \c Folder of the message
+        * \param item The \c FolderItem containing the message
+        * \param msginfo The \c MsgInfo for the message that should be checked
+        * \return \c TRUE if the message was modified, \c FALSE otherwise
+        */
        gboolean        (*is_msg_changed)       (Folder         *folder,
                                                 FolderItem     *item,
                                                 MsgInfo        *msginfo);
index 6e0fe80a9b5e53589bb596071471e2aa31fcc2ed..8a03969daa225556b343c86d7bcb3832738f252f 100644 (file)
@@ -440,52 +440,46 @@ static gchar *imap_folder_get_path                (Folder         *folder);
 static gchar *imap_item_get_path               (Folder         *folder,
                                                 FolderItem     *item);
 
-static FolderClass imap_class =
-{
-       F_IMAP,
-       "imap",
-       "IMAP4",
-
-       /* Folder functions */
-       imap_folder_new,
-       imap_folder_destroy,
-       NULL,
-       NULL,
-       imap_scan_tree,
-       imap_create_tree,
-
-       /* FolderItem functions */
-       imap_folder_item_new,
-       imap_folder_item_destroy,
-       NULL,
-       NULL,
-       imap_item_get_path,
-       imap_create_folder,
-       imap_rename_folder,
-       imap_remove_folder,
-       imap_close,
-       imap_get_num_list,
-       NULL,
-       NULL,
-       NULL,
-       imap_scan_required,
-
-       /* Message functions */
-       imap_get_msginfo,
-       imap_get_msginfos,
-       imap_fetch_msg,
-       imap_add_msg,
-       imap_add_msgs,
-       imap_copy_msg,
-       imap_copy_msgs,
-       imap_remove_msg,
-       imap_remove_all_msg,
-       imap_is_msg_changed,
-       imap_change_flags,
-};
+static FolderClass imap_class;
 
 FolderClass *imap_get_class(void)
 {
+       if (imap_class.idstr == NULL) {
+               imap_class.type = F_IMAP;
+               imap_class.idstr = "imap";
+               imap_class.uistr = "IMAP4";
+
+               /* Folder functions */
+               imap_class.new_folder = imap_folder_new;
+               imap_class.destroy_folder = imap_folder_destroy;
+               imap_class.scan_tree = imap_scan_tree;
+               imap_class.create_tree = imap_create_tree;
+
+               /* FolderItem functions */
+               imap_class.item_new = imap_folder_item_new;
+               imap_class.item_destroy = imap_folder_item_destroy;
+               imap_class.item_get_path = imap_item_get_path;
+               imap_class.create_folder = imap_create_folder;
+               imap_class.rename_folder = imap_rename_folder;
+               imap_class.remove_folder = imap_remove_folder;
+               imap_class.close = imap_close;
+               imap_class.get_num_list = imap_get_num_list;
+               imap_class.scan_required = imap_scan_required;
+
+               /* Message functions */
+               imap_class.get_msginfo = imap_get_msginfo;
+               imap_class.get_msginfos = imap_get_msginfos;
+               imap_class.fetch_msg = imap_fetch_msg;
+               imap_class.add_msg = imap_add_msg;
+               imap_class.add_msgs = imap_add_msgs;
+               imap_class.copy_msg = imap_copy_msg;
+               imap_class.copy_msgs = imap_copy_msgs;
+               imap_class.remove_msg = imap_remove_msg;
+               imap_class.remove_all_msg = imap_remove_all_msg;
+               imap_class.is_msg_changed = imap_is_msg_changed;
+               imap_class.change_flags = imap_change_flags;
+       }
+       
        return &imap_class;
 }
 
index 4ff99775f273e328d65c3745c980e14da04b244f..c9dd9201ededd9b39df469b888fe5476d6f189f6 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -104,52 +104,41 @@ static gboolean mh_rename_folder_func             (GNode          *node,
 static gchar   *mh_item_get_path               (Folder *folder, 
                                                 FolderItem *item);
 
-static FolderClass mh_class =
-{
-       F_MH,
-       "mh",
-       "MH",
-
-       /* Folder functions */
-       mh_folder_new,
-       mh_folder_destroy,
-       folder_local_set_xml,
-       folder_local_get_xml,
-       mh_scan_tree,
-       mh_create_tree,
-
-       /* FolderItem functions */
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       mh_item_get_path,
-       mh_create_folder,
-       mh_rename_folder,
-       mh_remove_folder,
-       NULL,
-       mh_get_num_list,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       
-       /* Message functions */
-       mh_get_msginfo,
-       NULL,
-       mh_fetch_msg,
-       mh_add_msg,
-       mh_add_msgs,
-       mh_copy_msg,
-       NULL,
-       mh_remove_msg,
-       mh_remove_all_msg,
-       mh_is_msg_changed,
-       NULL,
-};
+static FolderClass mh_class;
 
 FolderClass *mh_get_class(void)
 {
+       if (mh_class.idstr == NULL) {
+               mh_class.type = F_MH;
+               mh_class.idstr = "mh";
+               mh_class.uistr = "MH";
+               
+               /* Folder functions */
+               mh_class.new_folder = mh_folder_new;
+               mh_class.destroy_folder = mh_folder_destroy;
+               mh_class.set_xml = folder_local_set_xml;
+               mh_class.get_xml = folder_local_get_xml;
+               mh_class.scan_tree = mh_scan_tree;
+               mh_class.create_tree = mh_create_tree;
+
+               /* FolderItem functions */
+               mh_class.item_get_path = mh_item_get_path;
+               mh_class.create_folder = mh_create_folder;
+               mh_class.rename_folder = mh_rename_folder;
+               mh_class.remove_folder = mh_remove_folder;
+               mh_class.get_num_list = mh_get_num_list;
+               
+               /* Message functions */
+               mh_class.get_msginfo = mh_get_msginfo;
+               mh_class.fetch_msg = mh_fetch_msg;
+               mh_class.add_msg = mh_add_msg;
+               mh_class.add_msgs = mh_add_msgs;
+               mh_class.copy_msg = mh_copy_msg;
+               mh_class.remove_msg = mh_remove_msg;
+               mh_class.remove_all_msg = mh_remove_all_msg;
+               mh_class.is_msg_changed = mh_is_msg_changed;
+       }
+
        return &mh_class;
 }
 
index 910188bdafb0f90b0b107f0a4952bb7c00c89097..7a4eceba2afc8183a6287099db70bc9c2071ab19 100644 (file)
@@ -130,52 +130,30 @@ static gchar *news_folder_get_path         (Folder        *folder);
 gchar *news_item_get_path               (Folder        *folder,
                                          FolderItem    *item);
 
-static FolderClass news_class =
-{
-       F_NEWS,
-       "news",
-       "News",
-
-       /* Folder functions */
-       news_folder_new,
-       news_folder_destroy,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-
-       /* FolderItem functions */
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       news_item_get_path,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       news_get_num_list,
-       NULL,
-       NULL,
-       NULL,
-       news_scan_required,
-
-       /* Message functions */
-       news_get_msginfo,
-       news_get_msginfos,
-       news_fetch_msg,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-};
+static FolderClass news_class;
 
 FolderClass *news_get_class(void)
 {
+       if (news_class.idstr == NULL) {
+               news_class.type = F_NEWS;
+               news_class.idstr = "news";
+               news_class.uistr = "News";
+
+               /* Folder functions */
+               news_class.new_folder = news_folder_new;
+               news_class.destroy_folder = news_folder_destroy;
+
+               /* FolderItem functions */
+               news_class.item_get_path = news_item_get_path;
+               news_class.get_num_list = news_get_num_list;
+               news_class.scan_required = news_scan_required;
+
+               /* Message functions */
+               news_class.get_msginfo = news_get_msginfo;
+               news_class.get_msginfos = news_get_msginfos;
+               news_class.fetch_msg = news_fetch_msg;
+       };
+
        return &news_class;
 }