headers display conf and custom header ui - cache version
authorHoà Viêt Dinh <dinh.viet.hoa@free.fr>
Thu, 3 May 2001 17:25:10 +0000 (17:25 +0000)
committerHoà Viêt Dinh <dinh.viet.hoa@free.fr>
Thu, 3 May 2001 17:25:10 +0000 (17:25 +0000)
ChangeLog.claws
src/defs.h
src/prefs_display_headers.c
src/prefs_headers.c
src/procheader.c
src/procmsg.c
src/procmsg.h

index 8e99a25..3779941 100644 (file)
@@ -1,3 +1,16 @@
+2001-05-03 [hoa]
+
+       * src/defs.h
+       * src/procmsg.[ch]
+       * src/procheader.c
+                changed version of cache, added cc field
+
+       * src/prefs_display_headers.c
+               the interface was changed
+
+       * src/prefs_headers.c
+               added cancel button
+
 2001-05-03 [alfons]
 
        * src/textview.c: re-edited, prepared for fixing the email address
index 42b764e..5c277a2 100644 (file)
@@ -55,7 +55,7 @@
 #define FOLDER_LIST            "folderlist.xml"
 #define CACHE_FILE             ".sylpheed_cache"
 #define MARK_FILE              ".sylpheed_mark"
-#define CACHE_VERSION          17
+#define CACHE_VERSION          18
 #define MARK_VERSION           2
 
 #define DEFAULT_SIGNATURE      ".signature"
index 35ed603..82ebeb9 100644 (file)
 static struct Headers {
        GtkWidget *window;
 
-       GtkWidget *close_btn;
+       GtkWidget *ok_btn;
+       GtkWidget *cancel_btn;
 
        GtkWidget *hdr_combo;
        GtkWidget *hdr_entry;
        GtkWidget *key_check;
        GtkWidget *headers_clist;
+       GtkWidget *hidden_headers_clist;
 
        GtkWidget *other_headers;
 } headers;
@@ -75,13 +77,19 @@ static void prefs_display_headers_create    (void);
 
 static void prefs_display_headers_set_dialog   (void);
 static void prefs_display_headers_set_list     (void);
-static gint prefs_display_headers_clist_set_row        (gint    row);
+/* static gint prefs_display_headers_clist_set_row     (gint    row); */
+static gint prefs_display_headers_clist_set_row(gboolean hidden);
+/*static gint prefs_display_headers_clist_set_row      (void);*/
 
 /* callback functions */
 static void prefs_display_headers_select_dest_cb(void);
+static void prefs_display_headers_register_cb(GtkButton *btn,
+                                             void * hidden_data);
+/*
 static void prefs_display_headers_register_cb  (void);
 static void prefs_display_headers_substitute_cb        (void);
-static void prefs_display_headers_delete_cb    (void);
+*/
+static void prefs_display_headers_delete_cb(GtkButton *btn, void * clist_data);
 static void prefs_display_headers_up           (void);
 static void prefs_display_headers_down         (void);
 static void prefs_display_headers_select       (GtkCList       *clist,
@@ -94,7 +102,8 @@ static void prefs_display_headers_other_headers_toggled(void);
 static void prefs_display_headers_key_pressed  (GtkWidget      *widget,
                                                 GdkEventKey    *event,
                                                 gpointer        data);
-static void prefs_display_headers_close                (GtkButton      *button);
+static void prefs_display_headers_ok           (GtkButton      *button);
+static void prefs_display_headers_cancel       (GtkButton      *button);
 
 PrefsDisplayHeaders prefs_display_headers = { 1, NULL};
 
@@ -134,6 +143,9 @@ static void prefs_display_headers_set_default(void)
        }
 }
 
+#define ENTRY_SET_TEXT(entry, str) \
+       gtk_entry_set_text(GTK_ENTRY(entry), str ? str : "")
+
 void prefs_display_headers_open(void)
 {
        if (!headers.window) {
@@ -141,7 +153,7 @@ void prefs_display_headers_open(void)
        }
 
        manage_window_set_transient(GTK_WINDOW(headers.window));
-       gtk_widget_grab_focus(headers.close_btn);
+       gtk_widget_grab_focus(headers.ok_btn);
 
        prefs_display_headers_set_dialog();
 
@@ -152,7 +164,8 @@ static void prefs_display_headers_create(void)
 {
        GtkWidget *window;
        GtkWidget *vbox;
-       GtkWidget *close_btn;
+       GtkWidget *ok_btn;
+       GtkWidget *cancel_btn;
        GtkWidget *confirm_area;
 
        GtkWidget *vbox1;
@@ -172,6 +185,7 @@ static void prefs_display_headers_create(void)
        GtkWidget *ch_hbox;
        GtkWidget *ch_scrolledwin;
        GtkWidget *headers_clist;
+       GtkWidget *hidden_headers_clist;
 
        GtkWidget *btn_vbox;
        GtkWidget *up_btn;
@@ -179,7 +193,8 @@ static void prefs_display_headers_create(void)
 
        GtkWidget *checkbtn_other_headers;
 
-       gchar *title[] = {_("Header name"), _("Action")};
+       /*      gchar *title[] = {_("Header name"), _("Action")}; */
+       gchar *title[1];
 
        debug_print(_("Creating headers setting window...\n"));
 
@@ -193,11 +208,11 @@ static void prefs_display_headers_create(void)
        gtk_widget_show (vbox);
        gtk_container_add (GTK_CONTAINER (window), vbox);
 
-       gtkut_button_set_create (&confirm_area, &close_btn, _("Close"),
-                                NULL, NULL, NULL, NULL);
+       gtkut_button_set_create(&confirm_area, &ok_btn, _("OK"),
+                               &cancel_btn, _("Cancel"), NULL, NULL);
        gtk_widget_show (confirm_area);
        gtk_box_pack_end (GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
-       gtk_widget_grab_default (close_btn);
+       gtk_widget_grab_default (ok_btn);
 
        gtk_window_set_title (GTK_WINDOW(window),
                              _("Headers setting"));
@@ -210,8 +225,11 @@ static void prefs_display_headers_create(void)
                            GTK_SIGNAL_FUNC(manage_window_focus_in), NULL);
        gtk_signal_connect (GTK_OBJECT(window), "focus_out_event",
                            GTK_SIGNAL_FUNC(manage_window_focus_out), NULL);
-       gtk_signal_connect (GTK_OBJECT(close_btn), "clicked",
-                           GTK_SIGNAL_FUNC(prefs_display_headers_close),
+       gtk_signal_connect (GTK_OBJECT(ok_btn), "clicked",
+                           GTK_SIGNAL_FUNC(prefs_display_headers_ok),
+                           NULL);
+       gtk_signal_connect (GTK_OBJECT(cancel_btn), "clicked",
+                           GTK_SIGNAL_FUNC(prefs_display_headers_cancel),
                            NULL);
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
@@ -255,13 +273,16 @@ static void prefs_display_headers_create(void)
        gtk_widget_show (btn_hbox);
        gtk_box_pack_start (GTK_BOX (reg_hbox), btn_hbox, FALSE, FALSE, 0);
 
+       /*
        reg_btn = gtk_button_new_with_label (_("Add"));
        gtk_widget_show (reg_btn);
        gtk_box_pack_start (GTK_BOX (btn_hbox), reg_btn, FALSE, TRUE, 0);
        gtk_signal_connect (GTK_OBJECT (reg_btn), "clicked",
                            GTK_SIGNAL_FUNC
                            (prefs_display_headers_register_cb), NULL);
+       */
 
+       /*
        subst_btn = gtk_button_new_with_label (_(" Substitute "));
        gtk_widget_show (subst_btn);
        gtk_box_pack_start (GTK_BOX (btn_hbox), subst_btn, FALSE, TRUE, 0);
@@ -269,14 +290,7 @@ static void prefs_display_headers_create(void)
                            GTK_SIGNAL_FUNC
                            (prefs_display_headers_substitute_cb),
                            NULL);
-
-       del_btn = gtk_button_new_with_label (_("Delete"));
-       gtk_widget_show (del_btn);
-       gtk_box_pack_start (GTK_BOX (btn_hbox), del_btn, FALSE, TRUE, 0);
-       gtk_signal_connect (GTK_OBJECT (del_btn), "clicked",
-                           GTK_SIGNAL_FUNC (prefs_display_headers_delete_cb),
-                           NULL);
-
+       */
 
        ch_hbox = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (ch_hbox);
@@ -292,7 +306,8 @@ static void prefs_display_headers_create(void)
                                        GTK_POLICY_AUTOMATIC,
                                        GTK_POLICY_AUTOMATIC);
 
-       headers_clist = gtk_clist_new_with_titles(2, title);
+       title[0] = _("Headers order");
+       headers_clist = gtk_clist_new_with_titles(1, title);
        gtk_widget_show (headers_clist);
        gtk_container_add (GTK_CONTAINER (ch_scrolledwin), headers_clist);
        gtk_clist_set_column_width (GTK_CLIST (headers_clist), 0, 150);
@@ -310,6 +325,20 @@ static void prefs_display_headers_create(void)
        gtk_widget_show (btn_vbox);
        gtk_box_pack_start (GTK_BOX (ch_hbox), btn_vbox, FALSE, FALSE, 0);
 
+       reg_btn = gtk_button_new_with_label (_("Add"));
+       gtk_widget_show (reg_btn);
+       gtk_box_pack_start (GTK_BOX (btn_vbox), reg_btn, FALSE, TRUE, 0);
+       gtk_signal_connect (GTK_OBJECT (reg_btn), "clicked",
+                           GTK_SIGNAL_FUNC
+                           (prefs_display_headers_register_cb),
+                           (void *) FALSE);
+       del_btn = gtk_button_new_with_label (_("Delete"));
+       gtk_widget_show (del_btn);
+       gtk_box_pack_start (GTK_BOX (btn_vbox), del_btn, FALSE, TRUE, 0);
+       gtk_signal_connect (GTK_OBJECT (del_btn), "clicked",
+                           GTK_SIGNAL_FUNC (prefs_display_headers_delete_cb),
+                           (void *) headers_clist);
+
        up_btn = gtk_button_new_with_label (_("Up"));
        gtk_widget_show (up_btn);
        gtk_box_pack_start (GTK_BOX (btn_vbox), up_btn, FALSE, FALSE, 0);
@@ -322,6 +351,52 @@ static void prefs_display_headers_create(void)
        gtk_signal_connect (GTK_OBJECT (down_btn), "clicked",
                            GTK_SIGNAL_FUNC (prefs_display_headers_down), NULL);
 
+       /* hidden headers list */
+
+       ch_scrolledwin = gtk_scrolled_window_new (NULL, NULL);
+       gtk_widget_set_usize (ch_scrolledwin, 230, 200);
+       gtk_widget_show (ch_scrolledwin);
+       gtk_box_pack_start (GTK_BOX (ch_hbox), ch_scrolledwin,
+                           TRUE, TRUE, 0);
+       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ch_scrolledwin),
+                                       GTK_POLICY_AUTOMATIC,
+                                       GTK_POLICY_AUTOMATIC);
+
+       title[0] = _("Hidden headers");
+       hidden_headers_clist = gtk_clist_new_with_titles(1, title);
+       gtk_widget_show (hidden_headers_clist);
+       gtk_container_add (GTK_CONTAINER (ch_scrolledwin),
+                          hidden_headers_clist);
+       gtk_clist_set_column_width (GTK_CLIST (hidden_headers_clist), 0, 150);
+       gtk_clist_set_selection_mode (GTK_CLIST (hidden_headers_clist),
+                                     GTK_SELECTION_BROWSE);
+       gtk_clist_set_auto_sort(GTK_CLIST (hidden_headers_clist), TRUE);
+       GTK_WIDGET_UNSET_FLAGS (GTK_CLIST (hidden_headers_clist)->
+                               column[0].button, GTK_CAN_FOCUS);
+       gtk_signal_connect (GTK_OBJECT (hidden_headers_clist), "select_row",
+                           GTK_SIGNAL_FUNC (prefs_display_headers_select),
+                           NULL);
+
+       /* end of hidden headers list */
+
+       btn_vbox = gtk_vbox_new (FALSE, 8);
+       gtk_widget_show (btn_vbox);
+       gtk_box_pack_start (GTK_BOX (ch_hbox), btn_vbox, FALSE, FALSE, 0);
+
+       reg_btn = gtk_button_new_with_label (_("Add"));
+       gtk_widget_show (reg_btn);
+       gtk_box_pack_start (GTK_BOX (btn_vbox), reg_btn, FALSE, TRUE, 0);
+       gtk_signal_connect (GTK_OBJECT (reg_btn), "clicked",
+                           GTK_SIGNAL_FUNC
+                           (prefs_display_headers_register_cb),
+                           (void *) TRUE);
+       del_btn = gtk_button_new_with_label (_("Delete"));
+       gtk_widget_show (del_btn);
+       gtk_box_pack_start (GTK_BOX (btn_vbox), del_btn, FALSE, TRUE, 0);
+       gtk_signal_connect (GTK_OBJECT (del_btn), "clicked",
+                           GTK_SIGNAL_FUNC (prefs_display_headers_delete_cb),
+                           (void *) hidden_headers_clist);
+
        PACK_CHECK_BUTTON (vbox1, checkbtn_other_headers,
                           _("Show other headers"));
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_other_headers),
@@ -335,12 +410,14 @@ static void prefs_display_headers_create(void)
        gtk_widget_show_all(window);
 
        headers.window        = window;
-       headers.close_btn     = close_btn;
+       headers.ok_btn        = ok_btn;
+       headers.cancel_btn    = cancel_btn;
 
        headers.hdr_combo     = hdr_combo;
        headers.hdr_entry     = GTK_COMBO (hdr_combo)->entry;
        headers.key_check     = key_check;
        headers.headers_clist = headers_clist;
+       headers.hidden_headers_clist = hidden_headers_clist;
 
        headers.other_headers = checkbtn_other_headers;
 }
@@ -447,30 +524,44 @@ void prefs_display_headers_write_config(void)
 
 static void prefs_display_headers_set_dialog()
 {
-       GtkCList *clist = GTK_CLIST(headers.headers_clist);
+       GtkCList * clist = GTK_CLIST(headers.headers_clist);
+       GtkCList * hidden_clist = GTK_CLIST(headers.hidden_headers_clist);
        GSList *cur;
-       gchar *dp_str[2];
+       gchar *dp_str[1];
        gint row;
 
        gtk_clist_freeze(clist);
        gtk_clist_clear(clist);
 
+       gtk_clist_freeze(hidden_clist);
+       gtk_clist_clear(hidden_clist);
+
        dp_str[0] = _("(New)");
-       dp_str[1] = "";
+
        row = gtk_clist_append(clist, dp_str);
        gtk_clist_set_row_data(clist, row, NULL);
 
+       row = gtk_clist_append(hidden_clist, dp_str);
+       gtk_clist_set_row_data(hidden_clist, row, NULL);
+
        for (cur = prefs_display_headers.headers_list; cur != NULL;
             cur = cur->next) {
                HeaderDisplayProp *dp = (HeaderDisplayProp *)cur->data;
 
                dp_str[0] = dp->name;
-               dp_str[1] = dp->hidden ? _("Hide") : _("Show");
+               /* dp_str[1] = dp->hidden ? _("Hide") : _("Show"); */
 
-               row = gtk_clist_append(clist, dp_str);
-               gtk_clist_set_row_data(clist, row, dp);
+               if (dp->hidden) {
+                       row = gtk_clist_append(hidden_clist, dp_str);
+                       gtk_clist_set_row_data(hidden_clist, row, dp);
+               }
+               else {
+                       row = gtk_clist_append(clist, dp_str);
+                       gtk_clist_set_row_data(clist, row, dp);
+               }
        }
 
+       gtk_clist_thaw(hidden_clist);
        gtk_clist_thaw(clist);
 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(headers.other_headers), prefs_display_headers.show_other_headers);
@@ -478,31 +569,38 @@ static void prefs_display_headers_set_dialog()
 
 static void prefs_display_headers_set_list()
 {
-       gint row = 1;
+       gint row;
        HeaderDisplayProp *dp;
 
        g_slist_free(prefs_display_headers.headers_list);
        prefs_display_headers.headers_list = NULL;
 
+       row = 1;
        while ((dp = gtk_clist_get_row_data(GTK_CLIST(headers.headers_clist),
                row)) != NULL) {
                prefs_display_headers.headers_list =
                        g_slist_append(prefs_display_headers.headers_list, dp);
                row++;
        }
+
+       row = 1;
+       while ((dp = gtk_clist_get_row_data(GTK_CLIST(headers.hidden_headers_clist), row)) != NULL) {
+               prefs_display_headers.headers_list =
+                       g_slist_append(prefs_display_headers.headers_list, dp);
+               row++;
+       }
 }
 
 #define GET_ENTRY(entry) \
        entry_text = gtk_entry_get_text(GTK_ENTRY(entry))
 
-static gint prefs_display_headers_clist_set_row(gint row)
+static gint prefs_display_headers_clist_set_row(gboolean hidden)
 {
-       GtkCList *clist = GTK_CLIST(headers.headers_clist);
+       GtkCList *clist;
        HeaderDisplayProp *dp;
        gchar *entry_text;
-       gchar *dp_str[2];
-
-       g_return_val_if_fail(row != 0, -1);
+       gchar *dp_str[1];
+       gint row;
 
        GET_ENTRY(headers.hdr_entry);
        if (entry_text[0] == '\0') {
@@ -514,36 +612,37 @@ static gint prefs_display_headers_clist_set_row(gint row)
 
        dp->name = g_strdup(entry_text);
 
+       /*
        dp->hidden = !gtk_toggle_button_get_active
                (GTK_TOGGLE_BUTTON(headers.key_check));
+       */
+       dp->hidden = hidden;
+
+       if (hidden)
+               clist = GTK_CLIST(headers.hidden_headers_clist);
+       else
+               clist = GTK_CLIST(headers.headers_clist);
 
        dp_str[0] = dp->name;
-       dp_str[1] = dp->hidden ? _("Hide") : _("Show");
-
-       if (row < 0)
-               row = gtk_clist_append(clist, dp_str);
-       else {
-               HeaderDisplayProp *tmpdp;
-
-               gtk_clist_set_text(clist, row, 0, dp_str[0]);
-               gtk_clist_set_text(clist, row, 1, dp_str[1]);
-               tmpdp = gtk_clist_get_row_data(clist, row);
-               if (tmpdp)
-                       header_display_prop_free(tmpdp);
-       }
 
+       row = gtk_clist_append(clist, dp_str);
+       
        gtk_clist_set_row_data(clist, row, dp);
-
+       
        prefs_display_headers_set_list();
-
+               
        return row;
 }
 
-static void prefs_display_headers_register_cb(void)
+static void prefs_display_headers_register_cb(GtkButton *btn,
+                                             void * hidden_data)
 {
-       prefs_display_headers_clist_set_row(-1);
+       gboolean hidden = (gboolean) hidden_data;
+
+       prefs_display_headers_clist_set_row(hidden);
 }
 
+/*
 static void prefs_display_headers_substitute_cb(void)
 {
        GtkCList *clist = GTK_CLIST(headers.headers_clist);
@@ -560,10 +659,12 @@ static void prefs_display_headers_substitute_cb(void)
 
        prefs_display_headers_clist_set_row(row);
 }
+*/
 
-static void prefs_display_headers_delete_cb(void)
+static void prefs_display_headers_delete_cb(GtkButton *btn, void * clist_data)
 {
-       GtkCList *clist = GTK_CLIST(headers.headers_clist);
+       //      GtkCList *clist = GTK_CLIST(headers.headers_clist);     
+       GtkCList *clist = GTK_CLIST(clist_data);
        HeaderDisplayProp *dp;
        gint row;
 
@@ -611,9 +712,6 @@ static void prefs_display_headers_down(void)
        }
 }
 
-#define ENTRY_SET_TEXT(entry, str) \
-       gtk_entry_set_text(GTK_ENTRY(entry), str ? str : "")
-
 static void prefs_display_headers_select(GtkCList *clist, gint row,
                                         gint column, GdkEvent *event)
 {
@@ -624,15 +722,19 @@ static void prefs_display_headers_select(GtkCList *clist, gint row,
        if (!dp)
                dp = &default_dp;
 
-       ENTRY_SET_TEXT(headers.hdr_entry, dp->name);
+       ENTRY_SET_TEXT(headers.hdr_entry, "");
+
+       /*      ENTRY_SET_TEXT(headers.hdr_entry, dp->name);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(headers.key_check),
-                                    !dp->hidden);
+       !dp->hidden);*/
 
+       /*
        if ((row != 0) && event && (event->type == GDK_2BUTTON_PRESS)) {
                gtk_toggle_button_set_active
                        (GTK_TOGGLE_BUTTON(headers.key_check), dp->hidden);
                prefs_display_headers_clist_set_row(row);
        }
+       */
 }
 
 static void prefs_display_headers_key_pressed(GtkWidget *widget,
@@ -643,12 +745,18 @@ static void prefs_display_headers_key_pressed(GtkWidget *widget,
                gtk_widget_hide(headers.window);
 }
 
-static void prefs_display_headers_close(GtkButton *button)
+static void prefs_display_headers_ok(GtkButton *button)
 {
        prefs_display_headers_write_config();
        gtk_widget_hide(headers.window);
 }
 
+static void prefs_display_headers_cancel(GtkButton *button)
+{
+       prefs_display_headers_read_config();
+       gtk_widget_hide(headers.window);
+}
+
 static void prefs_display_headers_other_headers_toggled(void)
 {
        prefs_display_headers.show_other_headers = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(headers.other_headers));
index 8127424..451145d 100644 (file)
 static struct Headers {
        GtkWidget *window;
 
+       /*
        GtkWidget *close_btn;
+       */
+       GtkWidget *ok_btn;
+       GtkWidget *cancel_btn;
 
        GtkWidget *hdr_combo;
        GtkWidget *hdr_entry;
@@ -92,7 +96,11 @@ static void prefs_headers_select             (GtkCList       *clist,
 static void prefs_headers_key_pressed  (GtkWidget      *widget,
                                         GdkEventKey    *event,
                                         gpointer        data);
+/*
 static void prefs_headers_close                (GtkButton      *button);
+*/
+static void prefs_headers_ok           (GtkButton      *button);
+static void prefs_headers_cancel       (GtkButton      *button);
 
 static PrefsAccount * cur_ac = NULL;
 
@@ -103,7 +111,10 @@ void prefs_headers_open(PrefsAccount * ac)
        }
 
        manage_window_set_transient(GTK_WINDOW(headers.window));
+       /*
        gtk_widget_grab_focus(headers.close_btn);
+       */
+       gtk_widget_grab_focus(headers.ok_btn);
 
        prefs_headers_set_dialog(ac);
 
@@ -116,7 +127,11 @@ static void prefs_headers_create(void)
 {
        GtkWidget *window;
        GtkWidget *vbox;
-       GtkWidget *close_btn;
+
+       /*      GtkWidget *close_btn; */
+       GtkWidget *ok_btn;
+       GtkWidget *cancel_btn;
+
        GtkWidget *confirm_area;
 
        GtkWidget *vbox1;
@@ -156,11 +171,18 @@ static void prefs_headers_create(void)
        gtk_widget_show (vbox);
        gtk_container_add (GTK_CONTAINER (window), vbox);
 
+       gtkut_button_set_create(&confirm_area, &ok_btn, _("OK"),
+                               &cancel_btn, _("Cancel"), NULL, NULL);
+       /*
        gtkut_button_set_create (&confirm_area, &close_btn, _("Close"),
                                 NULL, NULL, NULL, NULL);
+       */
        gtk_widget_show (confirm_area);
        gtk_box_pack_end (GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
+       /*
        gtk_widget_grab_default (close_btn);
+       */
+       gtk_widget_grab_default (ok_btn);
 
        gtk_window_set_title (GTK_WINDOW(window),
                              _("Headers setting"));
@@ -172,8 +194,10 @@ static void prefs_headers_create(void)
                            GTK_SIGNAL_FUNC(manage_window_focus_in), NULL);
        gtk_signal_connect (GTK_OBJECT(window), "focus_out_event",
                            GTK_SIGNAL_FUNC(manage_window_focus_out), NULL);
-       gtk_signal_connect (GTK_OBJECT(close_btn), "clicked",
-                           GTK_SIGNAL_FUNC(prefs_headers_close), NULL);
+       gtk_signal_connect (GTK_OBJECT(ok_btn), "clicked",
+                           GTK_SIGNAL_FUNC(prefs_headers_ok), NULL);
+       gtk_signal_connect (GTK_OBJECT(cancel_btn), "clicked",
+                           GTK_SIGNAL_FUNC(prefs_headers_cancel), NULL);
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
@@ -299,7 +323,9 @@ static void prefs_headers_create(void)
        gtk_widget_show_all(window);
 
        headers.window    = window;
-       headers.close_btn = close_btn;
+       /*      headers.close_btn = close_btn; */
+       headers.ok_btn = ok_btn;
+       headers.cancel_btn = cancel_btn;
 
        headers.hdr_combo  = hdr_combo;
        headers.hdr_entry  = GTK_COMBO (hdr_combo)->entry;
@@ -623,8 +649,17 @@ static void prefs_headers_key_pressed(GtkWidget *widget, GdkEventKey *event,
                gtk_widget_hide(headers.window);
 }
 
-static void prefs_headers_close(GtkButton *button)
+static void prefs_headers_ok(GtkButton *button)
 {
        prefs_headers_write_config(cur_ac);
        gtk_widget_hide(headers.window);
 }
+
+static void prefs_headers_cancel(GtkButton *button)
+{
+       /*
+       prefs_headers_write_config(cur_ac); 
+       */
+       prefs_headers_read_config(cur_ac); 
+       gtk_widget_hide(headers.window);
+}
index 9a280cd..76ba140 100644 (file)
@@ -272,15 +272,16 @@ enum
        H_DATE          = 0,
        H_FROM          = 1,
        H_TO            = 2,
-       H_NEWSGROUPS    = 3,
-       H_SUBJECT       = 4,
-       H_MSG_ID        = 5,
-       H_REFERENCES    = 6,
-       H_IN_REPLY_TO   = 7,
-       H_CONTENT_TYPE  = 8,
-       H_SEEN          = 9,
-       H_X_FACE        = 10,
-       H_DISPOSITION_NOTIFICATION_TO = 11
+       H_CC            = 3,
+       H_NEWSGROUPS    = 4,
+       H_SUBJECT       = 5,
+       H_MSG_ID        = 6,
+       H_REFERENCES    = 7,
+       H_IN_REPLY_TO   = 8,
+       H_CONTENT_TYPE  = 9,
+       H_SEEN          = 10,
+       H_X_FACE        = 11,
+       H_DISPOSITION_NOTIFICATION_TO = 12
 };
 
 MsgInfo *procheader_parse(const gchar *file, MsgFlags flags, gboolean full)
@@ -288,6 +289,7 @@ MsgInfo *procheader_parse(const gchar *file, MsgFlags flags, gboolean full)
        static HeaderEntry hentry_full[] = {{"Date:",           NULL, FALSE},
                                           {"From:",            NULL, TRUE},
                                           {"To:",              NULL, TRUE},
+                                          {"Cc:",              NULL, TRUE},
                                           {"Newsgroups:",      NULL, TRUE},
                                           {"Subject:",         NULL, TRUE},
                                           {"Message-Id:",      NULL, FALSE},
@@ -302,6 +304,7 @@ MsgInfo *procheader_parse(const gchar *file, MsgFlags flags, gboolean full)
        static HeaderEntry hentry_short[] = {{"Date:",          NULL, FALSE},
                                            {"From:",           NULL, TRUE},
                                            {"To:",             NULL, TRUE},
+                                           {"Cc:",             NULL, TRUE},
                                            {"Newsgroups:",     NULL, TRUE},
                                            {"Subject:",        NULL, TRUE},
                                            {"Message-Id:",     NULL, FALSE},
@@ -363,6 +366,16 @@ MsgInfo *procheader_parse(const gchar *file, MsgFlags flags, gboolean full)
                        } else
                                msginfo->to = g_strdup(tmp);
                        break;
+               case H_CC:
+                       conv_unmime_header(tmp, sizeof(tmp), hp, NULL);
+                       if (msginfo->cc) {
+                               p = msginfo->cc;
+                               msginfo->cc =
+                                       g_strconcat(p, ", ", tmp, NULL);
+                               g_free(p);
+                       } else
+                               msginfo->cc = g_strdup(tmp);
+                       break;
                case H_NEWSGROUPS:
                        if (msginfo->newsgroups) {
                                p = msginfo->newsgroups;
index 969a0e8..ec70158 100644 (file)
@@ -229,6 +229,7 @@ GSList *procmsg_read_cache(FolderItem *item, gboolean scan_file)
                READ_CACHE_DATA(msginfo->date, fp);
                READ_CACHE_DATA(msginfo->from, fp);
                READ_CACHE_DATA(msginfo->to, fp);
+               READ_CACHE_DATA(msginfo->cc, fp);
                READ_CACHE_DATA(msginfo->newsgroups, fp);
                READ_CACHE_DATA(msginfo->subject, fp);
                READ_CACHE_DATA(msginfo->msgid, fp);
@@ -357,6 +358,7 @@ void procmsg_write_cache(MsgInfo *msginfo, FILE *fp)
        WRITE_CACHE_DATA(msginfo->date, fp);
        WRITE_CACHE_DATA(msginfo->from, fp);
        WRITE_CACHE_DATA(msginfo->to, fp);
+       WRITE_CACHE_DATA(msginfo->cc, fp);
        WRITE_CACHE_DATA(msginfo->newsgroups, fp);
        WRITE_CACHE_DATA(msginfo->subject, fp);
        WRITE_CACHE_DATA(msginfo->msgid, fp);
@@ -689,6 +691,7 @@ void procmsg_print_message(MsgInfo *msginfo, const gchar *cmdline)
        if (msginfo->date) fprintf(prfp, "Date: %s\n", msginfo->date);
        if (msginfo->from) fprintf(prfp, "From: %s\n", msginfo->from);
        if (msginfo->to)   fprintf(prfp, "To: %s\n", msginfo->to);
+       if (msginfo->cc)   fprintf(prfp, "Cc: %s\n", msginfo->cc);
        if (msginfo->newsgroups)
                fprintf(prfp, "Newsgroups: %s\n", msginfo->newsgroups);
        if (msginfo->subject) fprintf(prfp, "Subject: %s\n", msginfo->subject);
@@ -740,6 +743,7 @@ MsgInfo *procmsg_msginfo_copy(MsgInfo *msginfo)
        MEMBDUP(date);
        MEMBDUP(from);
        MEMBDUP(to);
+       MEMBDUP(cc);
        MEMBDUP(newsgroups);
        MEMBDUP(subject);
        MEMBDUP(msgid);
@@ -766,6 +770,7 @@ void procmsg_msginfo_free(MsgInfo *msginfo)
        g_free(msginfo->date);
        g_free(msginfo->from);
        g_free(msginfo->to);
+       g_free(msginfo->cc);
        g_free(msginfo->newsgroups);
        g_free(msginfo->subject);
        g_free(msginfo->msgid);
index f3c230d..ddc716d 100644 (file)
@@ -115,6 +115,7 @@ struct _MsgInfo
        gchar *subject;
        gchar *msgid;
        gchar *inreplyto;
+       gchar *cc;
 
        FolderItem *folder;
        FolderItem *to_folder;