#include "manual.h"
#include "timing.h"
#include "log.h"
+#include "gtkcmctree.h"
#define COL_FOLDER_WIDTH 150
#define COL_NUM_WIDTH 32
static GdkPixbuf *queueopenhrmxpm;
static GdkPixbuf *draftsxpm;
static GdkPixbuf *draftsopenxpm;
-static GdkPixbuf *noselectxpm;
+static GdkPixbuf *foldersubsxpm;
+static GdkPixbuf *foldersubsopenxpm;
+static GdkPixbuf *foldernoselectxpm;
+static GdkPixbuf *foldernoselectopenxpm;
static GdkPixbuf *m_inboxxpm;
static GdkPixbuf *m_inboxhrmxpm;
static GdkPixbuf *m_queueopenhrmxpm;
static GdkPixbuf *m_draftsxpm;
static GdkPixbuf *m_draftsopenxpm;
+static GdkPixbuf *m_foldersubsxpm;
+static GdkPixbuf *m_foldernoselectxpm;
static GdkPixbuf *newxpm;
static GdkPixbuf *unreadxpm;
gint width,
FolderView *folderview);
-static void mark_all_read_handler (GtkAction *action,
+static void mark_all_read_unread_handler (GtkAction *action,
gpointer data,
- gboolean recursive);
+ gboolean recursive,
+ gboolean read);
static void mark_all_read_cb (GtkAction *action,
gpointer data);
+static void mark_all_unread_cb (GtkAction *action,
+ gpointer data);
static void mark_all_read_recursive_cb (GtkAction *action,
gpointer data);
+static void mark_all_unread_recursive_cb (GtkAction *action,
+ gpointer data);
static void folderview_empty_trash_cb (GtkAction *action,
gpointer data);
static GtkActionEntry folderview_common_popup_entries[] =
{
- {"FolderViewPopup", NULL, "FolderViewPopup" },
- {"FolderViewPopup/MarkAllRead", NULL, N_("Mark all re_ad"), NULL, NULL, G_CALLBACK(mark_all_read_cb) },
- {"FolderViewPopup/MarkAllReadRec", NULL, N_("Mark all read recursi_vely"), NULL, NULL, G_CALLBACK(mark_all_read_recursive_cb) },
- {"FolderViewPopup/---", NULL, "---" },
- {"FolderViewPopup/RunProcessing", NULL, N_("R_un processing rules"), NULL, NULL, G_CALLBACK(folderview_run_processing_cb) },
- {"FolderViewPopup/SearchFolder", NULL, N_("_Search folder..."), NULL, NULL, G_CALLBACK(folderview_search_cb) },
- {"FolderViewPopup/Properties", NULL, N_("_Properties..."), NULL, NULL, G_CALLBACK(folderview_property_cb) },
- {"FolderViewPopup/Processing", NULL, N_("Process_ing..."), NULL, NULL, G_CALLBACK(folderview_processing_cb) },
- {"FolderViewPopup/EmptyTrash", NULL, N_("Empty _trash..."), NULL, NULL, G_CALLBACK(folderview_empty_trash_cb) },
- {"FolderViewPopup/SendQueue", NULL, N_("Send _queue..."), NULL, NULL, G_CALLBACK(folderview_send_queue_cb) },
+ {"FolderViewPopup", NULL, "FolderViewPopup", NULL, NULL , NULL},
+ {"FolderViewPopup/MarkAllRead", NULL, N_("Mark all re_ad"), NULL, NULL, G_CALLBACK(mark_all_read_cb) },
+ {"FolderViewPopup/MarkAllUnread", NULL, N_("Mark all u_nread"), NULL, NULL, G_CALLBACK(mark_all_unread_cb) },
+ {"FolderViewPopup/MarkAllReadRec", NULL, N_("Mark all read recursi_vely"), NULL, NULL, G_CALLBACK(mark_all_read_recursive_cb) },
+ {"FolderViewPopup/MarkAllUnreadRec", NULL, N_("Mark all unread recursi_vely"), NULL, NULL, G_CALLBACK(mark_all_unread_recursive_cb) },
+ {"FolderViewPopup/---", NULL, "---", NULL, NULL , NULL},
+ {"FolderViewPopup/RunProcessing", NULL, N_("R_un processing rules"), NULL, NULL, G_CALLBACK(folderview_run_processing_cb) },
+ {"FolderViewPopup/SearchFolder", NULL, N_("_Search folder..."), NULL, NULL, G_CALLBACK(folderview_search_cb) },
+ {"FolderViewPopup/Properties", NULL, N_("_Properties..."), NULL, NULL, G_CALLBACK(folderview_property_cb) },
+ {"FolderViewPopup/Processing", NULL, N_("Process_ing..."), NULL, NULL, G_CALLBACK(folderview_processing_cb) },
+ {"FolderViewPopup/EmptyTrash", NULL, N_("Empty _trash..."), NULL, NULL, G_CALLBACK(folderview_empty_trash_cb) },
+ {"FolderViewPopup/SendQueue", NULL, N_("Send _queue..."), NULL, NULL, G_CALLBACK(folderview_send_queue_cb) },
};
/* CLAWS: titles for "New" and "Unread" show new & unread pixmaps
* instead text (text overflows making them unreadable and ugly) */
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_NEW,
- &newxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_UNREAD,
- &unreadxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_READ,
- &readxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_NEW, &newxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_UNREAD, &unreadxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_READ, &readxpm);
label_folder = gtk_label_new(_("Folder"));
label_new = gtk_image_new_from_pixbuf(newxpm);
GdkColor gdk_color;
PangoFontDescription *normal_font;
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_INBOX_CLOSE, &inboxxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_INBOX_CLOSE_HRM, &inboxhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_INBOX_OPEN, &inboxopenxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_INBOX_OPEN_HRM, &inboxopenhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_OUTBOX_CLOSE, &outboxxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_OUTBOX_CLOSE_HRM, &outboxhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_OUTBOX_OPEN, &outboxopenxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_OUTBOX_OPEN_HRM, &outboxopenhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_DIR_CLOSE, &folderxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_DIR_CLOSE_HRM, &folderhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_DIR_OPEN, &folderopenxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_DIR_OPEN_HRM, &folderopenhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_TRASH_OPEN, &trashopenxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_TRASH_OPEN_HRM, &trashopenhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_TRASH_CLOSE, &trashxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_TRASH_CLOSE_HRM, &trashhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_QUEUE_CLOSE, &queuexpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_QUEUE_CLOSE_HRM, &queuehrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_QUEUE_OPEN, &queueopenxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_QUEUE_OPEN_HRM, &queueopenhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_DRAFTS_CLOSE, &draftsxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_DRAFTS_OPEN, &draftsopenxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_DIR_NOSELECT, &noselectxpm);
-
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_INBOX_CLOSE_MARK, &m_inboxxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_INBOX_CLOSE_HRM_MARK, &m_inboxhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_INBOX_OPEN_MARK, &m_inboxopenxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_INBOX_OPEN_HRM_MARK, &m_inboxopenhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_OUTBOX_CLOSE_MARK, &m_outboxxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_OUTBOX_CLOSE_HRM_MARK, &m_outboxhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_OUTBOX_OPEN_MARK, &m_outboxopenxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_OUTBOX_OPEN_HRM_MARK, &m_outboxopenhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_DIR_CLOSE_MARK, &m_folderxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_DIR_CLOSE_HRM_MARK, &m_folderhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_DIR_OPEN_MARK, &m_folderopenxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_DIR_OPEN_HRM_MARK, &m_folderopenhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_TRASH_OPEN_MARK, &m_trashopenxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_TRASH_OPEN_HRM_MARK, &m_trashopenhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_TRASH_CLOSE_MARK, &m_trashxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_TRASH_CLOSE_HRM_MARK, &m_trashhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_QUEUE_CLOSE_MARK, &m_queuexpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_QUEUE_CLOSE_HRM_MARK, &m_queuehrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_QUEUE_OPEN_MARK, &m_queueopenxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_QUEUE_OPEN_HRM_MARK, &m_queueopenhrmxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_DRAFTS_CLOSE_MARK, &m_draftsxpm);
- stock_pixbuf_gdk(ctree, STOCK_PIXMAP_DRAFTS_OPEN_MARK, &m_draftsopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_INBOX_CLOSE, &inboxxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_INBOX_CLOSE_HRM, &inboxhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_INBOX_OPEN, &inboxopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_INBOX_OPEN_HRM, &inboxopenhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_OUTBOX_CLOSE, &outboxxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_OUTBOX_CLOSE_HRM, &outboxhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_OUTBOX_OPEN, &outboxopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_OUTBOX_OPEN_HRM, &outboxopenhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DIR_CLOSE, &folderxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DIR_CLOSE_HRM, &folderhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DIR_OPEN, &folderopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DIR_OPEN_HRM, &folderopenhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_TRASH_OPEN, &trashopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_TRASH_OPEN_HRM, &trashopenhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_TRASH_CLOSE, &trashxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_TRASH_CLOSE_HRM, &trashhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_QUEUE_CLOSE, &queuexpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_QUEUE_CLOSE_HRM, &queuehrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_QUEUE_OPEN, &queueopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_QUEUE_OPEN_HRM, &queueopenhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DRAFTS_CLOSE, &draftsxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DRAFTS_OPEN, &draftsopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DIR_SUBS_OPEN, &foldersubsopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DIR_SUBS_CLOSE, &foldersubsxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DIR_NOSELECT_OPEN, &foldernoselectopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DIR_NOSELECT_CLOSE, &foldernoselectxpm);
+
+ stock_pixbuf_gdk(STOCK_PIXMAP_INBOX_CLOSE_MARK, &m_inboxxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_INBOX_CLOSE_HRM_MARK, &m_inboxhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_INBOX_OPEN_MARK, &m_inboxopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_INBOX_OPEN_HRM_MARK, &m_inboxopenhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_OUTBOX_CLOSE_MARK, &m_outboxxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_OUTBOX_CLOSE_HRM_MARK, &m_outboxhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_OUTBOX_OPEN_MARK, &m_outboxopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_OUTBOX_OPEN_HRM_MARK, &m_outboxopenhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DIR_CLOSE_MARK, &m_folderxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DIR_CLOSE_HRM_MARK, &m_folderhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DIR_OPEN_MARK, &m_folderopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DIR_OPEN_HRM_MARK, &m_folderopenhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_TRASH_OPEN_MARK, &m_trashopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_TRASH_OPEN_HRM_MARK, &m_trashopenhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_TRASH_CLOSE_MARK, &m_trashxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_TRASH_CLOSE_HRM_MARK, &m_trashhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_QUEUE_CLOSE_MARK, &m_queuexpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_QUEUE_CLOSE_HRM_MARK, &m_queuehrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_QUEUE_OPEN_MARK, &m_queueopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_QUEUE_OPEN_HRM_MARK, &m_queueopenhrmxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DRAFTS_CLOSE_MARK, &m_draftsxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DRAFTS_OPEN_MARK, &m_draftsopenxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DIR_SUBS_CLOSE_MARK, &m_foldersubsxpm);
+ stock_pixbuf_gdk(STOCK_PIXMAP_DIR_NOSELECT_CLOSE_MARK, &m_foldernoselectxpm);
normal_font = pango_font_description_from_string(NORMAL_FONT);
if (normal_font) {
(normal_style->font_desc);
normal_style->font_desc = font_desc;
}
- gtkut_convert_int_to_gdk_color(prefs_common.color_new, &gdk_color);
+ gtkut_convert_int_to_gdk_color(prefs_common.color[COL_NEW], &gdk_color);
normal_color_style = gtk_style_copy(normal_style);
normal_color_style->fg[GTK_STATE_NORMAL] = gdk_color;
}
if (!bold_style) {
- gtkut_convert_int_to_gdk_color(prefs_common.color_new, &gdk_color);
+ gtkut_convert_int_to_gdk_color(prefs_common.color[COL_NEW], &gdk_color);
bold_style = gtk_style_copy(gtk_widget_get_style(ctree));
if (prefs_common.derive_from_normal_font || !BOLD_FONT) {
PangoFontDescription *font_desc;
static void mark_all_read_cb(GtkAction *action, gpointer data)
{
- mark_all_read_handler(action, data, FALSE);
+ mark_all_read_unread_handler(action, data, FALSE, TRUE);
+}
+
+static void mark_all_unread_cb(GtkAction *action, gpointer data)
+{
+ mark_all_read_unread_handler(action, data, FALSE, FALSE);
}
static void mark_all_read_recursive_cb(GtkAction *action, gpointer data)
{
- mark_all_read_handler(action, data, TRUE);
+ mark_all_read_unread_handler(action, data, TRUE, TRUE);
}
-static void mark_all_read_handler(GtkAction *action, gpointer data, gboolean recursive)
+static void mark_all_unread_recursive_cb(GtkAction *action, gpointer data)
+{
+ mark_all_read_unread_handler(action, data, TRUE, FALSE);
+}
+
+static void mark_all_read_unread_handler(GtkAction *action, gpointer data,
+ gboolean recursive, gboolean read)
{
FolderView *folderview = (FolderView *)data;
FolderItem *item;
AlertValue val;
gchar *message;
+ gchar *title;
item = folderview_get_selected_item(folderview);
if (item == NULL)
return;
- message = recursive? _("Do you really want to mark all mails in this "
- "folder and its sub-folders as read?") :
- _("Do you really want to mark all mails in this "
- "folder as read?");
- if (folderview->summaryview->folder_item != item &&
- prefs_common.ask_mark_all_read) {
- val = alertpanel_full(_("Mark all as read"),
- message, GTK_STOCK_NO, GTK_STOCK_YES, NULL,
+ if (read) {
+ title = _("Mark all as read");
+ message = recursive? _("Do you really want to mark all mails in this "
+ "folder and its sub-folders as read?") :
+ _("Do you really want to mark all mails in this "
+ "folder as read?");
+ } else {
+ title = _("Mark all as unread");
+ message = recursive? _("Do you really want to mark all mails in this "
+ "folder and its sub-folders as unread?") :
+ _("Do you really want to mark all mails in this "
+ "folder as unread?");
+ }
+ if (prefs_common.ask_mark_all_read) {
+ val = alertpanel_full(title, message,
+ GTK_STOCK_NO, GTK_STOCK_YES, NULL,
TRUE, NULL, ALERT_QUESTION, G_ALERTDEFAULT);
if ((val & ~G_ALERTDISABLE) != G_ALERTALTERNATE)
else
summary_freeze(folderview->summaryview);
- if (recursive)
- folderutils_mark_all_read_recursive(item);
- else
- folderutils_mark_all_read(item);
-
+ if (read) {
+ if (recursive)
+ folderutils_mark_all_read_recursive(item);
+ else
+ folderutils_mark_all_read(item);
+ } else {
+ if (recursive)
+ folderutils_mark_all_unread_recursive(item);
+ else
+ folderutils_mark_all_unread(item);
+ }
if (folderview->summaryview->folder_item != item && !recursive)
summary_unlock(folderview->summaryview);
else
if ((folderview->summaryview->folder_item &&
folderview->summaryview->folder_item->total_msgs > 0) ||
prefs_common.layout_mode == SMALL_LAYOUT)
- summary_grab_focus(folderview->summaryview);
+ summary_select_node(folderview->summaryview,
+ folderview->summaryview->selected, OPEN_SELECTED_ON_FOLDER_OPEN);
else
gtk_widget_grab_focus(folderview->ctree);
}
if(item->marked_msgs > 0)
return node;
break;
+ default:
+ if(item->total_msgs > 0)
+ return node;
+ break;
}
}
}
void folderview_select_next_with_flag(FolderView *folderview,
- MsgPermFlags flag,
- gboolean force_open)
+ MsgPermFlags flag)
{
GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
GtkCMCTreeNode *node = NULL;
EntryAction last_summary_select_prio = prefs_common.summary_select_prio[0];
- gboolean last_open = prefs_common.always_show_msg;
switch (flag) {
case MSG_UNREAD:
- prefs_common.summary_select_prio[0] = ACTION_UNREAD;
+ prefs_common.summary_select_prio[0] = ACTION_OLDEST_UNREAD;
break;
case MSG_NEW:
- prefs_common.summary_select_prio[0] = ACTION_NEW;
+ prefs_common.summary_select_prio[0] = ACTION_OLDEST_NEW;
break;
case MSG_MARKED:
- prefs_common.summary_select_prio[0] = ACTION_MARKED;
+ prefs_common.summary_select_prio[0] = ACTION_OLDEST_MARKED;
+ break;
+ default:
+ prefs_common.summary_select_prio[0] = ACTION_OLDEST_LIST;
break;
}
- prefs_common.always_show_msg = force_open ? OPENMSG_ALWAYS : last_open;
node = folderview_find_next_with_flag(ctree, folderview->opened, flag);
if (node != NULL) {
out:
prefs_common.summary_select_prio[0] = last_summary_select_prio;
- prefs_common.always_show_msg = last_open;
}
FolderItem *folderview_get_selected_item(FolderView *folderview)
{
+ g_return_val_if_fail(folderview != NULL, NULL);
+ g_return_val_if_fail(folderview->ctree != NULL, NULL);
+
GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
if (!folderview->selected) return NULL;
FolderItem *folderview_get_opened_item(FolderView *folderview)
{
+ g_return_val_if_fail(folderview != NULL, NULL);
+ g_return_val_if_fail(folderview->ctree != NULL, NULL);
+
GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
if (!folderview->opened) return NULL;
static gchar *get_scan_str(FolderItem *item)
{
if (item->path)
- return g_strdup_printf(_("Scanning folder %s%c%s..."),
- item->folder->name, G_DIR_SEPARATOR,
- item->path);
+ return g_strdup_printf(_("Scanning folder %s/%s..."),
+ item->folder->name, item->path);
else
return g_strdup_printf(_("Scanning folder %s..."),
item->folder->name);
return folderview_have_unread_children_sub(folderview, item, FALSE);
}
+static gboolean folderview_have_read_children_sub(FolderView *folderview,
+ FolderItem *item,
+ gboolean in_sub)
+{
+ GNode *node = NULL;
+
+ if (!item || !item->folder || !item->folder->node) {
+ return FALSE;
+ }
+
+ node = item->folder->node;
+
+ node = g_node_find(node, G_PRE_ORDER, G_TRAVERSE_ALL, item);
+ node = node->children;
+
+ if (in_sub &&
+ (((item->total_msgs > 0) &&
+ (item->unread_msgs != (item->total_msgs - item->ignored_msgs))))) {
+ return TRUE;
+ }
+
+ while (node != NULL) {
+ if (node && node->data) {
+ FolderItem *next_item = (FolderItem*) node->data;
+ node = node->next;
+ if (folderview_have_read_children_sub(folderview,
+ next_item,
+ TRUE)) {
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+static gboolean folderview_have_read_children(FolderView *folderview,
+ FolderItem *item)
+{
+ return folderview_have_read_children_sub(folderview, item, FALSE);
+}
+
static gboolean folderview_have_matching_children_sub(FolderView *folderview,
FolderItem *item,
gboolean in_sub)
openxpm = mark?m_draftsopenxpm:draftsopenxpm;
break;
default:
- if (item->hide_read_msgs || item->hide_read_threads) {
+ if (!item->path &&
+ FOLDER_TYPE(item->folder) == F_IMAP &&
+ item->folder->account->imap_subsonly) {
+ xpm = mark?m_foldersubsxpm:foldersubsxpm;
+ openxpm = foldersubsopenxpm;
+ } else if (item->no_select) {
+ xpm = mark?m_foldernoselectxpm:foldernoselectxpm;
+ openxpm = foldernoselectopenxpm;
+ } else if (item->hide_read_msgs || item->hide_read_threads) {
xpm = mark?m_folderhrmxpm:folderhrmxpm;
openxpm = mark?m_folderopenhrmxpm:folderopenhrmxpm;
} else {
openxpm = mark?m_folderopenxpm:folderopenxpm;
}
}
-
- if (item->no_select) {
- xpm = openxpm = noselectxpm;
- }
name = folder_item_get_name(item);
if (item->search_match) {
if (!searchicon) {
- stock_pixbuf_gdk(folderview->ctree, STOCK_PIXMAP_QUICKSEARCH,
+ stock_pixbuf_gdk(STOCK_PIXMAP_QUICKSEARCH,
&searchicon);
}
xpm = openxpm = searchicon;
fpopup->add_menuitems(ui_manager, item);
MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup", "MarkAllRead", "FolderViewPopup/MarkAllRead", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup", "MarkAllUnread", "FolderViewPopup/MarkAllUnread", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup", "MarkAllReadRec", "FolderViewPopup/MarkAllReadRec", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup", "MarkAllUnreadRec", "FolderViewPopup/MarkAllUnreadRec", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup", "Separator1", "FolderViewPopup/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup", "RunProcessing", "FolderViewPopup/RunProcessing", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup", "SearchFolder", "FolderViewPopup/SearchFolder", GTK_UI_MANAGER_MENUITEM)
#define SET_SENS(name, sens) \
cm_menu_set_sensitive_full(ui_manager, "Popup/"name, sens)
- SET_SENS("FolderViewPopup/MarkAllRead", item->unread_msgs >= 1);
+ SET_SENS("FolderViewPopup/MarkAllRead", item->unread_msgs > 0);
+ SET_SENS("FolderViewPopup/MarkAllUnread", (item->total_msgs > 0) &&
+ (item->unread_msgs != (item->total_msgs - item->ignored_msgs)));
SET_SENS("FolderViewPopup/MarkAllReadRec", folderview_have_unread_children(folderview,item));
- SET_SENS("FolderViewPopup/SearchFolder", item->total_msgs >= 1 &&
+ SET_SENS("FolderViewPopup/MarkAllUnreadRec", folderview_have_read_children(folderview,item));
+ SET_SENS("FolderViewPopup/SearchFolder", item->total_msgs > 0 &&
folderview->selected == folderview->opened);
SET_SENS("FolderViewPopup/Properties", TRUE);
if (folderview->opened == folderview->selected &&
(!folderview->summaryview->folder_item ||
folderview->summaryview->folder_item->total_msgs == 0))
- folderview_select_next_with_flag(folderview, MSG_UNREAD, TRUE);
+ folderview_select_next_with_flag(folderview, MSG_UNREAD);
else
folderview_select_node(folderview,
folderview->selected);
return FALSE;
}
-void folderview_close_opened(FolderView *folderview)
+void folderview_close_opened(FolderView *folderview, gboolean dirty)
{
if (folderview->opened) {
- FolderItem *olditem;
-
- olditem = gtk_cmctree_node_get_row_data(GTK_CMCTREE(folderview->ctree),
+ if (dirty) {
+ folderview->opened = NULL;
+ return;
+ }
+
+ FolderItem *olditem =
+ gtk_cmctree_node_get_row_data(GTK_CMCTREE(folderview->ctree),
folderview->opened);
if (olditem) {
gchar *buf = g_strdup_printf(_("Closing folder %s..."),
/* Save cache for old folder */
/* We don't want to lose all caches if sylpheed crashed */
/* resets folderview->opened to NULL */
- folderview_close_opened(folderview);
+ folderview_close_opened(folderview, FALSE);
/* CLAWS: set compose button type: news folder items
* always have a news folder as parent */
last_derive != prefs_common.derive_from_normal_font)
update_font = TRUE;
+ if (!update_font)
+ return;
+
g_free(last_smallfont);
last_smallfont = g_strdup(SMALL_FONT);
g_free(last_normalfont);
last_boldfont = g_strdup(BOLD_FONT);
last_derive = prefs_common.derive_from_normal_font;
- if (update_font) {
- normal_style = normal_color_style = bold_style =
- bold_color_style = bold_tgtfold_style = NULL;
-
- folderview_init(folderview);
+#define STYLE_FREE(s) \
+ if (s != NULL) { \
+ g_object_unref(s); \
+ s = NULL; \
}
+
+ STYLE_FREE(normal_style);
+ STYLE_FREE(normal_color_style);
+ STYLE_FREE(bold_style);
+ STYLE_FREE(bold_color_style);
+ STYLE_FREE(bold_tgtfold_style);
+
+#undef STYLE_FREE
+
+ folderview_init(folderview);
gtk_cmclist_freeze(GTK_CMCLIST(folderview->ctree));
folderview_column_set_titles(folderview);
folderview_set_all();
}
g_hash_table_remove(folderview_popups, fpopup->klass);
}
+
+void folderview_remove_item(FolderView *folderview, FolderItem *item)
+{
+ g_return_if_fail(folderview != NULL);
+ g_return_if_fail(item != NULL);
+
+ GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
+ g_return_if_fail(ctree != NULL);
+
+ GtkCMCTreeNode *node =
+ gtk_cmctree_find_by_row_data(ctree, NULL, item);
+ g_return_if_fail(node != NULL);
+
+ gtk_cmctree_remove_node(ctree, node);
+}
+
+void folderview_freeze(FolderView *folderview)
+{
+ if (folderview)
+ gtk_cmclist_freeze(GTK_CMCLIST(folderview->ctree));
+}
+
+void folderview_thaw(FolderView *folderview)
+{
+ if (folderview)
+ gtk_cmclist_thaw(GTK_CMCLIST(folderview->ctree));
+}
+
+void folderview_grab_focus(FolderView *folderview)
+{
+ if (folderview)
+ gtk_widget_grab_focus(folderview->ctree);
+}