#include "gtkutils.h"
#include "prefs_common.h"
#include "prefs_account.h"
+#include "prefs_filter.h"
#include "account.h"
#include "folder.h"
#include "inc.h"
static GtkStyle *bold_color_style;
static GtkStyle *bold_tgtfold_style;
-static GdkPixmap *inboxxpm;
+static GdkBitmap *inboxxpm;
static GdkBitmap *inboxxpmmask;
static GdkPixmap *inboxhrmxpm;
static GdkBitmap *inboxhrmxpmmask;
+static GdkPixmap *inboxopenxpm;
+static GdkBitmap *inboxopenxpmmask;
+static GdkPixmap *inboxopenhrmxpm;
+static GdkBitmap *inboxopenhrmxpmmask;
static GdkPixmap *outboxxpm;
static GdkBitmap *outboxxpmmask;
static GdkPixmap *outboxhrmxpm;
static GdkBitmap *outboxhrmxpmmask;
+static GdkPixmap *outboxopenxpm;
+static GdkBitmap *outboxopenxpmmask;
+static GdkPixmap *outboxopenhrmxpm;
+static GdkBitmap *outboxopenhrmxpmmask;
static GdkPixmap *folderxpm;
static GdkBitmap *folderxpmmask;
+static GdkPixmap *folderhrmxpm;
+static GdkBitmap *folderhrmxpmmask;
static GdkPixmap *folderopenxpm;
static GdkBitmap *folderopenxpmmask;
static GdkPixmap *folderopenhrmxpm;
static GdkBitmap *folderopenhrmxpmmask;
+static GdkPixmap *trashopenxpm;
+static GdkBitmap *trashopenxpmmask;
+static GdkPixmap *trashopenhrmxpm;
+static GdkBitmap *trashopenhrmxpmmask;
static GdkPixmap *trashxpm;
static GdkBitmap *trashxpmmask;
static GdkPixmap *trashhrmxpm;
static GdkBitmap *trashhrmxpmmask;
+static GdkPixmap *queuexpm;
+static GdkBitmap *queuexpmmask;
+static GdkPixmap *queuehrmxpm;
+static GdkBitmap *queuehrmxpmmask;
+static GdkPixmap *queueopenxpm;
+static GdkBitmap *queueopenxpmmask;
+static GdkPixmap *queueopenhrmxpm;
+static GdkBitmap *queueopenhrmxpmmask;
static GdkPixmap *newxpm;
static GdkBitmap *newxpmmask;
static GdkPixmap *unreadxpm;
FolderView *folderview;
GtkWidget *scrolledwin;
GtkWidget *ctree;
- gchar *titles[N_FOLDER_COLS] = {_("Folder"), _("New"),
- _("Unread"), _("#")};
+ gchar *titles[N_FOLDER_COLS];
GtkWidget *mail_popup;
GtkWidget *news_popup;
GtkWidget *imap_popup;
debug_print(_("Creating folder view...\n"));
folderview = g_new0(FolderView, 1);
+ titles[COL_FOLDER] = _("Folder");
+ titles[COL_NEW] = _("New");
+ titles[COL_UNREAD] = _("Unread");
+ titles[COL_TOTAL] = _("#");
+
scrolledwin = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
GTK_POLICY_AUTOMATIC,
GtkWidget *hbox_new;
GtkWidget *hbox_unread;
- stock_pixmap_gdk(ctree, STOCK_PIXMAP_INBOX, &inboxxpm, &inboxxpmmask);
- stock_pixmap_gdk(ctree, STOCK_PIXMAP_OUTBOX,
- &outboxxpm, &outboxxpmmask);
- stock_pixmap_gdk(ctree, STOCK_PIXMAP_DIR_CLOSE,
- &folderxpm, &folderxpmmask);
- stock_pixmap_gdk(ctree, STOCK_PIXMAP_DIR_OPEN,
- &folderopenxpm, &folderopenxpmmask);
- stock_pixmap_gdk(ctree, STOCK_PIXMAP_TRASH, &trashxpm, &trashxpmmask);
- stock_pixmap_gdk(ctree, STOCK_PIXMAP_INBOX_HRM,
- &inboxhrmxpm, &inboxhrmxpmmask);
- stock_pixmap_gdk(ctree, STOCK_PIXMAP_OUTBOX_HRM,
- &outboxhrmxpm, &outboxhrmxpmmask);
- stock_pixmap_gdk(ctree, STOCK_PIXMAP_DIR_OPEN_HRM,
- &folderopenhrmxpm, &folderopenhrmxpmmask);
- stock_pixmap_gdk(ctree, STOCK_PIXMAP_TRASH_HRM,
- &trashhrmxpm, &trashhrmxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_INBOX_CLOSE, &inboxxpm, &inboxxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_INBOX_CLOSE_HRM, &inboxhrmxpm, &inboxhrmxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_INBOX_OPEN, &inboxopenxpm, &inboxopenxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_INBOX_OPEN_HRM, &inboxopenhrmxpm, &inboxopenhrmxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_OUTBOX_CLOSE, &outboxxpm, &outboxxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_OUTBOX_CLOSE_HRM, &outboxhrmxpm, &outboxhrmxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_OUTBOX_OPEN, &outboxopenxpm, &outboxopenxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_OUTBOX_OPEN_HRM, &outboxopenhrmxpm, &outboxopenhrmxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_DIR_CLOSE, &folderxpm, &folderxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_DIR_CLOSE_HRM, &folderhrmxpm, &folderhrmxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_DIR_OPEN, &folderopenxpm, &folderopenxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_DIR_OPEN_HRM, &folderopenhrmxpm, &folderopenhrmxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_TRASH_OPEN, &trashopenxpm, &trashopenxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_TRASH_OPEN_HRM, &trashopenhrmxpm, &trashopenhrmxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_TRASH_CLOSE, &trashxpm, &trashxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_TRASH_CLOSE_HRM, &trashhrmxpm, &trashhrmxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_QUEUE_CLOSE, &queuexpm, &queuexpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_QUEUE_CLOSE_HRM, &queuehrmxpm, &queuehrmxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_QUEUE_OPEN, &queueopenxpm, &queueopenxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_QUEUE_OPEN_HRM, &queueopenhrmxpm, &queueopenhrmxpmmask);
/* CLAWS: titles for "New" and "Unread" show new & unread pixmaps
* instead text (text overflows making them unreadable and ugly) */
folderview_select_node(folderview, node);
}
-void folderview_update_msg_num(FolderView *folderview, GtkCTreeNode *row,
- gint new, gint unread, gint total)
+void folderview_update_msg_num(FolderView *folderview, GtkCTreeNode *row)
{
GtkCTree *ctree = GTK_CTREE(folderview->ctree);
static GtkCTreeNode *prev_row = NULL;
FolderItem *item;
+ gint new, unread, total;
+ gchar *new_str, *unread_str, *total_str;
if (!row) return;
item = gtk_ctree_node_get_row_data(ctree, row);
if (!item) return;
+ gtk_ctree_node_get_text(ctree, row, COL_NEW, &new_str);
+ gtk_ctree_node_get_text(ctree, row, COL_UNREAD, &unread_str);
+ gtk_ctree_node_get_text(ctree, row, COL_TOTAL, &total_str);
+ new = atoi(new_str);
+ 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
if (prev_row == row &&
item->new == new &&
item->unread == unread &&
- item->total == total)
+ item->total == total)
return;
#endif
prev_row = row;
- item->new = new;
- item->unread = unread;
- item->total = total;
-
folderview_update_node(folderview, row);
}
return window;
}
-void folderview_update_tree(Folder *folder)
+void folderview_rescan_tree(Folder *folder)
{
GtkWidget *window;
inc_unlock();
}
-void folderview_update_all(void)
+void folderview_rescan_all(void)
{
GList *list;
GtkWidget *window;
inc_unlock();
}
-void folderview_update_all_node(void)
+void folderview_check_new(Folder *folder)
{
GList *list;
FolderItem *item;
for (node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
item = gtk_ctree_node_get_row_data(ctree, node);
- if (!item || !FOLDER_IS_LOCAL(item->folder) ||
- !item->path)
- continue;
+ if (!item || !item->path || !item->folder) continue;
+ if (folder && folder != item->folder) continue;
+ if (!folder && !FOLDER_IS_LOCAL(item->folder)) continue;
+
folderview_scan_tree_func(item->folder, item, NULL);
folder_item_scan(item);
folderview_update_node(folderview, node);
switch (item->stype) {
case F_INBOX:
- xpm = inboxxpm;
- mask = inboxxpmmask;
if (item->hide_read_msgs) {
- openxpm = inboxhrmxpm;
- openmask = inboxhrmxpmmask;
+ xpm = inboxhrmxpm;
+ mask = inboxhrmxpmmask;
+ openxpm = inboxopenhrmxpm;
+ openmask = inboxopenhrmxpmmask;
} else {
- openxpm = inboxxpm;
- openmask = inboxxpmmask;
+ xpm = inboxxpm;
+ mask = inboxxpmmask;
+ openxpm = inboxopenxpm;
+ openmask = inboxopenxpmmask;
}
name = g_strdup(_("Inbox"));
break;
case F_OUTBOX:
- xpm = outboxxpm;
- mask =outboxxpmmask;
if (item->hide_read_msgs) {
- openxpm = outboxhrmxpm;
- openmask = outboxhrmxpmmask;
+ xpm = outboxhrmxpm;
+ mask = outboxhrmxpmmask;
+ openxpm = outboxopenhrmxpm;
+ openmask = outboxopenhrmxpmmask;
} else {
- openxpm = outboxxpm;
- openmask = outboxxpmmask;
+ xpm = outboxxpm;
+ mask = outboxxpmmask;
+ openxpm = outboxopenxpm;
+ openmask = outboxopenxpmmask;
}
name = g_strdup(_("Outbox"));
break;
case F_QUEUE:
- xpm = outboxxpm;
- mask =outboxxpmmask;
if (item->hide_read_msgs) {
- openxpm = outboxhrmxpm;
- openmask = outboxhrmxpmmask;
+ xpm = queuehrmxpm;
+ mask = queuehrmxpmmask;
+ openxpm = queueopenhrmxpm;
+ openmask = queueopenhrmxpmmask;
} else {
- openxpm = outboxxpm;
- openmask = outboxxpmmask;
+ xpm = queuexpm;
+ mask = queuexpmmask;
+ openxpm = queueopenxpm;
+ openmask = queueopenxpmmask;
}
name = g_strdup(_("Queue"));
break;
case F_TRASH:
- xpm = trashxpm;
- mask = trashxpmmask;
if (item->hide_read_msgs) {
- openxpm = trashhrmxpm;
- openmask = trashhrmxpmmask;
+ xpm = trashhrmxpm;
+ mask = trashhrmxpmmask;
+ openxpm = trashopenhrmxpm;
+ openmask = trashopenhrmxpmmask;
} else {
- openxpm = trashxpm;
- openmask = trashxpmmask;
+ xpm = trashxpm;
+ mask = trashxpmmask;
+ openxpm = trashopenxpm;
+ openmask = trashopenxpmmask;
}
name = g_strdup(_("Trash"));
break;
name = g_strdup(_("Draft"));
break;
default:
- xpm = folderxpm;
- mask = folderxpmmask;
if (item->hide_read_msgs) {
+ xpm = folderhrmxpm;
+ mask = folderhrmxpmmask;
openxpm = folderopenhrmxpm;
openmask = folderopenhrmxpmmask;
} else {
+ xpm = folderxpm;
+ mask = folderxpmmask;
openxpm = folderopenxpm;
openmask = folderopenxpmmask;
}
if (!opened) {
gtkut_ctree_set_focus_row(ctree, folderview->opened);
gtk_ctree_select(ctree, folderview->opened);
- } else
+ } else {
folderview->opened = row;
+ if (gtk_ctree_node_is_visible(ctree, row)
+ != GTK_VISIBILITY_FULL)
+ gtk_ctree_node_moveto(ctree, row, -1, 0.5, 0);
+ }
folderview->open_folder = FALSE;
can_select = TRUE;
prefs_common.folder_col_total = width;
break;
default:
+ break;
}
}
g_return_if_fail(item->folder != NULL);
if (action == 0)
- folderview_update_all_node();
+ folderview_check_new(item->folder);
else
- folderview_update_tree(item->folder);
+ folderview_rescan_tree(item->folder);
}
static void folderview_new_folder_cb(FolderView *folderview, guint action,
FolderItem *item;
gchar *new_folder;
gchar *message;
+ gchar *old_path;
+ gchar *new_path;
if (!folderview->selected) return;
return;
}
+ Xstrdup_a(old_path, item->path, {g_free(new_folder); return;});
+
if (item->folder->rename_folder(item->folder, item, new_folder) < 0) {
g_free(new_folder);
return;
}
+
+ if (strchr(item->path, G_DIR_SEPARATOR) != NULL) {
+ gchar *dirname;
+ dirname = g_dirname(item->path);
+ new_path = g_strconcat(dirname, G_DIR_SEPARATOR_S, new_folder, NULL);
+ g_free(dirname);
+ } else
+ new_path = g_strdup(new_folder);
+
g_free(new_folder);
+ prefs_filter_rename_path(old_path, new_path);
+
+ if (FOLDER_TYPE(item->folder) == F_MH)
+ prefs_filtering_rename_path(old_path, new_path);
+
+ g_free(new_path);
+
gtk_clist_freeze(GTK_CLIST(ctree));
folderview_update_node(folderview, folderview->selected);
FolderItem *item;
gchar *message;
AlertValue avalue;
+ gchar *old_path;
if (!folderview->selected) return;
g_free(message);
if (avalue != G_ALERTDEFAULT) return;
+ Xstrdup_a(old_path, item->path, return);
+
if (item->folder->remove_folder(item->folder, item) < 0) {
alertpanel_error(_("Can't remove the folder `%s'."),
item->path);
return;
}
+ prefs_filter_delete_path(old_path);
+
+ if (FOLDER_TYPE(item->folder) == F_MH)
+ prefs_filtering_delete_path(old_path);
+
if (folderview->opened == folderview->selected ||
gtk_ctree_is_ancestor(ctree,
folderview->selected,
}
}
}
+
+void folderview_reflect_prefs_pixmap_theme(FolderView *folderview)
+{
+ folderview_init(folderview);
+ folderview_set_all();
+}