}
if (folderview->selected)
- sel_item = gtk_cmctree_node_get_row_data(GTK_CMCTREE(ctree), folderview->selected);
+ sel_item = folderview_get_selected_item(folderview);
if (folderview->opened)
- op_item = gtk_cmctree_node_get_row_data(GTK_CMCTREE(ctree), folderview->opened);
+ op_item = folderview_get_opened_item(folderview);
debug_print("recreating tree...\n");
gtk_widget_destroy(folderview->ctree);
main_window_cursor_wait(mainwin);
if (folderview->selected)
- sel_item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+ sel_item = folderview_get_selected_item(folderview);
if (folderview->opened)
- op_item = gtk_cmctree_node_get_row_data(ctree, folderview->opened);
+ op_item = folderview_get_opened_item(folderview);
folderview->selected = NULL;
folderview->opened = NULL;
FolderView *folderview = (FolderView *)data;
FolderItem *item;
AlertValue val;
+ gchar *message;
item = folderview_get_selected_item(folderview);
if (item == NULL)
return;
- if (folderview->summaryview->folder_item != item
- && prefs_common.ask_mark_all_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?");
+ if (folderview->summaryview->folder_item != item &&
+ prefs_common.ask_mark_all_read) {
val = alertpanel_full(_("Mark all as read"),
- _("Do you really want to mark all mails in this "
- "folder as read?"), GTK_STOCK_NO, GTK_STOCK_YES, NULL,
+ message, GTK_STOCK_NO, GTK_STOCK_YES, NULL,
TRUE, NULL, ALERT_QUESTION, G_ALERTDEFAULT);
if ((val & ~G_ALERTDISABLE) != G_ALERTALTERNATE)
else if (val & G_ALERTDISABLE)
prefs_common.ask_mark_all_read = FALSE;
}
-
folder_item_update_freeze();
if (folderview->summaryview->folder_item != item && !recursive)
return gtk_cmctree_node_get_row_data(ctree, folderview->selected);
}
+FolderItem *folderview_get_opened_item(FolderView *folderview)
+{
+ GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
+
+ if (!folderview->opened) return NULL;
+ return gtk_cmctree_node_get_row_data(ctree, folderview->opened);
+}
+
static void folderview_set_folders(FolderView *folderview)
{
GList *list;
node = gtk_cmctree_find_by_row_data(ctree, root, item);
if (!node)
- g_warning("%s not found.\n", item->path);
+ g_warning("%s not found.", item->path);
else {
parent = GTK_CMCTREE_ROW(node)->parent;
if (*prev && parent == GTK_CMCTREE_ROW(*prev)->parent)
static gboolean folderview_key_pressed(GtkWidget *widget, GdkEventKey *event,
FolderView *folderview)
{
+ GtkCMCTreeNode *node;
+ FolderItem *item;
+
if (!event) return FALSE;
if (quicksearch_has_focus(folderview->summaryview->quicksearch))
switch (event->keyval) {
case GDK_KEY_Right:
-#ifndef GENERIC_UMPC
- case GDK_KEY_Return:
- case GDK_KEY_KP_Enter:
-#endif
if (folderview->selected) {
- folderview_select_node(folderview,
- folderview->selected);
+ if (GTK_CMCTREE_ROW(folderview->selected)->children != NULL
+ && !GTK_CMCTREE_ROW(folderview->selected)->expanded)
+ gtk_cmctree_expand(GTK_CMCTREE(folderview->ctree),
+ folderview->selected);
+ else
+ folderview_select_node(folderview,
+ folderview->selected);
}
break;
#ifdef GENERIC_UMPC
folderview->selected);
}
break;
+#else
+ case GDK_KEY_Return:
+ case GDK_KEY_KP_Enter:
+ if (folderview->selected)
+ folderview_select_node(folderview, folderview->selected);
+ break;
#endif
case GDK_KEY_space:
BREAK_ON_MODIFIER_KEY();
folderview->selected);
}
break;
+ case GDK_KEY_Left:
+ if (folderview->selected) {
+ if (GTK_CMCTREE_ROW(folderview->selected)->expanded) {
+ gtk_cmctree_collapse(GTK_CMCTREE(folderview->ctree),
+ folderview->selected);
+ } else {
+ if ((item = gtk_cmctree_node_get_row_data(GTK_CMCTREE(folderview->ctree),
+ folderview->selected))) {
+ if ((node = gtk_cmctree_find_by_row_data(GTK_CMCTREE(folderview->ctree),
+ NULL, folder_item_parent(item)))) {
+ gtk_sctree_select(GTK_SCTREE(folderview->ctree), node);
+ if (!gtk_cmctree_node_is_visible(GTK_CMCTREE(folderview->ctree), node))
+ gtk_cmctree_node_moveto(GTK_CMCTREE(folderview->ctree),
+ node, -1, 0, 0);
+ }
+ }
+ }
+ }
+ break;
+ case GDK_KEY_Home:
+ case GDK_KEY_End:
+ if (event->keyval == GDK_KEY_Home)
+ node = gtk_cmctree_node_nth(GTK_CMCTREE(folderview->ctree), 0);
+ else
+ node = gtk_cmctree_last(GTK_CMCTREE(folderview->ctree),
+ gtk_cmctree_node_nth(GTK_CMCTREE(folderview->ctree), 0));
+
+ gtk_sctree_select(GTK_SCTREE(folderview->ctree), node);
+
+ if (!gtk_cmctree_node_is_visible(GTK_CMCTREE(folderview->ctree), node))
+ gtk_cmctree_node_moveto(GTK_CMCTREE(folderview->ctree),
+ node, -1, 0, 0);
+ break;
default:
break;
}
static void folderview_empty_trash_cb(GtkAction *action, gpointer data)
{
FolderView *folderview = (FolderView *)data;
- GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
FolderItem *item;
GSList *mlist = NULL;
GSList *cur = NULL;
PrefsAccount *ac;
if (!folderview->selected) return;
- item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+ item = folderview_get_selected_item(folderview);
cm_return_if_fail(item != NULL);
cm_return_if_fail(item->folder != NULL);
static void folderview_send_queue_cb(GtkAction *action, gpointer data)
{
FolderView *folderview = (FolderView *)data;
- GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
FolderItem *item;
FolderItem *special_queue = NULL;
PrefsAccount *ac;
gchar *errstr = NULL;
if (!folderview->selected) return;
- item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+ item = folderview_get_selected_item(folderview);
cm_return_if_fail(item != NULL);
cm_return_if_fail(item->folder != NULL);
static void folderview_run_processing_cb(GtkAction *action, gpointer data)
{
FolderView *folderview = (FolderView *)data;
- GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
FolderItem *item;
if (!folderview->selected) return;
- item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+ item = folderview_get_selected_item(folderview);
cm_return_if_fail(item != NULL);
cm_return_if_fail(item->folder != NULL);
static void folderview_property_cb(GtkAction *action, gpointer data)
{
FolderView *folderview = (FolderView *)data;
- GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
FolderItem *item;
if (!folderview->selected) return;
- item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+ item = folderview_get_selected_item(folderview);
cm_return_if_fail(item != NULL);
cm_return_if_fail(item->folder != NULL);
static void folderview_processing_cb(GtkAction *action, gpointer data)
{
FolderView *folderview = (FolderView *)data;
- GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
FolderItem *item;
gchar *id, *title;
if (!folderview->selected) return;
- item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+ item = folderview_get_selected_item(folderview);
cm_return_if_fail(item != NULL);
cm_return_if_fail(item->folder != NULL);
source, strlen(source));
}
} else {
- g_warning("unknown info %d\n", info);
+ g_warning("unknown info %d", info);
}
}