0.9.6claws5
authorChristoph Hohmann <reboot@gmx.ch>
Sat, 4 Oct 2003 20:52:40 +0000 (20:52 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Sat, 4 Oct 2003 20:52:40 +0000 (20:52 +0000)
* src/prefs_toolbar.c
* src/gtk/prefswindow.c
        remove widget_show_all for pages root widget

* src/plugins/spamassassin/spamassassin.[ch]
* src/plugins/spamassassin/spamassassin_gtk.c
* src/plugins/spamassassin/spamassassin_gtk.glade
        add support for new libspamc transports

ChangeLog.claws
configure.ac
src/gtk/prefswindow.c
src/plugins/spamassassin/spamassassin.c
src/plugins/spamassassin/spamassassin.h
src/plugins/spamassassin/spamassassin_gtk.c
src/plugins/spamassassin/spamassassin_gtk.glade
src/prefs_toolbar.c

index f3fb625..0c6f45f 100644 (file)
@@ -1,3 +1,14 @@
+2003-10-04 [christoph] 0.9.6claws5
+
+       * src/prefs_toolbar.c
+       * src/gtk/prefswindow.c
+               remove widget_show_all for pages root widget
+
+       * src/plugins/spamassassin/spamassassin.[ch]
+       * src/plugins/spamassassin/spamassassin_gtk.c
+       * src/plugins/spamassassin/spamassassin_gtk.glade
+               add support for new libspamc transports
+
 2003-10-04 [christoph] 0.9.6claws4
 
        * src/plugins/spamassassin/libspamc.[ch]
index 298190b..5e88631 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=4
+EXTRA_VERSION=5
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index 13e706a..7e930f9 100644 (file)
@@ -83,7 +83,6 @@ static gboolean ctree_select_row(GtkCTree *ctree, GList *node, gint column, gpoi
 
        if (!page->page_open) {
                page->create_widget(page, GTK_WINDOW(prefswindow->window), prefswindow->data);
-               gtk_widget_show_all(page->widget);
                gtk_container_add(GTK_CONTAINER(prefswindow->notebook), page->widget);
                page->page_open = TRUE;
        }
index dde2a56..396d410 100644 (file)
@@ -80,12 +80,14 @@ static gchar *username = NULL;
 static SpamAssassinConfig config;
 
 static PrefParam param[] = {
-       {"enable", "FALSE", &config.enable, P_BOOL,
+       {"transport", "0", &config.transport, P_INT,
         NULL, NULL, NULL},
        {"hostname", "localhost", &config.hostname, P_STRING,
         NULL, NULL, NULL},
        {"port", "783", &config.port, P_INT,
         NULL, NULL, NULL},
+       {"socket", "", &config.socket, P_STRING,
+        NULL, NULL, NULL},
        {"receive_spam", "TRUE", &config.receive_spam, P_BOOL,
         NULL, NULL, NULL},
        {"save_folder", NULL, &config.save_folder, P_STRING,
@@ -116,9 +118,23 @@ static gboolean msg_is_spam(FILE *fp)
        gboolean is_spam = FALSE;
 
        transport_init(&trans);
-       trans.type = TRANSPORT_TCP;
-       trans.hostname = config.hostname;
-       trans.port = config.port;
+       switch (config.transport) {
+       case SPAMASSASSIN_TRANSPORT_LOCALHOST:
+               trans.type = TRANSPORT_LOCALHOST;
+               trans.port = config.port;
+               break;
+       case SPAMASSASSIN_TRANSPORT_TCP:
+               trans.type = TRANSPORT_TCP;
+               trans.hostname = config.hostname;
+               trans.port = config.port;
+               break;
+       case SPAMASSASSIN_TRANSPORT_UNIX:
+               trans.type = TRANSPORT_UNIX;
+               trans.socketpath = config.socket;
+               break;
+       default:
+               return FALSE;
+       }
 
        if (transport_setup(&trans, flags) != EX_OK) {
                debug_print("failed to setup transport\n");
@@ -158,7 +174,7 @@ static gboolean mail_filtering_hook(gpointer source, gpointer data)
        int pid = 0;
        int status;
 
-       if (!config.enable)
+       if (config.transport == SPAMASSASSIN_DISABLED)
                return FALSE;
 
        debug_print("Filtering message %d\n", msginfo->msgnum);
index d2d310d..3e4ac97 100644 (file)
 
 typedef struct _SpamAssassinConfig SpamAssassinConfig;
 
+typedef enum {
+       SPAMASSASSIN_DISABLED            = 0,
+       SPAMASSASSIN_TRANSPORT_LOCALHOST = 1,
+       SPAMASSASSIN_TRANSPORT_TCP       = 2,
+       SPAMASSASSIN_TRANSPORT_UNIX      = 3,
+} SpamAssassinTransport;
+
 struct _SpamAssassinConfig
 {
-       gboolean         enable;
-       gchar           *hostname;
-       guint            port;
-       gboolean         receive_spam;
-       gchar           *save_folder;
-       guint            max_size;
-       guint            timeout;
+       SpamAssassinTransport    transport;
+       gchar                   *hostname;
+       guint                    port;
+       gchar                   *socket;
+       gboolean                 receive_spam;
+       gchar                   *save_folder;
+       guint                    max_size;
+       guint                    timeout;
 };
 
 SpamAssassinConfig *spamassassin_get_config    (void);
index ef3bdfe..a83d418 100644 (file)
@@ -41,13 +41,42 @@ struct SpamAssassinPage
 {
        PrefsPage page;
        
-       GtkWidget *enable;
+       GtkWidget *transport;
+       GtkWidget *transport_notebook;
        GtkWidget *hostname;
+       GtkWidget *colon;
        GtkWidget *port;
+       GtkWidget *socket;
        GtkWidget *receive_spam;
        GtkWidget *save_folder;
        GtkWidget *max_size;
        GtkWidget *timeout;
+
+       SpamAssassinTransport   trans;
+};
+
+struct Transport
+{
+       gchar                   *name;
+       SpamAssassinTransport    transport;
+       guint                    page;
+       guint                    pageflags;
+};
+
+enum {
+       PAGE_NETWORK = 0,
+       PAGE_UNIX    = 1,
+};
+
+enum {
+       NETWORK_HOSTNAME = 1,
+};
+
+struct Transport transports[] = {
+       { N_("Disabled"),       SPAMASSASSIN_DISABLED,                  PAGE_NETWORK, 0 },
+       { N_("Localhost"),      SPAMASSASSIN_TRANSPORT_LOCALHOST,       PAGE_NETWORK, 0 },
+       { N_("TCP"),            SPAMASSASSIN_TRANSPORT_TCP,             PAGE_NETWORK, NETWORK_HOSTNAME },
+       { N_("Unix Socket"),    SPAMASSASSIN_TRANSPORT_UNIX,            PAGE_UNIX,    0 },
 };
 
 static void foldersel_cb(GtkWidget *widget, gpointer data)
@@ -65,70 +94,124 @@ static void foldersel_cb(GtkWidget *widget, gpointer data)
        }
 }
 
+static void show_transport(struct SpamAssassinPage *page, struct Transport *transport)
+{
+       page->trans = transport->transport;
+
+       switch (transport->page) {
+       case PAGE_NETWORK:
+               if (transport->pageflags & NETWORK_HOSTNAME) {
+                       gtk_widget_show(page->hostname);
+                       gtk_widget_show(page->colon);
+               } else {
+                       gtk_widget_hide(page->hostname);
+                       gtk_widget_hide(page->colon);
+               }
+               break;
+       default:
+               break;
+       }
+       gtk_notebook_set_page(GTK_NOTEBOOK(page->transport_notebook), transport->page);
+}
+
+static void transport_sel_cb(GtkMenuItem *menuitem, gpointer data)
+{
+       struct SpamAssassinPage *page = (struct SpamAssassinPage *) data;
+       struct Transport *transport;
+
+       transport = (struct Transport *) gtk_object_get_user_data(GTK_OBJECT(menuitem));
+       show_transport(page, transport);
+}
+
 static void spamassassin_create_widget_func(PrefsPage * _page,
                                            GtkWindow * window,
                                            gpointer data)
 {
        struct SpamAssassinPage *page = (struct SpamAssassinPage *) _page;
        SpamAssassinConfig *config;
+       guint i, active;
 
        /*
         * BEGIN GLADE CODE
         * DO NOT EDIT
         */
-       GtkWidget *table1;
+       GtkWidget *table;
        GtkWidget *label3;
        GtkWidget *label4;
+       GtkWidget *hbox4;
+       GtkWidget *transport;
+       GtkWidget *transport_menu;
+       GtkWidget *transport_notebook;
        GtkWidget *hbox1;
        GtkWidget *hostname;
-       GtkWidget *label5;
+       GtkWidget *colon;
        GtkObject *port_adj;
        GtkWidget *port;
-       GtkWidget *enable;
+       GtkWidget *socket;
+       GtkWidget *label15;
+       GtkWidget *hbox6;
+       GtkObject *timeout_adj;
+       GtkWidget *timeout;
+       GtkWidget *label16;
        GtkWidget *label9;
        GtkWidget *receive_spam;
-       GtkWidget *label8;
-       GtkWidget *save_folder;
-       GtkWidget *button4;
-       GtkWidget *label6;
        GtkWidget *hbox3;
        GtkObject *max_size_adj;
        GtkWidget *max_size;
        GtkWidget *label11;
-       GtkWidget *label12;
-       GtkWidget *label13;
-       GtkWidget *hbox4;
-       GtkObject *timeout_adj;
-       GtkWidget *timeout;
+       GtkWidget *label8;
+       GtkWidget *save_folder;
+       GtkWidget *button4;
+       GtkWidget *label6;
        GtkTooltips *tooltips;
 
        tooltips = gtk_tooltips_new();
 
-       table1 = gtk_table_new(6, 3, FALSE);
-       gtk_widget_show(table1);
-       gtk_container_set_border_width(GTK_CONTAINER(table1), 8);
-       gtk_table_set_row_spacings(GTK_TABLE(table1), 4);
-       gtk_table_set_col_spacings(GTK_TABLE(table1), 8);
+       table = gtk_table_new(6, 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);
 
-       label3 = gtk_label_new(_("Enable"));
+       label3 = gtk_label_new(_("Transport"));
        gtk_widget_show(label3);
-       gtk_table_attach(GTK_TABLE(table1), label3, 0, 1, 0, 1,
+       gtk_table_attach(GTK_TABLE(table), label3, 0, 1, 0, 1,
                         (GtkAttachOptions) (GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5);
 
        label4 = gtk_label_new(_("spamd "));
        gtk_widget_show(label4);
-       gtk_table_attach(GTK_TABLE(table1), label4, 0, 1, 1, 2,
+       gtk_table_attach(GTK_TABLE(table), label4, 0, 1, 1, 2,
                         (GtkAttachOptions) (GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label4), 0, 0.5);
 
+       hbox4 = gtk_hbox_new(FALSE, 0);
+       gtk_widget_show(hbox4);
+       gtk_table_attach(GTK_TABLE(table), hbox4, 1, 2, 0, 1,
+                        (GtkAttachOptions) (GTK_FILL),
+                        (GtkAttachOptions) (GTK_FILL), 0, 0);
+
+       transport = gtk_option_menu_new();
+       gtk_widget_show(transport);
+       gtk_box_pack_start(GTK_BOX(hbox4), transport, FALSE, FALSE, 0);
+       transport_menu = gtk_menu_new();
+
+       transport_notebook = gtk_notebook_new();
+       gtk_widget_show(transport_notebook);
+       gtk_table_attach(GTK_TABLE(table), transport_notebook, 1, 2, 1, 2,
+                        (GtkAttachOptions) (GTK_FILL),
+                        (GtkAttachOptions) (GTK_FILL), 0, 0);
+       GTK_WIDGET_UNSET_FLAGS(transport_notebook, GTK_CAN_FOCUS);
+       gtk_notebook_set_show_tabs(GTK_NOTEBOOK(transport_notebook),
+                                  FALSE);
+       gtk_notebook_set_show_border(GTK_NOTEBOOK(transport_notebook),
+                                    FALSE);
+
        hbox1 = gtk_hbox_new(FALSE, 0);
        gtk_widget_show(hbox1);
-       gtk_table_attach(GTK_TABLE(table1), hbox1, 1, 2, 1, 2,
-                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                        (GtkAttachOptions) (GTK_FILL), 0, 0);
+       gtk_container_add(GTK_CONTAINER(transport_notebook), hbox1);
 
        hostname = gtk_entry_new();
        gtk_widget_show(hostname);
@@ -137,10 +220,10 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
                             _("Hostname or IP address of spamd server"),
                             NULL);
 
-       label5 = gtk_label_new(_(":"));
-       gtk_widget_show(label5);
-       gtk_box_pack_start(GTK_BOX(hbox1), label5, FALSE, FALSE, 0);
-       gtk_misc_set_padding(GTK_MISC(label5), 8, 0);
+       colon = gtk_label_new(_(":"));
+       gtk_widget_show(colon);
+       gtk_box_pack_start(GTK_BOX(hbox1), colon, FALSE, FALSE, 0);
+       gtk_misc_set_padding(GTK_MISC(colon), 8, 0);
 
        port_adj = gtk_adjustment_new(783, 1, 65535, 1, 10, 10);
        port = gtk_spin_button_new(GTK_ADJUSTMENT(port_adj), 1, 0);
@@ -151,24 +234,53 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
                             NULL);
        gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(port), TRUE);
 
-       enable = gtk_check_button_new_with_label("");
-       gtk_widget_show(enable);
-       gtk_table_attach(GTK_TABLE(table1), enable, 1, 2, 0, 1,
-                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+       socket = gtk_entry_new();
+       gtk_widget_show(socket);
+       gtk_container_add(GTK_CONTAINER(transport_notebook), socket);
+       gtk_tooltips_set_tip(tooltips, socket, _("Path of Unix socket"),
+                            NULL);
+
+       label15 = gtk_label_new(_("Timeout"));
+       gtk_widget_show(label15);
+       gtk_table_attach(GTK_TABLE(table), label15, 0, 1, 5, 6,
+                        (GtkAttachOptions) (GTK_FILL),
+                        (GtkAttachOptions) (0), 0, 0);
+       gtk_misc_set_alignment(GTK_MISC(label15), 0, 0.5);
+
+       hbox6 = gtk_hbox_new(FALSE, 0);
+       gtk_widget_show(hbox6);
+       gtk_table_attach(GTK_TABLE(table), hbox6, 1, 2, 5, 6,
+                        (GtkAttachOptions) (GTK_FILL),
+                        (GtkAttachOptions) (GTK_FILL), 0, 0);
+
+       timeout_adj = gtk_adjustment_new(60, 0, 10000, 10, 10, 10);
+       timeout = gtk_spin_button_new(GTK_ADJUSTMENT(timeout_adj), 1, 0);
+       gtk_widget_show(timeout);
+       gtk_box_pack_end(GTK_BOX(hbox6), timeout, FALSE, TRUE, 0);
+       gtk_widget_set_usize(timeout, 64, -2);
+       gtk_tooltips_set_tip(tooltips, timeout,
+                            _
+                            ("Maximum size a message is allowed to have to be checked"),
+                            NULL);
+       gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(timeout), TRUE);
+
+       label16 = gtk_label_new(_("s"));
+       gtk_widget_show(label16);
+       gtk_table_attach(GTK_TABLE(table), label16, 2, 3, 5, 6,
+                        (GtkAttachOptions) (GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0);
-       gtk_tooltips_set_tip(tooltips, enable,
-                            _("Enable SpamAssassin filtering"), NULL);
+       gtk_misc_set_alignment(GTK_MISC(label16), 0, 0.5);
 
        label9 = gtk_label_new(_("Save Spam"));
        gtk_widget_show(label9);
-       gtk_table_attach(GTK_TABLE(table1), label9, 0, 1, 2, 3,
+       gtk_table_attach(GTK_TABLE(table), label9, 0, 1, 2, 3,
                         (GtkAttachOptions) (GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label9), 0, 0.5);
 
        receive_spam = gtk_check_button_new_with_label("");
        gtk_widget_show(receive_spam);
-       gtk_table_attach(GTK_TABLE(table1), receive_spam, 1, 2, 2, 3,
+       gtk_table_attach(GTK_TABLE(table), receive_spam, 1, 2, 2, 3,
                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0);
        gtk_tooltips_set_tip(tooltips, receive_spam,
@@ -176,40 +288,9 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
                             ("Save mails that where identified as spam to a folder"),
                             NULL);
 
-       label8 = gtk_label_new(_("Save Folder"));
-       gtk_widget_show(label8);
-       gtk_table_attach(GTK_TABLE(table1), label8, 0, 1, 3, 4,
-                        (GtkAttachOptions) (GTK_FILL),
-                        (GtkAttachOptions) (0), 0, 0);
-       gtk_label_set_justify(GTK_LABEL(label8), GTK_JUSTIFY_LEFT);
-       gtk_misc_set_alignment(GTK_MISC(label8), 0, 0.5);
-
-       save_folder = gtk_entry_new();
-       gtk_widget_show(save_folder);
-       gtk_table_attach(GTK_TABLE(table1), save_folder, 1, 2, 3, 4,
-                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                        (GtkAttachOptions) (0), 0, 0);
-       gtk_tooltips_set_tip(tooltips, save_folder,
-                            _
-                            ("Folder that will be used to save spam. Leave empty to use the default trash folder"),
-                            NULL);
-
-       button4 = gtk_button_new_with_label(_("..."));
-       gtk_widget_show(button4);
-       gtk_table_attach(GTK_TABLE(table1), button4, 2, 3, 3, 4,
-                        (GtkAttachOptions) (GTK_SHRINK | GTK_FILL),
-                        (GtkAttachOptions) (0), 0, 0);
-
-       label6 = gtk_label_new(_("Maximum Size"));
-       gtk_widget_show(label6);
-       gtk_table_attach(GTK_TABLE(table1), label6, 0, 1, 4, 5,
-                        (GtkAttachOptions) (GTK_FILL),
-                        (GtkAttachOptions) (0), 0, 0);
-       gtk_misc_set_alignment(GTK_MISC(label6), 0, 0.5);
-
        hbox3 = gtk_hbox_new(FALSE, 0);
        gtk_widget_show(hbox3);
-       gtk_table_attach(GTK_TABLE(table1), hbox3, 1, 2, 4, 5,
+       gtk_table_attach(GTK_TABLE(table), hbox3, 1, 2, 4, 5,
                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                         (GtkAttachOptions) (GTK_FILL), 0, 0);
 
@@ -226,41 +307,41 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
 
        label11 = gtk_label_new(_("kB"));
        gtk_widget_show(label11);
-       gtk_table_attach(GTK_TABLE(table1), label11, 2, 3, 4, 5,
+       gtk_table_attach(GTK_TABLE(table), label11, 2, 3, 4, 5,
                         (GtkAttachOptions) (GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label11), 0, 0.5);
 
-       label12 = gtk_label_new(_("Timeout"));
-       gtk_widget_show(label12);
-       gtk_table_attach(GTK_TABLE(table1), label12, 0, 1, 5, 6,
+       label8 = gtk_label_new(_("Save Folder"));
+       gtk_widget_show(label8);
+       gtk_table_attach(GTK_TABLE(table), label8, 0, 1, 3, 4,
                         (GtkAttachOptions) (GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0);
-       gtk_misc_set_alignment(GTK_MISC(label12), 0, 0.5);
+       gtk_label_set_justify(GTK_LABEL(label8), GTK_JUSTIFY_LEFT);
+       gtk_misc_set_alignment(GTK_MISC(label8), 0, 0.5);
 
-       label13 = gtk_label_new(_("s"));
-       gtk_widget_show(label13);
-       gtk_table_attach(GTK_TABLE(table1), label13, 2, 3, 5, 6,
-                        (GtkAttachOptions) (GTK_FILL),
+       save_folder = gtk_entry_new();
+       gtk_widget_show(save_folder);
+       gtk_table_attach(GTK_TABLE(table), save_folder, 1, 2, 3, 4,
+                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0);
-       gtk_misc_set_alignment(GTK_MISC(label13), 0, 0.5);
-
-       hbox4 = gtk_hbox_new(FALSE, 0);
-       gtk_widget_show(hbox4);
-       gtk_table_attach(GTK_TABLE(table1), hbox4, 1, 2, 5, 6,
-                        (GtkAttachOptions) (GTK_FILL),
-                        (GtkAttachOptions) (GTK_FILL), 0, 0);
-
-       timeout_adj = gtk_adjustment_new(30, 5, 300, 1, 1, 1);
-       timeout = gtk_spin_button_new(GTK_ADJUSTMENT(timeout_adj), 1, 0);
-       gtk_widget_show(timeout);
-       gtk_box_pack_end(GTK_BOX(hbox4), timeout, FALSE, TRUE, 0);
-       gtk_widget_set_usize(timeout, 64, -2);
-       gtk_tooltips_set_tip(tooltips, timeout,
+       gtk_tooltips_set_tip(tooltips, save_folder,
                             _
-                            ("Maximum time allowed for the spam check. After the time the check will be aborted and the message delivered as none spam."),
+                            ("Folder that will be used to save spam. Leave empty to use the default trash folder"),
                             NULL);
-       gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(timeout), TRUE);
+
+       button4 = gtk_button_new_with_label(_("..."));
+       gtk_widget_show(button4);
+       gtk_table_attach(GTK_TABLE(table), button4, 2, 3, 3, 4,
+                        (GtkAttachOptions) (GTK_SHRINK | GTK_FILL),
+                        (GtkAttachOptions) (0), 0, 0);
+
+       label6 = gtk_label_new(_("Maximum Size"));
+       gtk_widget_show(label6);
+       gtk_table_attach(GTK_TABLE(table), label6, 0, 1, 4, 5,
+                        (GtkAttachOptions) (GTK_FILL),
+                        (GtkAttachOptions) (0), 0, 0);
+       gtk_misc_set_alignment(GTK_MISC(label6), 0, 0.5);
        /*
         * END GLADE CODE
         */
@@ -269,7 +350,6 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
 
        gtk_signal_connect(GTK_OBJECT(button4), "released", GTK_SIGNAL_FUNC(foldersel_cb), page);
 
-       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable), config->enable);
        if (config->hostname != NULL)
                gtk_entry_set_text(GTK_ENTRY(hostname), config->hostname);
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(port), (float) config->port);
@@ -279,15 +359,37 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(max_size), (float) config->max_size);
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(timeout), (float) config->timeout);
        
-       page->enable = enable;
+       page->transport = transport;
+       page->transport_notebook = transport_notebook;
        page->hostname = hostname;
+       page->colon = colon;
        page->port = port;
+       page->socket = socket;
        page->receive_spam = receive_spam;
        page->save_folder = save_folder;
        page->max_size = max_size;
        page->timeout = timeout;
 
-       page->page.widget = table1;
+       active = 0;
+       for (i = 0; i < (sizeof(transports) / sizeof(struct Transport)); i++) {
+               GtkWidget *menuitem;
+
+               menuitem = gtk_menu_item_new_with_label(gettext(transports[i].name));
+               gtk_object_set_user_data(GTK_OBJECT(menuitem), &transports[i]);
+               gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
+                                  GTK_SIGNAL_FUNC(transport_sel_cb), page);
+               gtk_widget_show(menuitem);
+               gtk_menu_append(GTK_MENU(transport_menu), menuitem);
+
+               if (config->transport == transports[i].transport) {
+                       show_transport(page, &transports[i]);
+                       active = i;
+               }
+       }
+       gtk_option_menu_set_menu(GTK_OPTION_MENU(transport), transport_menu);
+       gtk_option_menu_set_history(GTK_OPTION_MENU(transport), active);
+
+       page->page.widget = table;
 }
 
 static void spamassassin_destroy_widget_func(PrefsPage *_page)
@@ -305,7 +407,7 @@ static void spamassassin_save_func(PrefsPage *_page)
        config = spamassassin_get_config();
 
        /* enable */
-       config->enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->enable));
+       config->transport = page->trans;
 
        /* hostname */
        g_free(config->hostname);
@@ -314,6 +416,10 @@ static void spamassassin_save_func(PrefsPage *_page)
        /* port */
        config->port = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(page->port));
 
+       /* hostname */
+       g_free(config->socket);
+       config->socket = gtk_editable_get_chars(GTK_EDITABLE(page->socket), 0, -1);
+
        /* receive_spam */
        config->receive_spam = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->receive_spam));
 
index c53f4c9..b6b5845 100644 (file)
@@ -25,9 +25,9 @@
 
   <widget>
     <class>GtkTable</class>
-    <name>table1</name>
+    <name>table</name>
     <border_width>8</border_width>
-    <rows>5</rows>
+    <rows>6</rows>
     <columns>3</columns>
     <homogeneous>False</homogeneous>
     <row_spacing>4</row_spacing>
@@ -36,7 +36,7 @@
     <widget>
       <class>GtkLabel</class>
       <name>label3</name>
-      <label>Enable</label>
+      <label>Transport</label>
       <justify>GTK_JUSTIFY_CENTER</justify>
       <wrap>False</wrap>
       <xalign>0</xalign>
       </child>
     </widget>
 
+    <widget>
+      <class>GtkHBox</class>
+      <name>hbox4</name>
+      <homogeneous>False</homogeneous>
+      <spacing>0</spacing>
+      <child>
+       <left_attach>1</left_attach>
+       <right_attach>2</right_attach>
+       <top_attach>0</top_attach>
+       <bottom_attach>1</bottom_attach>
+       <xpad>0</xpad>
+       <ypad>0</ypad>
+       <xexpand>False</xexpand>
+       <yexpand>False</yexpand>
+       <xshrink>False</xshrink>
+       <yshrink>False</yshrink>
+       <xfill>True</xfill>
+       <yfill>True</yfill>
+      </child>
+
+      <widget>
+       <class>GtkOptionMenu</class>
+       <name>transport</name>
+       <can_focus>True</can_focus>
+       <items></items>
+       <initial_choice>0</initial_choice>
+       <child>
+         <padding>0</padding>
+         <expand>False</expand>
+         <fill>False</fill>
+       </child>
+      </widget>
+    </widget>
+
+    <widget>
+      <class>GtkNotebook</class>
+      <name>transport_notebook</name>
+      <show_tabs>False</show_tabs>
+      <show_border>False</show_border>
+      <tab_pos>GTK_POS_TOP</tab_pos>
+      <scrollable>False</scrollable>
+      <tab_hborder>2</tab_hborder>
+      <tab_vborder>2</tab_vborder>
+      <popup_enable>False</popup_enable>
+      <child>
+       <left_attach>1</left_attach>
+       <right_attach>2</right_attach>
+       <top_attach>1</top_attach>
+       <bottom_attach>2</bottom_attach>
+       <xpad>0</xpad>
+       <ypad>0</ypad>
+       <xexpand>False</xexpand>
+       <yexpand>False</yexpand>
+       <xshrink>False</xshrink>
+       <yshrink>False</yshrink>
+       <xfill>True</xfill>
+       <yfill>True</yfill>
+      </child>
+
+      <widget>
+       <class>GtkHBox</class>
+       <name>hbox1</name>
+       <homogeneous>False</homogeneous>
+       <spacing>0</spacing>
+
+       <widget>
+         <class>GtkEntry</class>
+         <name>hostname</name>
+         <tooltip>Hostname or IP address of spamd server</tooltip>
+         <can_focus>True</can_focus>
+         <editable>True</editable>
+         <text_visible>True</text_visible>
+         <text_max_length>0</text_max_length>
+         <text></text>
+         <child>
+           <padding>0</padding>
+           <expand>True</expand>
+           <fill>True</fill>
+         </child>
+       </widget>
+
+       <widget>
+         <class>GtkLabel</class>
+         <name>colon</name>
+         <label>:</label>
+         <justify>GTK_JUSTIFY_CENTER</justify>
+         <wrap>False</wrap>
+         <xalign>0.5</xalign>
+         <yalign>0.5</yalign>
+         <xpad>8</xpad>
+         <ypad>0</ypad>
+         <child>
+           <padding>0</padding>
+           <expand>False</expand>
+           <fill>False</fill>
+         </child>
+       </widget>
+
+       <widget>
+         <class>GtkSpinButton</class>
+         <name>port</name>
+         <width>64</width>
+         <tooltip>Port of spamd server</tooltip>
+         <can_focus>True</can_focus>
+         <climb_rate>1</climb_rate>
+         <digits>0</digits>
+         <numeric>True</numeric>
+         <update_policy>GTK_UPDATE_ALWAYS</update_policy>
+         <snap>False</snap>
+         <wrap>False</wrap>
+         <value>783</value>
+         <lower>1</lower>
+         <upper>65535</upper>
+         <step>1</step>
+         <page>10</page>
+         <page_size>10</page_size>
+         <child>
+           <padding>0</padding>
+           <expand>False</expand>
+           <fill>True</fill>
+           <pack>GTK_PACK_END</pack>
+         </child>
+       </widget>
+      </widget>
+
+      <widget>
+       <class>Placeholder</class>
+       <child_name>Notebook:tab</child_name>
+      </widget>
+
+      <widget>
+       <class>GtkEntry</class>
+       <name>socket</name>
+       <tooltip>Path of Unix socket</tooltip>
+       <can_focus>True</can_focus>
+       <editable>True</editable>
+       <text_visible>True</text_visible>
+       <text_max_length>0</text_max_length>
+       <text></text>
+      </widget>
+
+      <widget>
+       <class>Placeholder</class>
+       <child_name>Notebook:tab</child_name>
+      </widget>
+    </widget>
+
     <widget>
       <class>GtkLabel</class>
-      <name>label6</name>
-      <label>Maximum Size</label>
+      <name>label15</name>
+      <label>Timeout</label>
       <justify>GTK_JUSTIFY_CENTER</justify>
       <wrap>False</wrap>
       <xalign>0</xalign>
       <child>
        <left_attach>0</left_attach>
        <right_attach>1</right_attach>
-       <top_attach>2</top_attach>
-       <bottom_attach>3</bottom_attach>
+       <top_attach>5</top_attach>
+       <bottom_attach>6</bottom_attach>
        <xpad>0</xpad>
        <ypad>0</ypad>
        <xexpand>False</xexpand>
       </child>
     </widget>
 
+    <widget>
+      <class>GtkHBox</class>
+      <name>hbox6</name>
+      <homogeneous>False</homogeneous>
+      <spacing>0</spacing>
+      <child>
+       <left_attach>1</left_attach>
+       <right_attach>2</right_attach>
+       <top_attach>5</top_attach>
+       <bottom_attach>6</bottom_attach>
+       <xpad>0</xpad>
+       <ypad>0</ypad>
+       <xexpand>False</xexpand>
+       <yexpand>False</yexpand>
+       <xshrink>False</xshrink>
+       <yshrink>False</yshrink>
+       <xfill>True</xfill>
+       <yfill>True</yfill>
+      </child>
+
+      <widget>
+       <class>GtkSpinButton</class>
+       <name>timeout</name>
+       <width>64</width>
+       <tooltip>Maximum size a message is allowed to have to be checked</tooltip>
+       <can_focus>True</can_focus>
+       <climb_rate>1</climb_rate>
+       <digits>0</digits>
+       <numeric>True</numeric>
+       <update_policy>GTK_UPDATE_ALWAYS</update_policy>
+       <snap>False</snap>
+       <wrap>False</wrap>
+       <value>60</value>
+       <lower>0</lower>
+       <upper>10000</upper>
+       <step>10</step>
+       <page>10</page>
+       <page_size>10</page_size>
+       <child>
+         <padding>0</padding>
+         <expand>False</expand>
+         <fill>True</fill>
+         <pack>GTK_PACK_END</pack>
+       </child>
+      </widget>
+    </widget>
+
     <widget>
       <class>GtkLabel</class>
-      <name>label8</name>
-      <label>Save Folder</label>
-      <justify>GTK_JUSTIFY_LEFT</justify>
+      <name>label16</name>
+      <label>s</label>
+      <justify>GTK_JUSTIFY_CENTER</justify>
       <wrap>False</wrap>
       <xalign>0</xalign>
       <yalign>0.5</yalign>
       <xpad>0</xpad>
       <ypad>0</ypad>
       <child>
-       <left_attach>0</left_attach>
-       <right_attach>1</right_attach>
-       <top_attach>4</top_attach>
-       <bottom_attach>5</bottom_attach>
+       <left_attach>2</left_attach>
+       <right_attach>3</right_attach>
+       <top_attach>5</top_attach>
+       <bottom_attach>6</bottom_attach>
        <xpad>0</xpad>
        <ypad>0</ypad>
        <xexpand>False</xexpand>
       <child>
        <left_attach>0</left_attach>
        <right_attach>1</right_attach>
-       <top_attach>3</top_attach>
-       <bottom_attach>4</bottom_attach>
+       <top_attach>2</top_attach>
+       <bottom_attach>3</bottom_attach>
        <xpad>0</xpad>
        <ypad>0</ypad>
        <xexpand>False</xexpand>
       </child>
     </widget>
 
+    <widget>
+      <class>GtkCheckButton</class>
+      <name>receive_spam</name>
+      <tooltip>Save mails that where identified as spam to a folder</tooltip>
+      <can_focus>True</can_focus>
+      <label></label>
+      <active>False</active>
+      <draw_indicator>True</draw_indicator>
+      <child>
+       <left_attach>1</left_attach>
+       <right_attach>2</right_attach>
+       <top_attach>2</top_attach>
+       <bottom_attach>3</bottom_attach>
+       <xpad>0</xpad>
+       <ypad>0</ypad>
+       <xexpand>True</xexpand>
+       <yexpand>False</yexpand>
+       <xshrink>False</xshrink>
+       <yshrink>False</yshrink>
+       <xfill>True</xfill>
+       <yfill>False</yfill>
+      </child>
+    </widget>
+
     <widget>
       <class>GtkHBox</class>
-      <name>hbox1</name>
+      <name>hbox3</name>
       <homogeneous>False</homogeneous>
       <spacing>0</spacing>
       <child>
        <left_attach>1</left_attach>
        <right_attach>2</right_attach>
-       <top_attach>1</top_attach>
-       <bottom_attach>2</bottom_attach>
+       <top_attach>4</top_attach>
+       <bottom_attach>5</bottom_attach>
        <xpad>0</xpad>
        <ypad>0</ypad>
        <xexpand>True</xexpand>
        <yfill>True</yfill>
       </child>
 
-      <widget>
-       <class>GtkEntry</class>
-       <name>hostname</name>
-       <tooltip>Hostname or IP address of spamd server</tooltip>
-       <can_focus>True</can_focus>
-       <editable>True</editable>
-       <text_visible>True</text_visible>
-       <text_max_length>0</text_max_length>
-       <text></text>
-       <child>
-         <padding>0</padding>
-         <expand>True</expand>
-         <fill>True</fill>
-       </child>
-      </widget>
-
-      <widget>
-       <class>GtkLabel</class>
-       <name>label5</name>
-       <label>:</label>
-       <justify>GTK_JUSTIFY_CENTER</justify>
-       <wrap>False</wrap>
-       <xalign>0.5</xalign>
-       <yalign>0.5</yalign>
-       <xpad>8</xpad>
-       <ypad>0</ypad>
-       <child>
-         <padding>0</padding>
-         <expand>False</expand>
-         <fill>False</fill>
-       </child>
-      </widget>
-
       <widget>
        <class>GtkSpinButton</class>
-       <name>port</name>
+       <name>max_size</name>
        <width>64</width>
-       <tooltip>Port of spamd server</tooltip>
+       <tooltip>Maximum size a message is allowed to have to be checked</tooltip>
        <can_focus>True</can_focus>
        <climb_rate>1</climb_rate>
        <digits>0</digits>
        <update_policy>GTK_UPDATE_ALWAYS</update_policy>
        <snap>False</snap>
        <wrap>False</wrap>
-       <value>783</value>
-       <lower>1</lower>
-       <upper>65535</upper>
-       <step>1</step>
+       <value>250</value>
+       <lower>0</lower>
+       <upper>10000</upper>
+       <step>10</step>
        <page>10</page>
        <page_size>10</page_size>
        <child>
     </widget>
 
     <widget>
-      <class>GtkCheckButton</class>
-      <name>enable</name>
-      <tooltip>Enable SpamAssassin filtering</tooltip>
-      <can_focus>True</can_focus>
-      <label></label>
-      <active>False</active>
-      <draw_indicator>True</draw_indicator>
+      <class>GtkLabel</class>
+      <name>label11</name>
+      <label>kB</label>
+      <justify>GTK_JUSTIFY_CENTER</justify>
+      <wrap>False</wrap>
+      <xalign>0</xalign>
+      <yalign>0.5</yalign>
+      <xpad>0</xpad>
+      <ypad>0</ypad>
       <child>
-       <left_attach>1</left_attach>
-       <right_attach>2</right_attach>
-       <top_attach>0</top_attach>
-       <bottom_attach>1</bottom_attach>
+       <left_attach>2</left_attach>
+       <right_attach>3</right_attach>
+       <top_attach>4</top_attach>
+       <bottom_attach>5</bottom_attach>
        <xpad>0</xpad>
        <ypad>0</ypad>
-       <xexpand>True</xexpand>
+       <xexpand>False</xexpand>
        <yexpand>False</yexpand>
        <xshrink>False</xshrink>
        <yshrink>False</yshrink>
     </widget>
 
     <widget>
-      <class>GtkCheckButton</class>
-      <name>receive_spam</name>
-      <tooltip>Save mails that where identified as spam to a folder</tooltip>
-      <can_focus>True</can_focus>
-      <label></label>
-      <active>False</active>
-      <draw_indicator>True</draw_indicator>
+      <class>GtkLabel</class>
+      <name>label8</name>
+      <label>Save Folder</label>
+      <justify>GTK_JUSTIFY_LEFT</justify>
+      <wrap>False</wrap>
+      <xalign>0</xalign>
+      <yalign>0.5</yalign>
+      <xpad>0</xpad>
+      <ypad>0</ypad>
       <child>
-       <left_attach>1</left_attach>
-       <right_attach>2</right_attach>
+       <left_attach>0</left_attach>
+       <right_attach>1</right_attach>
        <top_attach>3</top_attach>
        <bottom_attach>4</bottom_attach>
        <xpad>0</xpad>
        <ypad>0</ypad>
-       <xexpand>True</xexpand>
+       <xexpand>False</xexpand>
        <yexpand>False</yexpand>
        <xshrink>False</xshrink>
        <yshrink>False</yshrink>
       <child>
        <left_attach>1</left_attach>
        <right_attach>2</right_attach>
-       <top_attach>4</top_attach>
-       <bottom_attach>5</bottom_attach>
+       <top_attach>3</top_attach>
+       <bottom_attach>4</bottom_attach>
        <xpad>0</xpad>
        <ypad>0</ypad>
        <xexpand>True</xexpand>
       <child>
        <left_attach>2</left_attach>
        <right_attach>3</right_attach>
-       <top_attach>4</top_attach>
-       <bottom_attach>5</bottom_attach>
+       <top_attach>3</top_attach>
+       <bottom_attach>4</bottom_attach>
        <xpad>0</xpad>
        <ypad>0</ypad>
        <xexpand>False</xexpand>
 
     <widget>
       <class>GtkLabel</class>
-      <name>label11</name>
-      <label>kB</label>
+      <name>label6</name>
+      <label>Maximum Size</label>
       <justify>GTK_JUSTIFY_CENTER</justify>
       <wrap>False</wrap>
       <xalign>0</xalign>
       <xpad>0</xpad>
       <ypad>0</ypad>
       <child>
-       <left_attach>2</left_attach>
-       <right_attach>3</right_attach>
-       <top_attach>2</top_attach>
-       <bottom_attach>3</bottom_attach>
+       <left_attach>0</left_attach>
+       <right_attach>1</right_attach>
+       <top_attach>4</top_attach>
+       <bottom_attach>5</bottom_attach>
        <xpad>0</xpad>
        <ypad>0</ypad>
        <xexpand>False</xexpand>
        <yfill>False</yfill>
       </child>
     </widget>
-
-    <widget>
-      <class>GtkHBox</class>
-      <name>hbox3</name>
-      <homogeneous>False</homogeneous>
-      <spacing>0</spacing>
-      <child>
-       <left_attach>1</left_attach>
-       <right_attach>2</right_attach>
-       <top_attach>2</top_attach>
-       <bottom_attach>3</bottom_attach>
-       <xpad>0</xpad>
-       <ypad>0</ypad>
-       <xexpand>True</xexpand>
-       <yexpand>False</yexpand>
-       <xshrink>False</xshrink>
-       <yshrink>False</yshrink>
-       <xfill>True</xfill>
-       <yfill>True</yfill>
-      </child>
-
-      <widget>
-       <class>GtkSpinButton</class>
-       <name>max_size</name>
-       <width>64</width>
-       <tooltip>Maximum size a message is allowed to have to be checked</tooltip>
-       <can_focus>True</can_focus>
-       <climb_rate>1</climb_rate>
-       <digits>0</digits>
-       <numeric>True</numeric>
-       <update_policy>GTK_UPDATE_ALWAYS</update_policy>
-       <snap>False</snap>
-       <wrap>False</wrap>
-       <value>250</value>
-       <lower>0</lower>
-       <upper>10000</upper>
-       <step>10</step>
-       <page>10</page>
-       <page_size>10</page_size>
-       <child>
-         <padding>0</padding>
-         <expand>False</expand>
-         <fill>True</fill>
-         <pack>GTK_PACK_END</pack>
-       </child>
-      </widget>
-    </widget>
   </widget>
 </widget>
 
index a5d88c3..9d66fc7 100644 (file)
@@ -845,6 +845,8 @@ static void prefs_toolbar_create(ToolbarPage *prefs_toolbar)
        gtk_signal_connect(GTK_OBJECT(down_btn), "clicked",
                           GTK_SIGNAL_FUNC(prefs_toolbar_down), prefs_toolbar);
        
+       gtk_widget_show_all(main_vbox);
+
        prefs_toolbar->clist_icons      = clist_icons;
        prefs_toolbar->clist_set        = clist_set;
        prefs_toolbar->combo_action     = combo_action;