#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;
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_NOSELECT, &noselectxpm);
+ 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_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) {
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:
case MSG_MARKED:
prefs_common.summary_select_prio[0] = ACTION_MARKED;
break;
+ default:
+ prefs_common.summary_select_prio[0] = ACTION_FIRST_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;
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 (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_boldfont = g_strdup(BOLD_FONT);
last_derive = prefs_common.derive_from_normal_font;
- normal_style = normal_color_style = bold_style =
- bold_color_style = bold_tgtfold_style = NULL;
+#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));
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)