#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) {
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);
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 */
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)