sync with 0.8.11cvs29
authorPaul Mangan <paul@claws-mail.org>
Fri, 18 Apr 2003 09:10:32 +0000 (09:10 +0000)
committerPaul Mangan <paul@claws-mail.org>
Fri, 18 Apr 2003 09:10:32 +0000 (09:10 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.ac
src/action.c
src/action.h
src/compose.c
src/mainwindow.c
src/prefs_actions.c
src/procmsg.c

index ebfd2b4..50ed573 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2003-04-18
+
+       * src/procmsg.c: procmsg_get_filter_keyword(): added X-Sequence to
+         auto-detected headers.
+       * src/action.[ch]
+         src/prefs_actions.c
+         src/compose.c
+         src/mainwindow.c: modified function names.
+         get_user_string(): Use input_dialog() instead of its own
+         implementation.
+
 2003-04-17
 
        * src/codeconv.[ch]: conv_encode_header(): don't include '(' and ')'
index ef04293..5e099d2 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-18 [paul]      0.8.11claws101
+
+       * sync with 0.8.11cvs29
+               see ChangeLog 2003-04-18
+
 2003-04-17 [paul]      0.8.11claws100
 
        * src/prefs_common.[ch]
index d23dc59..def4fdc 100644 (file)
@@ -1,3 +1,13 @@
+2003-04-18
+
+       * src/procmsg.c: procmsg_get_filter_keyword(): ¼«Æ°¸¡½Ð¤µ¤ì¤ë¥Ø¥Ã¥À
+         ¤Ë X-Sequence ¤òÄɲá£
+       * src/action.[ch]
+         src/prefs_actions.c
+         src/compose.c
+         src/mainwindow.c: ´Ø¿ô̾¤ò½¤Àµ¡£
+         get_user_string(): Æȼ«¤Î¼ÂÁõ¤ÎÂå¤ï¤ê¤Ë input_dialog() ¤ò»ÈÍÑ¡£
+
 2003-04-17
 
        * src/codeconv.[ch]: conv_encode_header(): addr_field ¤¬ TRUE ¤Î
index 71b9967..96562f2 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=11
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws100
+EXTRA_VERSION=claws101
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 04a1249..a123b91 100644 (file)
@@ -43,6 +43,7 @@
 #include "mainwindow.h"
 #include "prefs_common.h"
 #include "alertpanel.h"
+#include "inputdialog.h"
 #include "action.h"
 #include "compose.h"
 #include "procmsg.h"
@@ -91,14 +92,7 @@ struct _ChildInfo
        GdkFont         *msgfont;
 };
 
-struct _UserStringDialog
-{
-       GtkWidget       *dialog;
-       GtkWidget       *entry;
-       gchar           *user_str;
-};
-
-static void update_actions_menu                (GtkItemFactory *ifactory,
+static void action_update_menu         (GtkItemFactory *ifactory,
                                         gchar          *branch_path,
                                         gpointer        callback,
                                         gpointer        data);
@@ -143,7 +137,7 @@ static ChildInfo *fork_child                (gchar          *cmd,
                                         gint            body_pos,
                                         Children       *children);
 
-static gint wait_for_children          (gpointer        data);
+static gint wait_for_children          (Children       *children);
 
 static void free_children              (Children       *children);
 
@@ -168,22 +162,11 @@ static void catch_status          (gpointer                data,
                                         gint                    source,
                                         GdkInputCondition       cond);
 
-static gboolean user_string_dialog_delete_cb
-                                       (GtkWidget      *widget,
-                                        GdkEvent       *event,
-                                        gpointer        data);
-static void user_string_dialog_destroy_cb
-                                       (GtkWidget      *widget,
-                                        gpointer        data);
-static void user_string_dialog_activate_cb
-                                       (GtkWidget      *widget,
-                                        gpointer        data);
-
 static gchar *get_user_string          (const gchar    *action,
                                         ActionType      type);
 
 
-ActionType get_action_type(const gchar *action_str)
+ActionType action_get_type(const gchar *action_str)
 {
        const gchar *p;
        ActionType action_type = ACTION_NONE;
@@ -434,28 +417,20 @@ void actions_execute(gpointer data,
                msgview_actions_execute_cb((MessageView*)data, action_nb, widget);      
 }
 
-
-void update_mainwin_actions_menu(GtkItemFactory *ifactory,
-                                MainWindow *mainwin)
+void action_update_mainwin_menu(GtkItemFactory *ifactory, MainWindow *mainwin)
 {
-       update_actions_menu(ifactory, "/Tools/Actions",
-                           mainwin_actions_execute_cb,
-                           mainwin);
+       action_update_menu(ifactory, "/Tools/Actions",
+                          mainwin_actions_execute_cb, mainwin);
 }
 
-void update_compose_actions_menu(GtkItemFactory *ifactory,
-                                gchar *branch_path,
-                                Compose *compose)
+void action_update_compose_menu(GtkItemFactory *ifactory, Compose *compose)
 {
-       update_actions_menu(ifactory, branch_path,
-                           compose_actions_execute_cb,
-                           compose);
+       action_update_menu(ifactory, "/Tools/Actions",
+                          compose_actions_execute_cb, compose);
 }
 
-static void update_actions_menu(GtkItemFactory *ifactory,
-                               gchar *branch_path,
-                               gpointer callback,
-                               gpointer data)
+static void action_update_menu(GtkItemFactory *ifactory, gchar *branch_path,
+                              gpointer callback, gpointer data)
 {
        GtkWidget *menuitem;
        gchar *menu_path;
@@ -484,7 +459,7 @@ static void update_actions_menu(GtkItemFactory *ifactory,
                action   = g_strdup((gchar *)cur->data);
                action_p = strstr(action, ": ");
                if (action_p && action_p[2] &&
-                   get_action_type(&action_p[2]) != ACTION_ERROR) {
+                   action_get_type(&action_p[2]) != ACTION_ERROR) {
                        action_p[0] = 0x00;
                        menu_path = g_strdup_printf("%s/%s", branch_path,
                                                    action);
@@ -514,7 +489,7 @@ static void compose_actions_execute_cb(Compose *compose, guint action_nb,
        /* Point to the beginning of the command-line */
        action += 2;
 
-       action_type = get_action_type(action);
+       action_type = action_get_type(action);
        if (action_type & (ACTION_SINGLE | ACTION_MULTIPLE)) {
                alertpanel_warning
                        (_("The selected action cannot be used in the compose window\n"
@@ -603,7 +578,7 @@ static gboolean execute_actions(gchar *action, GtkCTree *ctree,
 
        g_return_val_if_fail(action && *action, FALSE);
 
-       action_type = get_action_type(action);
+       action_type = action_get_type(action);
 
        if (action_type == ACTION_ERROR)
                return FALSE;         /* ERR: syntax error */
@@ -938,10 +913,9 @@ static void kill_children_cb(GtkWidget *widget, gpointer data)
        }
 }
 
-static gint wait_for_children(gpointer data)
+static gint wait_for_children(Children *children)
 {
        gboolean new_output;
-       Children *children = (Children *)data;
        ChildInfo *child_info;
        GSList *cur;
        gint nb = children->nb;
@@ -1303,96 +1277,33 @@ static void user_string_dialog_destroy_cb(GtkWidget *widget, gpointer data)
        gtk_main_quit();
 }
 
-static void user_string_dialog_activate_cb(GtkWidget *widget, gpointer data)
-{
-       UserStringDialog *user_dialog = (UserStringDialog *) data;
-
-       g_free(user_dialog->user_str);
-       user_dialog->user_str =
-               gtk_editable_get_chars(GTK_EDITABLE(user_dialog->entry), 0, -1);
-       gtk_widget_destroy(user_dialog->dialog);
-}
-
 static gchar *get_user_string(const gchar *action, ActionType type)
 {
-       GtkWidget *dialog;
-       GtkWidget *label;
-       GtkWidget *entry;
-       GtkWidget *ok_button;
-       GtkWidget *cancel_button;
-       gchar *label_text;
-       UserStringDialog user_dialog;
-
-       dialog = gtk_dialog_new();
-       gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, FALSE);
-       gtk_container_set_border_width
-               (GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 8);
-       gtk_container_set_border_width
-               (GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), 5);
-       gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
+       gchar *message;
+       gchar *user_str = NULL;
 
        switch (type) {
        case ACTION_USER_HIDDEN_STR:
-               gtk_window_set_title(GTK_WINDOW(dialog),
-                                    _("Action's hidden user argument"));
-               label_text = g_strdup_printf(_("Enter the '%%h' "
-                                            "argument for the following "
-                                            "action:\n%s"), action);
+               message = g_strdup_printf
+                       (_("Enter the argument for the following action:\n"
+                          "(`%%h' will be replaced with the argument)\n"
+                          "  %s"),
+                        action);
+               user_str = input_dialog_with_invisible
+                       (_("Action's hidden user argument"), message, NULL);
                break;
        case ACTION_USER_STR:
-               gtk_window_set_title(GTK_WINDOW(dialog),
-                                    _("Action's user argument"));
-               label_text = g_strdup_printf(_("Enter the '%%u' "
-                                            "argument for the following "
-                                            "action:\n%s"), action);
+               message = g_strdup_printf
+                       (_("Enter the argument for the following action:\n"
+                          "(`%%u' will be replaced with the argument)\n"
+                          "  %s"),
+                        action);
+               user_str = input_dialog
+                       (_("Action's user argument"), message, NULL);
                break;
        default:
-               label_text = NULL;
-               debug_print("Unsupported action type %d", type);
+               g_warning("Unsupported action type %d", type);
        }
 
-       label = gtk_label_new(label_text);
-       g_free(label_text);
-       gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), label,
-                          TRUE, TRUE, 0);
-
-       entry = gtk_entry_new();
-       gtk_entry_set_visibility(GTK_ENTRY(entry),
-                                type != ACTION_USER_HIDDEN_STR);
-       gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), entry,
-                          TRUE, TRUE, 0);
-
-       ok_button = gtk_button_new_with_label(_("OK"));
-       gtk_box_pack_end(GTK_BOX(GTK_DIALOG(dialog)->action_area),
-                        ok_button, TRUE, TRUE, 0);
-
-       cancel_button = gtk_button_new_with_label(_("Cancel"));
-       gtk_box_pack_end(GTK_BOX(GTK_DIALOG(dialog)->action_area),
-                        cancel_button, TRUE, TRUE, 0);
-
-       user_dialog.dialog   = dialog;
-       user_dialog.user_str = NULL;
-       user_dialog.entry    = entry;
-
-       gtk_signal_connect(GTK_OBJECT(dialog), "delete_event",
-                          GTK_SIGNAL_FUNC(user_string_dialog_delete_cb),
-                          &user_dialog);
-       gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
-                          GTK_SIGNAL_FUNC(user_string_dialog_destroy_cb),
-                          &user_dialog);
-       gtk_signal_connect(GTK_OBJECT(entry), "activate",
-                          GTK_SIGNAL_FUNC(user_string_dialog_activate_cb),
-                          &user_dialog);
-       gtk_signal_connect(GTK_OBJECT(ok_button), "clicked",
-                          GTK_SIGNAL_FUNC(user_string_dialog_activate_cb),
-                          &user_dialog);
-       gtk_signal_connect_object(GTK_OBJECT(cancel_button), "clicked",
-                                 GTK_SIGNAL_FUNC(gtk_widget_destroy),
-                                 GTK_OBJECT(dialog));
-
-       gtk_widget_grab_focus(entry);
-       gtk_widget_show_all(dialog);
-       gtk_main();
-
-       return user_dialog.user_str;
+       return user_str;
 }
index 56f132d..28d3fe2 100644 (file)
@@ -43,17 +43,16 @@ typedef enum
        ACTION_ERROR            = 1 << 30
 } ActionType;
 
-void update_mainwin_actions_menu       (GtkItemFactory *ifactory, 
-                                        MainWindow     *mainwin);
-void update_compose_actions_menu       (GtkItemFactory *ifactory, 
-                                        gchar          *branch_path,
-                                        Compose        *compose);
+ActionType action_get_type     (const gchar    *action_str);
 
 void actions_execute                    (gpointer       data, 
                                         guint          action_nb,
                                         GtkWidget      *widget,
                                         gint           source);
 
-ActionType get_action_type             (const gchar    *action_str);
+void action_update_mainwin_menu        (GtkItemFactory *ifactory, 
+                                MainWindow     *mainwin);
+void action_update_compose_menu        (GtkItemFactory *ifactory, 
+                                Compose        *compose);
 
 #endif /* __ACTION_H__ */
index d303b75..38c12bc 100644 (file)
@@ -5006,7 +5006,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        }
 #endif
 
-       update_compose_actions_menu(ifactory, "/Tools/Actions", compose);
+       action_update_compose_menu(ifactory, compose);
 
 
        undostruct = undo_init(text);
@@ -5131,7 +5131,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
                gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(compose->header_last->combo)->entry), prefs_common.trans_hdr ? _("Newsgroups:") : "Newsgroups:");
 
        addressbook_set_target_compose(compose);
-       update_compose_actions_menu(ifactory, "/Tools/Actions", compose);
+       action_update_compose_menu(ifactory, compose);
        
        if (mode != COMPOSE_REDIRECT)
                compose_set_template_menu(compose);
index 04a5fc0..783610a 100644 (file)
@@ -973,7 +973,7 @@ MainWindow *main_window_create(SeparateType type)
        toolbar_main_set_sensitive(mainwin);
 
        /* create actions menu */
-       update_mainwin_actions_menu(ifactory, mainwin);
+       action_update_mainwin_menu(ifactory, mainwin);
 
        /* attach accel groups to main window */
 #define        ADD_MENU_ACCEL_GROUP_TO_WINDOW(menu,win)        \
index e42937a..72f76fc 100644 (file)
@@ -327,7 +327,7 @@ void prefs_actions_read_config(void)
                g_strchomp(buf);
                act = strstr(buf, ": ");
                if (act && act[2] && 
-                   get_action_type(&act[2]) != ACTION_ERROR)
+                   action_get_type(&act[2]) != ACTION_ERROR)
                        prefs_common.actions_list =
                                g_slist_append(prefs_common.actions_list,
                                               g_strdup(buf));
@@ -458,7 +458,7 @@ static gint prefs_actions_clist_set_row(gint row)
                return -1;
        }
 
-       if (get_action_type(entry_text) == ACTION_ERROR) {
+       if (action_get_type(entry_text) == ACTION_ERROR) {
                alertpanel_error(_("The command\n%s\nhas a syntax error."), 
                                 entry_text);
                return -1;
@@ -624,7 +624,7 @@ static void prefs_actions_ok(GtkWidget *widget, gpointer data)
 
        prefs_actions_write_config();
        ifactory = gtk_item_factory_from_widget(mainwin->menubar);
-       update_mainwin_actions_menu(ifactory, mainwin);
+       action_update_mainwin_menu(ifactory, mainwin);
        gtk_widget_hide(actions.window);
        inc_unlock();
 }
index cc13c72..3f4cb20 100644 (file)
@@ -22,6 +22,7 @@
 #include <glib.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <ctype.h>
 
 #include "intl.h"
 #include "main.h"
@@ -462,15 +463,16 @@ void procmsg_get_filter_keyword(MsgInfo *msginfo, gchar **header, gchar **key,
                                       {"X-List:",         NULL, TRUE},
                                       {"X-Mailing-list:", NULL, TRUE},
                                       {"List-Id:",        NULL, TRUE},
-                                      {NULL,              NULL, FALSE}};
-
+                                      {"X-Sequence:",     NULL, TRUE},
+                                      {NULL,              NULL, FALSE}};
        enum
        {
                H_X_BEENTHERE    = 0,
                H_X_ML_NAME      = 1,
                H_X_LIST         = 2,
                H_X_MAILING_LIST = 3,
-               H_LIST_ID        = 4
+               H_LIST_ID        = 4,
+               H_X_SEQUENCE     = 5
        };
 
        FILE *fp;
@@ -491,32 +493,45 @@ void procmsg_get_filter_keyword(MsgInfo *msginfo, gchar **header, gchar **key,
                procheader_get_header_fields(fp, hentry);
                fclose(fp);
 
+#define SET_FILTER_KEY(hstr, idx)      \
+{                                      \
+       *header = g_strdup(hstr);       \
+       *key = hentry[idx].body;        \
+       hentry[idx].body = NULL;        \
+}
+
                if (hentry[H_X_BEENTHERE].body != NULL) {
-                       *header = g_strdup("header \"X-BeenThere\"");
-                       *key = hentry[H_X_BEENTHERE].body;
-                       hentry[H_X_BEENTHERE].body = NULL;
+                       SET_FILTER_KEY("header \"X-BeenThere\"", H_X_BEENTHERE);
                } else if (hentry[H_X_ML_NAME].body != NULL) {
-                       *header = g_strdup("header \"X-ML-Name\"");
-                       *key = hentry[H_X_ML_NAME].body;
-                       hentry[H_X_ML_NAME].body = NULL;
+                       SET_FILTER_KEY("header \"X-ML-Name\"", H_X_ML_NAME);
                } else if (hentry[H_X_LIST].body != NULL) {
-                       *header = g_strdup("header \"X-List\"");
-                       *key = hentry[H_X_LIST].body;
-                       hentry[H_X_LIST].body = NULL;
+                       SET_FILTER_KEY("header \"X-List\"", H_X_LIST);
                } else if (hentry[H_X_MAILING_LIST].body != NULL) {
-                       *header = g_strdup("header \"X-Mailing-List\"");
-                       *key = hentry[H_X_MAILING_LIST].body;
-                       hentry[H_X_MAILING_LIST].body = NULL;
+                       SET_FILTER_KEY("header \"X-Mailing-List\"", H_X_MAILING_LIST);
                } else if (hentry[H_LIST_ID].body != NULL) {
-                       *header = g_strdup("header \"List-Id\"");
-                       *key = hentry[H_LIST_ID].body;
+                       SET_FILTER_KEY("header \"List-Id\"", H_LIST_ID);
                        extract_list_id_str(*key);
-                       hentry[H_LIST_ID].body = NULL;
+               } else if (hentry[H_X_SEQUENCE].body != NULL) {
+                       gchar *p;
+
+                       SET_FILTER_KEY("X-Sequence", H_X_SEQUENCE);
+                       p = *key;
+                       while (*p != '\0') {
+                               while (*p != '\0' && !isspace(*p)) p++;
+                               while (isspace(*p)) p++;
+                               if (isdigit(*p)) {
+                                       *p = '\0';
+                                       break;
+                               }
+                       }
+                       g_strstrip(*key);
                } else if (msginfo->subject) {
                        *header = g_strdup("subject");
                        *key = g_strdup(msginfo->subject);
                }
 
+#undef SET_FILTER_KEY
+
                g_free(hentry[H_X_BEENTHERE].body);
                hentry[H_X_BEENTHERE].body = NULL;
                g_free(hentry[H_X_ML_NAME].body);