2007-08-11 [paul] 2.10.0cvs113
[claws.git] / src / folderview.c
index 0a80d4676e99b3443e8bd1489a1798a1a7cd086e..302d948707beaa03548579d200ed40b525106347 100644 (file)
@@ -237,6 +237,9 @@ static void folderview_send_queue_cb        (FolderView     *folderview,
 static void folderview_search_cb       (FolderView     *folderview,
                                         guint           action,
                                         GtkWidget      *widget);
+static void folderview_run_processing_cb(FolderView    *folderview,
+                                        guint           action,
+                                        GtkWidget      *widget);
 
 static void folderview_property_cb     (FolderView     *folderview,
                                         guint           action,
@@ -289,6 +292,7 @@ static GtkItemFactoryEntry folderview_common_popup_entries[] =
 {
        {N_("/Mark all re_ad"),         NULL, mark_all_read_cb, 0, NULL},
        {"/---",                        NULL, NULL, 0, "<Separator>"},
+       {N_("/Run processing rules"),   NULL, folderview_run_processing_cb, 0, NULL},
        {N_("/_Search folder..."),      NULL, folderview_search_cb, 0, NULL},
        {N_("/_Properties..."),         NULL, folderview_property_cb, 0, NULL},
        {N_("/Process_ing..."),         NULL, folderview_processing_cb, 0, NULL},
@@ -373,9 +377,11 @@ static void create_ifactories(gpointer key, gpointer value, gpointer data)
 static void folderview_column_set_titles(FolderView *folderview)
 {
        GtkWidget *ctree = folderview->ctree;
+       GtkWidget *label_folder;
        GtkWidget *label_new;
        GtkWidget *label_unread;
        GtkWidget *label_total;
+       GtkWidget *hbox_folder;
        GtkWidget *hbox_new;
        GtkWidget *hbox_unread;
        GtkWidget *hbox_total;
@@ -393,18 +399,22 @@ static void folderview_column_set_titles(FolderView *folderview)
                         &unreadxpm, &unreadxpmmask);
        stock_pixmap_gdk(ctree, STOCK_PIXMAP_READ,
                         &readxpm, &readxpmmask);
-               
+       
+       label_folder = gtk_label_new(_("Folder"));
        label_new = gtk_image_new_from_pixmap(newxpm, newxpmmask);
        label_unread = gtk_image_new_from_pixmap(unreadxpm, unreadxpmmask);
        label_total = gtk_image_new_from_pixmap(readxpm, readxpmmask);
        
        gtk_clist_column_titles_active(GTK_CLIST(ctree));
         
+       hbox_folder = gtk_hbox_new(FALSE, 4);
        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_folder), label_folder, TRUE, TRUE, 0);
+       gtk_misc_set_alignment (GTK_MISC (label_folder), 0, 0.5);
        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);
@@ -412,14 +422,26 @@ static void folderview_column_set_titles(FolderView *folderview)
        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_folder);
        gtk_widget_show_all(hbox_new);
        gtk_widget_show_all(hbox_unread);
        gtk_widget_show_all(hbox_total);
 
+#ifdef MAEMO
+       gtk_widget_set_size_request(hbox_new, -1, 20);
+       gtk_widget_set_size_request(hbox_unread, -1, 20);
+       gtk_widget_set_size_request(hbox_total, -1, 20);
+#endif
+
+       gtk_clist_set_column_widget(GTK_CLIST(ctree),col_pos[F_COL_FOLDER],hbox_folder);
        gtk_clist_set_column_widget(GTK_CLIST(ctree),col_pos[F_COL_NEW],hbox_new);
        gtk_clist_set_column_widget(GTK_CLIST(ctree),col_pos[F_COL_UNREAD],hbox_unread);
        gtk_clist_set_column_widget(GTK_CLIST(ctree),col_pos[F_COL_TOTAL],hbox_total);
 
+#ifdef MAEMO
+       GTK_EVENTS_FLUSH();
+#endif
+
        gtk_sctree_set_column_tooltip(GTK_SCTREE(ctree), col_pos[F_COL_NEW], _("New"));
        gtk_sctree_set_column_tooltip(GTK_SCTREE(ctree), col_pos[F_COL_UNREAD], _("Unread"));
        gtk_sctree_set_column_tooltip(GTK_SCTREE(ctree), col_pos[F_COL_TOTAL], _("Total"));
@@ -475,6 +497,10 @@ static GtkWidget *folderview_ctree_create(FolderView *folderview)
        ctree = gtk_sctree_new_with_titles(N_FOLDER_COLS, col_pos[F_COL_FOLDER],
                                           titles);
 
+       if (prefs_common.show_col_headers == FALSE)
+               gtk_clist_column_titles_hide(GTK_CLIST(ctree));
+
+
        gtk_clist_set_selection_mode(GTK_CLIST(ctree), GTK_SELECTION_BROWSE);
        gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[F_COL_NEW],
                                           GTK_JUSTIFY_RIGHT);
@@ -530,8 +556,12 @@ static GtkWidget *folderview_ctree_create(FolderView *folderview)
                         folderview);
        g_signal_connect(G_OBJECT(ctree), "tree_select_row",
                         G_CALLBACK(folderview_selected), folderview);
+#ifndef MAEMO
+       /* drag-n-dropping folders on maemo is impractical as this 
+        * opens the folder almost everytime */
        g_signal_connect(G_OBJECT(ctree), "start_drag",
                         G_CALLBACK(folderview_start_drag), folderview);
+#endif
        g_signal_connect(G_OBJECT(ctree), "drag_data_get",
                         G_CALLBACK(folderview_drag_data_get),
                         folderview);
@@ -1898,6 +1928,8 @@ static void folderview_set_sens_and_popup_menu(FolderView *folderview, gint row,
        SET_SENS("/Mark all read", item->unread_msgs >= 1);
        SET_SENS("/Search folder...", item->total_msgs >= 1 && 
                 folderview->selected == folderview->opened);
+       SET_SENS("/Run processing rules", item->prefs->processing &&
+                item->total_msgs >= 1);
        SET_SENS("/Properties...", TRUE);
        SET_SENS("/Processing...", item->node->parent != NULL);
        if (item == folder->trash || item == special_trash
@@ -2422,6 +2454,21 @@ static void folderview_search_cb(FolderView *folderview, guint action,
        summary_search(folderview->summaryview);
 }
 
+static void folderview_run_processing_cb(FolderView *folderview, guint action,
+                                GtkWidget *widget)
+{
+       GtkCTree *ctree = GTK_CTREE(folderview->ctree);
+       FolderItem *item;
+
+       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);
+
+       folder_item_apply_processing(item);
+}
+
 static void folderview_property_cb(FolderView *folderview, guint action,
                                   GtkWidget *widget)
 {
@@ -2475,7 +2522,7 @@ void folderview_move_folder(FolderView *folderview, FolderItem *from_folder,
        
        if (prefs_common.warn_dnd) {
                buf = g_strdup_printf(copy ? _("Do you really want to copy folder '%s' in '%s' ?"):
-                                            _("Do you really want to make folder '%s' a sub-folder of '%s' ?"), 
+                                            _("Do you really want to make folder '%s' a subfolder of '%s' ?"), 
                                        from_folder->name, to_folder->name);
                status = alertpanel_full(copy ? _("Copy folder"):_("Move folder"), buf,
                                         GTK_STOCK_NO, GTK_STOCK_YES, NULL, TRUE,