From 54a761f3ddb05e27467ef9d917881ece9b15fe4a Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Wed, 7 Sep 2005 18:19:18 +0000 Subject: [PATCH] 2005-09-07 [colin] 1.9.14cvs2 * src/folderview.c * src/procmsg.c * src/summaryview.c * src/toolbar.c Fix special subfolders: - Inherit parent's icon - sent contents of queues subfolders - empty subfolders of trashes * src/mainwindow.c Remove outdated manual and faq entries * src/common/utils.c Add quotes around %s coming from mailcap --- ChangeLog-gtk2.claws | 15 ++++++++++++++ PATCHSETS | 1 + configure.ac | 2 +- src/common/utils.c | 11 ++++++++++ src/folderview.c | 35 ++++++++++++++++++++++++------- src/mainwindow.c | 21 +------------------ src/procmsg.c | 49 +++++++++++++++++++++++++++++++++++++++++++- src/summaryview.c | 5 ++--- src/toolbar.c | 1 - 9 files changed, 107 insertions(+), 33 deletions(-) diff --git a/ChangeLog-gtk2.claws b/ChangeLog-gtk2.claws index 0e4bf0354..0e87178a3 100644 --- a/ChangeLog-gtk2.claws +++ b/ChangeLog-gtk2.claws @@ -1,3 +1,18 @@ +2005-09-07 [colin] 1.9.14cvs2 + + * src/folderview.c + * src/procmsg.c + * src/summaryview.c + * src/toolbar.c + Fix special subfolders: + - Inherit parent's icon + - sent contents of queues subfolders + - empty subfolders of trashes + * src/mainwindow.c + Remove outdated manual and faq entries + * src/common/utils.c + Add quotes around %s coming from mailcap + 2005-09-07 [colin] 1.9.14cvs1 * src/compose.c diff --git a/PATCHSETS b/PATCHSETS index 2683c7117..7d9555df8 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -770,3 +770,4 @@ ( cvs diff -u -r 1.382.2.160 -r 1.382.2.161 src/compose.c; ) > 1.9.13cvs82.patchset ( cvs diff -u -r 1.58.2.11 -r 1.58.2.12 po/de.po; cvs diff -u -r 1.60.2.12 -r 1.60.2.13 po/es.po; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 po/fi.po; cvs diff -u -r 1.42.2.12 -r 1.42.2.13 po/fr.po; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 po/nb.po; cvs diff -u -r 1.50.2.9 -r 1.50.2.10 po/pt_BR.po; cvs diff -u -r 1.17.2.12 -r 1.17.2.13 po/sr.po; ) > 1.9.13cvs83.patchset ( cvs diff -u -r 1.382.2.161 -r 1.382.2.162 src/compose.c; cvs diff -u -r 1.83.2.38 -r 1.83.2.39 src/mimeview.c; cvs diff -u -r 1.36.2.42 -r 1.36.2.43 src/common/utils.c; cvs diff -u -r 1.20.2.23 -r 1.20.2.24 src/common/utils.h; ) > 1.9.14cvs1.patchset +( cvs diff -u -r 1.207.2.62 -r 1.207.2.63 src/folderview.c; cvs diff -u -r 1.274.2.58 -r 1.274.2.59 src/mainwindow.c; cvs diff -u -r 1.150.2.42 -r 1.150.2.43 src/procmsg.c; cvs diff -u -r 1.395.2.121 -r 1.395.2.122 src/summaryview.c; cvs diff -u -r 1.43.2.23 -r 1.43.2.24 src/toolbar.c; cvs diff -u -r 1.36.2.43 -r 1.36.2.44 src/common/utils.c; ) > 1.9.14cvs2.patchset diff --git a/configure.ac b/configure.ac index da2d36dfa..59201f5c8 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=9 MICRO_VERSION=14 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=1 +EXTRA_VERSION=2 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/common/utils.c b/src/common/utils.c index 556bf3cf0..fb2679634 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -4414,6 +4414,17 @@ static gchar *mailcap_get_command_in_file(const gchar *path, const gchar *type) result = g_strdup(trimmed); g_strfreev(parts); fclose(fp); + if (strstr(result, "%s") && !strstr(result, "'%s'")) { + gchar *start = g_strdup(result); + gchar *end = g_strdup(strstr(result, "%s")+2); + gchar *tmp; + *strstr(start, "%s") = '\0'; + tmp = g_strconcat(start,"'%s'",end, NULL); + g_free(start); + g_free(end); + g_free(result); + result = tmp; + } return result; } g_strfreev(parts); diff --git a/src/folderview.c b/src/folderview.c index 7fb65908e..058b6a4f4 100644 --- a/src/folderview.c +++ b/src/folderview.c @@ -639,7 +639,6 @@ void folderview_init(FolderView *folderview) } if (!bold_style) { - PangoFontDescription *font_desc; bold_style = gtk_style_copy(gtk_widget_get_style(ctree)); pango_font_description_set_weight (bold_style->font_desc, PANGO_WEIGHT_BOLD); @@ -1202,13 +1201,25 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node) gboolean add_sub_match_mark; gboolean use_bold, use_color; gint *col_pos = folderview->col_pos; - + SpecialFolderItemType stype; + item = gtk_ctree_node_get_row_data(ctree, node); g_return_if_fail(item != NULL); mark = (item->marked_msgs != 0); - switch (item->stype) { + stype = item->stype; + if (stype == F_NORMAL) { + if (folder_has_parent_of_type(item, F_TRASH)) + stype = F_TRASH; + else if (folder_has_parent_of_type(item, F_DRAFT)) + stype = F_DRAFT; + else if (folder_has_parent_of_type(item, F_OUTBOX)) + stype = F_OUTBOX; + else if (folder_has_parent_of_type(item, F_QUEUE)) + stype = F_QUEUE; + } + switch (stype) { case F_INBOX: if (item->hide_read_msgs) { xpm = mark?m_inboxhrmxpm:inboxhrmxpm; @@ -1673,11 +1684,13 @@ static gboolean folderview_button_pressed(GtkWidget *ctree, GdkEventButton *even if (NULL != (ac = account_find_from_item(item))) special_trash = account_get_special_folder(ac, F_TRASH); - if ((item == folder->trash || item == special_trash) && + if ((item == folder->trash || item == special_trash + || folder_has_parent_of_type(item, F_TRASH)) && gtk_item_factory_get_item(fpopup_factory, "/Empty trash...") == NULL) { gtk_item_factory_create_item(fpopup_factory, &folder_view_trash_popup_entries[0], folderview, 1); gtk_item_factory_create_item(fpopup_factory, &folder_view_trash_popup_entries[1], folderview, 1); - } else if (item != folder->trash && (special_trash == NULL || item != special_trash)) { + } else if (item != folder->trash && (special_trash == NULL || item != special_trash) + && !folder_has_parent_of_type(item, F_TRASH)) { gtk_item_factory_delete_entry(fpopup_factory, &folder_view_trash_popup_entries[0]); gtk_item_factory_delete_entry(fpopup_factory, &folder_view_trash_popup_entries[1]); } @@ -1690,7 +1703,8 @@ static gboolean folderview_button_pressed(GtkWidget *ctree, GdkEventButton *even folderview->selected == folderview->opened); SET_SENS("/Properties...", item->node->parent != NULL); SET_SENS("/Processing...", item->node->parent != NULL); - if (item == folder->trash || item == special_trash) { + if (item == folder->trash || item == special_trash + || folder_has_parent_of_type(item, F_TRASH)) { GSList *msglist = folder_item_get_msg_list(item); SET_SENS("/Empty trash...", msglist != NULL); procmsg_msg_list_free(msglist); @@ -1927,6 +1941,7 @@ void folderview_create_folder_node(FolderView *folderview, FolderItem *item) gchar *text[N_FOLDER_COLS] = {NULL, "0", "0", "0"}; GtkCTreeNode *node, *parent_node; gint *col_pos = folderview->col_pos; + FolderItemUpdateData hookdata; parent_node = gtk_ctree_find_by_row_data(ctree, NULL, folder_item_parent(item)); if (parent_node == NULL) @@ -1946,6 +1961,11 @@ void folderview_create_folder_node(FolderView *folderview, FolderItem *item) gtk_ctree_node_set_row_style(ctree, node, normal_style); folderview_sort_folders(folderview, parent_node, item->folder); + hookdata.item = item; + hookdata.update_flags = F_ITEM_UPDATE_NAME; + hookdata.msg = NULL; + hooks_invoke(FOLDER_ITEM_UPDATE_HOOKLIST, &hookdata); + gtk_clist_thaw(GTK_CLIST(ctree)); } @@ -1967,7 +1987,8 @@ static void folderview_empty_trash_cb(FolderView *folderview, guint action, if (NULL != (ac = account_find_from_item(item))) special_trash = account_get_special_folder(ac, F_TRASH); - if (item != item->folder->trash && item != special_trash) return; + if (item != item->folder->trash && item != special_trash + && !folder_has_parent_of_type(item, F_TRASH)) return; if (prefs_common.ask_on_clean) { if (alertpanel(_("Empty trash"), diff --git a/src/mainwindow.c b/src/mainwindow.c index 06c5981a2..0613dc723 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -784,12 +784,8 @@ static GtkItemFactoryEntry mainwin_entries[] = {N_("/_Help"), NULL, NULL, 0, ""}, {N_("/_Help/_Manual (Local)"), NULL, manual_open_cb, MANUAL_MANUAL_LOCAL, NULL}, - {N_("/_Help/Ma_nual (Sylpheed Doc Homepage)"), - NULL, manual_open_cb, MANUAL_MANUAL_SYLDOC, NULL}, {N_("/_Help/_FAQ (Local)"), NULL, manual_open_cb, MANUAL_FAQ_LOCAL, NULL}, - {N_("/_Help/FA_Q (Sylpheed Doc Homepage)"), - NULL, manual_open_cb, MANUAL_FAQ_SYLDOC, NULL}, - {N_("/_Help/_Claws FAQ (Claws Documentation)"), + {N_("/_Help/_User-contributed FAQ (Online)"), NULL, manual_open_cb, MANUAL_FAQ_CLAWS, NULL}, {N_("/_Help/---"), NULL, NULL, 0, ""}, {N_("/_Help/_About"), NULL, about_show, 0, NULL} @@ -1651,21 +1647,6 @@ void main_window_progress_set(MainWindow *mainwin, gint cur, gint total) void main_window_empty_trash(MainWindow *mainwin, gboolean confirm) { - GList *list; - guint has_trash; - Folder *folder; - - for (has_trash = 0, list = folder_get_list(); list != NULL; list = list->next) { - folder = FOLDER(list->data); - if (folder && folder->trash && folder->trash->total_msgs > 0) - has_trash++; - if (folder->account && folder->account->set_trash_folder && - folder_find_item_from_identifier(folder->account->trash_folder)) - has_trash++; - } - - if (!has_trash) return; - if (confirm) { if (alertpanel(_("Empty trash"), _("Delete all messages in trash folders?"), diff --git a/src/procmsg.c b/src/procmsg.c index 379e9782f..c1de1cc44 100644 --- a/src/procmsg.c +++ b/src/procmsg.c @@ -648,6 +648,13 @@ void procmsg_get_filter_keyword(MsgInfo *msginfo, gchar **header, gchar **key, void procmsg_empty_trash(FolderItem *trash) { + GNode *node, *next; + + if (!trash || + (trash->stype != F_TRASH && + !folder_has_parent_of_type(trash, F_TRASH))) + return; + if (trash && trash->total_msgs > 0) { GSList *mlist = folder_item_get_msg_list(trash); GSList *cur; @@ -664,6 +671,16 @@ void procmsg_empty_trash(FolderItem *trash) g_slist_free(mlist); folder_item_remove_all_msg(trash); } + + if (!trash->node || !trash->node->children) + return; + + node = trash->node->children; + while (node != NULL) { + next = node->next; + procmsg_empty_trash(FOLDER_ITEM(node->data)); + node = next; + } } void procmsg_empty_all_trash(void) @@ -748,9 +765,10 @@ parse_again: cur = orig; while (cur) { gchar *file = NULL; - PrefsAccount *ac = procmsg_get_account_from_file(file); + PrefsAccount *ac = NULL; msg = (MsgInfo *)cur->data; file = folder_item_fetch_msg(queue, msg->msgnum); + ac = procmsg_get_account_from_file(file); g_free(file); if (last_account == NULL || (ac != NULL && ac == last_account)) { @@ -823,6 +841,7 @@ gint procmsg_send_queue(FolderItem *queue, gboolean save_msgs) gint sent = 0, err = 0; GSList *list, *elem; GSList *sorted_list = NULL; + GNode *node, *next; if (!queue) queue = folder_get_default_queue(); @@ -871,6 +890,21 @@ gint procmsg_send_queue(FolderItem *queue, gboolean save_msgs) } g_slist_free(sorted_list); + folder_item_scan(queue); + + if (queue->node && queue->node->children) { + node = queue->node->children; + while (node != NULL) { + int res = 0; + next = node->next; + res = procmsg_send_queue(FOLDER_ITEM(node->data), save_msgs); + if (res < 0) + err = -res; + else + sent += res; + node = next; + } + } return (err != 0 ? -err : sent); } @@ -894,6 +928,19 @@ gboolean procmsg_queue_is_empty(FolderItem *queue) list = folder_item_get_msg_list(queue); res = (list == NULL); procmsg_msg_list_free(list); + + if (res == TRUE) { + GNode *node, *next; + if (queue->node && queue->node->children) { + node = queue->node->children; + while (node != NULL) { + next = node->next; + if (!procmsg_queue_is_empty(FOLDER_ITEM(node->data))) + return FALSE; + node = next; + } + } + } return res; } diff --git a/src/summaryview.c b/src/summaryview.c index 04b85eda9..c07e79cbb 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -1336,7 +1336,6 @@ void summary_select_prev_unread(SummaryView *summaryview) void summary_select_next_unread(SummaryView *summaryview) { GtkCTreeNode *node = summaryview->selected; - GtkCTree *ctree = GTK_CTREE(summaryview->ctree); gboolean skip_cur = FALSE; if (summaryview->displayed @@ -1436,7 +1435,6 @@ void summary_select_prev_new(SummaryView *summaryview) void summary_select_next_new(SummaryView *summaryview) { GtkCTreeNode *node = summaryview->selected; - GtkCTree *ctree = GTK_CTREE(summaryview->ctree); gboolean skip_cur = FALSE; if (summaryview->displayed @@ -3224,7 +3222,8 @@ void summary_delete_trash(SummaryView *summaryview) if (to_folder == NULL) to_folder = summaryview->folder_item->folder->trash; - if (to_folder == NULL || to_folder == summaryview->folder_item) + if (to_folder == NULL || to_folder == summaryview->folder_item + || folder_has_parent_of_type(summaryview->folder_item, F_TRASH)) summary_delete(summaryview); else summary_move_selected_to(summaryview, to_folder); diff --git a/src/toolbar.c b/src/toolbar.c index 932b90f2f..379a7dccb 100644 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -1996,7 +1996,6 @@ void send_queue_cb(gpointer data, guint action, GtkWidget *widget) prefs_common.savemsg) < 0) alertpanel_error(_("Some errors occurred while " "sending queued messages.")); - folder_item_scan(folder->queue); } } } -- 2.25.1