#include "statusbar.h"
#include "hooks.h"
#include "folderutils.h"
-#include "quicksearch.h"
+#include "partial_download.h"
typedef enum
{
static GdkBitmap *newxpmmask;
static GdkPixmap *unreadxpm;
static GdkBitmap *unreadxpmmask;
+static GdkPixmap *readxpm;
+static GdkBitmap *readxpmmask;
static GdkPixmap *draftsxpm;
static GdkBitmap *draftsxpmmask;
static GdkPixmap *draftsopenxpm;
guint action,
GtkWidget *widget);
+static void folderview_empty_trash_cb (FolderView *folderview,
+ guint action,
+ GtkWidget *widget);
+
static void folderview_search_cb (FolderView *folderview,
guint action,
GtkWidget *widget);
{N_("/Mark all _read"), NULL, mark_all_read_cb, 0, NULL},
{N_("/_Search folder..."), NULL, folderview_search_cb, 0, NULL},
{N_("/_Properties..."), NULL, folderview_property_cb, 0, NULL},
- {N_("/_Processing..."), NULL, folderview_processing_cb, 0, NULL},
+ {N_("/Pr_ocessing..."), NULL, folderview_processing_cb, 0, NULL},
};
+static GtkItemFactoryEntry folder_view_trash_popup_entries[] = {
+ {N_("/---"), NULL, NULL, 0, "<Separator>"},
+ {N_("/Empty trash..."), NULL, folderview_empty_trash_cb, 0, NULL},
+};
+
+
GtkTargetEntry folderview_drag_types[] =
{
{"text/plain", GTK_TARGET_SAME_APP, TARGET_DUMMY}
gtk_container_add(GTK_CONTAINER(scrolledwin), ctree);
gtk_clist_set_selection_mode(GTK_CLIST(ctree), GTK_SELECTION_BROWSE);
-#ifndef CLAWS /* text instead of pixmaps */
gtk_clist_set_column_justification(GTK_CLIST(ctree), COL_NEW,
GTK_JUSTIFY_RIGHT);
gtk_clist_set_column_justification(GTK_CLIST(ctree), COL_UNREAD,
GTK_JUSTIFY_RIGHT);
-#endif
gtk_clist_set_column_justification(GTK_CLIST(ctree), COL_TOTAL,
GTK_JUSTIFY_RIGHT);
gtk_clist_set_column_width(GTK_CLIST(ctree), COL_FOLDER,
void folderview_init(FolderView *folderview)
{
- static GdkFont *boldfont = NULL;
- static GdkFont *normalfont = NULL;
GtkWidget *ctree = folderview->ctree;
GtkWidget *label_new;
GtkWidget *label_unread;
+ GtkWidget *label_total;
GtkWidget *hbox_new;
GtkWidget *hbox_unread;
-
+ GtkWidget *hbox_total;
+
gtk_widget_realize(ctree);
stock_pixmap_gdk(ctree, STOCK_PIXMAP_INBOX_CLOSE, &inboxxpm, &inboxxpmmask);
stock_pixmap_gdk(ctree, STOCK_PIXMAP_INBOX_CLOSE_HRM, &inboxhrmxpm, &inboxhrmxpmmask);
&newxpm, &newxpmmask);
stock_pixmap_gdk(ctree, STOCK_PIXMAP_UNREAD,
&unreadxpm, &unreadxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_READ,
+ &readxpm, &readxpmmask);
label_new = gtk_pixmap_new(newxpm, newxpmmask);
label_unread = gtk_pixmap_new(unreadxpm, unreadxpmmask);
+ label_total = gtk_pixmap_new(readxpm, readxpmmask);
hbox_new = gtk_hbox_new(FALSE, 4);
hbox_unread = gtk_hbox_new(FALSE, 4);
+ hbox_total = gtk_hbox_new(FALSE, 4);
/* left justified */
- gtk_box_pack_start(GTK_BOX(hbox_new),label_new,FALSE,FALSE,0);
- gtk_box_pack_start(GTK_BOX(hbox_unread),label_unread,FALSE,FALSE,0);
+ gtk_box_pack_start(GTK_BOX(hbox_new), label_new, TRUE, TRUE, 0);
+ gtk_misc_set_alignment (GTK_MISC (label_new), 1, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox_unread), label_unread, TRUE, TRUE, 0);
+ gtk_misc_set_alignment (GTK_MISC (label_unread), 1, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox_total), label_total, TRUE, TRUE, 0);
+ gtk_misc_set_alignment (GTK_MISC (label_total), 1, 0.5);
gtk_widget_show_all(hbox_new);
gtk_widget_show_all(hbox_unread);
+ gtk_widget_show_all(hbox_total);
gtk_clist_set_column_widget(GTK_CLIST(ctree),COL_NEW,hbox_new);
gtk_clist_set_column_widget(GTK_CLIST(ctree),COL_UNREAD,hbox_unread);
+ gtk_clist_set_column_widget(GTK_CLIST(ctree),COL_TOTAL,hbox_total);
if (!normal_style) {
PangoFontDescription *font_desc;
{
FolderItem *item;
- item = folderview_get_selected(folderview);
+ item = folderview_get_selected_item(folderview);
if (item == NULL)
return;
folderview_select_node(folderview, node);
}
+FolderItem *folderview_get_selected_item(FolderView *folderview)
+{
+ GtkCTree *ctree = GTK_CTREE(folderview->ctree);
+
+ if (!folderview->selected) return NULL;
+ return gtk_ctree_node_get_row_data(ctree, folderview->selected);
+}
+
void folderview_update_msg_num(FolderView *folderview, GtkCTreeNode *row)
{
GtkCTree *ctree = GTK_CTREE(folderview->ctree);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_title(GTK_WINDOW(window), str);
gtk_window_set_modal(GTK_WINDOW(window), TRUE);
- gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
+ gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
manage_window_set_transient(GTK_WINDOW(window));
label = gtk_label_new(str);
gchar *str;
gboolean add_unread_mark;
gboolean use_bold, use_color;
- gboolean hide_read_msgs = FALSE;
-
+
item = gtk_ctree_node_get_row_data(ctree, node);
g_return_if_fail(item != NULL);
- hide_read_msgs = item->hide_read_msgs;
-
- item->hide_read_msgs |= quicksearch_is_active(folderview->summaryview->quicksearch);
-
switch (item->stype) {
case F_INBOX:
if (item->hide_read_msgs) {
openmask = folderopenxpmmask;
}
}
-
- item->hide_read_msgs = hide_read_msgs;
-
name = folder_item_get_name(item);
if (!GTK_CTREE_ROW(node)->expanded &&
node = gtk_ctree_find_by_row_data(ctree, NULL, update_info->item);
if (node) {
- if (update_info->update_flags & (F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_NAME | F_ITEM_UPDATE_ICON))
+ if (update_info->update_flags & (F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_NAME))
folderview_update_node(folderview, node);
if ((update_info->update_flags & F_ITEM_UPDATE_CONTENT) && (folderview->opened == node))
summary_show(folderview->summaryview, update_info->item);
if (fpopup->set_sensitivity != NULL)
fpopup->set_sensitivity(fpopup_factory, item);
+ if (item == folder->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) {
+ 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]);
+ }
+
#define SET_SENS(name, sens) \
menu_set_sensitive(fpopup_factory, name, sens)
folderview->selected == folderview->opened);
SET_SENS("/Properties...", TRUE);
SET_SENS("/Processing...", item->node->parent != NULL);
-
+ if (item == folder->trash)
+ SET_SENS("/Empty trash...", folder_item_get_msg_list(item) != NULL);
#undef SET_SENS
popup = gtk_item_factory_get_widget(fpopup_factory, fpopup->path);
gtk_clist_thaw(GTK_CLIST(ctree));
}
+static void folderview_empty_trash_cb(FolderView *folderview, guint action,
+ GtkWidget *widget)
+{
+ GtkCTree *ctree = GTK_CTREE(folderview->ctree);
+ FolderItem *item;
+ GSList *mlist = NULL;
+ GSList *cur = NULL;
+ if (!folderview->selected) return;
+
+ item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
+ g_return_if_fail(item != NULL);
+ g_return_if_fail(item->folder != NULL);
+ if (item != item->folder->trash) return;
+
+ if (prefs_common.ask_on_clean) {
+ if (alertpanel(_("Empty trash"),
+ _("Empty all messages in trash?"),
+ _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
+ return;
+ }
+
+ mlist = folder_item_get_msg_list(item);
+
+ for (cur = mlist ; cur != NULL ; cur = cur->next) {
+ MsgInfo * msginfo = (MsgInfo *) cur->data;
+ partial_mark_for_delete(msginfo);
+ procmsg_msginfo_free(msginfo);
+ }
+
+ folder_item_remove_all_msg(item);
+}
+
static void folderview_search_cb(FolderView *folderview, guint action,
GtkWidget *widget)
{
if (!item2->name)
return -1;
- return g_strcasecmp(item1->name, item2->name);
+ return g_utf8_collate(item1->name, item2->name);
}
static void folderview_processing_cb(FolderView *folderview, guint action,
folderview->nodes_to_recollapse = NULL;
}
-FolderItem *folderview_get_selected(FolderView *folderview)
-{
- return (FolderItem *) gtk_ctree_node_get_row_data(
- GTK_CTREE(folderview->ctree), folderview->selected);
-}
-
void folderview_register_popup(FolderViewPopup *fpopup)
{
GList *folderviews;