From 62446ff785a57dc0e3f9e809f4ed832e9f2882b3 Mon Sep 17 00:00:00 2001 From: Christoph Hohmann Date: Sat, 5 Apr 2003 20:38:53 +0000 Subject: [PATCH] 0.8.11claws72 * src/account.c * src/folder.[ch] * src/folderview.c * src/imap.c * src/inc.c * src/main.c * src/mainwindow.c * src/mbox_folder.c * src/mh.c * src/mimeview.h * src/msgcache.[ch] * src/news.c * src/procmime.h * src/procmsg.[ch] * src/setup.c * src/gtk/gtkutils.c o rename structure field names class and new to klass and new_msgs, to allow including files in C++ o add 'extern "C"' block to some header files o add MsgInfoList and MsgNumberList as alias for GSList for developers to know what type of list is expected * src/plugins/image_viewer/plugin.c * src/plugins/image_viewer/viewer.[ch] * src/plugins/image_viewer/viewerprefs.[ch] rename function names to prevent conflicts --- ChangeLog.claws | 29 ++++ configure.ac | 2 +- src/account.c | 4 +- src/folder.c | 204 ++++++++++++------------- src/folder.h | 32 ++-- src/folderview.c | 63 +++----- src/gtk/gtkutils.c | 2 +- src/imap.c | 10 +- src/inc.c | 2 +- src/main.c | 2 +- src/mainwindow.c | 8 +- src/mbox_folder.c | 18 +-- src/mh.c | 2 +- src/mimeview.h | 12 +- src/msgcache.c | 6 +- src/msgcache.h | 35 +++-- src/news.c | 4 +- src/plugins/image_viewer/plugin.c | 8 +- src/plugins/image_viewer/viewer.c | 4 +- src/plugins/image_viewer/viewer.h | 4 +- src/plugins/image_viewer/viewerprefs.c | 4 +- src/plugins/image_viewer/viewerprefs.h | 4 +- src/plugins/trayicon/trayicon.c | 11 +- src/procmime.h | 12 +- src/procmsg.c | 40 ++--- src/procmsg.h | 9 +- src/setup.c | 2 +- 27 files changed, 287 insertions(+), 246 deletions(-) diff --git a/ChangeLog.claws b/ChangeLog.claws index cd48ca98f..645afef85 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,32 @@ +2003-04-05 [christoph] 0.8.11claws72 + + * src/account.c + * src/folder.[ch] + * src/folderview.c + * src/imap.c + * src/inc.c + * src/main.c + * src/mainwindow.c + * src/mbox_folder.c + * src/mh.c + * src/mimeview.h + * src/msgcache.[ch] + * src/news.c + * src/procmime.h + * src/procmsg.[ch] + * src/setup.c + * src/gtk/gtkutils.c + o rename structure field names class and new to klass and + new_msgs, to allow including files in C++ + o add 'extern "C"' block to some header files + o add MsgInfoList and MsgNumberList as alias for GSList for + developers to know what type of list is expected + + * src/plugins/image_viewer/plugin.c + * src/plugins/image_viewer/viewer.[ch] + * src/plugins/image_viewer/viewerprefs.[ch] + rename function names to prevent conflicts + 2003-04-05 [paul] 0.8.11claws71 * sync with 0.8.11cvs18 diff --git a/configure.ac b/configure.ac index decebbd78..3e770c094 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=8 MICRO_VERSION=11 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws71 +EXTRA_VERSION=claws72 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/account.c b/src/account.c index 68304c8b5..cb956f17a 100644 --- a/src/account.c +++ b/src/account.c @@ -352,7 +352,7 @@ void account_add(void) ac_prefs->folder = REMOTE_FOLDER(folder); folder_add(folder); if (ac_prefs->protocol == A_IMAP4) - folder->class->create_tree(folder); + folder->klass->create_tree(folder); folderview_set_all(); } } @@ -435,7 +435,7 @@ void account_set_missing_folder(void) ap->folder = REMOTE_FOLDER(folder); folder_add(folder); if (ap->protocol == A_IMAP4) - folder->class->create_tree(folder); + folder->klass->create_tree(folder); } } } diff --git a/src/folder.c b/src/folder.c index 2e2d6a156..28f49c9bd 100644 --- a/src/folder.c +++ b/src/folder.c @@ -89,21 +89,21 @@ GSList *folder_get_class_list() return classlist; } -void folder_register_class(FolderClass *class) +void folder_register_class(FolderClass *klass) { - debug_print("registering folder class %s\n", class->idstr); - classlist = g_slist_append(classlist, class); + debug_print("registering folder class %s\n", klass->idstr); + classlist = g_slist_append(classlist, klass); } -Folder *folder_new(FolderClass *class, const gchar *name, const gchar *path) +Folder *folder_new(FolderClass *klass, const gchar *name, const gchar *path) { Folder *folder = NULL; FolderItem *item; - g_return_val_if_fail(class != NULL, NULL); + g_return_val_if_fail(klass != NULL, NULL); name = name ? name : path; - folder = class->new(name, path); + folder = klass->new_folder(name, path); /* Create root folder item */ item = folder_item_new(folder, name, NULL); @@ -146,7 +146,7 @@ void folder_remote_folder_init(Folder *folder, const gchar *name, void folder_destroy(Folder *folder) { g_return_if_fail(folder != NULL); - g_return_if_fail(folder->class->destroy != NULL); + g_return_if_fail(folder->klass->destroy_folder != NULL); folder_list = g_list_remove(folder_list, folder); @@ -154,7 +154,7 @@ void folder_destroy(Folder *folder) g_free(folder->name); g_free(folder); - folder->class->destroy(folder); + folder->klass->destroy_folder(folder); } void folder_local_folder_destroy(LocalFolder *lfolder) @@ -176,8 +176,8 @@ FolderItem *folder_item_new(Folder *folder, const gchar *name, const gchar *path { FolderItem *item = NULL; - if (folder->class->item_new) { - item = folder->class->item_new(folder); + if (folder->klass->item_new) { + item = folder->klass->item_new(folder); } else { item = g_new0(FolderItem, 1); } @@ -188,10 +188,10 @@ FolderItem *folder_item_new(Folder *folder, const gchar *name, const gchar *path item->name = g_strdup(name); item->path = g_strdup(path); item->mtime = 0; - item->new = 0; - item->unread = 0; - item->unreadmarked = 0; - item->total = 0; + item->new_msgs = 0; + item->unread_msgs = 0; + item->unreadmarked_msgs = 0; + item->total_msgs = 0; item->last_num = -1; item->cache = NULL; item->no_sub = FALSE; @@ -259,8 +259,8 @@ void folder_item_destroy(FolderItem *item) g_free(item->path); if (item->folder != NULL) { - if(item->folder->class->item_destroy) { - item->folder->class->item_destroy(item->folder, item); + if(item->folder->klass->item_destroy) { + item->folder->klass->item_destroy(item->folder, item); } else { g_free(item); } @@ -418,13 +418,13 @@ void folder_scan_tree(Folder *folder) { GHashTable *pptable; - if (!folder->class->scan_tree) + if (!folder->klass->scan_tree) return; pptable = folder_persist_prefs_new(folder); folder_tree_destroy(folder); - folder->class->scan_tree(folder); + folder->klass->scan_tree(folder); g_node_traverse(folder->node, G_POST_ORDER, G_TRAVERSE_ALL, -1, folder_scan_tree_func, pptable); folder_persist_prefs_free(pptable); @@ -438,7 +438,7 @@ FolderItem *folder_create_folder(FolderItem *parent, const gchar *name) { FolderItem *new_item; - new_item = parent->folder->class->create_folder(parent->folder, parent, name); + new_item = parent->folder->klass->create_folder(parent->folder, parent, name); if (new_item) new_item->cache = msgcache_new(); @@ -447,10 +447,10 @@ FolderItem *folder_create_folder(FolderItem *parent, const gchar *name) struct TotalMsgCount { - guint new; - guint unread; - guint unreadmarked; - guint total; + guint new_msgs; + guint unread_msgs; + guint unreadmarked_msgs; + guint total_msgs; }; struct FuncToAllFoldersData @@ -497,26 +497,26 @@ static void folder_count_total_msgs_func(FolderItem *item, gpointer data) { struct TotalMsgCount *count = (struct TotalMsgCount *)data; - count->new += item->new; - count->unread += item->unread; - count->unreadmarked += item->unreadmarked; - count->total += item->total; + count->new_msgs += item->new_msgs; + count->unread_msgs += item->unread_msgs; + count->unreadmarked_msgs += item->unreadmarked_msgs; + count->total_msgs += item->total_msgs; } -void folder_count_total_msgs(guint *new, guint *unread, guint *unreadmarked, guint *total) +void folder_count_total_msgs(guint *new_msgs, guint *unread_msgs, guint *unreadmarked_msgs, guint *total_msgs) { struct TotalMsgCount count; - count.new = count.unread = count.unreadmarked = count.total = 0; + count.new_msgs = count.unread_msgs = count.unreadmarked_msgs = count.total_msgs = 0; debug_print("Counting total number of messages...\n"); folder_func_to_all_folders(folder_count_total_msgs_func, &count); - *new = count.new; - *unread = count.unread; - *unreadmarked = count.unreadmarked; - *total = count.total; + *new_msgs = count.new_msgs; + *unread_msgs = count.unread_msgs; + *unreadmarked_msgs = count.unreadmarked_msgs; + *total_msgs = count.total_msgs; } Folder *folder_find_from_path(const gchar *path) @@ -534,14 +534,14 @@ Folder *folder_find_from_path(const gchar *path) return NULL; } -Folder *folder_find_from_name(const gchar *name, FolderClass *class) +Folder *folder_find_from_name(const gchar *name, FolderClass *klass) { GList *list; Folder *folder; for (list = folder_list; list != NULL; list = list->next) { folder = list->data; - if (folder->class == class && strcmp2(name, folder->name) == 0) + if (folder->klass == klass && strcmp2(name, folder->name) == 0) return folder; } @@ -597,7 +597,7 @@ gchar *folder_get_identifier(Folder *folder) g_return_val_if_fail(folder != NULL, NULL); - type_str = folder->class->idstr; + type_str = folder->klass->idstr; return g_strconcat("#", type_str, "/", folder->name, NULL); } @@ -704,7 +704,7 @@ gchar *folder_item_get_name(FolderItem *item) * the folder knows the ui string and how to abbrev */ if (!item->parent) { - name = g_strconcat(item->name, " (", item->folder->class->uistr, ")", NULL); + name = g_strconcat(item->name, " (", item->folder->klass->uistr, ")", NULL); } else { if (FOLDER_CLASS(item->folder) == news_get_class() && item->path && !strcmp2(item->name, item->path)) @@ -804,7 +804,7 @@ void folder_set_missing_folders(void) folder->queue && folder->trash) continue; - if (folder->class->create_tree(folder) < 0) { + if (folder->klass->create_tree(folder) < 0) { g_warning("%s: can't create the folder tree.\n", LOCAL_FOLDER(folder)->rootpath); continue; @@ -990,7 +990,7 @@ void folder_item_close(FolderItem *item) g_return_if_fail(item != NULL); - if (item->new) { + if (item->new_msgs) { mlist = folder_item_get_msg_list(item); for (cur = mlist ; cur != NULL ; cur = cur->next) { MsgInfo * msginfo; @@ -1025,18 +1025,18 @@ gint folder_item_scan(FolderItem *item) folder = item->folder; g_return_val_if_fail(folder != NULL, -1); - g_return_val_if_fail(folder->class->get_num_list != NULL, -1); + g_return_val_if_fail(folder->klass->get_num_list != NULL, -1); debug_print("Scanning folder %s for cache changes.\n", item->path); /* Get list of messages for folder and cache */ - if (folder->class->get_num_list(item->folder, item, &folder_list) < 0) { + if (folder->klass->get_num_list(item->folder, item, &folder_list) < 0) { debug_print("Error fetching list of message numbers\n"); return(-1); } - if (!folder->class->check_msgnum_validity || - folder->class->check_msgnum_validity(folder, item)) { + if (!folder->klass->check_msgnum_validity || + folder->klass->check_msgnum_validity(folder, item)) { if (!item->cache) folder_item_read_cache(item); cache_list = msgcache_get_msg_list(item->cache); @@ -1149,7 +1149,7 @@ gint folder_item_scan(FolderItem *item) MsgInfo *msginfo; msginfo = msgcache_get_msg(item->cache, folder_cur_num); - if (folder->class->is_msg_changed && folder->class->is_msg_changed(folder, item, msginfo)) { + if (folder->klass->is_msg_changed && folder->klass->is_msg_changed(folder, item, msginfo)) { msgcache_remove_msg(item->cache, msginfo->msgnum); new_list = g_slist_prepend(new_list, GINT_TO_POINTER(msginfo->msgnum)); procmsg_msginfo_free(msginfo); @@ -1183,9 +1183,9 @@ gint folder_item_scan(FolderItem *item) g_slist_free(folder_list); if (new_list != NULL) { - if (folder->class->get_msginfos) { - newmsg_list = folder->class->get_msginfos(folder, item, new_list); - } else if (folder->class->get_msginfo) { + if (folder->klass->get_msginfos) { + newmsg_list = folder->klass->get_msginfos(folder, item, new_list); + } else if (folder->klass->get_msginfo) { GSList *elem; for (elem = new_list; elem != NULL; elem = g_slist_next(elem)) { @@ -1193,7 +1193,7 @@ gint folder_item_scan(FolderItem *item) guint num; num = GPOINTER_TO_INT(elem->data); - msginfo = folder->class->get_msginfo(folder, item, num); + msginfo = folder->klass->get_msginfo(folder, item, num); if (msginfo != NULL) { newmsg_list = g_slist_prepend(newmsg_list, msginfo); debug_print("Added newly found message %d to cache.\n", num); @@ -1242,10 +1242,10 @@ gint folder_item_scan(FolderItem *item) } g_slist_free(exists_list); - item->new = newcnt; - item->unread = unreadcnt; - item->total = totalcnt; - item->unreadmarked = unreadmarkedcnt; + item->new_msgs = newcnt; + item->unread_msgs = unreadcnt; + item->total_msgs = totalcnt; + item->unreadmarked_msgs = unreadmarkedcnt; update_flags |= F_ITEM_UPDATE_MSGCNT; @@ -1408,8 +1408,8 @@ MsgInfo *folder_item_get_msginfo(FolderItem *item, gint num) if ((msginfo = msgcache_get_msg(item->cache, num)) != NULL) return msginfo; - g_return_val_if_fail(folder->class->get_msginfo, NULL); - if ((msginfo = folder->class->get_msginfo(folder, item, num)) != NULL) { + g_return_val_if_fail(folder->klass->get_msginfo, NULL); + if ((msginfo = folder->klass->get_msginfo(folder, item, num)) != NULL) { msgcache_add_msg(item->cache, msginfo); return msginfo; } @@ -1454,9 +1454,9 @@ gchar *folder_item_fetch_msg(FolderItem *item, gint num) folder = item->folder; - g_return_val_if_fail(folder->class->fetch_msg != NULL, NULL); + g_return_val_if_fail(folder->klass->fetch_msg != NULL, NULL); - return folder->class->fetch_msg(folder, item, num); + return folder->klass->fetch_msg(folder, item, num); } static gint folder_item_get_msg_num_by_file(FolderItem *dest, const gchar *file) @@ -1539,12 +1539,12 @@ static void add_msginfo_to_cache(FolderItem *item, MsgInfo *newmsginfo, MsgInfo { /* update folder stats */ if (MSG_IS_NEW(newmsginfo->flags)) - item->new++; + item->new_msgs++; if (MSG_IS_UNREAD(newmsginfo->flags)) - item->unread++; + item->unread_msgs++; if (MSG_IS_UNREAD(newmsginfo->flags) && procmsg_msg_has_marked_parent(newmsginfo)) - item->unreadmarked++; - item->total++; + item->unreadmarked_msgs++; + item->total_msgs++; copy_msginfo_flags(flagsource, newmsginfo); @@ -1557,12 +1557,12 @@ static void remove_msginfo_from_cache(FolderItem *item, MsgInfo *msginfo) folder_item_read_cache(item); if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) - msginfo->folder->new--; + msginfo->folder->new_msgs--; if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) - msginfo->folder->unread--; + msginfo->folder->unread_msgs--; if (MSG_IS_UNREAD(msginfo->flags) && procmsg_msg_has_marked_parent(msginfo)) - msginfo->folder->unreadmarked--; - msginfo->folder->total--; + msginfo->folder->unreadmarked_msgs--; + msginfo->folder->total_msgs--; msgcache_remove_msg(item->cache, msginfo->msgnum); folder_item_update(msginfo->folder, F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT); @@ -1580,15 +1580,15 @@ gint folder_item_add_msg(FolderItem *dest, const gchar *file, folder = dest->folder; - g_return_val_if_fail(folder->class->add_msg != NULL, -1); + g_return_val_if_fail(folder->klass->add_msg != NULL, -1); if (!dest->cache) folder_item_read_cache(dest); - num = folder->class->add_msg(folder, dest, file, FALSE); + num = folder->klass->add_msg(folder, dest, file, FALSE); if (num > 0) { - msginfo = folder->class->get_msginfo(folder, dest, num); + msginfo = folder->klass->get_msginfo(folder, dest, num); if (msginfo != NULL) { add_msginfo_to_cache(dest, msginfo, NULL); @@ -1682,7 +1682,7 @@ FolderItem *folder_item_move_recursive (FolderItem *src, FolderItem *dest) new_id = folder_item_get_identifier(new_item); debug_print("updating rules : %s => %s\n", old_id, new_id); - src->folder->class->remove_folder(src->folder, src); + src->folder->klass->remove_folder(src->folder, src); folder_write_list(); if (old_id != NULL && new_id != NULL) @@ -1806,8 +1806,8 @@ gint folder_item_move_msgs_with_dest(FolderItem *dest, GSList *msglist) folder = dest->folder; - g_return_val_if_fail(folder->class->copy_msg != NULL, -1); - g_return_val_if_fail(folder->class->remove_msg != NULL, -1); + g_return_val_if_fail(folder->klass->copy_msg != NULL, -1); + g_return_val_if_fail(folder->klass->remove_msg != NULL, -1); /* * Copy messages to destination folder and @@ -1820,7 +1820,7 @@ gint folder_item_move_msgs_with_dest(FolderItem *dest, GSList *msglist) if (!item && msginfo->folder != NULL) item = msginfo->folder; - num = folder->class->copy_msg(folder, dest, msginfo); + num = folder->klass->copy_msg(folder, dest, msginfo); newmsgnums = g_slist_append(newmsgnums, GINT_TO_POINTER(num)); } @@ -1860,8 +1860,8 @@ gint folder_item_move_msgs_with_dest(FolderItem *dest, GSList *msglist) continue; if (!folderscan && - ((newmsginfo = folder->class->get_msginfo(folder, dest, num)) != NULL)) { - newmsginfo = folder->class->get_msginfo(folder, dest, num); + ((newmsginfo = folder->klass->get_msginfo(folder, dest, num)) != NULL)) { + newmsginfo = folder->klass->get_msginfo(folder, dest, num); add_msginfo_to_cache(dest, newmsginfo, msginfo); procmsg_msginfo_free(newmsginfo); } else if ((newmsginfo = msgcache_get_msg(dest->cache, num)) != NULL) { @@ -1884,7 +1884,7 @@ gint folder_item_move_msgs_with_dest(FolderItem *dest, GSList *msglist) l2 = g_slist_next(l2); if (num >= 0) { - item->folder->class->remove_msg(item->folder, + item->folder->klass->remove_msg(item->folder, msginfo->folder, msginfo->msgnum); remove_msginfo_from_cache(item, msginfo); @@ -1892,8 +1892,8 @@ gint folder_item_move_msgs_with_dest(FolderItem *dest, GSList *msglist) } - if (folder->class->finished_copy) - folder->class->finished_copy(folder, dest); + if (folder->klass->finished_copy) + folder->klass->finished_copy(folder, dest); g_slist_free(newmsgnums); return lastnum; @@ -1963,7 +1963,7 @@ gint folder_item_copy_msgs_with_dest(FolderItem *dest, GSList *msglist) folder = dest->folder; - g_return_val_if_fail(folder->class->copy_msg != NULL, -1); + g_return_val_if_fail(folder->klass->copy_msg != NULL, -1); /* * Copy messages to destination folder and @@ -1972,7 +1972,7 @@ gint folder_item_copy_msgs_with_dest(FolderItem *dest, GSList *msglist) for (l = msglist ; l != NULL ; l = g_slist_next(l)) { MsgInfo * msginfo = (MsgInfo *) l->data; - num = folder->class->copy_msg(folder, dest, msginfo); + num = folder->klass->copy_msg(folder, dest, msginfo); newmsgnums = g_slist_append(newmsgnums, GINT_TO_POINTER(num)); } @@ -2012,8 +2012,8 @@ gint folder_item_copy_msgs_with_dest(FolderItem *dest, GSList *msglist) continue; if (!folderscan && - ((newmsginfo = folder->class->get_msginfo(folder, dest, num)) != NULL)) { - newmsginfo = folder->class->get_msginfo(folder, dest, num); + ((newmsginfo = folder->klass->get_msginfo(folder, dest, num)) != NULL)) { + newmsginfo = folder->klass->get_msginfo(folder, dest, num); add_msginfo_to_cache(dest, newmsginfo, msginfo); procmsg_msginfo_free(newmsginfo); } else if ((newmsginfo = msgcache_get_msg(dest->cache, num)) != NULL) { @@ -2023,8 +2023,8 @@ gint folder_item_copy_msgs_with_dest(FolderItem *dest, GSList *msglist) } } - if (folder->class->finished_copy) - folder->class->finished_copy(folder, dest); + if (folder->klass->finished_copy) + folder->klass->finished_copy(folder, dest); g_slist_free(newmsgnums); return lastnum; @@ -2041,7 +2041,7 @@ gint folder_item_remove_msg(FolderItem *item, gint num) folder = item->folder; if (!item->cache) folder_item_read_cache(item); - ret = folder->class->remove_msg(folder, item, num); + ret = folder->klass->remove_msg(folder, item, num); msginfo = msgcache_get_msg(item->cache, num); if (msginfo != NULL) { @@ -2085,21 +2085,21 @@ gint folder_item_remove_all_msg(FolderItem *item) folder = item->folder; - g_return_val_if_fail(folder->class->remove_all_msg != NULL, -1); + g_return_val_if_fail(folder->klass->remove_all_msg != NULL, -1); - result = folder->class->remove_all_msg(folder, item); + result = folder->klass->remove_all_msg(folder, item); if (result == 0) { - if (folder->class->finished_remove) - folder->class->finished_remove(folder, item); + if (folder->klass->finished_remove) + folder->klass->finished_remove(folder, item); folder_item_free_cache(item); item->cache = msgcache_new(); - item->new = 0; - item->unread = 0; - item->unreadmarked = 0; - item->total = 0; + item->new_msgs = 0; + item->unread_msgs = 0; + item->unreadmarked_msgs = 0; + item->total_msgs = 0; folder_item_update(item, F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT); } @@ -2111,8 +2111,8 @@ void folder_item_change_msg_flags(FolderItem *item, MsgInfo *msginfo, MsgPermFla g_return_if_fail(item != NULL); g_return_if_fail(msginfo != NULL); - if (item->folder->class->change_flags != NULL) { - item->folder->class->change_flags(item->folder, item, msginfo, newflags); + if (item->folder->klass->change_flags != NULL) { + item->folder->klass->change_flags(item->folder, item, msginfo, newflags); } else { msginfo->flags.perm_flags = newflags; } @@ -2126,9 +2126,9 @@ gboolean folder_item_is_msg_changed(FolderItem *item, MsgInfo *msginfo) folder = item->folder; - g_return_val_if_fail(folder->class->is_msg_changed != NULL, -1); + g_return_val_if_fail(folder->klass->is_msg_changed != NULL, -1); - return folder->class->is_msg_changed(folder, item, msginfo); + return folder->klass->is_msg_changed(folder, item, msginfo); } gchar *folder_item_get_cache_file(FolderItem *item) @@ -2284,10 +2284,10 @@ static gboolean folder_build_tree(GNode *node, gpointer data) item = folder_item_new(folder, name, path); item->stype = stype; item->mtime = mtime; - item->new = new; - item->unread = unread; - item->unreadmarked = unreadmarked; - item->total = total; + item->new_msgs = new; + item->unread_msgs = unread; + item->unreadmarked_msgs = unreadmarked; + item->total_msgs = total; item->no_sub = no_sub; item->no_select = no_select; item->collapsed = collapsed; @@ -2428,7 +2428,7 @@ static void folder_write_list_recursive(GNode *node, gpointer data) if (depth == 1) { Folder *folder = item->folder; - fprintf(fp, "class->idstr); + fprintf(fp, "klass->idstr); if (folder->name) PUT_ESCAPE_STR(fp, "name", folder->name); if (FOLDER_TYPE(folder) == F_MH || FOLDER_TYPE(folder) == F_MBOX) @@ -2485,7 +2485,7 @@ static void folder_write_list_recursive(GNode *node, gpointer data) fprintf(fp, " mtime=\"%lu\" new=\"%d\" unread=\"%d\" unreadmarked=\"%d\" total=\"%d\"", - item->mtime, item->new, item->unread, item->unreadmarked, item->total); + item->mtime, item->new_msgs, item->unread_msgs, item->unreadmarked_msgs, item->total_msgs); if (item->account) fprintf(fp, " account_id=\"%d\"", @@ -2612,7 +2612,7 @@ static void folder_create_processing_folder(void) if (!is_dir_exist(tmpname)) { debug_print("*TMP* creating %s\n", tmpname); - processing_folder_item = processing_folder->class->create_folder(processing_folder, + processing_folder_item = processing_folder->klass->create_folder(processing_folder, processing_folder->node->data, PROCESSING_FOLDER_ITEM); } else { diff --git a/src/folder.h b/src/folder.h index 3f3b8e6cd..b426051f4 100644 --- a/src/folder.h +++ b/src/folder.h @@ -34,9 +34,9 @@ typedef struct _FolderItem FolderItem; typedef struct _FolderItemUpdateData FolderItemUpdateData; #define FOLDER(obj) ((Folder *)obj) -#define FOLDER_TYPE(obj) (FOLDER(obj)->class->type) +#define FOLDER_TYPE(obj) (FOLDER(obj)->klass->type) -#define FOLDER_CLASS(obj) (FOLDER(obj)->class) +#define FOLDER_CLASS(obj) (FOLDER(obj)->klass) #define LOCAL_FOLDER(obj) ((LocalFolder *)obj) #define REMOTE_FOLDER(obj) ((RemoteFolder *)obj) @@ -128,7 +128,7 @@ typedef void (*FolderItemFunc) (FolderItem *item, struct _Folder { - FolderClass *class; + FolderClass *klass; gchar *name; PrefsAccount *account; @@ -158,9 +158,9 @@ struct _FolderClass /* virtual functions */ /* Folder funtions */ - Folder *(*new) (const gchar *name, + Folder *(*new_folder) (const gchar *name, const gchar *path); - void (*destroy) (Folder *folder); + void (*destroy_folder) (Folder *folder); void (*scan_tree) (Folder *folder); gint (*create_tree) (Folder *folder); @@ -195,7 +195,7 @@ struct _FolderClass gint num); GSList *(*get_msginfos) (Folder *folder, FolderItem *item, - GSList *msgnum_list); + MsgNumberList *msgnum_list); gchar *(*fetch_msg) (Folder *folder, FolderItem *item, gint num); @@ -250,10 +250,10 @@ struct _FolderItem time_t mtime; - gint new; - gint unread; - gint total; - gint unreadmarked; + gint new_msgs; + gint unread_msgs; + gint total_msgs; + gint unreadmarked_msgs; gint last_num; @@ -307,7 +307,7 @@ struct _FolderItemUpdateData }; void folder_system_init (); -void folder_register_class (FolderClass *class); +void folder_register_class (FolderClass *klass); Folder *folder_new (FolderClass *type, const gchar *name, const gchar *path); @@ -347,14 +347,14 @@ FolderItem *folder_create_folder(FolderItem *parent, const gchar *name); void folder_update_op_count (void); void folder_func_to_all_folders (FolderItemFunc function, gpointer data); -void folder_count_total_msgs (guint *new, - guint *unread, - guint *unreadmarked, - guint *total); +void folder_count_total_msgs (guint *new_msgs, + guint *unread_msgs, + guint *unreadmarked_msgs, + guint *total_msgs); Folder *folder_find_from_path (const gchar *path); Folder *folder_find_from_name (const gchar *name, - FolderClass *class); + FolderClass *klass); FolderItem *folder_find_item_from_path (const gchar *path); FolderClass *folder_get_class_from_string (const gchar *str); gchar *folder_get_identifier (Folder *folder); diff --git a/src/folderview.c b/src/folderview.c index 326c8962b..5ad85b2e7 100644 --- a/src/folderview.c +++ b/src/folderview.c @@ -705,7 +705,7 @@ static GtkCTreeNode *folderview_find_next_unread(GtkCTree *ctree, for (; node != NULL; node = gtkut_ctree_node_next(ctree, node)) { item = gtk_ctree_node_get_row_data(ctree, node); - if (item && item->unread > 0 && item->stype != F_TRASH) + if (item && item->unread_msgs > 0 && item->stype != F_TRASH) return node; } @@ -751,19 +751,6 @@ void folderview_update_msg_num(FolderView *folderview, GtkCTreeNode *row) unread = atoi(unread_str); total = atoi(total_str); - /* CLAWS: don't know why but this always seems to be true - * when deleting messages. Somewhere claws does a folder - * scan which sets all new, unread & total to the correct - * values. It then enters this function, but leaves it - * because new, unread and total are the same... */ -#ifndef CLAWS - if (prev_row == row && - item->new == new && - item->unread == unread && - item->total == total) - return; -#endif - prev_row = row; folderview_update_node(folderview, row); @@ -832,7 +819,7 @@ void folderview_rescan_tree(Folder *folder) g_return_if_fail(folder != NULL); - if (!folder->class->scan_tree) return; + if (!folder->klass->scan_tree) return; inc_lock(); window = label_window_create(_("Rebuilding folder tree...")); @@ -917,13 +904,13 @@ gint folderview_check_new(Folder *folder) if (!folder && !FOLDER_IS_LOCAL(item->folder)) continue; folderview_scan_tree_func(item->folder, item, NULL); - former_new = item->new; + former_new = item->new_msgs; if (folder_item_scan(item) < 0) { if (folder && !FOLDER_IS_LOCAL(folder)) break; } folderview_update_node(folderview, node); - new_msgs += item->new; + new_msgs += item->new_msgs; former_new_msgs += former_new; } @@ -978,8 +965,8 @@ static gboolean folderview_search_new_recursive(GtkCTree *ctree, if (node) { item = gtk_ctree_node_get_row_data(ctree, node); if (item) { - if (item->new > 0 || - (item->stype == F_QUEUE && item->total > 0)) + if (item->new_msgs > 0 || + (item->stype == F_QUEUE && item->total_msgs > 0)) return TRUE; } node = GTK_CTREE_ROW(node)->children; @@ -1024,8 +1011,8 @@ static gboolean folderview_search_unread_recursive(GtkCTree *ctree, if (node) { item = gtk_ctree_node_get_row_data(ctree, node); if (item) { - if (item->unread > 0 || - (item->stype == F_QUEUE && item->total > 0)) + if (item->unread_msgs > 0 || + (item->stype == F_QUEUE && item->total_msgs > 0)) return TRUE; } node = GTK_CTREE_ROW(node)->children; @@ -1158,21 +1145,21 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node) else add_unread_mark = FALSE; - if (item->stype == F_QUEUE && item->total > 0 && + if (item->stype == F_QUEUE && item->total_msgs > 0 && prefs_common.display_folder_unread) { - str = g_strdup_printf("%s (%d%s)", name, item->total, + str = g_strdup_printf("%s (%d%s)", name, item->total_msgs, add_unread_mark ? "+" : ""); gtk_ctree_set_node_info(ctree, node, str, FOLDER_SPACING, xpm, mask, openxpm, openmask, FALSE, GTK_CTREE_ROW(node)->expanded); g_free(str); - } else if ((item->unread > 0 || add_unread_mark) && + } else if ((item->unread_msgs > 0 || add_unread_mark) && prefs_common.display_folder_unread) { - if (item->unread > 0) - str = g_strdup_printf("%s (%d%s%s)", name, item->unread, + if (item->unread_msgs > 0) + str = g_strdup_printf("%s (%d%s%s)", name, item->unread_msgs, add_unread_mark ? "+" : "", - item->unreadmarked > 0 ? "!":""); + item->unreadmarked_msgs > 0 ? "!":""); else str = g_strdup_printf("%s (+)", name); gtk_ctree_set_node_info(ctree, node, str, FOLDER_SPACING, @@ -1181,7 +1168,7 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node) g_free(str); } else { str = g_strdup_printf("%s%s", name, - item->unreadmarked > 0 ? " (!)":""); + item->unreadmarked_msgs > 0 ? " (!)":""); gtk_ctree_set_node_info(ctree, node, str, FOLDER_SPACING, xpm, mask, openxpm, openmask, @@ -1195,9 +1182,9 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node) gtk_ctree_node_set_text(ctree, node, COL_UNREAD, "-"); gtk_ctree_node_set_text(ctree, node, COL_TOTAL, "-"); } else { - gtk_ctree_node_set_text(ctree, node, COL_NEW, itos(item->new)); - gtk_ctree_node_set_text(ctree, node, COL_UNREAD, itos(item->unread)); - gtk_ctree_node_set_text(ctree, node, COL_TOTAL, itos(item->total)); + gtk_ctree_node_set_text(ctree, node, COL_NEW, itos(item->new_msgs)); + gtk_ctree_node_set_text(ctree, node, COL_UNREAD, itos(item->unread_msgs)); + gtk_ctree_node_set_text(ctree, node, COL_TOTAL, itos(item->total_msgs)); } if (item->stype == F_OUTBOX || item->stype == F_DRAFT || @@ -1205,13 +1192,13 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node) use_bold = use_color = FALSE; } else if (item->stype == F_QUEUE) { /* highlight queue folder if there are any messages */ - use_bold = use_color = (item->total > 0); + use_bold = use_color = (item->total_msgs > 0); } else { /* if unread messages exist, print with bold font */ - use_bold = (item->unread > 0) || add_unread_mark; + use_bold = (item->unread_msgs > 0) || add_unread_mark; /* if new messages exist, print with colored letter */ use_color = - (item->new > 0) || + (item->new_msgs > 0) || (add_unread_mark && folderview_have_new_children(folderview, node)); } @@ -1526,7 +1513,7 @@ static void folderview_button_pressed(GtkWidget *ctree, GdkEventButton *event, if (item->parent != NULL) delete_folder = folder_scoring = folder_processing = TRUE; } - if (item->unread < 1) + if (item->unread_msgs < 1) mark_all_read = FALSE; } @@ -2020,7 +2007,7 @@ static void folderview_rename_folder_cb(FolderView *folderview, guint action, Xstrdup_a(old_path, item->path, {g_free(new_folder); return;}); old_id = folder_item_get_identifier(item); - if (item->folder->class->rename_folder(item->folder, item, new_folder) < 0) { + if (item->folder->klass->rename_folder(item->folder, item, new_folder) < 0) { g_free(old_id); g_free(new_folder); return; @@ -2087,7 +2074,7 @@ static void folderview_rename_mbox_folder_cb(FolderView *folderview, return; } - if (item->folder->class->rename_folder(item->folder, item, new_folder) < 0) { + if (item->folder->klass->rename_folder(item->folder, item, new_folder) < 0) { g_free(new_folder); return; } @@ -2141,7 +2128,7 @@ static void folderview_delete_folder_cb(FolderView *folderview, guint action, Xstrdup_a(old_path, item->path, return); old_id = folder_item_get_identifier(item); - if (item->folder->class->remove_folder(item->folder, item) < 0) { + if (item->folder->klass->remove_folder(item->folder, item) < 0) { alertpanel_error(_("Can't remove the folder `%s'."), name); if (folderview->opened == folderview->selected) summary_show(folderview->summaryview, diff --git a/src/gtk/gtkutils.c b/src/gtk/gtkutils.c index 6f04f9a47..090f27218 100644 --- a/src/gtk/gtkutils.c +++ b/src/gtk/gtkutils.c @@ -470,7 +470,7 @@ void gtkut_widget_wait_for_draw(GtkWidget *widget) { gboolean flag = FALSE; - if (!GTK_WIDGET_VISIBLE(widget) || !GTK_WIDGET_MAPPED(widget)) return; + if (!GTK_WIDGET_DRAWABLE(widget)) return; gtk_signal_connect(GTK_OBJECT(widget), "draw", GTK_SIGNAL_FUNC(gtkut_widget_draw_cb), &flag); diff --git a/src/imap.c b/src/imap.c index 75fd82664..6a84458ba 100644 --- a/src/imap.c +++ b/src/imap.c @@ -369,7 +369,7 @@ Folder *imap_folder_new(const gchar *name, const gchar *path) Folder *folder; folder = (Folder *)g_new0(IMAPFolder, 1); - folder->class = &imap_class; + folder->klass = &imap_class; imap_folder_init(folder, name, path); return folder; @@ -907,9 +907,9 @@ gint imap_scan_folder(Folder *folder, FolderItem *item) &messages, &recent, &uid_next, &uid_validity, &unseen); if (ok != IMAP_SUCCESS) return -1; - item->new = unseen > 0 ? recent : 0; - item->unread = unseen; - item->total = messages; + item->new_msgs = unseen > 0 ? recent : 0; + item->unread_msgs = unseen; + item->total_msgs = messages; item->last_num = (messages > 0 && uid_next > 0) ? uid_next - 1 : 0; /* item->mtime = uid_validity; */ @@ -3347,7 +3347,7 @@ void imap_change_flags(Folder *folder, FolderItem *item, MsgInfo *msginfo, MsgPe gint ok = IMAP_SUCCESS; g_return_if_fail(folder != NULL); - g_return_if_fail(folder->class == &imap_class); + g_return_if_fail(folder->klass == &imap_class); g_return_if_fail(item != NULL); g_return_if_fail(item->folder == folder); g_return_if_fail(msginfo != NULL); diff --git a/src/inc.c b/src/inc.c index fa6ae5884..e67722de6 100644 --- a/src/inc.c +++ b/src/inc.c @@ -124,7 +124,7 @@ static void inc_notify_cmd (gint new_msgs, gboolean notify); #define FOLDER_SUMMARY_MISMATCH(f, s) \ - (f) && (s) ? ((s)->newmsgs != (f)->new) || ((f)->unread != (s)->unread) || ((f)->total != (s)->messages) \ + (f) && (s) ? ((s)->newmsgs != (f)->new_msgs) || ((f)->unread_msgs != (s)->unread) || ((f)->total_msgs != (s)->messages) \ : FALSE /** diff --git a/src/main.c b/src/main.c index af18903d3..b7a7d7eef 100644 --- a/src/main.c +++ b/src/main.c @@ -467,7 +467,7 @@ static gint get_queued_message_num(void) if (!queue) return -1; folder_item_scan(queue); - return queue->total; + return queue->total_msgs; } static void save_all_caches(FolderItem *item, gpointer data) diff --git a/src/mainwindow.c b/src/mainwindow.c index 5fe4c4b92..cadc7d52e 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -1350,7 +1350,7 @@ void main_window_empty_trash(MainWindow *mainwin, gboolean confirm) for (has_trash = 0, list = folder_get_list(); list != NULL; list = list->next) { folder = FOLDER(list->data); - if (folder && folder->trash && folder->trash->total > 0) + if (folder && folder->trash && folder->trash->total_msgs > 0) has_trash++; } @@ -1392,7 +1392,7 @@ void main_window_add_mailbox(MainWindow *mainwin) path); g_free(path); - if (folder->class->create_tree(folder) < 0) { + if (folder->klass->create_tree(folder) < 0) { alertpanel_error(_("Creation of the mailbox failed.\n" "Maybe some files already exist, or you don't have the permission to write there.")); folder_destroy(folder); @@ -1429,7 +1429,7 @@ void main_window_add_mbox(MainWindow *mainwin) g_basename(path), path); g_free(path); - if (folder->class->create_tree(folder) < 0) { + if (folder->klass->create_tree(folder) < 0) { alertpanel_error(_("Creation of the mailbox failed.")); folder_destroy(folder); return; @@ -1486,7 +1486,7 @@ SensitiveCond main_window_get_current_state(MainWindow *mainwin) if (selection == SUMMARY_SELECTED_SINGLE) state |= M_SINGLE_TARGET_EXIST; if (mainwin->summaryview->folder_item && - mainwin->summaryview->folder_item->folder->class->type == F_NEWS) + mainwin->summaryview->folder_item->folder->klass->type == F_NEWS) state |= M_NEWS; else state |= M_NOT_NEWS; diff --git a/src/mbox_folder.c b/src/mbox_folder.c index c9425064e..ca5a6bb1c 100644 --- a/src/mbox_folder.c +++ b/src/mbox_folder.c @@ -117,7 +117,7 @@ Folder *mbox_folder_new(const gchar *name, const gchar *path) Folder *folder; folder = (Folder *)g_new0(MBOXFolder, 1); - folder->class = &mbox_class; + folder->klass = &mbox_class; mbox_folder_init(folder, name, path); return folder; @@ -1647,9 +1647,9 @@ void mbox_scan_folder(Folder *folder, FolderItem *item) cached = mbox_cache_get_mbox(mbox_path); if (cached == NULL) { - item->new = 0; - item->unread = 0; - item->total = 0; + item->new_msgs = 0; + item->unread_msgs = 0; + item->total_msgs = 0; item->last_num = 0; g_free(mbox_path); return; @@ -1658,7 +1658,7 @@ void mbox_scan_folder(Folder *folder, FolderItem *item) n_msg = mbox_cache_get_count(mbox_path); if (n_msg == 0) { - item->new = item->unread = item->total = 0; + item->new_msgs = item->unread_msgs = item->total_msgs = 0; } else { gint new = 0; @@ -1676,13 +1676,13 @@ void mbox_scan_folder(Folder *folder, FolderItem *item) unread ++; } - item->new = new; - item->unread = unread; - item->total = total; + item->new_msgs = new; + item->unread_msgs = unread; + item->total_msgs = total; } debug_print("Last number in dir %s = %d\n", mbox_path, - item->total); + item->total_msgs); item->last_num = n_msg; g_free(mbox_path); } diff --git a/src/mh.c b/src/mh.c index 689059f8d..e821e0254 100644 --- a/src/mh.c +++ b/src/mh.c @@ -127,7 +127,7 @@ Folder *mh_folder_new(const gchar *name, const gchar *path) Folder *folder; folder = (Folder *)g_new0(MHFolder, 1); - folder->class = &mh_class; + folder->klass = &mh_class; mh_folder_init(folder, name, path); return folder; diff --git a/src/mimeview.h b/src/mimeview.h index faffcda56..f96c6145e 100644 --- a/src/mimeview.h +++ b/src/mimeview.h @@ -17,8 +17,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __MIMEVIEW_H__ -#define __MIMEVIEW_H__ +#ifndef MIMEVIEW_H +#define MIMEVIEW_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ #include #include @@ -102,4 +106,8 @@ void mimeview_pass_key_press_event (MimeView *mimeview, void mimeview_register_viewer_factory (MimeViewerFactory *factory); void mimeview_unregister_viewer_factory (MimeViewerFactory *factory); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __MIMEVIEW_H__ */ diff --git a/src/msgcache.c b/src/msgcache.c index 9ccd72999..e71d033a0 100644 --- a/src/msgcache.c +++ b/src/msgcache.c @@ -445,15 +445,15 @@ MsgInfo *msgcache_get_msg_by_id(MsgCache *cache, const gchar *msgid) static void msgcache_get_msg_list_func(gpointer key, gpointer value, gpointer user_data) { - GSList **listptr = user_data; + MsgInfoList **listptr = user_data; MsgInfo *msginfo = value; *listptr = g_slist_prepend(*listptr, procmsg_msginfo_new_ref(msginfo)); } -GSList *msgcache_get_msg_list(MsgCache *cache) +MsgInfoList *msgcache_get_msg_list(MsgCache *cache) { - GSList *msg_list = NULL; + MsgInfoList *msg_list = NULL; g_return_val_if_fail(cache != NULL, NULL); diff --git a/src/msgcache.h b/src/msgcache.h index 2d2a4a617..b5a37f9e3 100644 --- a/src/msgcache.h +++ b/src/msgcache.h @@ -31,18 +31,27 @@ typedef struct _MsgCache MsgCache; #include "procmsg.h" #include "folder.h" -MsgCache *msgcache_new (); -void msgcache_destroy (MsgCache *cache); -MsgCache *msgcache_read_cache (FolderItem *item, const gchar *cache_file); -void msgcache_read_mark (MsgCache *cache, const gchar *mark_file); -gint msgcache_write (const gchar *cache_file, const gchar *mark_file, MsgCache *cache); -void msgcache_add_msg (MsgCache *cache, MsgInfo *msginfo); -void msgcache_remove_msg (MsgCache *cache, guint num); -void msgcache_update_msg (MsgCache *cache, MsgInfo *msginfo); -MsgInfo *msgcache_get_msg (MsgCache *cache, guint num); -MsgInfo *msgcache_get_msg_by_id (MsgCache *cache, const gchar *msgid); -GSList *msgcache_get_msg_list (MsgCache *cache); -time_t msgcache_get_last_access_time (MsgCache *cache); -gint msgcache_get_memory_usage (MsgCache *cache); +MsgCache *msgcache_new (); +void msgcache_destroy (MsgCache *cache); +MsgCache *msgcache_read_cache (FolderItem *item, + const gchar *cache_file); +void msgcache_read_mark (MsgCache *cache, + const gchar *mark_file); +gint msgcache_write (const gchar *cache_file, + const gchar *mark_file, + MsgCache *cache); +void msgcache_add_msg (MsgCache *cache, + MsgInfo *msginfo); +void msgcache_remove_msg (MsgCache *cache, + guint num); +void msgcache_update_msg (MsgCache *cache, + MsgInfo *msginfo); +MsgInfo *msgcache_get_msg (MsgCache *cache, + guint num); +MsgInfo *msgcache_get_msg_by_id (MsgCache *cache, + const gchar *msgid); +MsgInfoList *msgcache_get_msg_list (MsgCache *cache); +time_t msgcache_get_last_access_time (MsgCache *cache); +gint msgcache_get_memory_usage (MsgCache *cache); #endif diff --git a/src/news.c b/src/news.c index 5ee623bda..adc5b0a54 100644 --- a/src/news.c +++ b/src/news.c @@ -159,7 +159,7 @@ Folder *news_folder_new(const gchar *name, const gchar *path) Folder *folder; folder = (Folder *)g_new0(NewsFolder, 1); - folder->class = &news_class; + folder->klass = &news_class; news_folder_init(folder, name, path); return folder; @@ -347,7 +347,7 @@ gint news_scan_group(Folder *folder, FolderItem *item) } if (num == 0) { - item->new = item->unread = item->total = item->last_num = 0; + item->new_msgs = item->unread_msgs = item->total_msgs = item->last_num = 0; return 0; } diff --git a/src/plugins/image_viewer/plugin.c b/src/plugins/image_viewer/plugin.c index 104cba6d9..c3c9e484f 100644 --- a/src/plugins/image_viewer/plugin.c +++ b/src/plugins/image_viewer/plugin.c @@ -24,15 +24,15 @@ gint plugin_init(gchar **error) { - prefs_init(); - viewer_init(); + image_viewer_prefs_init(); + image_viewer_init(); return 0; } void plugin_done() { - viewer_done(); - prefs_done(); + image_viewer_done(); + image_viewer_prefs_done(); } const gchar *plugin_name() diff --git a/src/plugins/image_viewer/viewer.c b/src/plugins/image_viewer/viewer.c index 4cd75e3c8..68a1f9b3b 100644 --- a/src/plugins/image_viewer/viewer.c +++ b/src/plugins/image_viewer/viewer.c @@ -287,12 +287,12 @@ MimeViewerFactory image_viewer_factory = image_viewer_create, }; -void viewer_init() +void image_viewer_init() { mimeview_register_viewer_factory(&image_viewer_factory); } -void viewer_done() +void image_viewer_done() { mimeview_unregister_viewer_factory(&image_viewer_factory); } diff --git a/src/plugins/image_viewer/viewer.h b/src/plugins/image_viewer/viewer.h index 906e3a67f..f6fb86e17 100644 --- a/src/plugins/image_viewer/viewer.h +++ b/src/plugins/image_viewer/viewer.h @@ -26,7 +26,7 @@ #include "mimeview.h" -void viewer_init(); -void viewer_done(); +void image_viewer_init(); +void image_viewer_done(); #endif diff --git a/src/plugins/image_viewer/viewerprefs.c b/src/plugins/image_viewer/viewerprefs.c index caa6710c8..03401fa74 100644 --- a/src/plugins/image_viewer/viewerprefs.c +++ b/src/plugins/image_viewer/viewerprefs.c @@ -150,7 +150,7 @@ static void imageviewer_save_func(PrefsPage * _page) static struct ImageViewerPage imageviewer_page; -void prefs_init() +void image_viewer_prefs_init() { prefs_set_default(param); prefs_read_config(param, PREFS_BLOCK_NAME, COMMON_RC); @@ -163,7 +163,7 @@ void prefs_init() prefs_gtk_register_page((PrefsPage *) &imageviewer_page); } -void prefs_done() +void image_viewer_prefs_done() { prefs_gtk_unregister_page((PrefsPage *) &imageviewer_page); } diff --git a/src/plugins/image_viewer/viewerprefs.h b/src/plugins/image_viewer/viewerprefs.h index e51049aa1..a813ee58d 100644 --- a/src/plugins/image_viewer/viewerprefs.h +++ b/src/plugins/image_viewer/viewerprefs.h @@ -32,7 +32,7 @@ struct _ImageViewerPrefs extern ImageViewerPrefs imageviewerprefs; -void prefs_init(); -void prefs_done(); +void image_viewer_prefs_init(); +void image_viewer_prefs_done(); #endif diff --git a/src/plugins/trayicon/trayicon.c b/src/plugins/trayicon/trayicon.c index dd6ed3303..05d402e91 100644 --- a/src/plugins/trayicon/trayicon.c +++ b/src/plugins/trayicon/trayicon.c @@ -106,19 +106,16 @@ static gboolean folder_item_update_hook(gpointer source, gpointer data) static gboolean click_cb(GtkWidget * widget, GdkEventButton * event, gpointer user_data) { -/* MainWindow *mainwin; +/* mainwin = mainwindow_get_mainwindow(); - if (mainwin_hidden) { - gtk_widget_show(mainwin->window); - mainwin_hidden = FALSE; + if (GTK_WIDGET_VISIBLE(GTK_WIDGET(mainwin->window))) { + gtk_widget_hide_all(mainwin->window); } else { - gtk_widget_hide(mainwin->window); - mainwin_hidden = TRUE; + gtk_widget_show_all(mainwin->window); } */ - return TRUE; } diff --git a/src/procmime.h b/src/procmime.h index 132885a4d..239ebd86a 100644 --- a/src/procmime.h +++ b/src/procmime.h @@ -20,6 +20,10 @@ #ifndef __PROCMIME_H__ #define __PROCMIME_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -129,8 +133,8 @@ void procmime_mimeinfo_free_all (MimeInfo *mimeinfo); MimeInfo *procmime_mimeinfo_insert (MimeInfo *parent, MimeInfo *mimeinfo); -void procmime_mimeinfo_replace (MimeInfo *old, - MimeInfo *new); +void procmime_mimeinfo_replace (MimeInfo *old_mimeinfo, + MimeInfo *new_mimeinfo); MimeInfo *procmime_mimeinfo_next (MimeInfo *mimeinfo); @@ -184,4 +188,8 @@ const gchar *procmime_get_encoding_str (EncodingType encoding); void renderer_read_config(void); void renderer_write_config(void); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __PROCMIME_H__ */ diff --git a/src/procmsg.c b/src/procmsg.c index f650ef269..d4d242f34 100644 --- a/src/procmsg.c +++ b/src/procmsg.c @@ -124,9 +124,9 @@ void procmsg_msg_list_free(GSList *mlist) } struct MarkSum { - gint *new; - gint *unread; - gint *total; + gint *new_msgs; + gint *unread_msgs; + gint *total_msgs; gint *min; gint *max; gint first; @@ -459,7 +459,7 @@ void procmsg_empty_trash(void) for (cur = folder_get_list(); cur != NULL; cur = cur->next) { trash = FOLDER(cur->data)->trash; - if (trash && trash->total > 0) + if (trash && trash->total_msgs > 0) folder_item_remove_all_msg(trash); } } @@ -1071,38 +1071,38 @@ gint procmsg_send_message_queue(const gchar *file) return (newsval != 0 ? newsval : mailval); } -static void update_folder_msg_counts(FolderItem *item, MsgInfo *msginfo, MsgPermFlags old) +static void update_folder_msg_counts(FolderItem *item, MsgInfo *msginfo, MsgPermFlags old_flags) { - MsgPermFlags new = msginfo->flags.perm_flags; + MsgPermFlags new_flags = msginfo->flags.perm_flags; /* NEW flag */ - if (!(old & MSG_NEW) && (new & MSG_NEW)) { - item->new++; + if (!(old_flags & MSG_NEW) && (new_flags & MSG_NEW)) { + item->new_msgs++; } - if ((old & MSG_NEW) && !(new & MSG_NEW)) { - item->new--; + if ((old_flags & MSG_NEW) && !(new_flags & MSG_NEW)) { + item->new_msgs--; } /* UNREAD flag */ - if (!(old & MSG_UNREAD) && (new & MSG_UNREAD)) { - item->unread++; + if (!(old_flags & MSG_UNREAD) && (new_flags & MSG_UNREAD)) { + item->unread_msgs++; if (procmsg_msg_has_marked_parent(msginfo)) - item->unreadmarked++; + item->unreadmarked_msgs++; } - if ((old & MSG_UNREAD) && !(new & MSG_UNREAD)) { - item->unread--; + if ((old_flags & MSG_UNREAD) && !(new_flags & MSG_UNREAD)) { + item->unread_msgs--; if (procmsg_msg_has_marked_parent(msginfo)) - item->unreadmarked--; + item->unreadmarked_msgs--; } /* MARK flag */ - if (!(old & MSG_MARKED) && (new & MSG_MARKED)) { + if (!(old_flags & MSG_MARKED) && (new_flags & MSG_MARKED)) { procmsg_update_unread_children(msginfo, TRUE); } - if ((old & MSG_MARKED) && !(new & MSG_MARKED)) { + if ((old_flags & MSG_MARKED) && !(new_flags & MSG_MARKED)) { procmsg_update_unread_children(msginfo, FALSE); } } @@ -1303,9 +1303,9 @@ void procmsg_update_unread_children(MsgInfo *info, gboolean newly_marked) MsgInfo *tmp = (MsgInfo *)cur->data; if(MSG_IS_UNREAD(tmp->flags) && !MSG_IS_IGNORE_THREAD(tmp->flags)) { if(newly_marked) - info->folder->unreadmarked++; + info->folder->unreadmarked_msgs++; else - info->folder->unreadmarked--; + info->folder->unreadmarked_msgs--; folder_item_update(info->folder, F_ITEM_UPDATE_MSGCNT); } procmsg_msginfo_free(tmp); diff --git a/src/procmsg.h b/src/procmsg.h index 98cefd569..afeecef4b 100644 --- a/src/procmsg.h +++ b/src/procmsg.h @@ -34,6 +34,9 @@ typedef struct _MsgInfo MsgInfo; typedef struct _MsgFlags MsgFlags; typedef struct _MsgInfoUpdate MsgInfoUpdate; +typedef GSList MsgInfoList; +typedef GSList MsgNumberList; + typedef enum { MSG_NEW = 1 << 0, @@ -208,9 +211,9 @@ GSList *procmsg_read_cache (FolderItem *item, gint procmsg_get_last_num_in_msg_list(GSList *mlist); void procmsg_msg_list_free (GSList *mlist); void procmsg_get_mark_sum (const gchar *folder, - gint *new, - gint *unread, - gint *total, + gint *new_msgs, + gint *unread_msgs, + gint *total_msgs, gint *min, gint *max, gint first); diff --git a/src/setup.c b/src/setup.c index 3da133e3f..8a9464a71 100644 --- a/src/setup.c +++ b/src/setup.c @@ -57,7 +57,7 @@ void setup(MainWindow *mainwin) folder = folder_new(mh_get_class(), !strcmp(path, "Mail") ? _("Mailbox") : g_basename(path), path); g_free(path); - if (folder->class->create_tree(folder) < 0) { + if (folder->klass->create_tree(folder) < 0) { alertpanel_error(_("Creation of the mailbox failed.\n" "Maybe some files already exist, or you don't have the permission to write there.")); folder_destroy(folder);