2006-09-12 [colin] 2.4.0cvs178
[claws.git] / src / prefs_filtering_action.c
index 272293ff3d61ec334d4a82eaa530dd1d31d75995..3c2e3b38703de38cd943659fb5cc614692b8a238 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 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
@@ -14,7 +14,7 @@
  *
  * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -138,6 +138,7 @@ typedef enum Action_ {
        ACTION_CHANGE_SCORE,
        ACTION_SET_SCORE,
        ACTION_HIDE,
+       ACTION_IGNORE,
        ACTION_STOP,
        /* add other action constants */
 } Action;
@@ -163,6 +164,7 @@ static struct {
        { N_("Change score"),           ACTION_CHANGE_SCORE},
        { N_("Set score"),              ACTION_SET_SCORE},
        { N_("Hide"),                   ACTION_HIDE     },
+       { N_("Ignore thread"),          ACTION_IGNORE   },
        { N_("Stop filter"),            ACTION_STOP     },
 };
 
@@ -224,6 +226,18 @@ void prefs_filtering_action_open(GSList *action_list,
        gtk_widget_show(filtering_action.window);
 }
 
+/*!
+ *\brief       Save Gtk object size to prefs dataset
+ */
+static void prefs_filtering_action_size_allocate_cb(GtkWidget *widget,
+                                        GtkAllocation *allocation)
+{
+       g_return_if_fail(allocation != NULL);
+
+       prefs_common.filteringactionwin_width = allocation->width;
+       prefs_common.filteringactionwin_height = allocation->height;
+}
+
 /*!
  *\brief       Create the matcher dialog
  */
@@ -275,6 +289,7 @@ static void prefs_filtering_action_create(void)
 
        GList *combo_items;
        gint i;
+       static GdkGeometry geometry;
 
         GList * accounts;
 
@@ -290,8 +305,10 @@ static void prefs_filtering_action_create(void)
        gtk_widget_show(vbox);
        gtk_container_add(GTK_CONTAINER(window), vbox);
 
-       gtkut_stock_button_set_create(&confirm_area, &ok_btn, GTK_STOCK_OK,
-                                     &cancel_btn, GTK_STOCK_CANCEL, NULL, NULL);
+       gtkut_stock_button_set_create(&confirm_area,
+                                     &cancel_btn, GTK_STOCK_CANCEL,
+                                     &ok_btn, GTK_STOCK_OK,
+                                     NULL, NULL);
        gtk_widget_show(confirm_area);
        gtk_box_pack_end(GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
        gtk_widget_grab_default(ok_btn);
@@ -300,6 +317,8 @@ static void prefs_filtering_action_create(void)
                             _("Filtering action configuration"));
        g_signal_connect(G_OBJECT(window), "delete_event",
                         G_CALLBACK(prefs_filtering_action_deleted), NULL);
+       g_signal_connect(G_OBJECT(window), "size_allocate",
+                        G_CALLBACK(prefs_filtering_action_size_allocate_cb), NULL);
        g_signal_connect(G_OBJECT(window), "key_press_event",
                         G_CALLBACK(prefs_filtering_action_key_pressed), NULL);
        MANAGE_WINDOW_SIGNALS_CONNECT(window);
@@ -439,7 +458,11 @@ static void prefs_filtering_action_create(void)
                          G_CALLBACK(prefs_filtering_action_select_dest),
                          NULL);
 
-       exec_btn = gtk_button_new_with_label (_("Info ..."));
+#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..."));
+#endif
        gtk_widget_show (exec_btn);
        gtk_box_pack_start (GTK_BOX (hbox1), exec_btn, FALSE, FALSE, 0);
        g_signal_connect (G_OBJECT (exec_btn), "clicked",
@@ -467,7 +490,7 @@ static void prefs_filtering_action_create(void)
        g_signal_connect(G_OBJECT(reg_btn), "clicked",
                         G_CALLBACK(prefs_filtering_action_register_cb), NULL);
 
-       subst_btn = gtk_button_new_with_label(_("  Replace  "));
+       subst_btn = gtkut_get_replace_btn(_("Replace"));
        gtk_widget_show(subst_btn);
        gtk_box_pack_start(GTK_BOX(btn_hbox), subst_btn, FALSE, TRUE, 0);
        g_signal_connect(G_OBJECT(subst_btn), "clicked",
@@ -513,6 +536,16 @@ static void prefs_filtering_action_create(void)
        g_signal_connect(G_OBJECT(down_btn), "clicked",
                         G_CALLBACK(prefs_filtering_action_down), NULL);
 
+       if (!geometry.min_height) {
+               geometry.min_width = 490;
+               geometry.min_height = 328;
+       }
+
+       gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
+                                     GDK_HINT_MIN_SIZE);
+       gtk_widget_set_size_request(window, prefs_common.filteringactionwin_width,
+                                   prefs_common.filteringactionwin_height);
+
        gtk_widget_show_all(window);
 
        filtering_action.window    = window;
@@ -549,7 +582,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;
        }                        
 
@@ -712,6 +745,8 @@ static gint prefs_filtering_action_get_matching_from_action(Action action_id)
                return MATCHACTION_COLOR;
        case ACTION_HIDE:
                return MATCHACTION_HIDE;
+       case ACTION_IGNORE:
+               return MATCHACTION_IGNORE;
        case ACTION_STOP:
                return MATCHACTION_STOP;
        case ACTION_CHANGE_SCORE:
@@ -793,6 +828,7 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert)
                 break;
        case ACTION_STOP:
        case ACTION_HIDE:
+       case ACTION_IGNORE:
         case ACTION_DELETE:
         case ACTION_MARK:
         case ACTION_UNMARK:
@@ -1040,7 +1076,7 @@ static gint prefs_filtering_action_deleted(GtkWidget *widget,
  * When adding new lines, remember to put 2 strings for each line
  */
 static gchar *exec_desc_strings[] = {
-       "%%",   "%",
+       "%%",   N_("literal %"),
        "%s",   N_("Subject"),
        "%f",   N_("From"),
        "%t",   N_("To"),
@@ -1049,10 +1085,10 @@ static gchar *exec_desc_strings[] = {
        "%i",   N_("Message-ID"),
        "%n",   N_("Newsgroups"),
        "%r",   N_("References"),
-       "%F",   N_("Filename - should not be modified"),
+       "%F",   N_("filename (should not be modified)"),
        "\\n",  N_("new line"),
        "\\",   N_("escape character for quotes"),
-       "\\\"",N_("quote character"),
+       "\\\"", N_("quote character"),
        NULL, NULL
 };
 
@@ -1060,8 +1096,11 @@ static DescriptionWindow exec_desc_win = {
        NULL,
         NULL, 
         2,
-        N_("Description of symbols"),
-        exec_desc_strings
+        N_("Filtering Action: 'Execute'"),
+       N_("'Execute' allows you to send a message or message element "
+          "to an external program or script.\n\n"
+          "The following symbols can be used:"),
+       exec_desc_strings
 };
 
 /*!
@@ -1176,6 +1215,7 @@ static void prefs_filtering_action_type_select(GtkList *list,
        case ACTION_MARK_AS_UNREAD:
         case ACTION_STOP:
         case ACTION_HIDE:
+       case ACTION_IGNORE:
                gtk_widget_show(filtering_action.account_label);
                gtk_widget_set_sensitive(filtering_action.account_label, FALSE);
                gtk_widget_set_sensitive(filtering_action.account_combo, FALSE);
@@ -1341,7 +1381,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);
@@ -1498,6 +1538,10 @@ static gboolean prefs_filtering_actions_selected
                gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
                                     ACTION_HIDE);
                break;
+       case MATCHACTION_IGNORE:
+               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+                                    ACTION_IGNORE);
+               break;
        }
 
        filteringaction_free(action); /* XXX: memleak */