move message wrapping options to /'Other Preferences/Compose/Message Wrapping'
authorPaul Mangan <paul@claws-mail.org>
Wed, 30 Jun 2004 10:56:37 +0000 (10:56 +0000)
committerPaul Mangan <paul@claws-mail.org>
Wed, 30 Jun 2004 10:56:37 +0000 (10:56 +0000)
ChangeLog.claws
configure.ac
po/POTFILES.in
src/Makefile.am
src/main.c
src/prefs_common.c
src/prefs_wrapping.c [new file with mode: 0644]
src/prefs_wrapping.h [new file with mode: 0644]

index 67c63e5..2e8dde3 100644 (file)
@@ -1,3 +1,13 @@
+2004-06-30 [paul]      0.9.12cvs1
+
+       * po/POTFILES.in
+         src/Makefile.am
+         src/main.c
+         src/prefs_common.c
+         src/prefs_wrapping.[ch]       ** NEW FILES **
+               move message wrapping options to
+               /'Other Preferences/Compose/Message Wrapping'
+
 2004-06-28 [paul]      0.9.12
 
        * Sylpheed-Claws 0.9.12 released
index 9d9751d..0274a8a 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=12
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=0
+EXTRA_VERSION=1
 EXTRA_RELEASE=
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
index 01dfb50..85974d3 100644 (file)
@@ -95,6 +95,7 @@ src/prefs_summary_column.c
 src/prefs_template.c
 src/prefs_themes.c
 src/prefs_toolbar.c
+src/prefs_wrapping.c
 src/privacy.c
 src/procmsg.c
 src/quote_fmt.c
index cfad0b3..4381bff 100644 (file)
@@ -99,6 +99,7 @@ sylpheed_SOURCES = \
        prefs_template.c \
        prefs_themes.c \
        prefs_toolbar.c \
+       prefs_wrapping.c \
        privacy.c \
        procheader.c \
        procmime.c \
@@ -228,6 +229,7 @@ sylpheedinclude_HEADERS = \
        prefs_template.h \
        prefs_themes.h \
        prefs_toolbar.h \
+       prefs_wrapping.h \
        privacy.h \
        procheader.h \
        procmime.h \
index 3b3a738..ab394c1 100644 (file)
@@ -55,6 +55,7 @@
 #include "prefs_fonts.h"
 #include "prefs_spelling.h"
 #include "prefs_themes.h"
+#include "prefs_wrapping.h"
 #include "prefs_display_header.h"
 #include "account.h"
 #include "procmsg.h"
@@ -259,6 +260,7 @@ int main(int argc, char *argv[])
        prefs_themes_init();
        prefs_fonts_init();
        prefs_ext_prog_init();
+       prefs_wrapping_init();
 #ifdef USE_ASPELL
        gtkaspell_checkers_init();
        prefs_spelling_init();
@@ -436,6 +438,7 @@ static void exit_sylpheed(MainWindow *mainwin)
        prefs_themes_done();
        prefs_fonts_done();
        prefs_ext_prog_done();
+       prefs_wrapping_done();
 #ifdef USE_ASPELL       
        prefs_spelling_done();
        gtkaspell_checkers_quit();
index 20b90c6..8dd6694 100644 (file)
@@ -98,11 +98,6 @@ static struct Compose {
        GtkWidget *checkbtn_autoextedit;
        GtkWidget *spinbtn_undolevel;
        GtkObject *spinbtn_undolevel_adj;
-       GtkWidget *spinbtn_linewrap;
-       GtkObject *spinbtn_linewrap_adj;
-       GtkWidget *checkbtn_wrapquote;
-       GtkWidget *checkbtn_autowrap;
-       GtkWidget *checkbtn_wrapatsend;
 
        GtkWidget *checkbtn_reply_account_autosel;
        GtkWidget *checkbtn_forward_account_autosel;
@@ -111,7 +106,6 @@ static struct Compose {
        GtkWidget *checkbtn_default_reply_list;
        GtkWidget *checkbtn_forward_as_attachment;
        GtkWidget *checkbtn_redirect_keep_from;
-       GtkWidget *checkbtn_smart_wrapping;
        GtkWidget *checkbtn_block_cursor;
        GtkWidget *checkbtn_reply_with_quote;
        
@@ -320,21 +314,15 @@ static PrefParam param[] = {
         prefs_set_data_from_toggle, prefs_set_toggle},
 
        {"linewrap_length", "72", &prefs_common.linewrap_len, P_INT,
-        &compose.spinbtn_linewrap,
-        prefs_set_data_from_spinbtn, prefs_set_spinbtn},
+        NULL, NULL, NULL},
        {"linewrap_quotation", "FALSE", &prefs_common.linewrap_quote, P_BOOL,
-        &compose.checkbtn_wrapquote,
-        prefs_set_data_from_toggle, prefs_set_toggle},
+        NULL, NULL, NULL},
        {"linewrap_auto", "FALSE", &prefs_common.autowrap, P_BOOL,
-        &compose.checkbtn_autowrap,
-        prefs_set_data_from_toggle, prefs_set_toggle},
-       {"linewrap_before_sending", "FALSE",
-        &prefs_common.linewrap_at_send, P_BOOL,
-        &compose.checkbtn_wrapatsend,
-        prefs_set_data_from_toggle, prefs_set_toggle},
-        {"smart_wrapping", "TRUE", &prefs_common.smart_wrapping,
-        P_BOOL, &compose.checkbtn_smart_wrapping,
-        prefs_set_data_from_toggle, prefs_set_toggle},
+        NULL, NULL, NULL},
+       {"linewrap_before_sending", "FALSE", &prefs_common.linewrap_at_send, P_BOOL, 
+        NULL, NULL, NULL},
+        {"smart_wrapping", "TRUE", &prefs_common.smart_wrapping, P_BOOL, 
+        NULL, NULL, NULL},
         {"autosave", "FALSE", &prefs_common.autosave,
         P_BOOL, &compose.checkbtn_autosave,
         prefs_set_data_from_toggle, prefs_set_toggle},
@@ -1389,25 +1377,13 @@ static void prefs_compose_create(void)
        GtkObject *spinbtn_undolevel_adj;
        GtkWidget *spinbtn_undolevel;
 
-       GtkWidget *vbox_linewrap;
-
-       GtkWidget *hbox3;
-       GtkWidget *hbox4;
        GtkWidget *hbox5;
-       GtkWidget *label_linewrap;
-       GtkObject *spinbtn_linewrap_adj;
-       GtkWidget *spinbtn_linewrap;
-       GtkWidget *checkbtn_wrapquote;
-       GtkWidget *checkbtn_autowrap;
-       GtkWidget *checkbtn_wrapatsend;
 
        GtkWidget *checkbtn_default_reply_list;
 
        GtkWidget *checkbtn_forward_as_attachment;
        GtkWidget *checkbtn_redirect_keep_from;
-       GtkWidget *checkbtn_smart_wrapping;
        GtkWidget *checkbtn_block_cursor;
-       GtkWidget *frame_msgwrap;
 
        GtkWidget *hbox_autosave;
        GtkWidget *checkbtn_autosave;
@@ -1490,49 +1466,6 @@ static void prefs_compose_create(void)
        gtk_widget_set_usize (spinbtn_undolevel, 64, -1);
        gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_undolevel), TRUE);
 
-        /* line-wrapping */
-       PACK_FRAME(vbox1, frame_msgwrap, _("Message wrapping"));
-
-       vbox_linewrap = gtk_vbox_new (FALSE, VSPACING_NARROW);
-       gtk_widget_show (vbox_linewrap);
-       gtk_container_add (GTK_CONTAINER (frame_msgwrap), vbox_linewrap);
-       gtk_container_set_border_width (GTK_CONTAINER (vbox_linewrap), 8);
-
-       hbox3 = gtk_hbox_new (FALSE, 8);
-       gtk_widget_show (hbox3);
-       gtk_box_pack_start (GTK_BOX (vbox_linewrap), hbox3, FALSE, FALSE, 0);
-
-
-       label_linewrap = gtk_label_new (_("Wrap messages at"));
-       gtk_widget_show (label_linewrap);
-       gtk_box_pack_start (GTK_BOX (hbox3), label_linewrap, FALSE, FALSE, 0);
-
-       spinbtn_linewrap_adj = gtk_adjustment_new (72, 20, 1024, 1, 10, 10);
-       spinbtn_linewrap = gtk_spin_button_new
-               (GTK_ADJUSTMENT (spinbtn_linewrap_adj), 1, 0);
-       gtk_widget_show (spinbtn_linewrap);
-       gtk_box_pack_start (GTK_BOX (hbox3), spinbtn_linewrap, FALSE, FALSE, 0);
-       gtk_widget_set_usize (spinbtn_linewrap, 64, -1);
-       gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_linewrap), TRUE);
-
-       label_linewrap = gtk_label_new (_("characters"));
-       gtk_widget_show (label_linewrap);
-       gtk_box_pack_start (GTK_BOX (hbox3), label_linewrap, FALSE, FALSE, 0);
-
-       hbox4 = gtk_hbox_new (FALSE, VSPACING);
-       gtk_widget_show (hbox4);
-       gtk_box_pack_start (GTK_BOX (vbox_linewrap), hbox4, FALSE, FALSE, 0);
-
-       PACK_CHECK_BUTTON (hbox4, checkbtn_wrapquote, _("Wrap quotation"));
-
-       PACK_CHECK_BUTTON (hbox4, checkbtn_autowrap, _("Wrap on input"));
-
-       PACK_CHECK_BUTTON
-               (hbox4, checkbtn_wrapatsend, _("Wrap before sending"));
-
-       PACK_CHECK_BUTTON (vbox_linewrap, checkbtn_smart_wrapping,
-                          _("Smart wrapping (EXPERIMENTAL)"));
-       
        /*
        compose.checkbtn_quote   = checkbtn_quote;
        compose.entry_quotemark  = entry_quotemark;
@@ -1548,12 +1481,6 @@ static void prefs_compose_create(void)
        compose.spinbtn_undolevel     = spinbtn_undolevel;
        compose.spinbtn_undolevel_adj = spinbtn_undolevel_adj;
 
-       compose.spinbtn_linewrap      = spinbtn_linewrap;
-       compose.spinbtn_linewrap_adj  = spinbtn_linewrap_adj;
-       compose.checkbtn_wrapquote    = checkbtn_wrapquote;
-       compose.checkbtn_autowrap     = checkbtn_autowrap;
-       compose.checkbtn_wrapatsend   = checkbtn_wrapatsend;
-
        compose.checkbtn_autosave     = checkbtn_autosave;
        compose.entry_autosave_length = entry_autosave_length;
        
@@ -1561,8 +1488,6 @@ static void prefs_compose_create(void)
                checkbtn_forward_as_attachment;
        compose.checkbtn_redirect_keep_from =
                checkbtn_redirect_keep_from;
-       compose.checkbtn_smart_wrapping = 
-               checkbtn_smart_wrapping;
        compose.checkbtn_block_cursor   =
                checkbtn_block_cursor;
        compose.checkbtn_default_reply_list = checkbtn_default_reply_list;
diff --git a/src/prefs_wrapping.c b/src/prefs_wrapping.c
new file mode 100644 (file)
index 0000000..34855e3
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2004 Hiroyuki Yamamoto & The Sylpheed-Claws Team
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include "defs.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "intl.h"
+#include "prefs_common.h"
+#include "prefs_gtk.h"
+
+#include "gtk/gtkutils.h"
+#include "gtk/prefswindow.h"
+
+#include "manage_window.h"
+
+typedef struct _WrappingPage
+{
+       PrefsPage page;
+
+       GtkWidget *window;
+
+       GtkWidget *spinbtn_linewrap;
+       GtkWidget *checkbtn_wrapquote;
+       GtkWidget *checkbtn_autowrap;
+       GtkWidget *checkbtn_wrapatsend;
+       GtkWidget *checkbtn_smart_wrapping;
+} WrappingPage;
+
+void prefs_wrapping_create_widget(PrefsPage *_page, GtkWindow *window, 
+                                 gpointer data)
+{
+       WrappingPage *prefs_wrapping = (WrappingPage *) _page;
+       
+       GtkWidget *table;
+       GtkWidget *label_linewrap;
+       GtkObject *spinbtn_linewrap_adj;
+       GtkWidget *spinbtn_linewrap;
+       GtkWidget *checkbtn_wrapquote;
+       GtkWidget *checkbtn_autowrap;
+       GtkWidget *checkbtn_wrapatsend;
+       GtkWidget *checkbtn_smart_wrapping;
+       GtkWidget *hbox1;
+
+       table = gtk_table_new(8, 3, FALSE);
+       gtk_widget_show(table);
+       gtk_container_set_border_width(GTK_CONTAINER(table), 8);
+       gtk_table_set_row_spacings(GTK_TABLE(table), 4);
+       gtk_table_set_col_spacings(GTK_TABLE(table), 8);
+
+       checkbtn_autowrap = gtk_check_button_new_with_label(_("Wrap on input"));
+       gtk_widget_show (checkbtn_autowrap);
+       gtk_table_attach (GTK_TABLE (table), checkbtn_autowrap, 0, 1, 1, 2,
+                         (GtkAttachOptions) (GTK_FILL),
+                         (GtkAttachOptions) (0), 0, 0);
+
+       checkbtn_wrapatsend = gtk_check_button_new_with_label(_("Wrap before sending"));
+       gtk_widget_show (checkbtn_wrapatsend);
+       gtk_table_attach (GTK_TABLE (table), checkbtn_wrapatsend, 0, 1, 2, 3,
+                         (GtkAttachOptions) (GTK_FILL),
+                         (GtkAttachOptions) (0), 0, 0);
+
+       checkbtn_wrapquote = gtk_check_button_new_with_label(_("Wrap quotation"));
+       gtk_widget_show (checkbtn_wrapquote);
+       gtk_table_attach (GTK_TABLE (table), checkbtn_wrapquote, 0, 1, 3, 4,
+                         (GtkAttachOptions) (GTK_FILL),
+                         (GtkAttachOptions) (0), 0, 0);
+
+       checkbtn_smart_wrapping = 
+               gtk_check_button_new_with_label(_("Smart wrapping (EXPERIMENTAL)"));
+       gtk_widget_show (checkbtn_smart_wrapping);
+       gtk_table_attach (GTK_TABLE (table), checkbtn_smart_wrapping, 0, 1, 4, 5,
+                         (GtkAttachOptions) (GTK_FILL),
+                         (GtkAttachOptions) (0), 0, 0);
+       
+       hbox1 = gtk_hbox_new (FALSE, 0);
+       gtk_widget_show (hbox1);
+       gtk_table_attach (GTK_TABLE (table), hbox1, 0, 1, 5, 6,
+                         (GtkAttachOptions) (GTK_FILL),
+                         (GtkAttachOptions) (GTK_FILL), 0, 0);
+
+       label_linewrap = gtk_label_new (_("Wrap messages at"));
+       gtk_widget_show (label_linewrap);
+       gtk_box_pack_start (GTK_BOX (hbox1), label_linewrap, FALSE, FALSE, 4);
+
+       spinbtn_linewrap_adj = gtk_adjustment_new (72, 20, 1024, 1, 10, 10);
+       spinbtn_linewrap = gtk_spin_button_new
+               (GTK_ADJUSTMENT (spinbtn_linewrap_adj), 1, 0);
+       gtk_widget_show (spinbtn_linewrap);
+       gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_linewrap, FALSE, FALSE, 0);
+
+       label_linewrap = gtk_label_new (_("characters"));
+       gtk_widget_show (label_linewrap);
+       gtk_box_pack_start (GTK_BOX (hbox1), label_linewrap, FALSE, FALSE, 0);
+       
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_autowrap),
+                                    prefs_common.autowrap);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_wrapatsend),
+                                    prefs_common.linewrap_at_send);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_wrapquote),
+                                    prefs_common.linewrap_quote);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_smart_wrapping),
+                                    prefs_common.smart_wrapping);
+       gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_linewrap),
+                                 prefs_common.linewrap_len);
+
+       prefs_wrapping->window                  = GTK_WIDGET(window);
+       prefs_wrapping->spinbtn_linewrap        = spinbtn_linewrap;
+       prefs_wrapping->checkbtn_wrapquote      = checkbtn_wrapquote;
+       prefs_wrapping->checkbtn_autowrap       = checkbtn_autowrap;
+       prefs_wrapping->checkbtn_wrapatsend     = checkbtn_wrapatsend;
+       prefs_wrapping->checkbtn_smart_wrapping = checkbtn_smart_wrapping;
+
+       prefs_wrapping->page.widget = table;
+}
+
+void prefs_wrapping_save(PrefsPage *_page)
+{
+       WrappingPage *page = (WrappingPage *) _page;
+
+       prefs_common.linewrap_len = 
+               gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(page->spinbtn_linewrap));
+       prefs_common.linewrap_quote = 
+               gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_wrapquote));
+       prefs_common.autowrap =
+               gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_autowrap));
+       prefs_common.linewrap_at_send = 
+               gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_wrapatsend));
+       prefs_common.smart_wrapping = 
+               gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_smart_wrapping));
+}
+
+static void prefs_wrapping_destroy_widget(PrefsPage *_page)
+{
+}
+
+WrappingPage *prefs_wrapping;
+
+void prefs_wrapping_init(void)
+{
+       WrappingPage *page;
+
+       page = g_new0(WrappingPage, 1);
+       page->page.path = _("Compose/Message Wrapping");
+       page->page.create_widget = prefs_wrapping_create_widget;
+       page->page.destroy_widget = prefs_wrapping_destroy_widget;
+       page->page.save_page = prefs_wrapping_save;
+       page->page.weight = 60.0;
+       prefs_gtk_register_page((PrefsPage *) page);
+       prefs_wrapping = page;
+}
+
+void prefs_wrapping_done(void)
+{
+       prefs_gtk_unregister_page((PrefsPage *) prefs_wrapping);
+       g_free(prefs_wrapping);
+}
diff --git a/src/prefs_wrapping.h b/src/prefs_wrapping.h
new file mode 100644 (file)
index 0000000..de5eae7
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2004 Hiroyuki Yamamoto & the Sylpheed-Claws team
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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.
+ */
+
+#ifndef PREFS_WRAPPING_H
+#define PREFS_WRAPPING_H
+
+void prefs_wrapping_init       (void);
+void prefs_wrapping_done       (void);
+
+#endif /* PREFS_WRAPPING_H */