revise label colouring, add filter action for label colouring, fix filtering issues
[claws.git] / src / prefs_matcher.c
index 4800c691a2649cfb5bb05d1c56e1f4b30d5aba15..df2a165d10b97f4092c2eb42a359f44242bc00db 100644 (file)
@@ -52,20 +52,26 @@ static struct Matcher {
        GtkWidget *ok_btn;
 
        GtkWidget *predicate_combo;
        GtkWidget *ok_btn;
 
        GtkWidget *predicate_combo;
+       GtkWidget *predicate_flag_combo;
        GtkWidget *header_combo;
 
        GtkWidget *criteria_list;
        GtkWidget *header_combo;
 
        GtkWidget *criteria_list;
+
        GtkWidget *predicate_list;
        GtkWidget *predicate_list;
+       GtkWidget *predicate_label;
+       GtkWidget *predicate_flag_list;
+
        GtkWidget *bool_op_list;
 
        GtkWidget *header_entry;
        GtkWidget *header_label;
        GtkWidget *value_entry;
        GtkWidget *value_label;
        GtkWidget *bool_op_list;
 
        GtkWidget *header_entry;
        GtkWidget *header_label;
        GtkWidget *value_entry;
        GtkWidget *value_label;
-       GtkWidget *predicate_label;
        GtkWidget *case_chkbtn;
        GtkWidget *regexp_chkbtn;
 
        GtkWidget *case_chkbtn;
        GtkWidget *regexp_chkbtn;
 
+       GtkWidget *exec_btn;
+
        GtkWidget *cond_clist;
 } matcher;
 
        GtkWidget *cond_clist;
 } matcher;
 
@@ -73,38 +79,77 @@ static struct Matcher {
 
 enum {
        CRITERIA_ALL = 0,
 
 enum {
        CRITERIA_ALL = 0,
+
        CRITERIA_SUBJECT = 1,
        CRITERIA_FROM = 2,
        CRITERIA_TO = 3,
        CRITERIA_CC = 4,
        CRITERIA_TO_OR_CC = 5,
        CRITERIA_NEWSGROUPS = 6,
        CRITERIA_SUBJECT = 1,
        CRITERIA_FROM = 2,
        CRITERIA_TO = 3,
        CRITERIA_CC = 4,
        CRITERIA_TO_OR_CC = 5,
        CRITERIA_NEWSGROUPS = 6,
-       CRITERIA_AGE_GREATER = 7,
-       CRITERIA_AGE_LOWER = 8,
-       CRITERIA_HEADER = 9,
-       CRITERIA_HEADERS_PART = 10,
-       CRITERIA_BODY_PART = 11,
-       CRITERIA_MESSAGE = 12
+       CRITERIA_INREPLYTO = 7,
+       CRITERIA_REFERENCES = 8,
+       CRITERIA_AGE_GREATER = 9,
+       CRITERIA_AGE_LOWER = 10,
+       CRITERIA_HEADER = 11,
+       CRITERIA_HEADERS_PART = 12,
+       CRITERIA_BODY_PART = 13,
+       CRITERIA_MESSAGE = 14,
+
+       CRITERIA_UNREAD = 15,
+       CRITERIA_NEW = 16,
+       CRITERIA_MARKED = 17,
+       CRITERIA_DELETED = 18,
+       CRITERIA_REPLIED = 19,
+       CRITERIA_FORWARDED = 20,
+
+       CRITERIA_SCORE_GREATER = 21,
+       CRITERIA_SCORE_LOWER = 22,
+
+       CRITERIA_EXECUTE = 23
+};
+
+enum {
+       BOOL_OP_OR = 0,
+       BOOL_OP_AND = 1
 };
 
 gchar * bool_op_text [] = {
        "or", "and"
 };
 
 };
 
 gchar * bool_op_text [] = {
        "or", "and"
 };
 
+enum {
+       PREDICATE_CONTAINS = 0,
+       PREDICATE_DOES_NOT_CONTAIN = 1
+};
+
 gchar * predicate_text [] = {
        "contains", "does not contain"
 };
 
 gchar * predicate_text [] = {
        "contains", "does not contain"
 };
 
+enum {
+       PREDICATE_FLAG_ENABLED = 0,
+       PREDICATE_FLAG_DISABLED = 1
+};
+
+gchar * predicate_flag_text [] = {
+       "yes", "no"
+};
+
 gchar * criteria_text [] = {
        "All messages", "Subject",
        "From", "To", "Cc", "To or Cc",
 gchar * criteria_text [] = {
        "All messages", "Subject",
        "From", "To", "Cc", "To or Cc",
-       "Newsgroups",
+       "Newsgroups", "In reply to", "References",
        "Age greater than", "Age lower than",
        "Header", "Headers part",
        "Age greater than", "Age lower than",
        "Header", "Headers part",
-       "Body part", "Whole message"
+       "Body part", "Whole message",
+       "Unread flag", "New flag",
+       "Marked flag", "Deleted flag",
+       "Replied flag", "Forwarded flag",
+       "Score greater than", "Score lower than",
+       "Execute"
 };
 
 };
 
-gint get_sel_from_list(GtkList * list)
+static gint get_sel_from_list(GtkList * list)
 {
        gint row = 0;
        void * sel;
 {
        gint row = 0;
        void * sel;
@@ -121,12 +166,7 @@ gint get_sel_from_list(GtkList * list)
        return row;
 }
 
        return row;
 }
 
-enum {
-       PREDICATE_CONTAINS = 0,
-       PREDICATE_DOES_NOT_CONTAIN = 1
-};
-
-static MatcherList * tmp_matchers;
+static PrefsMatcherSignal * matchers_callback;
 
 #define VSPACING               12
 #define VSPACING_NARROW                4
 
 #define VSPACING               12
 #define VSPACING_NARROW                4
@@ -136,7 +176,7 @@ static MatcherList * tmp_matchers;
 /* widget creating functions */
 static void prefs_matcher_create       (void);
 
 /* widget creating functions */
 static void prefs_matcher_create       (void);
 
-static void prefs_matcher_set_dialog   (void);
+static void prefs_matcher_set_dialog   (MatcherList * matchers);
 
 /*
 static void prefs_matcher_set_list     (void);
 
 /*
 static void prefs_matcher_set_list     (void);
@@ -168,9 +208,10 @@ static gint prefs_matcher_deleted(GtkWidget *widget, GdkEventAny *event,
 static void prefs_matcher_criteria_select(GtkList *list,
                                          GtkWidget *widget,
                                          gpointer user_data);
 static void prefs_matcher_criteria_select(GtkList *list,
                                          GtkWidget *widget,
                                          gpointer user_data);
-static void prefs_matcher_set_list(void);
+static MatcherList * prefs_matcher_get_list(void);
+static void prefs_matcher_exec_info_create(void);
 
 
-void prefs_matcher_open(MatcherList * matchers)
+void prefs_matcher_open(MatcherList * matchers, PrefsMatcherSignal * cb)
 {
        inc_autocheck_timer_remove();
 
 {
        inc_autocheck_timer_remove();
 
@@ -181,8 +222,9 @@ void prefs_matcher_open(MatcherList * matchers)
        manage_window_set_transient(GTK_WINDOW(matcher.window));
        gtk_widget_grab_focus(matcher.ok_btn);
 
        manage_window_set_transient(GTK_WINDOW(matcher.window));
        gtk_widget_grab_focus(matcher.ok_btn);
 
-       tmp_matchers = matchers;
-       prefs_matcher_set_dialog();
+       matchers_callback = cb;
+
+       prefs_matcher_set_dialog(matchers);
 
        gtk_widget_show(matcher.window);
 }
 
        gtk_widget_show(matcher.window);
 }
@@ -212,6 +254,8 @@ static void prefs_matcher_create(void)
        GtkWidget *value_entry;
        GtkWidget *predicate_combo;
        GtkWidget *predicate_list;
        GtkWidget *value_entry;
        GtkWidget *predicate_combo;
        GtkWidget *predicate_list;
+       GtkWidget *predicate_flag_combo;
+       GtkWidget *predicate_flag_list;
        GtkWidget *predicate_label;
        GtkWidget *bool_op_combo;
        GtkWidget *bool_op_list;
        GtkWidget *predicate_label;
        GtkWidget *bool_op_combo;
        GtkWidget *bool_op_list;
@@ -235,6 +279,8 @@ static void prefs_matcher_create(void)
        GtkWidget *up_btn;
        GtkWidget *down_btn;
 
        GtkWidget *up_btn;
        GtkWidget *down_btn;
 
+       GtkWidget *exec_btn;
+
        GList *combo_items;
        gint i;
 
        GList *combo_items;
        gint i;
 
@@ -258,13 +304,6 @@ static void prefs_matcher_create(void)
        gtk_box_pack_end (GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
        gtk_widget_grab_default (ok_btn);
 
        gtk_box_pack_end (GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
        gtk_widget_grab_default (ok_btn);
 
-       /*
-       gtkut_button_set_create (&confirm_area, &close_btn, _("Close"),
-                                NULL, NULL, NULL, NULL);
-       gtk_widget_show (confirm_area);
-       gtk_box_pack_end (GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
-       gtk_widget_grab_default (close_btn);*/
-
        gtk_window_set_title (GTK_WINDOW(window),
                              _("Condition setting"));
        gtk_signal_connect (GTK_OBJECT(window), "delete_event",
        gtk_window_set_title (GTK_WINDOW(window),
                              _("Condition setting"));
        gtk_signal_connect (GTK_OBJECT(window), "delete_event",
@@ -285,10 +324,10 @@ static void prefs_matcher_create(void)
        gtk_box_pack_start (GTK_BOX (vbox), vbox1, TRUE, TRUE, 0);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);
 
        gtk_box_pack_start (GTK_BOX (vbox), vbox1, TRUE, TRUE, 0);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);
 
-       table1 = gtk_table_new (2, 3, FALSE);
+       table1 = gtk_table_new (2, 4, FALSE);
        gtk_widget_show (table1);
 
        gtk_widget_show (table1);
 
-       gtk_box_pack_start (GTK_BOX (vbox1), table1, FALSE, TRUE, 0);
+       gtk_box_pack_start (GTK_BOX (vbox1), table1, FALSE, FALSE, 0);
        gtk_table_set_row_spacings (GTK_TABLE (table1), 8);
        gtk_table_set_col_spacings (GTK_TABLE (table1), 8);
 
        gtk_table_set_row_spacings (GTK_TABLE (table1), 8);
        gtk_table_set_col_spacings (GTK_TABLE (table1), 8);
 
@@ -352,24 +391,31 @@ static void prefs_matcher_create(void)
        gtk_widget_show (value_label);
        gtk_misc_set_alignment (GTK_MISC (value_label), 0, 0.5);
        gtk_table_attach (GTK_TABLE (table1), value_label, 2, 3, 0, 1,
        gtk_widget_show (value_label);
        gtk_misc_set_alignment (GTK_MISC (value_label), 0, 0.5);
        gtk_table_attach (GTK_TABLE (table1), value_label, 2, 3, 0, 1,
-                         GTK_FILL, 0, 0, 0);
+                         GTK_FILL | GTK_SHRINK | GTK_EXPAND, 0, 0, 0);
 
        value_entry = gtk_entry_new ();
        gtk_widget_show (value_entry);
        gtk_widget_set_usize (value_entry, 200, -1);
        gtk_table_attach (GTK_TABLE (table1), value_entry, 2, 3, 1, 2,
 
        value_entry = gtk_entry_new ();
        gtk_widget_show (value_entry);
        gtk_widget_set_usize (value_entry, 200, -1);
        gtk_table_attach (GTK_TABLE (table1), value_entry, 2, 3, 1, 2,
-                         0, 0, 0, 0);
-
+                         GTK_FILL | GTK_SHRINK | GTK_EXPAND, 0, 0, 0);
+
+       exec_btn = gtk_button_new_with_label (_("Info ..."));
+       gtk_widget_show (exec_btn);
+       gtk_table_attach (GTK_TABLE (table1), exec_btn, 3, 4, 1, 2,
+                         GTK_FILL | GTK_SHRINK | GTK_EXPAND, 0, 0, 0);
+       gtk_signal_connect (GTK_OBJECT (exec_btn), "clicked",
+                           GTK_SIGNAL_FUNC (prefs_matcher_exec_info),
+                           NULL);
 
        /* predicate */
 
        vbox2 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox2);
 
        /* predicate */
 
        vbox2 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox2);
-       gtk_box_pack_start (GTK_BOX (vbox1), vbox2, TRUE, TRUE, 0);
+       gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
 
        hbox1 = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (hbox1);
 
        hbox1 = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (hbox1);
-       gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
+       gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
 
        predicate_label = gtk_label_new (_("Predicate"));
        gtk_widget_show (predicate_label);
 
        predicate_label = gtk_label_new (_("Predicate"));
        gtk_widget_show (predicate_label);
@@ -397,9 +443,31 @@ static void prefs_matcher_create(void)
        gtk_box_pack_start (GTK_BOX (hbox1), predicate_combo,
                            FALSE, FALSE, 0);
 
        gtk_box_pack_start (GTK_BOX (hbox1), predicate_combo,
                            FALSE, FALSE, 0);
 
+       /* predicate flag */
+
+       predicate_flag_combo = gtk_combo_new ();
+       gtk_widget_hide (predicate_flag_combo);
+       gtk_widget_set_usize (predicate_flag_combo, 120, -1);
+       predicate_flag_list = GTK_COMBO(predicate_flag_combo)->list;
+       gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(predicate_flag_combo)->entry), FALSE);
+
+       combo_items = NULL;
+
+       for(i = 0 ; i < (gint) (sizeof(predicate_text) / sizeof(gchar *)) ;
+           i++) {
+               combo_items = g_list_append(combo_items, (gpointer) _(predicate_flag_text[i]));
+       }
+       gtk_combo_set_popdown_strings(GTK_COMBO(predicate_flag_combo),
+                                     combo_items);
+
+       g_list_free(combo_items);
+
+       gtk_box_pack_start (GTK_BOX (hbox1), predicate_flag_combo,
+                           FALSE, FALSE, 0);
+
        vbox3 = gtk_vbox_new (FALSE, 0);
        gtk_widget_show (vbox3);
        vbox3 = gtk_vbox_new (FALSE, 0);
        gtk_widget_show (vbox3);
-       gtk_box_pack_start (GTK_BOX (hbox1), vbox3, TRUE, TRUE, 0);
+       gtk_box_pack_start (GTK_BOX (hbox1), vbox3, FALSE, FALSE, 0);
 
        PACK_CHECK_BUTTON (vbox3, case_chkbtn, _("Case sensitive"));
        PACK_CHECK_BUTTON (vbox3, regexp_chkbtn, _("Use regexp"));
 
        PACK_CHECK_BUTTON (vbox3, case_chkbtn, _("Case sensitive"));
        PACK_CHECK_BUTTON (vbox3, regexp_chkbtn, _("Use regexp"));
@@ -465,7 +533,7 @@ static void prefs_matcher_create(void)
        g_list_free(combo_items);
 
        gtk_box_pack_start (GTK_BOX (btn_hbox), bool_op_combo,
        g_list_free(combo_items);
 
        gtk_box_pack_start (GTK_BOX (btn_hbox), bool_op_combo,
-                           FALSE, TRUE, 0);
+                           FALSE, FALSE, 0);
 
        cond_hbox = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (cond_hbox);
 
        cond_hbox = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (cond_hbox);
@@ -522,9 +590,12 @@ static void prefs_matcher_create(void)
        matcher.predicate_label = predicate_label;
        matcher.predicate_list = predicate_list;
        matcher.predicate_combo = predicate_combo;
        matcher.predicate_label = predicate_label;
        matcher.predicate_list = predicate_list;
        matcher.predicate_combo = predicate_combo;
+       matcher.predicate_flag_list = predicate_flag_list;
+       matcher.predicate_flag_combo = predicate_flag_combo;
        matcher.case_chkbtn = case_chkbtn;
        matcher.regexp_chkbtn = regexp_chkbtn;
        matcher.bool_op_list = bool_op_list;
        matcher.case_chkbtn = case_chkbtn;
        matcher.regexp_chkbtn = regexp_chkbtn;
        matcher.bool_op_list = bool_op_list;
+       matcher.exec_btn = exec_btn;
 
        matcher.cond_clist   = cond_clist;
 }
 
        matcher.cond_clist   = cond_clist;
 }
@@ -559,27 +630,35 @@ static void prefs_matcher_reset_condition(void)
        gtk_entry_set_text(GTK_ENTRY(matcher.value_entry), "");
 }
 
        gtk_entry_set_text(GTK_ENTRY(matcher.value_entry), "");
 }
 
- static void prefs_matcher_set_dialog(void)
+static void prefs_matcher_update_hscrollbar(void)
+{
+       gint optwidth = gtk_clist_optimal_column_width(GTK_CLIST(matcher.cond_clist), 0);
+       gtk_clist_set_column_width(GTK_CLIST(matcher.cond_clist), 0, optwidth);
+}
+
+static void prefs_matcher_set_dialog(MatcherList * matchers)
 {
        GtkCList *clist = GTK_CLIST(matcher.cond_clist);
        GSList * cur;
 {
        GtkCList *clist = GTK_CLIST(matcher.cond_clist);
        GSList * cur;
-       gboolean bool_op = 0;
+       gboolean bool_op = 1;
 
        gtk_clist_freeze(clist);
        gtk_clist_clear(clist);
 
        prefs_matcher_clist_set_row(-1, NULL);
 
        gtk_clist_freeze(clist);
        gtk_clist_clear(clist);
 
        prefs_matcher_clist_set_row(-1, NULL);
-       if (tmp_matchers != NULL) {
-               for (cur = tmp_matchers->matchers ; cur != NULL ;
+       if (matchers != NULL) {
+               for (cur = matchers->matchers ; cur != NULL ;
                     cur = g_slist_next(cur)) {
                        MatcherProp * prop;
                        prop = (MatcherProp *) cur->data;
                        prefs_matcher_clist_set_row(-1, prop);
                     cur = g_slist_next(cur)) {
                        MatcherProp * prop;
                        prop = (MatcherProp *) cur->data;
                        prefs_matcher_clist_set_row(-1, prop);
-                       matcherprop_free(prop);
                }
 
                }
 
-               bool_op = tmp_matchers->bool_and;
+               bool_op = matchers->bool_and;
        }
        }
+       
+       prefs_matcher_update_hscrollbar();
+
        gtk_clist_thaw(clist);
 
        gtk_list_select_item(GTK_LIST(matcher.bool_op_list), bool_op);
        gtk_clist_thaw(clist);
 
        gtk_list_select_item(GTK_LIST(matcher.bool_op_list), bool_op);
@@ -587,25 +666,17 @@ static void prefs_matcher_reset_condition(void)
        prefs_matcher_reset_condition();
 }
 
        prefs_matcher_reset_condition();
 }
 
-static void prefs_matcher_set_list(void)
+static MatcherList * prefs_matcher_get_list(void)
 {
        gchar * matcher_str;
        MatcherProp * prop;
        gint row = 1;
 {
        gchar * matcher_str;
        MatcherProp * prop;
        gint row = 1;
-       GSList * l;
        gchar * tmp;
        gchar * tmp;
+       gboolean bool_and;
+       GSList * matcher_list;
+       MatcherList * matchers;
 
 
-       if (tmp_matchers == NULL)
-               return;
-
-       /* free old */
-
-       for(l = tmp_matchers->matchers ; l != NULL ; l = g_slist_next(l))
-               matcherprop_free((MatcherProp *) l->data);
-       g_slist_free(tmp_matchers->matchers);
-       tmp_matchers->matchers = NULL;
-
-       /* set new */
+       matcher_list = NULL;
 
        while (gtk_clist_get_text(GTK_CLIST(matcher.cond_clist),
                                  row, 0, &matcher_str)) {
 
        while (gtk_clist_get_text(GTK_CLIST(matcher.cond_clist),
                                  row, 0, &matcher_str)) {
@@ -617,14 +688,94 @@ static void prefs_matcher_set_list(void)
                        if (tmp == NULL)
                                break;
                        
                        if (tmp == NULL)
                                break;
                        
-                       tmp_matchers->matchers =
-                               g_slist_append(tmp_matchers->matchers, prop);
+                       matcher_list = g_slist_append(matcher_list, prop);
                }
                row ++;
        }
 
                }
                row ++;
        }
 
-       tmp_matchers->bool_and = get_sel_from_list(GTK_LIST(matcher.bool_op_list));
+       bool_and = get_sel_from_list(GTK_LIST(matcher.bool_op_list));
+
+       matchers = matcherlist_new(matcher_list, bool_and);
 
 
+       return matchers;
+}
+
+static gint prefs_matcher_get_criteria_from_matching(gint matching_id)
+{
+       switch(matching_id) {
+       case MATCHING_ALL:
+               return CRITERIA_ALL;
+       case MATCHING_NOT_UNREAD:
+       case MATCHING_UNREAD:
+               return CRITERIA_UNREAD;
+       case MATCHING_NOT_NEW:
+       case MATCHING_NEW:
+               return CRITERIA_NEW;
+       case MATCHING_NOT_MARKED:
+       case MATCHING_MARKED:
+               return CRITERIA_MARKED;
+       case MATCHING_NOT_DELETED:
+       case MATCHING_DELETED:
+               return CRITERIA_DELETED;
+               break;
+       case MATCHING_NOT_REPLIED:
+       case MATCHING_REPLIED:
+               return CRITERIA_REPLIED;
+       case MATCHING_NOT_FORWARDED:
+       case MATCHING_FORWARDED:
+               return CRITERIA_FORWARDED;
+       case MATCHING_NOT_SUBJECT:
+       case MATCHING_SUBJECT:
+               return CRITERIA_SUBJECT;
+       case MATCHING_NOT_FROM:
+       case MATCHING_FROM:
+               return CRITERIA_FROM;
+       case MATCHING_NOT_TO:
+       case MATCHING_TO:
+               return CRITERIA_TO;
+       case MATCHING_NOT_CC:
+       case MATCHING_CC:
+               return CRITERIA_CC;
+       case MATCHING_NOT_NEWSGROUPS:
+       case MATCHING_NEWSGROUPS:
+               return CRITERIA_NEWSGROUPS;
+       case MATCHING_NOT_INREPLYTO:
+       case MATCHING_INREPLYTO:
+               return CRITERIA_INREPLYTO;
+       case MATCHING_NOT_REFERENCES:
+       case MATCHING_REFERENCES:
+               return CRITERIA_REFERENCES;
+       case MATCHING_NOT_TO_AND_NOT_CC:
+       case MATCHING_TO_OR_CC:
+               return CRITERIA_TO_OR_CC;
+       case MATCHING_NOT_BODY_PART:
+       case MATCHING_BODY_PART:
+               return CRITERIA_BODY_PART;
+       case MATCHING_NOT_MESSAGE:
+       case MATCHING_MESSAGE:
+               return CRITERIA_MESSAGE;
+               break;
+       case MATCHING_NOT_HEADERS_PART:
+       case MATCHING_HEADERS_PART:
+               return CRITERIA_HEADERS_PART;
+       case MATCHING_NOT_HEADER:
+       case MATCHING_HEADER:
+               return CRITERIA_HEADER;
+       case MATCHING_AGE_GREATER:
+               return CRITERIA_AGE_GREATER;
+       case MATCHING_AGE_LOWER:
+               return CRITERIA_AGE_LOWER;
+       case MATCHING_SCORE_GREATER:
+               return CRITERIA_SCORE_GREATER;
+       case MATCHING_SCORE_LOWER:
+               return CRITERIA_SCORE_LOWER;
+       case MATCHING_NOT_EXECUTE:
+       case MATCHING_EXECUTE:
+               return CRITERIA_EXECUTE;
+               break;
+       default:
+               return -1;
+       }
 }
 
 static gint prefs_matcher_get_matching_from_criteria(gint criteria_id)
 }
 
 static gint prefs_matcher_get_matching_from_criteria(gint criteria_id)
@@ -632,6 +783,18 @@ static gint prefs_matcher_get_matching_from_criteria(gint criteria_id)
        switch (criteria_id) {
        case CRITERIA_ALL:
                return MATCHING_ALL;
        switch (criteria_id) {
        case CRITERIA_ALL:
                return MATCHING_ALL;
+       case CRITERIA_UNREAD:
+               return MATCHING_UNREAD;
+       case CRITERIA_NEW:
+               return MATCHING_NEW;
+       case CRITERIA_MARKED:
+               return MATCHING_MARKED;
+       case CRITERIA_DELETED:
+               return MATCHING_DELETED;
+       case CRITERIA_REPLIED:
+               return MATCHING_REPLIED;
+       case CRITERIA_FORWARDED:
+               return MATCHING_FORWARDED;
        case CRITERIA_SUBJECT:
                return MATCHING_SUBJECT;
        case CRITERIA_FROM:
        case CRITERIA_SUBJECT:
                return MATCHING_SUBJECT;
        case CRITERIA_FROM:
@@ -644,10 +807,18 @@ static gint prefs_matcher_get_matching_from_criteria(gint criteria_id)
                return MATCHING_TO_OR_CC;
        case CRITERIA_NEWSGROUPS:
                return MATCHING_NEWSGROUPS;
                return MATCHING_TO_OR_CC;
        case CRITERIA_NEWSGROUPS:
                return MATCHING_NEWSGROUPS;
+       case CRITERIA_INREPLYTO:
+               return MATCHING_INREPLYTO;
+       case CRITERIA_REFERENCES:
+               return MATCHING_REFERENCES;
        case CRITERIA_AGE_GREATER:
                return MATCHING_AGE_GREATER;
        case CRITERIA_AGE_LOWER:
                return MATCHING_AGE_LOWER;
        case CRITERIA_AGE_GREATER:
                return MATCHING_AGE_GREATER;
        case CRITERIA_AGE_LOWER:
                return MATCHING_AGE_LOWER;
+       case CRITERIA_SCORE_GREATER:
+               return MATCHING_SCORE_GREATER;
+       case CRITERIA_SCORE_LOWER:
+               return MATCHING_SCORE_LOWER;
        case CRITERIA_HEADER:
                return MATCHING_HEADER;
        case CRITERIA_HEADERS_PART:
        case CRITERIA_HEADER:
                return MATCHING_HEADER;
        case CRITERIA_HEADERS_PART:
@@ -656,6 +827,8 @@ static gint prefs_matcher_get_matching_from_criteria(gint criteria_id)
                return MATCHING_BODY_PART;
        case CRITERIA_MESSAGE:
                return MATCHING_MESSAGE;
                return MATCHING_BODY_PART;
        case CRITERIA_MESSAGE:
                return MATCHING_MESSAGE;
+       case CRITERIA_EXECUTE:
+               return MATCHING_EXECUTE;
        default:
                return -1;
        }
        default:
                return -1;
        }
@@ -664,6 +837,18 @@ static gint prefs_matcher_get_matching_from_criteria(gint criteria_id)
 static gint prefs_matcher_not_criteria(gint matcher_criteria)
 {
        switch(matcher_criteria) {
 static gint prefs_matcher_not_criteria(gint matcher_criteria)
 {
        switch(matcher_criteria) {
+       case MATCHING_UNREAD:
+               return MATCHING_NOT_UNREAD;
+       case MATCHING_NEW:
+               return MATCHING_NOT_NEW;
+       case MATCHING_MARKED:
+               return MATCHING_NOT_MARKED;
+       case MATCHING_DELETED:
+               return MATCHING_NOT_DELETED;
+       case MATCHING_REPLIED:
+               return MATCHING_NOT_REPLIED;
+       case MATCHING_FORWARDED:
+               return MATCHING_NOT_FORWARDED;
        case MATCHING_SUBJECT:
                return MATCHING_NOT_SUBJECT;
        case MATCHING_FROM:
        case MATCHING_SUBJECT:
                return MATCHING_NOT_SUBJECT;
        case MATCHING_FROM:
@@ -676,12 +861,18 @@ static gint prefs_matcher_not_criteria(gint matcher_criteria)
                return MATCHING_NOT_TO_AND_NOT_CC;
        case MATCHING_NEWSGROUPS:
                return MATCHING_NOT_NEWSGROUPS;
                return MATCHING_NOT_TO_AND_NOT_CC;
        case MATCHING_NEWSGROUPS:
                return MATCHING_NOT_NEWSGROUPS;
+       case MATCHING_INREPLYTO:
+               return MATCHING_NOT_INREPLYTO;
+       case MATCHING_REFERENCES:
+               return MATCHING_NOT_REFERENCES;
        case MATCHING_HEADER:
                return MATCHING_NOT_HEADER;
        case MATCHING_HEADERS_PART:
                return MATCHING_NOT_HEADERS_PART;
        case MATCHING_MESSAGE:
                return MATCHING_NOT_MESSAGE;
        case MATCHING_HEADER:
                return MATCHING_NOT_HEADER;
        case MATCHING_HEADERS_PART:
                return MATCHING_NOT_HEADERS_PART;
        case MATCHING_MESSAGE:
                return MATCHING_NOT_MESSAGE;
+       case MATCHING_EXECUTE:
+               return MATCHING_NOT_EXECUTE;
        case MATCHING_BODY_PART:
                return MATCHING_NOT_BODY_PART;
        default:
        case MATCHING_BODY_PART:
                return MATCHING_NOT_BODY_PART;
        default:
@@ -695,25 +886,54 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
        gint criteria;
        gint matchtype;
        gint value_pred;
        gint criteria;
        gint matchtype;
        gint value_pred;
+       gint value_pred_flag;
        gint value_criteria;
        gboolean use_regexp;
        gboolean case_sensitive;
        gchar * header;
        gchar * expr;
        gint value_criteria;
        gboolean use_regexp;
        gboolean case_sensitive;
        gchar * header;
        gchar * expr;
-       gint age;
-       gchar * age_str;
+       gint value;
+       gchar * value_str;
 
        value_criteria = get_sel_from_list(GTK_LIST(matcher.criteria_list));
 
        criteria = prefs_matcher_get_matching_from_criteria(value_criteria);
 
        value_pred = get_sel_from_list(GTK_LIST(matcher.predicate_list));
 
        value_criteria = get_sel_from_list(GTK_LIST(matcher.criteria_list));
 
        criteria = prefs_matcher_get_matching_from_criteria(value_criteria);
 
        value_pred = get_sel_from_list(GTK_LIST(matcher.predicate_list));
+       value_pred_flag = get_sel_from_list(GTK_LIST(matcher.predicate_flag_list));
 
        use_regexp = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(matcher.regexp_chkbtn));
        case_sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(matcher.case_chkbtn));
 
 
        use_regexp = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(matcher.regexp_chkbtn));
        case_sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(matcher.case_chkbtn));
 
-       if (value_pred != PREDICATE_CONTAINS)
-               criteria = prefs_matcher_not_criteria(criteria);
+       switch (value_criteria) {
+       case CRITERIA_UNREAD:
+       case CRITERIA_NEW:
+       case CRITERIA_MARKED:
+       case CRITERIA_DELETED:
+       case CRITERIA_REPLIED:
+       case CRITERIA_FORWARDED:
+               if (value_pred_flag == PREDICATE_FLAG_DISABLED)
+                       criteria = prefs_matcher_not_criteria(criteria);
+               break;
+       case CRITERIA_SUBJECT:
+       case CRITERIA_FROM:
+       case CRITERIA_TO:
+       case CRITERIA_CC:
+       case CRITERIA_TO_OR_CC:
+       case CRITERIA_NEWSGROUPS:
+       case CRITERIA_INREPLYTO:
+       case CRITERIA_REFERENCES:
+       case CRITERIA_HEADERS_PART:
+       case CRITERIA_BODY_PART:
+       case CRITERIA_MESSAGE:
+       case CRITERIA_EXECUTE:
+       case CRITERIA_AGE_GREATER:
+       case CRITERIA_AGE_LOWER:
+       case CRITERIA_HEADER:
+               if (value_pred == PREDICATE_DOES_NOT_CONTAIN)
+                       criteria = prefs_matcher_not_criteria(criteria);
+               break;
+       }
 
        if (use_regexp) {
                if (case_sensitive)
 
        if (use_regexp) {
                if (case_sensitive)
@@ -730,10 +950,16 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
 
        header = NULL;
        expr = NULL;
 
        header = NULL;
        expr = NULL;
-       age = 0;
+       value = 0;
 
        switch (value_criteria) {
        case CRITERIA_ALL:
 
        switch (value_criteria) {
        case CRITERIA_ALL:
+       case CRITERIA_UNREAD:
+       case CRITERIA_NEW:
+       case CRITERIA_MARKED:
+       case CRITERIA_DELETED:
+       case CRITERIA_REPLIED:
+       case CRITERIA_FORWARDED:
                break;
 
        case CRITERIA_SUBJECT:
                break;
 
        case CRITERIA_SUBJECT:
@@ -742,28 +968,34 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
        case CRITERIA_CC:
        case CRITERIA_TO_OR_CC:
        case CRITERIA_NEWSGROUPS:
        case CRITERIA_CC:
        case CRITERIA_TO_OR_CC:
        case CRITERIA_NEWSGROUPS:
+       case CRITERIA_INREPLYTO:
+       case CRITERIA_REFERENCES:
        case CRITERIA_HEADERS_PART:
        case CRITERIA_BODY_PART:
        case CRITERIA_MESSAGE:
        case CRITERIA_HEADERS_PART:
        case CRITERIA_BODY_PART:
        case CRITERIA_MESSAGE:
+       case CRITERIA_EXECUTE:
                expr = gtk_entry_get_text(GTK_ENTRY(matcher.value_entry));
 
                expr = gtk_entry_get_text(GTK_ENTRY(matcher.value_entry));
 
+               /*
                if (*expr == '\0') {
                    alertpanel_error(_("Match string is not set."));
                    return NULL;
                }
                if (*expr == '\0') {
                    alertpanel_error(_("Match string is not set."));
                    return NULL;
                }
-
+               */
                break;
 
        case CRITERIA_AGE_GREATER:
        case CRITERIA_AGE_LOWER:
                break;
 
        case CRITERIA_AGE_GREATER:
        case CRITERIA_AGE_LOWER:
-               age_str = gtk_entry_get_text(GTK_ENTRY(matcher.value_entry));
+       case CRITERIA_SCORE_GREATER:
+       case CRITERIA_SCORE_LOWER:
+               value_str = gtk_entry_get_text(GTK_ENTRY(matcher.value_entry));
 
 
-               if (*age_str == '\0') {
-                   alertpanel_error(_("Age is not set."));
+               if (*value_str == '\0') {
+                   alertpanel_error(_("Value is not set."));
                    return NULL;
                }
 
                    return NULL;
                }
 
-               age = atoi(age_str);
+               value = atoi(value_str);
 
                break;
 
 
                break;
 
@@ -776,16 +1008,18 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
                    alertpanel_error(_("Header name is not set."));
                    return NULL;
                }
                    alertpanel_error(_("Header name is not set."));
                    return NULL;
                }
+               /*
                if (*expr == '\0') {
                    alertpanel_error(_("Match string is not set."));
                    return NULL;
                }
                if (*expr == '\0') {
                    alertpanel_error(_("Match string is not set."));
                    return NULL;
                }
-
+               */
                break;
        }
 
                break;
        }
 
-       matcherprop =  matcherprop_new(criteria, header, matchtype, expr, age);
-       
+       matcherprop =  matcherprop_new(criteria, header, matchtype,
+                                      expr, value);
+
        return matcherprop;
 }
 
        return matcherprop;
 }
 
@@ -802,6 +1036,7 @@ static void prefs_matcher_register_cb(void)
        matcherprop_free(matcherprop);
 
        prefs_matcher_reset_condition();
        matcherprop_free(matcherprop);
 
        prefs_matcher_reset_condition();
+       prefs_matcher_update_hscrollbar();
 }
 
 static void prefs_matcher_substitute_cb(void)
 }
 
 static void prefs_matcher_substitute_cb(void)
@@ -823,6 +1058,8 @@ static void prefs_matcher_substitute_cb(void)
        matcherprop_free(matcherprop);
 
        prefs_matcher_reset_condition();
        matcherprop_free(matcherprop);
 
        prefs_matcher_reset_condition();
+       
+       prefs_matcher_update_hscrollbar();
 }
 
 static void prefs_matcher_delete_cb(void)
 }
 
 static void prefs_matcher_delete_cb(void)
@@ -836,6 +1073,8 @@ static void prefs_matcher_delete_cb(void)
                return;
 
        gtk_clist_remove(clist, row);
                return;
 
        gtk_clist_remove(clist, row);
+       
+       prefs_matcher_update_hscrollbar();
 }
 
 static void prefs_matcher_up(void)
 }
 
 static void prefs_matcher_up(void)
@@ -869,6 +1108,7 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
        gchar * tmp;
        MatcherProp * prop;
        gboolean negative_cond;
        gchar * tmp;
        MatcherProp * prop;
        gboolean negative_cond;
+       gint criteria;
 
        if (!gtk_clist_get_text(GTK_CLIST(matcher.cond_clist),
                                row, 0, &matcher_str))
 
        if (!gtk_clist_get_text(GTK_CLIST(matcher.cond_clist),
                                row, 0, &matcher_str))
@@ -886,90 +1126,31 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
        if (tmp == NULL)
                return;
 
        if (tmp == NULL)
                return;
 
-       switch(prop->criteria) {
-       case MATCHING_ALL:
+       criteria = prefs_matcher_get_criteria_from_matching(prop->criteria);
+       if (criteria != -1)
                gtk_list_select_item(GTK_LIST(matcher.criteria_list),
                gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_ALL);
-               break;
+                                    criteria);
 
 
+       switch(prop->criteria) {
+       case MATCHING_NOT_UNREAD:
+       case MATCHING_NOT_NEW:
+       case MATCHING_NOT_MARKED:
+       case MATCHING_NOT_DELETED:
+       case MATCHING_NOT_REPLIED:
+       case MATCHING_NOT_FORWARDED:
        case MATCHING_NOT_SUBJECT:
        case MATCHING_NOT_SUBJECT:
-               negative_cond = TRUE;
-       case MATCHING_SUBJECT:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_SUBJECT);
-               break;
-
        case MATCHING_NOT_FROM:
        case MATCHING_NOT_FROM:
-               negative_cond = TRUE;
-       case MATCHING_FROM:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_FROM);
-               break;
-
        case MATCHING_NOT_TO:
        case MATCHING_NOT_TO:
-               negative_cond = TRUE;
-       case MATCHING_TO:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_TO);
-               break;
-
        case MATCHING_NOT_CC:
        case MATCHING_NOT_CC:
-               negative_cond = TRUE;
-       case MATCHING_CC:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_CC);
-               break;
-
        case MATCHING_NOT_NEWSGROUPS:
        case MATCHING_NOT_NEWSGROUPS:
-               negative_cond = TRUE;
-       case MATCHING_NEWSGROUPS:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_NEWSGROUPS);
-               break;
-
+       case MATCHING_NOT_INREPLYTO:
+       case MATCHING_NOT_REFERENCES:
        case MATCHING_NOT_TO_AND_NOT_CC:
        case MATCHING_NOT_TO_AND_NOT_CC:
-               negative_cond = TRUE;
-       case MATCHING_TO_OR_CC:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_TO_OR_CC);
-               break;
-
        case MATCHING_NOT_BODY_PART:
        case MATCHING_NOT_BODY_PART:
-               negative_cond = TRUE;
-       case MATCHING_BODY_PART:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_BODY_PART);
-               break;
-
        case MATCHING_NOT_MESSAGE:
        case MATCHING_NOT_MESSAGE:
-               negative_cond = TRUE;
-       case MATCHING_MESSAGE:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_MESSAGE);
-               break;
-
        case MATCHING_NOT_HEADERS_PART:
        case MATCHING_NOT_HEADERS_PART:
-               negative_cond = TRUE;
-       case MATCHING_HEADERS_PART:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_HEADERS_PART);
-               break;
-
        case MATCHING_NOT_HEADER:
                negative_cond = TRUE;
        case MATCHING_NOT_HEADER:
                negative_cond = TRUE;
-       case MATCHING_HEADER:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_HEADER);
-               break;
-
-       case MATCHING_AGE_GREATER:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_AGE_GREATER);
-               break;
-
-       case MATCHING_AGE_LOWER:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_AGE_LOWER);
                break;
        }
        
                break;
        }
        
@@ -983,6 +1164,8 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
        case MATCHING_NOT_CC:
        case MATCHING_NOT_TO_AND_NOT_CC:
        case MATCHING_NOT_NEWSGROUPS:
        case MATCHING_NOT_CC:
        case MATCHING_NOT_TO_AND_NOT_CC:
        case MATCHING_NOT_NEWSGROUPS:
+       case MATCHING_NOT_INREPLYTO:
+       case MATCHING_NOT_REFERENCES:
        case MATCHING_NOT_HEADERS_PART:
        case MATCHING_NOT_BODY_PART:
        case MATCHING_NOT_MESSAGE:
        case MATCHING_NOT_HEADERS_PART:
        case MATCHING_NOT_BODY_PART:
        case MATCHING_NOT_MESSAGE:
@@ -992,6 +1175,8 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
        case MATCHING_CC:
        case MATCHING_TO_OR_CC:
        case MATCHING_NEWSGROUPS:
        case MATCHING_CC:
        case MATCHING_TO_OR_CC:
        case MATCHING_NEWSGROUPS:
+       case MATCHING_INREPLYTO:
+       case MATCHING_REFERENCES:
        case MATCHING_HEADERS_PART:
        case MATCHING_BODY_PART:
        case MATCHING_MESSAGE:
        case MATCHING_HEADERS_PART:
        case MATCHING_BODY_PART:
        case MATCHING_MESSAGE:
@@ -1000,7 +1185,9 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
 
        case MATCHING_AGE_GREATER:
        case MATCHING_AGE_LOWER:
 
        case MATCHING_AGE_GREATER:
        case MATCHING_AGE_LOWER:
-               gtk_entry_set_text(GTK_ENTRY(matcher.value_entry), itos(prop->age));
+       case MATCHING_SCORE_GREATER:
+       case MATCHING_SCORE_LOWER:
+               gtk_entry_set_text(GTK_ENTRY(matcher.value_entry), itos(prop->value));
                break;
 
        case MATCHING_NOT_HEADER:
                break;
 
        case MATCHING_NOT_HEADER:
@@ -1054,8 +1241,32 @@ static void prefs_matcher_criteria_select(GtkList *list,
                gtk_widget_set_sensitive(matcher.value_entry, FALSE);
                gtk_widget_set_sensitive(matcher.predicate_label, FALSE);
                gtk_widget_set_sensitive(matcher.predicate_combo, FALSE);
                gtk_widget_set_sensitive(matcher.value_entry, FALSE);
                gtk_widget_set_sensitive(matcher.predicate_label, FALSE);
                gtk_widget_set_sensitive(matcher.predicate_combo, FALSE);
+               gtk_widget_set_sensitive(matcher.predicate_flag_combo, FALSE);
+               gtk_widget_hide(matcher.predicate_combo);
+               gtk_widget_show(matcher.predicate_flag_combo);
+               gtk_widget_set_sensitive(matcher.case_chkbtn, FALSE);
+               gtk_widget_set_sensitive(matcher.regexp_chkbtn, FALSE);
+               gtk_widget_set_sensitive(matcher.exec_btn, FALSE);
+               break;
+
+       case CRITERIA_UNREAD:
+       case CRITERIA_NEW:
+       case CRITERIA_MARKED:
+       case CRITERIA_DELETED:
+       case CRITERIA_REPLIED:
+       case CRITERIA_FORWARDED:
+               gtk_widget_set_sensitive(matcher.header_combo, FALSE);
+               gtk_widget_set_sensitive(matcher.header_label, FALSE);
+               gtk_widget_set_sensitive(matcher.value_label, FALSE);
+               gtk_widget_set_sensitive(matcher.value_entry, FALSE);
+               gtk_widget_set_sensitive(matcher.predicate_label, TRUE);
+               gtk_widget_set_sensitive(matcher.predicate_combo, FALSE);
+               gtk_widget_set_sensitive(matcher.predicate_flag_combo, TRUE);
+               gtk_widget_hide(matcher.predicate_combo);
+               gtk_widget_show(matcher.predicate_flag_combo);
                gtk_widget_set_sensitive(matcher.case_chkbtn, FALSE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, FALSE);
                gtk_widget_set_sensitive(matcher.case_chkbtn, FALSE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, FALSE);
+               gtk_widget_set_sensitive(matcher.exec_btn, FALSE);
                break;
 
        case CRITERIA_SUBJECT:
                break;
 
        case CRITERIA_SUBJECT:
@@ -1064,6 +1275,8 @@ static void prefs_matcher_criteria_select(GtkList *list,
        case CRITERIA_CC:
        case CRITERIA_TO_OR_CC:
        case CRITERIA_NEWSGROUPS:
        case CRITERIA_CC:
        case CRITERIA_TO_OR_CC:
        case CRITERIA_NEWSGROUPS:
+       case CRITERIA_INREPLYTO:
+       case CRITERIA_REFERENCES:
        case CRITERIA_HEADERS_PART:
        case CRITERIA_BODY_PART:
        case CRITERIA_MESSAGE:
        case CRITERIA_HEADERS_PART:
        case CRITERIA_BODY_PART:
        case CRITERIA_MESSAGE:
@@ -1073,20 +1286,45 @@ static void prefs_matcher_criteria_select(GtkList *list,
                gtk_widget_set_sensitive(matcher.value_entry, TRUE);
                gtk_widget_set_sensitive(matcher.predicate_label, TRUE);
                gtk_widget_set_sensitive(matcher.predicate_combo, TRUE);
                gtk_widget_set_sensitive(matcher.value_entry, TRUE);
                gtk_widget_set_sensitive(matcher.predicate_label, TRUE);
                gtk_widget_set_sensitive(matcher.predicate_combo, TRUE);
+               gtk_widget_set_sensitive(matcher.predicate_flag_combo, FALSE);
+               gtk_widget_show(matcher.predicate_combo);
+               gtk_widget_hide(matcher.predicate_flag_combo);
                gtk_widget_set_sensitive(matcher.case_chkbtn, TRUE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, TRUE);
                gtk_widget_set_sensitive(matcher.case_chkbtn, TRUE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, TRUE);
+               gtk_widget_set_sensitive(matcher.exec_btn, FALSE);
+               break;
+
+       case CRITERIA_EXECUTE:
+               gtk_widget_set_sensitive(matcher.header_combo, FALSE);
+               gtk_widget_set_sensitive(matcher.header_label, FALSE);
+               gtk_widget_set_sensitive(matcher.value_label, TRUE);
+               gtk_widget_set_sensitive(matcher.value_entry, TRUE);
+               gtk_widget_set_sensitive(matcher.predicate_label, TRUE);
+               gtk_widget_set_sensitive(matcher.predicate_combo, FALSE);
+               gtk_widget_set_sensitive(matcher.predicate_flag_combo, TRUE);
+               gtk_widget_hide(matcher.predicate_combo);
+               gtk_widget_show(matcher.predicate_flag_combo);
+               gtk_widget_set_sensitive(matcher.case_chkbtn, FALSE);
+               gtk_widget_set_sensitive(matcher.regexp_chkbtn, FALSE);
+               gtk_widget_set_sensitive(matcher.exec_btn, TRUE);
                break;
 
        case CRITERIA_AGE_GREATER:
        case CRITERIA_AGE_LOWER:
                break;
 
        case CRITERIA_AGE_GREATER:
        case CRITERIA_AGE_LOWER:
+       case CRITERIA_SCORE_GREATER:
+       case CRITERIA_SCORE_LOWER:
                gtk_widget_set_sensitive(matcher.header_combo, FALSE);
                gtk_widget_set_sensitive(matcher.header_label, FALSE);
                gtk_widget_set_sensitive(matcher.value_label, TRUE);
                gtk_widget_set_sensitive(matcher.value_entry, TRUE);
                gtk_widget_set_sensitive(matcher.predicate_label, FALSE);
                gtk_widget_set_sensitive(matcher.predicate_combo, FALSE);
                gtk_widget_set_sensitive(matcher.header_combo, FALSE);
                gtk_widget_set_sensitive(matcher.header_label, FALSE);
                gtk_widget_set_sensitive(matcher.value_label, TRUE);
                gtk_widget_set_sensitive(matcher.value_entry, TRUE);
                gtk_widget_set_sensitive(matcher.predicate_label, FALSE);
                gtk_widget_set_sensitive(matcher.predicate_combo, FALSE);
+               gtk_widget_set_sensitive(matcher.predicate_flag_combo, FALSE);
+               gtk_widget_show(matcher.predicate_combo);
+               gtk_widget_hide(matcher.predicate_flag_combo);
                gtk_widget_set_sensitive(matcher.case_chkbtn, FALSE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, FALSE);
                gtk_widget_set_sensitive(matcher.case_chkbtn, FALSE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, FALSE);
+               gtk_widget_set_sensitive(matcher.exec_btn, FALSE);
                break;
 
        case CRITERIA_HEADER:
                break;
 
        case CRITERIA_HEADER:
@@ -1096,8 +1334,12 @@ static void prefs_matcher_criteria_select(GtkList *list,
                gtk_widget_set_sensitive(matcher.value_entry, TRUE);
                gtk_widget_set_sensitive(matcher.predicate_label, TRUE);
                gtk_widget_set_sensitive(matcher.predicate_combo, TRUE);
                gtk_widget_set_sensitive(matcher.value_entry, TRUE);
                gtk_widget_set_sensitive(matcher.predicate_label, TRUE);
                gtk_widget_set_sensitive(matcher.predicate_combo, TRUE);
+               gtk_widget_set_sensitive(matcher.predicate_flag_combo, FALSE);
+               gtk_widget_show(matcher.predicate_combo);
+               gtk_widget_hide(matcher.predicate_flag_combo);
                gtk_widget_set_sensitive(matcher.case_chkbtn, TRUE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, TRUE);
                gtk_widget_set_sensitive(matcher.case_chkbtn, TRUE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, TRUE);
+               gtk_widget_set_sensitive(matcher.exec_btn, FALSE);
                break;
        }
 }
                break;
        }
 }
@@ -1116,8 +1358,18 @@ static void prefs_matcher_cancel(void)
 
 static void prefs_matcher_ok(void)
 {
 
 static void prefs_matcher_ok(void)
 {
-       prefs_matcher_set_list();
-       gtk_widget_hide(matcher.window);
+       MatcherList * matchers;
+
+       matchers = prefs_matcher_get_list();
+       if (matchers != NULL) {
+               gtk_widget_hide(matcher.window);
+               if (matchers_callback != NULL)
+                       matchers_callback(matchers);
+               matcherlist_free(matchers);
+       }
+       else {
+               gtk_widget_hide(matcher.window);
+       }
 }
 
 static gint prefs_matcher_deleted(GtkWidget *widget, GdkEventAny *event,
 }
 
 static gint prefs_matcher_deleted(GtkWidget *widget, GdkEventAny *event,
@@ -1126,3 +1378,89 @@ static gint prefs_matcher_deleted(GtkWidget *widget, GdkEventAny *event,
        prefs_matcher_cancel();
        return TRUE;
 }
        prefs_matcher_cancel();
        return TRUE;
 }
+
+static GtkWidget * exec_info_win;
+
+void prefs_matcher_exec_info(void)
+{
+       if (!exec_info_win)
+               prefs_matcher_exec_info_create();
+
+       gtk_widget_show(exec_info_win);
+       gtk_main();
+       gtk_widget_hide(exec_info_win);
+}
+
+static void prefs_matcher_exec_info_create(void)
+{
+       GtkWidget *vbox;
+       GtkWidget *hbox;
+       GtkWidget *hbbox;
+       GtkWidget *label;
+       GtkWidget *ok_btn;
+
+       exec_info_win = gtk_window_new(GTK_WINDOW_DIALOG);
+       gtk_window_set_title(GTK_WINDOW(exec_info_win),
+                            _("Description of symbols"));
+       gtk_container_set_border_width(GTK_CONTAINER(exec_info_win), 8);
+       gtk_window_set_position(GTK_WINDOW(exec_info_win), GTK_WIN_POS_CENTER);
+       gtk_window_set_modal(GTK_WINDOW(exec_info_win), TRUE);
+       gtk_window_set_policy(GTK_WINDOW(exec_info_win), FALSE, TRUE, FALSE);
+
+       vbox = gtk_vbox_new(FALSE, 8);
+       gtk_container_add(GTK_CONTAINER(exec_info_win), vbox);
+
+       hbox = gtk_hbox_new(FALSE, 4);
+       gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
+
+       label = gtk_label_new
+               ("%%:\n"
+                "%s:\n"
+                "%f:\n"
+                "%t:\n"
+                "%c:\n"
+                "%d:\n"
+                "%i:\n"
+                "%n:\n"
+                "%r:\n"
+                "%F:\n"
+                "\\n:\n"
+                "\\:\n"
+                "\\\":\n"
+                "%%:");
+
+       gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
+       gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+
+       label = gtk_label_new
+               (_("%\n"
+                  "Subject\n"
+                  "From\n"
+                  "To\n"
+                  "Cc\n"
+                  "Date\n"
+                  "Message-ID\n"
+                  "Newsgroups\n"
+                  "References\n"
+                  "Filename - should not be modified\n"
+                  "new line\n"
+                  "escape character for quotes\n"
+                  "quote character\n"
+                  "%"));
+
+       gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
+       gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+
+       gtkut_button_set_create(&hbbox, &ok_btn, _("OK"),
+                               NULL, NULL, NULL, NULL);
+       gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
+
+       gtk_widget_grab_default(ok_btn);
+       gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
+                                 GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+
+       gtk_signal_connect(GTK_OBJECT(exec_info_win), "delete_event",
+                                         GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+
+       gtk_widget_show_all(vbox);
+}