sync with sylpheed 0.7.0cvs12
authorPaul Mangan <paul@claws-mail.org>
Mon, 21 Jan 2002 11:34:09 +0000 (11:34 +0000)
committerPaul Mangan <paul@claws-mail.org>
Mon, 21 Jan 2002 11:34:09 +0000 (11:34 +0000)
ChangeLog.claws
configure.in
src/compose.c
src/folderview.c
src/grouplistdialog.c
src/mainwindow.c
src/prefs_filter.c
src/prefs_filter.h
src/summaryview.c
src/summaryview.h
src/textview.c

index b8b116f..6a00f9d 100644 (file)
@@ -1,3 +1,8 @@
+2002-01-21 [paul]      0.7.0claws20
+
+       * sync with sylpheed 0.7.0cvs12
+               see ChangeLog entries 2002-01-20 and 2002-01-21
+
 2002-01-21 [carsten]   0.7.0claws19
        * src/mainwindow.c
        * src/menu.[ch]
index fa31641..6e8d69c 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws19
+EXTRA_VERSION=claws20
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 0e3695f..6cb88f9 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-2002 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
@@ -2368,6 +2368,11 @@ static void compose_wrap_line_all(Compose *compose)
                                        do_delete = FALSE;
                        }
 
+                       /* skip delete if it is continuous URL */
+                       if (do_delete && (line_pos - p_pos <= i_len) &&
+                           gtkut_stext_is_uri_string(text, line_pos, tlen))
+                               do_delete = FALSE;
+
 #ifdef WRAP_DEBUG
                        printf("qlen=%d l_len=%d wrap_len=%d do_del=%d\n",
                                qlen, line_len, linewrap_len, do_delete);
index ba50984..6784a05 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-2002 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
@@ -2101,7 +2101,7 @@ static void folderview_new_news_group_cb(FolderView *folderview, guint action,
                GNode *next = gnode->next;
 
                item = FOLDER_ITEM(gnode->data);
-               if (g_slist_find_custom(new_subscr, item->name,
+               if (g_slist_find_custom(new_subscr, item->path,
                                        (GCompareFunc)g_strcasecmp) != NULL) {
                        gnode = next;
                        continue;
index aa54888..1c7bd7a 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-2002 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
@@ -122,7 +122,7 @@ GSList *grouplist_dialog(Folder *folder)
        subscribed = NULL;
        for (node = folder->node->children; node != NULL; node = node->next) {
                item = FOLDER_ITEM(node->data);
-               subscribed = g_slist_append(subscribed, g_strdup(item->name));
+               subscribed = g_slist_append(subscribed, g_strdup(item->path));
        }
 
        grouplist_dialog_set_list(NULL, TRUE);
@@ -141,7 +141,7 @@ GSList *grouplist_dialog(Folder *folder)
                     node = node->next) {
                        item = FOLDER_ITEM(node->data);
                        subscribed = g_slist_append(subscribed,
-                                                   g_strdup(item->name));
+                                                   g_strdup(item->path));
                }
        }
 
index ec044db..42b0899 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-2002 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
@@ -384,6 +384,10 @@ static void allsel_cb               (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
 
+static void create_filter_cb    (MainWindow    *mainwin,
+                                 guint          action,
+                                 GtkWidget     *widget);
+
 static void prefs_common_open_cb (MainWindow   *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
@@ -639,6 +643,15 @@ static GtkItemFactoryEntry mainwin_entries[] =
                                                NULL, add_address_cb, 0, NULL},
        {N_("/_Tool/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_Tool/_Filter messages"),         NULL, filter_cb, 0, NULL},
+       {N_("/_Tool/_Create filter rule"),      NULL, NULL, 0, "<Branch>"},
+       {N_("/_Tool/_Create filter rule/_Automatically"),
+                                               NULL, create_filter_cb, FILTER_BY_AUTO, NULL},
+       {N_("/_Tool/_Create filter rule/by _From"),
+                                               NULL, create_filter_cb, FILTER_BY_FROM, NULL},
+       {N_("/_Tool/_Create filter rule/by _To"),
+                                               NULL, create_filter_cb, FILTER_BY_TO, NULL},
+       {N_("/_Tool/_Create filter rule/by _Subject"),
+                                               NULL, create_filter_cb, FILTER_BY_SUBJECT, NULL},
        {N_("/_Tool/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_Tool/E_xecute"),                 "x", execute_summary_cb, 0, NULL},
        {N_("/_Tool/---"),                      NULL, NULL, 0, "<Separator>"},
@@ -654,9 +667,9 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Configuration/_Filtering ..."),
                                                NULL, prefs_filtering_open_cb, 0, NULL},
        {N_("/_Configuration/_Template..."),    NULL, prefs_template_open_cb, 0, NULL},
+       {N_("/_Configuration/---"),             NULL, NULL, 0, "<Separator>"},
        {N_("/_Configuration/_Preferences for current account..."),
                                                NULL, prefs_account_open_cb, 0, NULL},
-       {N_("/_Configuration/---"),             NULL, NULL, 0, "<Separator>"},
        {N_("/_Configuration/Create _new account..."),
                                                NULL, new_account_cb, 0, NULL},
        {N_("/_Configuration/_Edit accounts..."),
@@ -1495,6 +1508,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
 
                {"/Tool/Add sender to address book", M_SINGLE_TARGET_EXIST},
                {"/Tool/Filter messages"           , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
+               {"/Tool/Create filter rule"        , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
                {"/Tool/Execute"                   , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
 
                {"/Configuration", M_UNLOCKED},
@@ -2872,6 +2886,12 @@ static void allsel_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
                messageview_select_all(mainwin->messageview);
 }
 
+static void create_filter_cb(MainWindow *mainwin, guint action,
+                            GtkWidget *widget)
+{
+       summary_filter_open(mainwin->summaryview, (PrefsFilterType)action);
+}
+
 static void prefs_common_open_cb(MainWindow *mainwin, guint action,
                                 GtkWidget *widget)
 {
@@ -2881,7 +2901,7 @@ static void prefs_common_open_cb(MainWindow *mainwin, guint action,
 static void prefs_filter_open_cb(MainWindow *mainwin, guint action,
                                 GtkWidget *widget)
 {
-       prefs_filter_open();
+       prefs_filter_open(NULL, NULL);
 }
 
 static void prefs_scoring_open_cb(MainWindow *mainwin, guint action,
index 0311eef..5ebb210 100644 (file)
@@ -61,8 +61,8 @@ static struct Filter {
        GtkWidget *pred_combo2;
        GtkWidget *pred_entry1;
        GtkWidget *pred_entry2;
-       GtkWidget *op_combo;
-       GtkWidget *op_entry;
+       GtkWidget *cond_combo;
+       GtkWidget *cond_entry;
 
        GtkWidget *dest_entry;
        GtkWidget *regex_chkbtn;
@@ -84,7 +84,8 @@ static struct Filter {
 /* widget creating functions */
 static void prefs_filter_create                (void);
 
-static void prefs_filter_set_dialog    (void);
+static void prefs_filter_set_dialog    (const gchar    *header,
+                                        const gchar    *key);
 static void prefs_filter_set_list      (void);
 static gint prefs_filter_clist_set_row (gint    row);
 
@@ -116,7 +117,7 @@ static void prefs_filter_key_pressed        (GtkWidget      *widget,
 static void prefs_filter_cancel                (void);
 static void prefs_filter_ok            (void);
 
-void prefs_filter_open(void)
+void prefs_filter_open(const gchar *header, const gchar *key)
 {
        if (prefs_rc_is_readonly(FILTER_RC))
                return;
@@ -130,7 +131,7 @@ void prefs_filter_open(void)
        manage_window_set_transient(GTK_WINDOW(filter.window));
        gtk_widget_grab_focus(filter.ok_btn);
 
-       prefs_filter_set_dialog();
+       prefs_filter_set_dialog(header, key);
 
        gtk_widget_show(filter.window);
 }
@@ -145,9 +146,9 @@ static void prefs_filter_create(void)
 
        GtkWidget *vbox1;
        GtkWidget *table1;
-       GtkWidget *op_label;
-       GtkWidget *op_combo;
-       GtkWidget *op_entry;
+       GtkWidget *cond_label;
+       GtkWidget *cond_combo;
+       GtkWidget *cond_entry;
        GtkWidget *hdr_label;
        GtkWidget *hdr_combo1;
        GtkWidget *hdr_combo2;
@@ -239,21 +240,21 @@ static void prefs_filter_create(void)
        gtk_table_set_row_spacings (GTK_TABLE (table1), 8);
        gtk_table_set_col_spacings (GTK_TABLE (table1), 8);
 
-       op_label = gtk_label_new (_("Operator"));
-       gtk_widget_show (op_label);
-       gtk_table_attach (GTK_TABLE (table1), op_label, 0, 1, 0, 1,
+       cond_label = gtk_label_new (_("Condition"));
+       gtk_widget_show (cond_label);
+       gtk_table_attach (GTK_TABLE (table1), cond_label, 0, 1, 0, 1,
                          GTK_FILL, 0, 0, 0);
-       gtk_misc_set_alignment (GTK_MISC (op_label), 0, 0.5);
+       gtk_misc_set_alignment (GTK_MISC (cond_label), 0, 0.5);
 
-       op_combo = gtk_combo_new ();
-       gtk_widget_show (op_combo);
-       gtk_table_attach (GTK_TABLE (table1), op_combo, 0, 1, 2, 3,
+       cond_combo = gtk_combo_new ();
+       gtk_widget_show (cond_combo);
+       gtk_table_attach (GTK_TABLE (table1), cond_combo, 0, 1, 2, 3,
                          0, 0, 0, 0);
-       gtk_widget_set_usize (op_combo, 52, -1);
-       gtkut_combo_set_items (GTK_COMBO (op_combo), "and", "or", NULL);
+       gtk_widget_set_usize (cond_combo, 52, -1);
+       gtkut_combo_set_items (GTK_COMBO (cond_combo), "and", "or", NULL);
 
-       op_entry = GTK_COMBO (op_combo)->entry;
-       gtk_entry_set_editable (GTK_ENTRY (op_entry), FALSE);
+       cond_entry = GTK_COMBO (cond_combo)->entry;
+       gtk_entry_set_editable (GTK_ENTRY (cond_entry), FALSE);
 
        hdr_label = gtk_label_new (_("Header"));
        gtk_widget_show (hdr_label);
@@ -475,8 +476,8 @@ static void prefs_filter_create(void)
        filter.pred_combo2 = pred_combo2;
        filter.pred_entry1 = pred_entry1;
        filter.pred_entry2 = pred_entry2;
-       filter.op_combo    = op_combo;
-       filter.op_entry    = op_entry;
+       filter.cond_combo  = cond_combo;
+       filter.cond_entry  = cond_entry;
 
        filter.dest_entry       = dest_entry;
        filter.destsel_btn      = destsel_btn;
@@ -563,7 +564,7 @@ void prefs_filter_write_config(void)
        }
 }
 
-static void prefs_filter_set_dialog(void)
+static void prefs_filter_set_dialog(const gchar *header, const gchar *key)
 {
        GtkCList *clist = GTK_CLIST(filter.cond_clist);
        GSList *cur;
@@ -589,6 +590,11 @@ static void prefs_filter_set_dialog(void)
        }
 
        gtk_clist_thaw(clist);
+
+       if (header && key) {
+               gtk_entry_set_text(GTK_ENTRY(filter.hdr_entry1), header);
+               gtk_entry_set_text(GTK_ENTRY(filter.key_entry1), key);
+       }
 }
 
 static void prefs_filter_set_list(void)
@@ -661,7 +667,7 @@ static gint prefs_filter_clist_set_row(gint row)
        if (!strcmp(entry_text, _("contains")))
                flt->flag2 |= FLT_CONTAIN;
 
-       GET_ENTRY(filter.op_entry);
+       GET_ENTRY(filter.cond_entry);
        if (!strcmp(entry_text, "and"))
                flt->cond = FLT_AND;
        else
@@ -810,7 +816,7 @@ static void prefs_filter_select(GtkCList *clist, gint row, gint column,
        gtk_toggle_button_set_active
                (GTK_TOGGLE_BUTTON(filter.regex_chkbtn), is_regex);
 
-       gtk_entry_set_text(GTK_ENTRY(filter.op_entry),
+       gtk_entry_set_text(GTK_ENTRY(filter.cond_entry),
                           flt->cond == FLT_OR ? "or" : "and");
        if (flt->action == FLT_NOTRECV)
                gtk_toggle_button_set_active
index 4ca1d6f..1fdef18 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-2002 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
 #ifndef __PREFS_FILTER_H__
 #define __PREFS_FILTER_H__
 
+typedef enum
+{
+       FILTER_BY_NONE,
+       FILTER_BY_AUTO,
+       FILTER_BY_FROM,
+       FILTER_BY_TO,
+       FILTER_BY_SUBJECT
+} PrefsFilterType;
+
 void prefs_filter_read_config  (void);
 void prefs_filter_write_config (void);
-void prefs_filter_open         (void);
+void prefs_filter_open         (const gchar    *header,
+                                const gchar    *key);
 
 #endif /* __PREFS_FILTER_H__ */
index 4b61d1a..cd75c7b 100644 (file)
@@ -61,6 +61,7 @@
 #include "sourcewindow.h"
 #include "prefs_common.h"
 #include "prefs_summary_column.h"
+#include "prefs_filter.h"
 #include "account.h"
 #include "compose.h"
 #include "utils.h"
@@ -3859,6 +3860,86 @@ static void summary_filter_func(GtkCTree *ctree, GtkCTreeNode *node,
                                              summaryview->folder_table);
 }
 
+void summary_filter_open(SummaryView *summaryview, PrefsFilterType type)
+{
+       static HeaderEntry hentry[] = {{"List-Id:",        NULL, FALSE},
+                                      {"X-ML-Name:",      NULL, FALSE},
+                                      {"X-List:",         NULL, FALSE},
+                                      {"X-Mailing-list:", NULL, FALSE},
+                                      {NULL,              NULL, FALSE}};
+       enum
+       {
+               H_LIST_ID        = 0,
+               H_X_ML_NAME      = 1,
+               H_X_LIST         = 2,
+               H_X_MAILING_LIST = 3
+       };
+
+       MsgInfo *msginfo;
+       gchar *header = NULL;
+       gchar *key = NULL;
+       FILE *fp;
+
+       if (!summaryview->selected) return;
+
+       msginfo = gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
+                                             summaryview->selected);
+       if (!msginfo) return;
+
+       switch (type) {
+       case FILTER_BY_NONE:
+               break;
+       case FILTER_BY_AUTO:
+               if ((fp = procmsg_open_message(msginfo)) == NULL) return;
+               procheader_get_header_fields(fp, hentry);
+               fclose(fp);
+
+               if (hentry[H_LIST_ID].body != NULL) {
+                       header = "List-Id";
+                       Xstrdup_a(key, hentry[H_LIST_ID].body, );
+               } else if (hentry[H_X_ML_NAME].body != NULL) {
+                       header = "X-ML-Name";
+                       Xstrdup_a(key, hentry[H_X_ML_NAME].body, );
+               } else if (hentry[H_X_LIST].body != NULL) {
+                       header = "X-List";
+                       Xstrdup_a(key, hentry[H_X_LIST].body, );
+               } else if (hentry[H_X_MAILING_LIST].body != NULL) {
+                       header = "X-Mailing-list";
+                       Xstrdup_a(key, hentry[H_X_MAILING_LIST].body, );
+               } else if (msginfo->subject) {
+                       header = "Subject";
+                       key = msginfo->subject;
+               }
+
+               g_free(hentry[H_LIST_ID].body);
+               hentry[H_LIST_ID].body = NULL;
+               g_free(hentry[H_X_ML_NAME].body);
+               hentry[H_X_ML_NAME].body = NULL;
+               g_free(hentry[H_X_LIST].body);
+               hentry[H_X_LIST].body = NULL;
+               g_free(hentry[H_X_MAILING_LIST].body);
+               hentry[H_X_MAILING_LIST].body = NULL;
+
+               break;
+       case FILTER_BY_FROM:
+               header = "From";
+               key = msginfo->from;
+               break;
+       case FILTER_BY_TO:
+               header = "To";
+               key = msginfo->to;
+               break;
+       case FILTER_BY_SUBJECT:
+               header = "Subject";
+               key = msginfo->subject;
+               break;
+       default:
+               break;
+       }
+
+       prefs_filter_open(header, key);
+}
+
 /* color label */
 
 #define N_COLOR_LABELS colorlabel_get_color_count()
index c821cf5..5101490 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-2002 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
@@ -35,6 +35,7 @@ typedef struct _SummaryColumnState    SummaryColumnState;
 #include "headerview.h"
 #include "messageview.h"
 #include "headerwindow.h"
+#include "prefs_filter.h"
 #include "folder.h"
 #include "gtksctree.h"
 
@@ -195,6 +196,8 @@ void summary_thread_build     (SummaryView          *summaryview);
 void summary_unthread            (SummaryView          *summaryview);
 
 void summary_filter              (SummaryView          *summaryview);
+void summary_filter_open         (SummaryView          *summaryview,
+                                  PrefsFilterType       type);
 void summary_sort                (SummaryView          *summaryview,
                                   SummarySortType       type);
 
index 37fa0bb..3961f2f 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-2002 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
@@ -58,6 +58,8 @@
        Xstrdup_a(fontstr, s, ); \
        if ((p = strchr(fontstr, ',')) != NULL) *p = '\0'; \
        font = gdk_font_load(fontstr); \
+       if (!font) \
+               g_warning("Couldn't load the font '%s'\n", fontstr); \
 }
 
 typedef struct _RemoteURI      RemoteURI;
@@ -173,19 +175,27 @@ TextView *textview_create(void)
        gtk_widget_ensure_style(text_mb);
        if (text_sb->style && text_sb->style->font->type == GDK_FONT_FONTSET) {
                GtkStyle *style;
-
-               style = gtk_style_copy(text_sb->style);
-               gdk_font_unref(style->font);
-               FONT_LOAD(style->font, NORMAL_FONT);
-               gtk_widget_set_style(text_sb, style);
+               GdkFont *font;
+
+               FONT_LOAD(font, prefs_common.normalfont);
+               if (font) {
+                       style = gtk_style_copy(text_sb->style);
+                       gdk_font_unref(style->font);
+                       style->font = font;
+                       gtk_widget_set_style(text_sb, style);
+               }
        }
        if (text_mb->style && text_mb->style->font->type == GDK_FONT_FONT) {
                GtkStyle *style;
-
-               style = gtk_style_copy(text_mb->style);
-               gdk_font_unref(style->font);
-               style->font = gdk_fontset_load(NORMAL_FONT);
-               gtk_widget_set_style(text_mb, style);
+               GdkFont *font;
+
+               font = gdk_fontset_load(prefs_common.normalfont);
+               if (font) {
+                       style = gtk_style_copy(text_mb->style);
+                       gdk_font_unref(style->font);
+                       style->font = font;
+                       gtk_widget_set_style(text_mb, style);
+               }
        }
        gtk_widget_ref(scrolledwin_sb);
        gtk_widget_ref(scrolledwin_mb);