2007-08-02 [paul] 2.10.0cvs84
[claws.git] / src / folderview.c
index 6eeed53edc0dd84494a4b03f0a34232a9b53b3d2..2bfd2c24e2c9d59ba5174f6bb18eb5896748643f 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},
@@ -475,9 +479,9 @@ static GtkWidget *folderview_ctree_create(FolderView *folderview)
        ctree = gtk_sctree_new_with_titles(N_FOLDER_COLS, col_pos[F_COL_FOLDER],
                                           titles);
 
-#ifdef MAEMO
-       gtk_clist_column_titles_hide(GTK_CLIST(ctree));
-#endif
+       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],
@@ -534,8 +538,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);
@@ -1902,6 +1910,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
@@ -2426,6 +2436,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)
 {