revise label colouring, add filter action for label colouring, fix filtering issues
[claws.git] / src / prefs_matcher.c
index 05f469ff2825d273fe688fedd8df0496386de6ef..df2a165d10b97f4092c2eb42a359f44242bc00db 100644 (file)
@@ -70,6 +70,8 @@ static struct Matcher {
        GtkWidget *case_chkbtn;
        GtkWidget *regexp_chkbtn;
 
+       GtkWidget *exec_btn;
+
        GtkWidget *cond_clist;
 } matcher;
 
@@ -85,19 +87,25 @@ enum {
        CRITERIA_TO_OR_CC = 5,
        CRITERIA_NEWSGROUPS = 6,
        CRITERIA_INREPLYTO = 7,
-       CRITERIA_AGE_GREATER = 8,
-       CRITERIA_AGE_LOWER = 9,
-       CRITERIA_HEADER = 10,
-       CRITERIA_HEADERS_PART = 11,
-       CRITERIA_BODY_PART = 12,
-       CRITERIA_MESSAGE = 13,
-
-       CRITERIA_UNREAD = 14,
-       CRITERIA_NEW = 15,
-       CRITERIA_MARKED = 16,
-       CRITERIA_DELETED = 17,
-       CRITERIA_REPLIED = 18,
-       CRITERIA_FORWARDED = 19
+       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 {
@@ -124,22 +132,24 @@ enum {
 };
 
 gchar * predicate_flag_text [] = {
-       "flag enabled", "flag disabled"
+       "yes", "no"
 };
 
 gchar * criteria_text [] = {
        "All messages", "Subject",
        "From", "To", "Cc", "To or Cc",
-       "Newsgroups", "In reply to"
+       "Newsgroups", "In reply to", "References",
        "Age greater than", "Age lower than",
        "Header", "Headers part",
        "Body part", "Whole message",
        "Unread flag", "New flag",
        "Marked flag", "Deleted flag",
-       "Replied flag", "Forwarded 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;
@@ -199,6 +209,7 @@ static void prefs_matcher_criteria_select(GtkList *list,
                                          GtkWidget *widget,
                                          gpointer user_data);
 static MatcherList * prefs_matcher_get_list(void);
+static void prefs_matcher_exec_info_create(void);
 
 void prefs_matcher_open(MatcherList * matchers, PrefsMatcherSignal * cb)
 {
@@ -268,6 +279,8 @@ static void prefs_matcher_create(void)
        GtkWidget *up_btn;
        GtkWidget *down_btn;
 
+       GtkWidget *exec_btn;
+
        GList *combo_items;
        gint i;
 
@@ -311,7 +324,7 @@ 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);
 
-       table1 = gtk_table_new (2, 3, FALSE);
+       table1 = gtk_table_new (2, 4, FALSE);
        gtk_widget_show (table1);
 
        gtk_box_pack_start (GTK_BOX (vbox1), table1, FALSE, FALSE, 0);
@@ -386,6 +399,13 @@ static void prefs_matcher_create(void)
        gtk_table_attach (GTK_TABLE (table1), value_entry, 2, 3, 1, 2,
                          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 */
 
@@ -575,6 +595,7 @@ static void prefs_matcher_create(void)
        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;
 }
@@ -609,11 +630,17 @@ static void prefs_matcher_reset_condition(void)
        gtk_entry_set_text(GTK_ENTRY(matcher.value_entry), "");
 }
 
+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;
-       gboolean bool_op = 0;
+       gboolean bool_op = 1;
 
        gtk_clist_freeze(clist);
        gtk_clist_clear(clist);
@@ -629,6 +656,8 @@ static void prefs_matcher_set_dialog(MatcherList * matchers)
 
                bool_op = matchers->bool_and;
        }
+       
+       prefs_matcher_update_hscrollbar();
 
        gtk_clist_thaw(clist);
 
@@ -671,6 +700,84 @@ static MatcherList * prefs_matcher_get_list(void)
        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)
 {
        switch (criteria_id) {
@@ -702,10 +809,16 @@ static gint prefs_matcher_get_matching_from_criteria(gint criteria_id)
                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_SCORE_GREATER:
+               return MATCHING_SCORE_GREATER;
+       case CRITERIA_SCORE_LOWER:
+               return MATCHING_SCORE_LOWER;
        case CRITERIA_HEADER:
                return MATCHING_HEADER;
        case CRITERIA_HEADERS_PART:
@@ -714,6 +827,8 @@ static gint prefs_matcher_get_matching_from_criteria(gint criteria_id)
                return MATCHING_BODY_PART;
        case CRITERIA_MESSAGE:
                return MATCHING_MESSAGE;
+       case CRITERIA_EXECUTE:
+               return MATCHING_EXECUTE;
        default:
                return -1;
        }
@@ -748,12 +863,16 @@ static gint prefs_matcher_not_criteria(gint matcher_criteria)
                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_EXECUTE:
+               return MATCHING_NOT_EXECUTE;
        case MATCHING_BODY_PART:
                return MATCHING_NOT_BODY_PART;
        default:
@@ -773,8 +892,8 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
        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));
 
@@ -803,9 +922,11 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
        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:
@@ -829,7 +950,7 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
 
        header = NULL;
        expr = NULL;
-       age = 0;
+       value = 0;
 
        switch (value_criteria) {
        case CRITERIA_ALL:
@@ -848,9 +969,11 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
        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:
                expr = gtk_entry_get_text(GTK_ENTRY(matcher.value_entry));
 
                /*
@@ -863,14 +986,16 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
 
        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;
                }
 
-               age = atoi(age_str);
+               value = atoi(value_str);
 
                break;
 
@@ -892,7 +1017,8 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
                break;
        }
 
-       matcherprop =  matcherprop_new(criteria, header, matchtype, expr, age);
+       matcherprop =  matcherprop_new(criteria, header, matchtype,
+                                      expr, value);
 
        return matcherprop;
 }
@@ -910,6 +1036,7 @@ static void prefs_matcher_register_cb(void)
        matcherprop_free(matcherprop);
 
        prefs_matcher_reset_condition();
+       prefs_matcher_update_hscrollbar();
 }
 
 static void prefs_matcher_substitute_cb(void)
@@ -931,6 +1058,8 @@ static void prefs_matcher_substitute_cb(void)
        matcherprop_free(matcherprop);
 
        prefs_matcher_reset_condition();
+       
+       prefs_matcher_update_hscrollbar();
 }
 
 static void prefs_matcher_delete_cb(void)
@@ -944,6 +1073,8 @@ static void prefs_matcher_delete_cb(void)
                return;
 
        gtk_clist_remove(clist, row);
+       
+       prefs_matcher_update_hscrollbar();
 }
 
 static void prefs_matcher_up(void)
@@ -977,6 +1108,7 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
        gchar * tmp;
        MatcherProp * prop;
        gboolean negative_cond;
+       gint criteria;
 
        if (!gtk_clist_get_text(GTK_CLIST(matcher.cond_clist),
                                row, 0, &matcher_str))
@@ -994,139 +1126,31 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
        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),
-                                    CRITERIA_ALL);
-               break;
+                                    criteria);
 
+       switch(prop->criteria) {
        case MATCHING_NOT_UNREAD:
-               negative_cond = TRUE;
-       case MATCHING_UNREAD:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_UNREAD);
-               break;
-
        case MATCHING_NOT_NEW:
-               negative_cond = TRUE;
-       case MATCHING_NEW:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_NEW);
-               break;
-
        case MATCHING_NOT_MARKED:
-               negative_cond = TRUE;
-       case MATCHING_MARKED:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_MARKED);
-               break;
-
        case MATCHING_NOT_DELETED:
-               negative_cond = TRUE;
-       case MATCHING_DELETED:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_DELETED);
-               break;
-
        case MATCHING_NOT_REPLIED:
-               negative_cond = TRUE;
-       case MATCHING_REPLIED:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_REPLIED);
-               break;
-
        case MATCHING_NOT_FORWARDED:
-               negative_cond = TRUE;
-       case MATCHING_FORWARDED:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_FORWARDED);
-               break;
-
        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:
-               negative_cond = TRUE;
-       case MATCHING_FROM:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_FROM);
-               break;
-
        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:
-               negative_cond = TRUE;
-       case MATCHING_CC:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_CC);
-               break;
-
        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:
-               negative_cond = TRUE;
-       case MATCHING_INREPLYTO:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_INREPLYTO);
-               break;
-
+       case MATCHING_NOT_REFERENCES:
        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:
-               negative_cond = TRUE;
-       case MATCHING_BODY_PART:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_BODY_PART);
-               break;
-
        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:
-               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_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;
        }
        
@@ -1141,6 +1165,7 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
        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:
@@ -1151,6 +1176,7 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
        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:
@@ -1159,7 +1185,9 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
 
        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:
@@ -1218,6 +1246,7 @@ static void prefs_matcher_criteria_select(GtkList *list,
                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:
@@ -1237,6 +1266,7 @@ static void prefs_matcher_criteria_select(GtkList *list,
                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_SUBJECT:
@@ -1246,6 +1276,7 @@ static void prefs_matcher_criteria_select(GtkList *list,
        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:
@@ -1260,10 +1291,28 @@ static void prefs_matcher_criteria_select(GtkList *list,
                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.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:
+       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);
@@ -1275,6 +1324,7 @@ static void prefs_matcher_criteria_select(GtkList *list,
                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.exec_btn, FALSE);
                break;
 
        case CRITERIA_HEADER:
@@ -1289,6 +1339,7 @@ static void prefs_matcher_criteria_select(GtkList *list,
                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.exec_btn, FALSE);
                break;
        }
 }
@@ -1327,3 +1378,89 @@ static gint prefs_matcher_deleted(GtkWidget *widget, GdkEventAny *event,
        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);
+}