Create filter rules using a message is fixed. We can now create processing rules...
authorHoà Viêt Dinh <dinh.viet.hoa@free.fr>
Tue, 16 Dec 2003 13:37:57 +0000 (13:37 +0000)
committerHoà Viêt Dinh <dinh.viet.hoa@free.fr>
Tue, 16 Dec 2003 13:37:57 +0000 (13:37 +0000)
ChangeLog.claws
configure.ac
src/mainwindow.c
src/messageview.c
src/summaryview.c
src/summaryview.h

index 2e6c6c5..7b289ec 100644 (file)
@@ -1,3 +1,11 @@
+2003-12-16 [hoa]       0.9.7claws45
+
+       * src/mainwindow.c
+       * src/messageview.c
+       * src/summaryview.[ch]
+               Create filter rules using a message is fixed.
+               We can now create processing rules using a message.
+
 2003-12-15 [alfons]    0.9.7claws44
 
        * src/procheader.c
index c9ea858..e6169f1 100644 (file)
@@ -206,8 +206,8 @@ AM_PATH_GLIB(1.2.6,,
 
 dnl check for IPv6 option
 AC_ARG_ENABLE(ipv6,
-       [  --enable-ipv6           Enable IPv6 support [default=no]],
-       [ac_cv_enable_ipv6=$enableval], [ac_cv_enable_ipv6=no])
+       [  --disable-ipv6           Disable IPv6 support],
+       [ac_cv_enable_ipv6=$enableval], [ac_cv_enable_ipv6=yes])
 
 dnl automated checks for IPv6 support.
 AC_MSG_CHECKING([whether to use IPv6])
index ad4070d..b092164 100644 (file)
@@ -344,6 +344,9 @@ static void select_thread_cb         (MainWindow    *mainwin,
 static void create_filter_cb    (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
+static void create_processing_cb (MainWindow   *mainwin,
+                                 guint          action,
+                                 GtkWidget     *widget);
 
 static void prefs_common_open_cb       (MainWindow     *mainwin,
                                         guint           action,
@@ -670,6 +673,15 @@ static GtkItemFactoryEntry mainwin_entries[] =
                                                NULL, create_filter_cb, FILTER_BY_TO, NULL},
        {N_("/_Tools/_Create filter rule/by _Subject"),
                                                NULL, create_filter_cb, FILTER_BY_SUBJECT, NULL},
+       {N_("/_Tools/_Create processing rule"), NULL, NULL, 0, "<Branch>"},
+       {N_("/_Tools/_Create processing rule/_Automatically"),
+                                               NULL, create_processing_cb, FILTER_BY_AUTO, NULL},
+       {N_("/_Tools/_Create processing rule/by _From"),
+                                               NULL, create_processing_cb, FILTER_BY_FROM, NULL},
+       {N_("/_Tools/_Create processing rule/by _To"),
+                                               NULL, create_processing_cb, FILTER_BY_TO, NULL},
+       {N_("/_Tools/_Create processing rule/by _Subject"),
+                                               NULL, create_processing_cb, FILTER_BY_SUBJECT, NULL},
        {N_("/_Tools/---"),                     NULL, NULL, 0, "<Separator>"},
        {N_("/_Tools/Actio_ns"),                NULL, NULL, 0, "<Branch>"},
        {N_("/_Tools/---"),                     NULL, NULL, 0, "<Separator>"},
@@ -2682,7 +2694,13 @@ static void select_thread_cb(MainWindow *mainwin, guint action,
 static void create_filter_cb(MainWindow *mainwin, guint action,
                             GtkWidget *widget)
 {
-       summary_filter_open(mainwin->summaryview, (PrefsFilterType)action);
+       summary_filter_open(mainwin->summaryview, (PrefsFilterType)action, 0);
+}
+
+static void create_processing_cb(MainWindow *mainwin, guint action,
+                            GtkWidget *widget)
+{
+       summary_filter_open(mainwin->summaryview, (PrefsFilterType)action, 1);
 }
 
 static void prefs_common_open_cb(MainWindow *mainwin, guint action,
index 0126e3f..4a9334a 100644 (file)
@@ -127,6 +127,9 @@ static void add_address_cb          (gpointer        data,
 static void create_filter_cb           (gpointer        data,
                                         guint           action,
                                         GtkWidget      *widget);
+static void create_processing_cb       (gpointer        data,
+                                        guint           action,
+                                        GtkWidget      *widget);
 
 static void about_cb                   (gpointer        data,
                                         guint           action,
@@ -270,6 +273,14 @@ static GtkItemFactoryEntry msgview_entries[] =
                                        NULL, create_filter_cb, FILTER_BY_TO, NULL},
        {N_("/_Tools/_Create filter rule/by _Subject"),
                                        NULL, create_filter_cb, FILTER_BY_SUBJECT, NULL},
+       {N_("/_Tools/Create processing rule/_Automatically"),
+                                       NULL, create_processing_cb, FILTER_BY_AUTO, NULL},
+       {N_("/_Tools/Create processing rule/by _From"),
+                                       NULL, create_processing_cb, FILTER_BY_FROM, NULL},
+       {N_("/_Tools/Create processing rule/by _To"),
+                                       NULL, create_processing_cb, FILTER_BY_TO, NULL},
+       {N_("/_Tools/Create processing rule/by _Subject"),
+                                       NULL, create_processing_cb, FILTER_BY_SUBJECT, NULL},
        {N_("/_Tools/---"),             NULL, NULL, 0, "<Separator>"},
        {N_("/_Tools/Actio_ns"),        NULL, NULL, 0, "<Branch>"},
 
@@ -1307,27 +1318,26 @@ static void add_address_cb(gpointer data, guint action, GtkWidget *widget)
 static void create_filter_cb(gpointer data, guint action, GtkWidget *widget)
 {
        MessageView *messageview = (MessageView *)data;
-       gchar *header = NULL;
-       gchar *key = NULL;
        FolderItem * item;
        
        if (!messageview->msginfo) return;
-
-       procmsg_get_filter_keyword(messageview->msginfo, &header, &key,
-                                  (PrefsFilterType)action);
        
        item = messageview->msginfo->folder;
-       if (item == NULL)
-               prefs_filtering_open(&pre_global_processing,
-                                    _("Processing rules to apply before folder rules"),
-                                    header, key);
-       else
-               prefs_filtering_open(&item->prefs->processing,
-                                    _("Processing configuration"),
-                                    header, key);
+       summary_msginfo_filter_open(item,  messageview->msginfo,
+                                   (PrefsFilterType)action, 0);
+}
 
-       g_free(header);
-       g_free(key);
+static void create_processing_cb(gpointer data, guint action,
+                                GtkWidget *widget)
+{
+       MessageView *messageview = (MessageView *)data;
+       FolderItem * item;
+       
+       if (!messageview->msginfo) return;
+       
+       item = messageview->msginfo->folder;
+       summary_msginfo_filter_open(item,  messageview->msginfo,
+                                   (PrefsFilterType)action, 1);
 }
 
 static void about_cb(gpointer data, guint action, GtkWidget *widget)
index a9bee28..ecd305d 100644 (file)
@@ -302,6 +302,9 @@ static void summary_add_address_cb  (SummaryView            *summaryview,
 static void summary_create_filter_cb   (SummaryView            *summaryview,
                                         guint                   action,
                                         GtkWidget              *widget);
+static void summary_create_processing_cb(SummaryView           *summaryview,
+                                        guint                   action,
+                                        GtkWidget              *widget);
 
 static void summary_mark_clicked       (GtkWidget              *button,
                                         SummaryView            *summaryview);
@@ -441,6 +444,15 @@ static GtkItemFactoryEntry summary_popup_entries[] =
                                        NULL, summary_create_filter_cb, FILTER_BY_TO, NULL},
        {N_("/Create f_ilter rule/by _Subject"),
                                        NULL, summary_create_filter_cb, FILTER_BY_SUBJECT, NULL},
+       {N_("/Create processing rule"), NULL, NULL,             0, "<Branch>"},
+       {N_("/Create processing rule/_Automatically"),
+                                       NULL, summary_create_processing_cb, FILTER_BY_AUTO, NULL},
+       {N_("/Create processing rule/by _From"),
+                                       NULL, summary_create_processing_cb, FILTER_BY_FROM, NULL},
+       {N_("/Create processing rule/by _To"),
+                                       NULL, summary_create_processing_cb, FILTER_BY_TO, NULL},
+       {N_("/Create processing rule/by _Subject"),
+                                       NULL, summary_create_processing_cb, FILTER_BY_SUBJECT, NULL},
        {N_("/---"),                    NULL, NULL,             0, "<Separator>"},
        {N_("/_View"),                  NULL, NULL,             0, "<Branch>"},
        {N_("/_View/Open in new _window"),
@@ -1339,6 +1351,7 @@ static void summary_set_menu_sensitive(SummaryView *summaryview)
 
                {"/Add sender to address book"  , M_SINGLE_TARGET_EXIST},
                {"/Create filter rule"          , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
+               {"/Create processing rule"      , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
 
                {"/View"                        , M_SINGLE_TARGET_EXIST},
                {"/View/Open in new window"     , M_SINGLE_TARGET_EXIST},
@@ -4019,11 +4032,38 @@ static void summary_filter_func(GtkCTree *ctree, GtkCTreeNode *node,
        filter_message_by_msginfo(filtering_rules, msginfo);
 }
 
-void summary_filter_open(SummaryView *summaryview, PrefsFilterType type)
+void summary_msginfo_filter_open(FolderItem * item, MsgInfo *msginfo,
+                                PrefsFilterType type, gint processing_rule)
 {
-       MsgInfo *msginfo;
        gchar *header = NULL;
        gchar *key = NULL;
+
+       procmsg_get_filter_keyword(msginfo, &header, &key, type);
+       
+       if (processing_rule) {
+               if (item == NULL)
+                       prefs_filtering_open(&pre_global_processing,
+                                            _("Processing rules to apply before folder rules"),
+                                            header, key);
+               else
+                       prefs_filtering_open(&item->prefs->processing,
+                                            _("Processing configuration"),
+                                            header, key);
+       }
+       else {
+               prefs_filtering_open(&filtering_rules,
+                                    _("Filtering configuration"),
+                                      header, key);
+       }
+       
+       g_free(header);
+       g_free(key);
+}
+
+void summary_filter_open(SummaryView *summaryview, PrefsFilterType type,
+                        gint processing_rule)
+{
+       MsgInfo *msginfo;
        FolderItem * item;
        
        if (!summaryview->selected) return;
@@ -4031,21 +4071,9 @@ void summary_filter_open(SummaryView *summaryview, PrefsFilterType type)
        msginfo = gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
                                              summaryview->selected);
        if (!msginfo) return;
-
-       procmsg_get_filter_keyword(msginfo, &header, &key, type);
        
        item = summaryview->folder_item;
-       if (item == NULL)
-               prefs_filtering_open(&pre_global_processing,
-                                    _("Processing rules to apply before folder rules"),
-                                    header, key);
-       else
-               prefs_filtering_open(&item->prefs->processing,
-                                    _("Processing configuration"),
-                                    header, key);
-
-       g_free(header);
-       g_free(key);
+       summary_msginfo_filter_open(item, msginfo, type, processing_rule);
 }
 
 /* color label */
@@ -4742,7 +4770,13 @@ static void summary_add_address_cb(SummaryView *summaryview,
 static void summary_create_filter_cb(SummaryView *summaryview,
                                     guint action, GtkWidget *widget)
 {
-       summary_filter_open(summaryview, (PrefsFilterType)action);
+       summary_filter_open(summaryview, (PrefsFilterType)action, 0);
+}
+
+static void summary_create_processing_cb(SummaryView *summaryview,
+                                        guint action, GtkWidget *widget)
+{
+       summary_filter_open(summaryview, (PrefsFilterType)action, 1);
 }
 
 static void summary_sort_by_column_click(SummaryView *summaryview,
index 11a2f19..b84b071 100644 (file)
@@ -205,8 +205,11 @@ void summary_collapse_threads        (SummaryView          *summaryview);
 void summary_toggle_ignore_thread (SummaryView         *summaryview);
 
 void summary_filter              (SummaryView          *summaryview);
-void summary_filter_open         (SummaryView          *summaryview,
-                                  PrefsFilterType       type);
+void summary_filter_open          (SummaryView *summaryview,
+                                  PrefsFilterType type,
+                                  gint processing_rule);
+void summary_msginfo_filter_open  (FolderItem * item, MsgInfo *msginfo,
+                                  PrefsFilterType type, gint processing_rule);
 
 void summary_sort                (SummaryView          *summaryview,
                                   FolderSortKey         sort_key,