2007-12-06 [colin] 3.1.0cvs62
[claws.git] / src / prefs_filtering_action.c
index fb511aec79d7a9a185839e174bf09f9639218470..1098d0ed36c44ae5d3f618fc9a6af05f44738966 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -13,8 +13,8 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * 
  */
 
 #ifdef HAVE_CONFIG_H
 #include "folder.h"
 #include "description_window.h"
 #include "addr_compl.h"
-
+#include "tags.h"
 #include "matcher_parser.h"
 #include "colorlabel.h"
+#include "combobox.h"
 
 enum {
        PFA_ACTION,
@@ -69,11 +70,10 @@ static void prefs_filtering_action_cancel(void);
 static void prefs_filtering_action_ok(void);
 static gint prefs_filtering_action_deleted(GtkWidget *widget,
     GdkEventAny *event, gpointer data);
-static void prefs_filtering_action_type_selection_changed(GtkList *list,
+static void prefs_filtering_action_type_selection_changed(GtkWidget *widget,
     gpointer user_data);
-static void prefs_filtering_action_type_select(GtkList *list,
-    GtkWidget *widget, gpointer user_data);
 static void prefs_filtering_action_select_dest(void);
+static void prefs_filtering_action_select_addressbook(void);
 static void prefs_filtering_action_up(void);
 static void prefs_filtering_action_down(void);
 static void prefs_filtering_action_set_dialog(GSList *action_list);
@@ -92,6 +92,8 @@ static gboolean prefs_filtering_actions_selected              (GtkTreeSelection *selector,
                                                                 gboolean currently_selected,
                                                                 gpointer data);
 
+static void prefs_filtering_action_exec_info(void);
+
 /*!
  *\brief       UI data for matcher dialog
  */
@@ -101,10 +103,8 @@ static struct FilteringAction_ {
        GtkWidget *ok_btn;
 
        GtkWidget *action_list_view;
-       GtkWidget *action_type_list;
        GtkWidget *action_combo;
        GtkWidget *account_label;
-       GtkWidget *account_list;
        GtkWidget *account_combo;
        GtkWidget *dest_entry;
        GtkWidget *dest_btn;
@@ -115,6 +115,13 @@ static struct FilteringAction_ {
        GtkWidget *color_label;
        GtkWidget *color_optmenu;
        GtkWidget *score_label;
+       GtkWidget *header_label;
+       GtkWidget *header_combo;
+       GtkWidget *header_entry;
+       GtkWidget *addressbook_label;
+       GtkWidget *addressbook_btn;
+       GtkWidget *tags_label;
+       GtkWidget *tags_combo;
 
        gint current_action;
 } filtering_action;
@@ -130,6 +137,8 @@ typedef enum Action_ {
        ACTION_UNLOCK,
        ACTION_MARK_AS_READ,
        ACTION_MARK_AS_UNREAD,
+       ACTION_MARK_AS_SPAM,
+       ACTION_MARK_AS_HAM,
        ACTION_FORWARD,
        ACTION_FORWARD_AS_ATTACHMENT,
        ACTION_REDIRECT,
@@ -137,8 +146,13 @@ typedef enum Action_ {
        ACTION_COLOR,
        ACTION_CHANGE_SCORE,
        ACTION_SET_SCORE,
+       ACTION_SET_TAG,
+       ACTION_UNSET_TAG,
+       ACTION_CLEAR_TAGS,
        ACTION_HIDE,
        ACTION_IGNORE,
+       ACTION_WATCH,
+       ACTION_ADD_TO_ADDRESSBOOK,
        ACTION_STOP,
        /* add other action constants */
 } Action;
@@ -156,6 +170,8 @@ static struct {
        { N_("Unlock"),                 ACTION_UNLOCK   },
        { N_("Mark as read"),           ACTION_MARK_AS_READ },
        { N_("Mark as unread"),         ACTION_MARK_AS_UNREAD },
+       { N_("Mark as spam"),           ACTION_MARK_AS_SPAM },
+       { N_("Mark as ham"),            ACTION_MARK_AS_HAM },
        { N_("Forward"),                ACTION_FORWARD  },
        { N_("Forward as attachment"),  ACTION_FORWARD_AS_ATTACHMENT },
        { N_("Redirect"),               ACTION_REDIRECT },
@@ -163,8 +179,13 @@ static struct {
        { N_("Color"),                  ACTION_COLOR    },
        { N_("Change score"),           ACTION_CHANGE_SCORE},
        { N_("Set score"),              ACTION_SET_SCORE},
+       { N_("Apply tag"),              ACTION_SET_TAG},
+       { N_("Unset tag"),              ACTION_UNSET_TAG},
+       { N_("Clear tags"),             ACTION_CLEAR_TAGS},
        { N_("Hide"),                   ACTION_HIDE     },
        { N_("Ignore thread"),          ACTION_IGNORE   },
+       { N_("Watch thread"),           ACTION_WATCH    },
+       { N_("Add to address book"),    ACTION_ADD_TO_ADDRESSBOOK       },
        { N_("Stop filter"),            ACTION_STOP     },
 };
 
@@ -174,32 +195,6 @@ static struct {
  */
 static PrefsFilteringActionSignal *filtering_action_callback;
 
-/*!
- *\brief       Find index of list selection 
- *
- *\param       list GTK list widget
- *
- *\return      gint Selection index
- */
-static gint get_sel_from_list(GtkList *list)
-{
-       gint row = 0;
-       void * sel;
-       GList * child;
-
-       if (list->selection == NULL) 
-               return -1;
-
-       sel = list->selection->data;
-       for (child = list->children; child != NULL; child = g_list_next(child)) {
-               if (child->data == sel)
-                       return row;
-               row ++;
-       }
-       
-       return row;
-}
-
 /*!
  *\brief       Opens the filtering action dialog with a list of actions
  *
@@ -214,6 +209,10 @@ void prefs_filtering_action_open(GSList *action_list,
 
        if (!filtering_action.window) {
                prefs_filtering_action_create();
+       } else {
+               /* update color label menu */
+               gtk_option_menu_set_menu(GTK_OPTION_MENU(filtering_action.color_optmenu),
+                               colorlabel_create_color_menu());
        }
 
        manage_window_set_transient(GTK_WINDOW(filtering_action.window));
@@ -256,17 +255,21 @@ static void prefs_filtering_action_create(void)
        GtkWidget *action_label;
        GtkWidget *recip_label;
        GtkWidget *action_combo;
-       GtkWidget *action_type_list;
-       GtkWidget *account_list;
        GtkWidget *dest_label;
        GtkWidget *exec_label;
        GtkWidget *score_label;
        GtkWidget *color_label;
        GtkWidget *account_label;
        GtkWidget *account_combo;
+       GtkWidget *header_label;
+       GtkWidget *header_combo;
+       GtkWidget *header_entry;
+       GtkWidget *addressbook_label;
+       GtkWidget *addressbook_btn;
        GtkWidget *dest_entry;
        GtkWidget *dest_btn;
-        GList * cur;
+       GtkWidget *tags_label;
+       GtkWidget *tags_combo;
 
        GtkWidget *reg_hbox;
        GtkWidget *btn_hbox;
@@ -287,15 +290,15 @@ static void prefs_filtering_action_create(void)
 
        GtkWidget *color_optmenu;
 
-       GList *combo_items;
        gint i;
        static GdkGeometry geometry;
 
         GList * accounts;
+       GSList *tmp, *tags;
 
        debug_print("Creating matcher configuration window...\n");
 
-       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+       window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_filtering_action");
        gtk_container_set_border_width(GTK_CONTAINER(window), 8);
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
        gtk_window_set_modal(GTK_WINDOW(window), TRUE);
@@ -344,27 +347,16 @@ static void prefs_filtering_action_create(void)
        gtk_misc_set_alignment (GTK_MISC (action_label), 0, 0.5);
        gtk_box_pack_start (GTK_BOX (hbox1), action_label, FALSE, FALSE, 0);
 
-       action_combo = gtk_combo_new ();
+       action_combo = gtk_combo_box_new_text ();
        gtk_widget_show (action_combo);
-       gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(action_combo)->entry),
-                              FALSE);
 
-       combo_items = NULL;
        for (i = 0; i < sizeof action_text / sizeof action_text[0]; i++)
-               combo_items = g_list_append
-                       (combo_items, (gpointer) _(action_text[i].text));
-       gtk_combo_set_popdown_strings(GTK_COMBO(action_combo), combo_items);
-
-       g_list_free(combo_items);
-
+               gtk_combo_box_append_text(GTK_COMBO_BOX(action_combo),
+                                       (gpointer) _(action_text[i].text));
+       gtk_combo_box_set_active(GTK_COMBO_BOX(action_combo), 0);
        gtk_box_pack_start (GTK_BOX (hbox1), action_combo,
                            TRUE, TRUE, 0);
-       action_type_list = GTK_COMBO(action_combo)->list;
-       g_signal_connect (G_OBJECT(action_type_list), "select-child",
-                         G_CALLBACK(prefs_filtering_action_type_select),
-                         NULL);
-
-       g_signal_connect(G_OBJECT(action_type_list), "selection-changed",
+       g_signal_connect(G_OBJECT(action_combo), "changed",
                         G_CALLBACK(prefs_filtering_action_type_selection_changed),
                         NULL);
 
@@ -380,11 +372,10 @@ static void prefs_filtering_action_create(void)
        gtk_misc_set_alignment (GTK_MISC (account_label), 0, 0.5);
        gtk_box_pack_start (GTK_BOX (hbox1), account_label, FALSE, FALSE, 0);
 
-       account_combo = gtk_combo_new ();
+       account_combo = gtk_combo_box_new_text ();
        gtk_widget_set_size_request (account_combo, 150, -1);
        gtk_widget_show (account_combo);
 
-       combo_items = NULL;
        for (accounts = account_get_list() ; accounts != NULL;
             accounts = accounts->next) {
                PrefsAccount *ac = (PrefsAccount *)accounts->data;
@@ -393,21 +384,26 @@ static void prefs_filtering_action_create(void)
                name = g_strdup_printf("%s <%s> (%s)",
                                       ac->name, ac->address,
                                       ac->account_name);
-               combo_items = g_list_append(combo_items, (gpointer) name);
+               gtk_combo_box_append_text(GTK_COMBO_BOX(account_combo), (gpointer) name);
+               g_free(name);
        }
 
-       gtk_combo_set_popdown_strings(GTK_COMBO(account_combo), combo_items);
+       gtk_combo_box_set_active(GTK_COMBO_BOX(account_combo), 0);
+       gtk_box_pack_start (GTK_BOX (hbox1), account_combo,
+                           TRUE, TRUE, 0);
+
+       /* header */
 
-       for(cur = g_list_first(combo_items) ; cur != NULL ;
-           cur = g_list_next(cur))
-               g_free(cur->data);
-       g_list_free(combo_items);
+       header_label = gtk_label_new(_("Header name"));
+       gtk_widget_show(header_label);
+       gtk_misc_set_alignment(GTK_MISC(header_label), 0, 0.5);
+       gtk_box_pack_start (GTK_BOX (hbox1), header_label, FALSE, FALSE, 0);
 
-       gtk_box_pack_start (GTK_BOX (hbox1), account_combo,
+       header_combo = combobox_text_new(TRUE, "From", "To", "Cc", "Reply-To", "Sender", NULL);
+       gtk_widget_set_size_request(header_combo, 120, -1);
+       gtk_box_pack_start (GTK_BOX (hbox1), header_combo,
                            TRUE, TRUE, 0);
-       account_list = GTK_COMBO(account_combo)->list;
-       gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(account_combo)->entry),
-                              FALSE);
+       header_entry = GTK_BIN(header_combo)->child;
 
        /* destination */
 
@@ -441,6 +437,16 @@ static void prefs_filtering_action_create(void)
        gtk_misc_set_alignment (GTK_MISC (score_label), 0, 0.5);
        gtk_box_pack_start (GTK_BOX (hbox1), score_label, FALSE, FALSE, 0);
 
+       addressbook_label = gtk_label_new (_("Book/folder"));
+       gtk_widget_show(addressbook_label);
+       gtk_misc_set_alignment(GTK_MISC(addressbook_label), 0, 0.5);
+       gtk_box_pack_start(GTK_BOX(hbox1), addressbook_label, FALSE, FALSE, 0);
+
+       tags_label = gtk_label_new (_("Tag"));
+       gtk_widget_show (tags_label);
+       gtk_misc_set_alignment (GTK_MISC (tags_label), 0, 0.5);
+       gtk_box_pack_start (GTK_BOX (hbox1), tags_label, FALSE, FALSE, 0);
+
        dest_entry = gtk_entry_new ();
        gtk_widget_set_size_request (dest_entry, 150, -1);
        gtk_widget_show (dest_entry);
@@ -451,6 +457,22 @@ static void prefs_filtering_action_create(void)
                                 colorlabel_create_color_menu());
        gtk_box_pack_start(GTK_BOX(hbox1), color_optmenu, TRUE, TRUE, 0);
 
+       tags_combo = gtk_combo_box_new_text ();
+       gtk_widget_set_size_request (tags_combo, 150, -1);
+       gtk_widget_show (tags_combo);
+
+       for (tmp = tags = tags_get_list() ; tmp != NULL;
+            tmp = tmp->next) {
+               gchar *name = g_strdup(tags_get_tag(GPOINTER_TO_INT(tmp->data)));
+
+               gtk_combo_box_append_text(GTK_COMBO_BOX(tags_combo), (gpointer) name);
+               g_free(name);
+       }
+
+       gtk_combo_box_set_active(GTK_COMBO_BOX(tags_combo), 0);
+       gtk_box_pack_start (GTK_BOX (hbox1), tags_combo,
+                           TRUE, TRUE, 0);
+
        dest_btn = gtk_button_new_with_label (_("Select ..."));
        gtk_widget_show (dest_btn);
        gtk_box_pack_start (GTK_BOX (hbox1), dest_btn, FALSE, FALSE, 0);
@@ -458,10 +480,17 @@ static void prefs_filtering_action_create(void)
                          G_CALLBACK(prefs_filtering_action_select_dest),
                          NULL);
 
+       addressbook_btn = gtk_button_new_with_label (_("Select ..."));
+       gtk_widget_show (addressbook_btn);
+       gtk_box_pack_start (GTK_BOX (hbox1), addressbook_btn, FALSE, FALSE, 0);
+       g_signal_connect (G_OBJECT (addressbook_btn), "clicked",
+                         G_CALLBACK(prefs_filtering_action_select_addressbook),
+                         NULL);
+
 #if GTK_CHECK_VERSION(2, 8, 0)
        exec_btn = gtk_button_new_from_stock(GTK_STOCK_INFO);
 #else
-       exec_btn = gtk_button_new_with_label (_("Info ..."));
+       exec_btn = gtk_button_new_with_label (_("Info..."));
 #endif
        gtk_widget_show (exec_btn);
        gtk_box_pack_start (GTK_BOX (hbox1), exec_btn, FALSE, FALSE, 0);
@@ -549,11 +578,11 @@ static void prefs_filtering_action_create(void)
        gtk_widget_show_all(window);
 
        filtering_action.window    = window;
-       filtering_action.action_type_list = action_type_list;
        filtering_action.action_combo = action_combo;
        filtering_action.account_label = account_label;
-       filtering_action.account_list = account_list;
        filtering_action.account_combo = account_combo;
+       filtering_action.tags_label = tags_label;
+       filtering_action.tags_combo = tags_combo;
        filtering_action.dest_entry = dest_entry;
        filtering_action.dest_btn = dest_btn;
        filtering_action.dest_label = dest_label;
@@ -563,8 +592,15 @@ static void prefs_filtering_action_create(void)
        filtering_action.color_label   = color_label;
        filtering_action.color_optmenu = color_optmenu;
        filtering_action.score_label = score_label;
+       filtering_action.header_label = header_label;
+       filtering_action.header_combo = header_combo;
+       filtering_action.header_entry = header_entry;
+       filtering_action.addressbook_label = addressbook_label;
+       filtering_action.addressbook_btn = addressbook_btn;
        filtering_action.ok_btn = ok_btn;
        filtering_action.action_list_view = action_list_view;
+       
+       prefs_filtering_action_type_selection_changed(NULL, NULL);
 }
 
 /*!
@@ -582,7 +618,7 @@ static void prefs_filtering_action_list_view_set_row(GtkTreeIter *row,
        if (row == NULL && action == NULL) {
                prefs_filtering_action_list_view_insert_action
                        (filtering_action.action_list_view,
-                        NULL, _("New"), FALSE);
+                        NULL, _("(New)"), FALSE);
                return;
        }                        
 
@@ -717,6 +753,12 @@ static gint prefs_filtering_action_get_matching_from_action(Action action_id)
        switch (action_id) {
        case ACTION_MOVE:
                return MATCHACTION_MOVE;
+       case ACTION_SET_TAG:
+               return MATCHACTION_SET_TAG;
+       case ACTION_UNSET_TAG:
+               return MATCHACTION_UNSET_TAG;
+       case ACTION_CLEAR_TAGS:
+               return MATCHACTION_CLEAR_TAGS;
        case ACTION_COPY:
                return MATCHACTION_COPY;
        case ACTION_DELETE:
@@ -733,6 +775,10 @@ static gint prefs_filtering_action_get_matching_from_action(Action action_id)
                return MATCHACTION_MARK_AS_READ;
        case ACTION_MARK_AS_UNREAD:
                return MATCHACTION_MARK_AS_UNREAD;
+       case ACTION_MARK_AS_SPAM:
+               return MATCHACTION_MARK_AS_SPAM;
+       case ACTION_MARK_AS_HAM:
+               return MATCHACTION_MARK_AS_HAM;
        case ACTION_FORWARD:
                return MATCHACTION_FORWARD;
        case ACTION_FORWARD_AS_ATTACHMENT:
@@ -747,12 +793,16 @@ static gint prefs_filtering_action_get_matching_from_action(Action action_id)
                return MATCHACTION_HIDE;
        case ACTION_IGNORE:
                return MATCHACTION_IGNORE;
+       case ACTION_WATCH:
+               return MATCHACTION_WATCH;
        case ACTION_STOP:
                return MATCHACTION_STOP;
        case ACTION_CHANGE_SCORE:
                return MATCHACTION_CHANGE_SCORE;
        case ACTION_SET_SCORE:
                return MATCHACTION_SET_SCORE;
+       case ACTION_ADD_TO_ADDRESSBOOK:
+               return MATCHACTION_ADD_TO_ADDRESSBOOK;
        default:
                return -1;
        }
@@ -777,10 +827,11 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert)
         FilteringAction * action;
         gchar * score_str = NULL;
         gint score;
+       gchar * header = NULL;
         
-       action_id = get_sel_from_list(GTK_LIST(filtering_action.action_type_list));
+       action_id = gtk_combo_box_get_active(GTK_COMBO_BOX(filtering_action.action_combo));
        action_type = prefs_filtering_action_get_matching_from_action(action_id);
-       list_id = get_sel_from_list(GTK_LIST(filtering_action.account_list));
+       list_id = gtk_combo_box_get_active(GTK_COMBO_BOX(filtering_action.account_combo));
        account_id = get_account_id_from_list_id(list_id);
         score = 0;
         destination = NULL;
@@ -826,9 +877,36 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert)
                }
                 score = strtol(score_str, NULL, 10);
                 break;
+       case ACTION_ADD_TO_ADDRESSBOOK:
+               header = gtk_editable_get_chars(GTK_EDITABLE(filtering_action.header_entry), 0, -1);
+               if (*header == '\0') {
+                       if (alert)
+                                alertpanel_error(_("Header is not set."));
+                       g_free(header);
+                       return NULL;
+               }
+               destination = gtk_editable_get_chars(GTK_EDITABLE(filtering_action.dest_entry), 0, -1);
+               if (*destination == '\0') {
+                       if (alert)
+                                alertpanel_error(_("Target addressbook/folder is not set."));
+                       g_free(destination);
+                       return NULL;
+               }
+               break;
+       case ACTION_SET_TAG:
+       case ACTION_UNSET_TAG:
+               destination = gtk_combo_box_get_active_text(GTK_COMBO_BOX(filtering_action.tags_combo));
+               if (!destination || *destination == '\0') {
+                       if (alert)
+                                alertpanel_error(_("Tag name is empty."));
+                       g_free(destination);
+                       return NULL;
+               }
+               break;
        case ACTION_STOP:
        case ACTION_HIDE:
        case ACTION_IGNORE:
+       case ACTION_WATCH:
         case ACTION_DELETE:
         case ACTION_MARK:
         case ACTION_UNMARK:
@@ -836,12 +914,14 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert)
         case ACTION_UNLOCK:
         case ACTION_MARK_AS_READ:
         case ACTION_MARK_AS_UNREAD:
+        case ACTION_MARK_AS_SPAM:
+        case ACTION_MARK_AS_HAM:
+        case ACTION_CLEAR_TAGS:
        default:
                break;
        }
-       
        action = filteringaction_new(action_type, account_id,
-            destination, labelcolor, score);
+            destination, labelcolor, score, header);
        
        g_free(destination);
        g_free(score_str);
@@ -868,7 +948,8 @@ static void prefs_filtering_action_register_cb(void)
         * what seems to be a bug. this causes any other 
         * list items to be unselectable)
         * prefs_filtering_action_reset_dialog(); */
-       gtk_list_select_item(GTK_LIST(filtering_action.account_list), 0);
+       gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.account_combo), 0);
+       gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.tags_combo), 0);
        gtk_entry_set_text(GTK_ENTRY(filtering_action.dest_entry), "");
 }
 
@@ -1024,7 +1105,8 @@ static gboolean prefs_filtering_action_key_pressed(GtkWidget *widget,
  */
 static void prefs_filtering_action_cancel(void)
 {
-       gtk_widget_hide(filtering_action.window);
+       gtk_widget_destroy(filtering_action.window);
+       filtering_action.window = NULL;
        inc_unlock();
 }
 
@@ -1050,7 +1132,8 @@ static void prefs_filtering_action_ok(void)
         }
         g_slist_free(action_list);
 
-       gtk_widget_hide(filtering_action.window);
+       gtk_widget_destroy(filtering_action.window);
+       filtering_action.window = NULL;
         inc_unlock();
 }
 
@@ -1098,7 +1181,7 @@ static DescriptionWindow exec_desc_win = {
         2,
         N_("Filtering Action: 'Execute'"),
        N_("'Execute' allows you to send a message or message element "
-          "to an external program or script.\n\n"
+          "to an external program or script.\n"
           "The following symbols can be used:"),
        exec_desc_strings
 };
@@ -1106,7 +1189,7 @@ static DescriptionWindow exec_desc_win = {
 /*!
  *\brief       Show Execute action's info
  */
-void prefs_filtering_action_exec_info(void)
+static void prefs_filtering_action_exec_info(void)
 {
        description_window_create(&exec_desc_win);
 }
@@ -1125,12 +1208,25 @@ static void prefs_filtering_action_select_dest(void)
        g_free(path);
 }
 
-static void prefs_filtering_action_type_selection_changed(GtkList *list,
-    gpointer user_data)
+static void prefs_filtering_action_select_addressbook(void)
+{
+       const gchar *folderpath = NULL;
+       gchar *new_path = NULL;
+
+       folderpath = gtk_entry_get_text(GTK_ENTRY(filtering_action.dest_entry));
+       new_path = addressbook_folder_selection(folderpath);
+       if (new_path) {
+               gtk_entry_set_text(GTK_ENTRY(filtering_action.dest_entry), new_path);
+               g_free(new_path);
+       } 
+}
+
+static void prefs_filtering_action_type_selection_changed(GtkWidget *combo,
+                                                         gpointer user_data)
 {
        gint value;
 
-       value = get_sel_from_list(GTK_LIST(filtering_action.action_type_list));
+       value = gtk_combo_box_get_active(GTK_COMBO_BOX(filtering_action.action_combo));
 
        if (filtering_action.current_action != value) {
                if (filtering_action.current_action == ACTION_FORWARD 
@@ -1138,28 +1234,29 @@ static void prefs_filtering_action_type_selection_changed(GtkList *list,
                ||  filtering_action.current_action == ACTION_REDIRECT) {
                        debug_print("unregistering address completion entry\n");
                        address_completion_unregister_entry(GTK_ENTRY(filtering_action.dest_entry));
+                       address_completion_end(filtering_action.window);
                }
                if (value == ACTION_FORWARD || value == ACTION_FORWARD_AS_ATTACHMENT
                ||  value == ACTION_REDIRECT) {
                        debug_print("registering address completion entry\n");
-                       address_completion_register_entry(GTK_ENTRY(filtering_action.dest_entry));
+                       address_completion_start(filtering_action.window);
+                       address_completion_register_entry(
+                                       GTK_ENTRY(filtering_action.dest_entry),
+                                       TRUE);
                }
                filtering_action.current_action = value;
        }
-}
-
-static void prefs_filtering_action_type_select(GtkList *list,
-    GtkWidget *widget, gpointer user_data)
-{
-       Action value;
-
-       value = (Action) get_sel_from_list(GTK_LIST(filtering_action.action_type_list));
 
        switch (value) {
        case ACTION_MOVE:
                gtk_widget_show(filtering_action.account_label);
                gtk_widget_set_sensitive(filtering_action.account_label, FALSE);
+               gtk_widget_show(filtering_action.account_combo);
                gtk_widget_set_sensitive(filtering_action.account_combo, FALSE);
+               gtk_widget_hide(filtering_action.tags_label);
+               gtk_widget_set_sensitive(filtering_action.tags_label, FALSE);
+               gtk_widget_hide(filtering_action.tags_combo);
+               gtk_widget_set_sensitive(filtering_action.tags_combo, FALSE);
                gtk_widget_show(filtering_action.dest_entry);
                gtk_widget_set_sensitive(filtering_action.dest_entry, TRUE);
                gtk_widget_show(filtering_action.dest_btn);
@@ -1172,11 +1269,23 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
                gtk_widget_hide(filtering_action.score_label);
+               gtk_widget_hide(filtering_action.addressbook_label);
+               gtk_widget_hide(filtering_action.header_label);
+               gtk_widget_hide(filtering_action.header_combo);
+               gtk_widget_hide(filtering_action.header_entry);
+               gtk_widget_set_sensitive(filtering_action.header_entry, FALSE);
+               gtk_widget_hide(filtering_action.addressbook_btn);
+               gtk_widget_set_sensitive(filtering_action.addressbook_btn, FALSE);
                break;
        case ACTION_COPY:
                gtk_widget_show(filtering_action.account_label);
                gtk_widget_set_sensitive(filtering_action.account_label, FALSE);
+               gtk_widget_show(filtering_action.account_combo);
                gtk_widget_set_sensitive(filtering_action.account_combo, FALSE);
+               gtk_widget_hide(filtering_action.tags_label);
+               gtk_widget_set_sensitive(filtering_action.tags_label, FALSE);
+               gtk_widget_hide(filtering_action.tags_combo);
+               gtk_widget_set_sensitive(filtering_action.tags_combo, FALSE);
                gtk_widget_show(filtering_action.dest_entry);
                gtk_widget_set_sensitive(filtering_action.dest_entry, TRUE);
                gtk_widget_show(filtering_action.dest_btn);
@@ -1189,11 +1298,23 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
                gtk_widget_hide(filtering_action.score_label);
+               gtk_widget_hide(filtering_action.header_label);
+               gtk_widget_hide(filtering_action.header_combo);
+               gtk_widget_hide(filtering_action.header_entry);
+               gtk_widget_set_sensitive(filtering_action.header_entry, FALSE);
+               gtk_widget_hide(filtering_action.addressbook_label);
+               gtk_widget_hide(filtering_action.addressbook_btn);
+               gtk_widget_set_sensitive(filtering_action.addressbook_btn, FALSE);
                break;
        case ACTION_DELETE:
                gtk_widget_show(filtering_action.account_label);
                gtk_widget_set_sensitive(filtering_action.account_label, FALSE);
+               gtk_widget_show(filtering_action.account_combo);
                gtk_widget_set_sensitive(filtering_action.account_combo, FALSE);
+               gtk_widget_hide(filtering_action.tags_label);
+               gtk_widget_set_sensitive(filtering_action.tags_label, FALSE);
+               gtk_widget_hide(filtering_action.tags_combo);
+               gtk_widget_set_sensitive(filtering_action.tags_combo, FALSE);
                gtk_widget_show(filtering_action.dest_entry);
                gtk_widget_set_sensitive(filtering_action.dest_entry, FALSE);
                gtk_widget_show(filtering_action.dest_btn);
@@ -1206,6 +1327,13 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
                gtk_widget_hide(filtering_action.score_label);
+               gtk_widget_hide(filtering_action.header_label);
+               gtk_widget_hide(filtering_action.header_combo);
+               gtk_widget_hide(filtering_action.header_entry);
+               gtk_widget_set_sensitive(filtering_action.header_entry, FALSE);
+               gtk_widget_hide(filtering_action.addressbook_label);
+               gtk_widget_hide(filtering_action.addressbook_btn);
+               gtk_widget_set_sensitive(filtering_action.addressbook_btn, FALSE);
                break;
        case ACTION_MARK:
        case ACTION_UNMARK:
@@ -1213,12 +1341,21 @@ static void prefs_filtering_action_type_select(GtkList *list,
        case ACTION_UNLOCK:
        case ACTION_MARK_AS_READ:
        case ACTION_MARK_AS_UNREAD:
+       case ACTION_MARK_AS_SPAM:
+       case ACTION_MARK_AS_HAM:
         case ACTION_STOP:
         case ACTION_HIDE:
        case ACTION_IGNORE:
+       case ACTION_WATCH:
+       case ACTION_CLEAR_TAGS:
                gtk_widget_show(filtering_action.account_label);
                gtk_widget_set_sensitive(filtering_action.account_label, FALSE);
+               gtk_widget_show(filtering_action.account_combo);
                gtk_widget_set_sensitive(filtering_action.account_combo, FALSE);
+               gtk_widget_hide(filtering_action.tags_label);
+               gtk_widget_set_sensitive(filtering_action.tags_label, FALSE);
+               gtk_widget_hide(filtering_action.tags_combo);
+               gtk_widget_set_sensitive(filtering_action.tags_combo, FALSE);
                gtk_widget_show(filtering_action.dest_entry);
                gtk_widget_set_sensitive(filtering_action.dest_entry, FALSE);
                gtk_widget_show(filtering_action.dest_btn);
@@ -1231,11 +1368,23 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
                gtk_widget_hide(filtering_action.score_label);
+               gtk_widget_hide(filtering_action.header_label);
+               gtk_widget_hide(filtering_action.header_combo);
+               gtk_widget_hide(filtering_action.header_entry);
+               gtk_widget_set_sensitive(filtering_action.header_entry, FALSE);
+               gtk_widget_hide(filtering_action.addressbook_label);
+               gtk_widget_hide(filtering_action.addressbook_btn);
+               gtk_widget_set_sensitive(filtering_action.addressbook_btn, FALSE);
                break;
        case ACTION_FORWARD:
                gtk_widget_show(filtering_action.account_label);
                gtk_widget_set_sensitive(filtering_action.account_label, TRUE);
+               gtk_widget_show(filtering_action.account_combo);
                gtk_widget_set_sensitive(filtering_action.account_combo, TRUE);
+               gtk_widget_hide(filtering_action.tags_label);
+               gtk_widget_set_sensitive(filtering_action.tags_label, FALSE);
+               gtk_widget_hide(filtering_action.tags_combo);
+               gtk_widget_set_sensitive(filtering_action.tags_combo, FALSE);
                gtk_widget_show(filtering_action.dest_entry);
                gtk_widget_set_sensitive(filtering_action.dest_entry, TRUE);
                gtk_widget_show(filtering_action.dest_btn);
@@ -1248,11 +1397,23 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
                gtk_widget_hide(filtering_action.score_label);
+               gtk_widget_hide(filtering_action.header_label);
+               gtk_widget_hide(filtering_action.header_combo);
+               gtk_widget_hide(filtering_action.header_entry);
+               gtk_widget_set_sensitive(filtering_action.header_entry, FALSE);
+               gtk_widget_hide(filtering_action.addressbook_label);
+               gtk_widget_hide(filtering_action.addressbook_btn);
+               gtk_widget_set_sensitive(filtering_action.addressbook_btn, FALSE);
                break;
        case ACTION_FORWARD_AS_ATTACHMENT:
                gtk_widget_show(filtering_action.account_label);
                gtk_widget_set_sensitive(filtering_action.account_label, TRUE);
+               gtk_widget_show(filtering_action.account_combo);
                gtk_widget_set_sensitive(filtering_action.account_combo, TRUE);
+               gtk_widget_hide(filtering_action.tags_label);
+               gtk_widget_set_sensitive(filtering_action.tags_label, FALSE);
+               gtk_widget_hide(filtering_action.tags_combo);
+               gtk_widget_set_sensitive(filtering_action.tags_combo, FALSE);
                gtk_widget_show(filtering_action.dest_entry);
                gtk_widget_set_sensitive(filtering_action.dest_entry, TRUE);
                gtk_widget_show(filtering_action.dest_btn);
@@ -1265,11 +1426,23 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
                gtk_widget_hide(filtering_action.score_label);
+               gtk_widget_hide(filtering_action.header_label);
+               gtk_widget_hide(filtering_action.header_entry);
+               gtk_widget_hide(filtering_action.header_combo);
+               gtk_widget_set_sensitive(filtering_action.header_entry, FALSE);
+               gtk_widget_hide(filtering_action.addressbook_label);
+               gtk_widget_hide(filtering_action.addressbook_btn);
+               gtk_widget_set_sensitive(filtering_action.addressbook_btn, FALSE);
                break;
        case ACTION_REDIRECT:
                gtk_widget_show(filtering_action.account_label);
                gtk_widget_set_sensitive(filtering_action.account_label, TRUE);
+               gtk_widget_show(filtering_action.account_combo);
                gtk_widget_set_sensitive(filtering_action.account_combo, TRUE);
+               gtk_widget_hide(filtering_action.tags_label);
+               gtk_widget_set_sensitive(filtering_action.tags_label, FALSE);
+               gtk_widget_hide(filtering_action.tags_combo);
+               gtk_widget_set_sensitive(filtering_action.tags_combo, FALSE);
                gtk_widget_show(filtering_action.dest_entry);
                gtk_widget_set_sensitive(filtering_action.dest_entry, TRUE);
                gtk_widget_show(filtering_action.dest_btn);
@@ -1282,11 +1455,23 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
                gtk_widget_hide(filtering_action.score_label);
+               gtk_widget_hide(filtering_action.header_label);
+               gtk_widget_hide(filtering_action.header_combo);
+               gtk_widget_hide(filtering_action.header_entry);
+               gtk_widget_set_sensitive(filtering_action.header_entry, FALSE);
+               gtk_widget_hide(filtering_action.addressbook_label);
+               gtk_widget_hide(filtering_action.addressbook_btn);
+               gtk_widget_set_sensitive(filtering_action.addressbook_btn, FALSE);
                break;
        case ACTION_EXECUTE:
                gtk_widget_show(filtering_action.account_label);
                gtk_widget_set_sensitive(filtering_action.account_label, FALSE);
+               gtk_widget_show(filtering_action.account_combo);
                gtk_widget_set_sensitive(filtering_action.account_combo, FALSE);
+               gtk_widget_hide(filtering_action.tags_label);
+               gtk_widget_set_sensitive(filtering_action.tags_label, FALSE);
+               gtk_widget_hide(filtering_action.tags_combo);
+               gtk_widget_set_sensitive(filtering_action.tags_combo, FALSE);
                gtk_widget_show(filtering_action.dest_entry);
                gtk_widget_set_sensitive(filtering_action.dest_entry, TRUE);
                gtk_widget_hide(filtering_action.dest_btn);
@@ -1298,11 +1483,23 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
                gtk_widget_hide(filtering_action.score_label);
+               gtk_widget_hide(filtering_action.header_label);
+               gtk_widget_hide(filtering_action.header_combo);
+               gtk_widget_hide(filtering_action.header_entry);
+               gtk_widget_set_sensitive(filtering_action.header_entry, FALSE);
+               gtk_widget_hide(filtering_action.addressbook_label);
+               gtk_widget_hide(filtering_action.addressbook_btn);
+               gtk_widget_set_sensitive(filtering_action.addressbook_btn, FALSE);
                break;
        case ACTION_COLOR:
                gtk_widget_show(filtering_action.account_label);
                gtk_widget_set_sensitive(filtering_action.account_label, FALSE);
+               gtk_widget_show(filtering_action.account_combo);
                gtk_widget_set_sensitive(filtering_action.account_combo, FALSE);
+               gtk_widget_hide(filtering_action.tags_label);
+               gtk_widget_set_sensitive(filtering_action.tags_label, FALSE);
+               gtk_widget_hide(filtering_action.tags_combo);
+               gtk_widget_set_sensitive(filtering_action.tags_combo, FALSE);
                gtk_widget_hide(filtering_action.dest_entry);
                gtk_widget_hide(filtering_action.dest_btn);
                gtk_widget_hide(filtering_action.dest_label);
@@ -1313,12 +1510,24 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_show(filtering_action.color_optmenu);
                gtk_widget_show(filtering_action.color_label);
                gtk_widget_hide(filtering_action.score_label);
+               gtk_widget_hide(filtering_action.header_label);
+               gtk_widget_hide(filtering_action.header_combo);
+               gtk_widget_hide(filtering_action.header_entry);
+               gtk_widget_set_sensitive(filtering_action.header_entry, FALSE);
+               gtk_widget_hide(filtering_action.addressbook_label);
+               gtk_widget_hide(filtering_action.addressbook_btn);
+               gtk_widget_set_sensitive(filtering_action.addressbook_btn, FALSE);
                break;
        case ACTION_CHANGE_SCORE:
        case ACTION_SET_SCORE:
                gtk_widget_show(filtering_action.account_label);
                gtk_widget_set_sensitive(filtering_action.account_label, FALSE);
+               gtk_widget_show(filtering_action.account_combo);
                gtk_widget_set_sensitive(filtering_action.account_combo, FALSE);
+               gtk_widget_hide(filtering_action.tags_label);
+               gtk_widget_set_sensitive(filtering_action.tags_label, FALSE);
+               gtk_widget_hide(filtering_action.tags_combo);
+               gtk_widget_set_sensitive(filtering_action.tags_combo, FALSE);
                gtk_widget_show(filtering_action.dest_entry);
                gtk_widget_set_sensitive(filtering_action.dest_entry, TRUE);
                gtk_widget_hide(filtering_action.dest_btn);
@@ -1330,14 +1539,80 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
                gtk_widget_show(filtering_action.score_label);
+               gtk_widget_hide(filtering_action.header_label);
+               gtk_widget_hide(filtering_action.header_combo);
+               gtk_widget_hide(filtering_action.header_entry);
+               gtk_widget_set_sensitive(filtering_action.header_entry, FALSE);
+               gtk_widget_hide(filtering_action.addressbook_label);
+               gtk_widget_hide(filtering_action.addressbook_btn);
+               gtk_widget_set_sensitive(filtering_action.addressbook_btn, FALSE);
+               break;
+       case ACTION_ADD_TO_ADDRESSBOOK:
+               gtk_widget_hide(filtering_action.account_label);
+               gtk_widget_set_sensitive(filtering_action.account_label, FALSE);
+               gtk_widget_hide(filtering_action.account_combo);
+               gtk_widget_set_sensitive(filtering_action.account_combo, FALSE);
+               gtk_widget_hide(filtering_action.tags_label);
+               gtk_widget_set_sensitive(filtering_action.tags_label, FALSE);
+               gtk_widget_hide(filtering_action.tags_combo);
+               gtk_widget_set_sensitive(filtering_action.tags_combo, FALSE);
+               gtk_widget_show(filtering_action.dest_entry);
+               gtk_widget_set_sensitive(filtering_action.dest_entry, TRUE);
+               gtk_widget_hide(filtering_action.dest_btn);
+               gtk_widget_set_sensitive(filtering_action.dest_btn, FALSE);
+               gtk_widget_hide(filtering_action.dest_label);
+               gtk_widget_set_sensitive(filtering_action.dest_label, FALSE);
+               gtk_widget_hide(filtering_action.recip_label);
+               gtk_widget_hide(filtering_action.exec_label);
+               gtk_widget_hide(filtering_action.exec_btn);
+               gtk_widget_hide(filtering_action.color_optmenu);
+               gtk_widget_hide(filtering_action.color_label);
+               gtk_widget_hide(filtering_action.score_label);
+               gtk_widget_show(filtering_action.header_label);
+               gtk_widget_show(filtering_action.header_combo);
+               gtk_widget_show(filtering_action.header_entry);
+               gtk_widget_set_sensitive(filtering_action.header_entry, TRUE);
+               gtk_widget_show(filtering_action.addressbook_label);
+               gtk_widget_show(filtering_action.addressbook_btn);
+               gtk_widget_set_sensitive(filtering_action.addressbook_btn, TRUE);
+               break;
+       case ACTION_SET_TAG:
+       case ACTION_UNSET_TAG:
+               gtk_widget_show(filtering_action.account_label);
+               gtk_widget_set_sensitive(filtering_action.account_label, FALSE);
+               gtk_widget_show(filtering_action.account_combo);
+               gtk_widget_set_sensitive(filtering_action.account_combo, FALSE);
+               gtk_widget_show(filtering_action.tags_label);
+               gtk_widget_set_sensitive(filtering_action.tags_label, TRUE);
+               gtk_widget_show(filtering_action.tags_combo);
+               gtk_widget_set_sensitive(filtering_action.tags_combo, TRUE);
+               gtk_widget_hide(filtering_action.dest_entry);
+               gtk_widget_set_sensitive(filtering_action.dest_entry, FALSE);
+               gtk_widget_hide(filtering_action.dest_btn);
+               gtk_widget_set_sensitive(filtering_action.dest_btn, FALSE);
+               gtk_widget_hide(filtering_action.dest_label);
+               gtk_widget_hide(filtering_action.recip_label);
+               gtk_widget_set_sensitive(filtering_action.recip_label, TRUE);
+               gtk_widget_hide(filtering_action.exec_label);
+               gtk_widget_hide(filtering_action.exec_btn);
+               gtk_widget_hide(filtering_action.color_optmenu);
+               gtk_widget_hide(filtering_action.color_label);
+               gtk_widget_hide(filtering_action.score_label);
+               gtk_widget_hide(filtering_action.header_label);
+               gtk_widget_hide(filtering_action.header_combo);
+               gtk_widget_hide(filtering_action.header_entry);
+               gtk_widget_set_sensitive(filtering_action.header_entry, FALSE);
+               gtk_widget_hide(filtering_action.addressbook_label);
+               gtk_widget_hide(filtering_action.addressbook_btn);
+               gtk_widget_set_sensitive(filtering_action.addressbook_btn, FALSE);
                break;
        }
 }
 
 static void prefs_filtering_action_reset_dialog(void)
 {
-       gtk_list_select_item(GTK_LIST(filtering_action.action_type_list), 0);
-       gtk_list_select_item(GTK_LIST(filtering_action.account_list), 0);
+       gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo), 0);
+       gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.account_combo), 0);
        gtk_entry_set_text(GTK_ENTRY(filtering_action.dest_entry), "");
 }
 
@@ -1381,7 +1656,7 @@ static GtkWidget *prefs_filtering_action_list_view_create(void)
        list_view = GTK_TREE_VIEW(gtk_tree_view_new_with_model(model));
        g_object_unref(model);  
        
-       gtk_tree_view_set_rules_hint(list_view, prefs_common.enable_rules_hint);
+       gtk_tree_view_set_rules_hint(list_view, prefs_common.use_stripes_everywhere);
 
        selector = gtk_tree_view_get_selection(list_view);
        gtk_tree_selection_set_mode(selector, GTK_SELECTION_BROWSE);
@@ -1457,94 +1732,112 @@ static gboolean prefs_filtering_actions_selected
 
        switch(action->type) {
        case MATCHACTION_MOVE:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_MOVE);
                break;
        case MATCHACTION_COPY:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_COPY);
                break;
        case MATCHACTION_DELETE:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_DELETE);
                break;
        case MATCHACTION_MARK:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_MARK);
                break;
        case MATCHACTION_UNMARK:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_UNMARK);
                break;
        case MATCHACTION_LOCK:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_LOCK);
                break;
        case MATCHACTION_UNLOCK:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_UNLOCK);
                break;
        case MATCHACTION_MARK_AS_READ:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_MARK_AS_READ);
                break;
        case MATCHACTION_MARK_AS_UNREAD:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_MARK_AS_UNREAD);
                break;
+       case MATCHACTION_MARK_AS_SPAM:
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
+                                    ACTION_MARK_AS_SPAM);
+               break;
+       case MATCHACTION_MARK_AS_HAM:
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
+                                    ACTION_MARK_AS_HAM);
+               break;
        case MATCHACTION_FORWARD:
                list_id = get_list_id_from_account_id(action->account_id);
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_FORWARD);
-               gtk_list_select_item(GTK_LIST(filtering_action.account_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.account_combo),
                                     list_id);
                break;
        case MATCHACTION_FORWARD_AS_ATTACHMENT:
                list_id = get_list_id_from_account_id(action->account_id);
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_FORWARD_AS_ATTACHMENT);
-               gtk_list_select_item(GTK_LIST(filtering_action.account_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.account_combo),
                                     list_id);
                break;
        case MATCHACTION_REDIRECT:
                list_id = get_list_id_from_account_id(action->account_id);
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_REDIRECT);
-               gtk_list_select_item(GTK_LIST(filtering_action.account_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.account_combo),
                                     list_id);
                break;
        case MATCHACTION_EXECUTE:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_EXECUTE);
                break;
        case MATCHACTION_COLOR:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_COLOR);
                gtk_option_menu_set_history(GTK_OPTION_MENU(filtering_action.color_optmenu), action->labelcolor);     
                break;
        case MATCHACTION_CHANGE_SCORE:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_CHANGE_SCORE);
                break;
        case MATCHACTION_SET_SCORE:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_SET_SCORE);
                break;
        case MATCHACTION_STOP:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_STOP);
                break;
        case MATCHACTION_HIDE:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_HIDE);
                break;
        case MATCHACTION_IGNORE:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_IGNORE);
                break;
+       case MATCHACTION_WATCH:
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
+                                    ACTION_WATCH);
+               break;
+       case MATCHACTION_ADD_TO_ADDRESSBOOK:
+               if (action->header)
+                       gtk_entry_set_text(GTK_ENTRY(filtering_action.header_entry), action->header);
+               else
+                       gtk_entry_set_text(GTK_ENTRY(filtering_action.header_entry), "");
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
+                                    ACTION_ADD_TO_ADDRESSBOOK);
        }
 
        filteringaction_free(action); /* XXX: memleak */
        return TRUE;
 }
-