*
* 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.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "defs.h"
#include <glib.h>
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <gtk/gtkutils.h>
#include "common/sylpheed.h"
#include "common/version.h"
-#include "intl.h"
#include "plugin.h"
#include "common/utils.h"
#include "prefs.h"
#include "prefs_gtk.h"
#include "foldersel.h"
#include "spamassassin.h"
+#include "statusbar.h"
+#include "menu.h"
struct SpamAssassinPage
{
default:
break;
}
- gtk_notebook_set_page(GTK_NOTEBOOK(page->transport_notebook), transport->page);
+ gtk_notebook_set_current_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));
+ transport = (struct Transport *) g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID);
show_transport(page, transport);
}
port = gtk_spin_button_new(GTK_ADJUSTMENT(port_adj), 1, 0);
gtk_widget_show(port);
gtk_box_pack_end(GTK_BOX(hbox1), port, FALSE, TRUE, 0);
- gtk_widget_set_usize(port, 64, -2);
+ gtk_widget_set_size_request(port, 64, -2);
gtk_tooltips_set_tip(tooltips, port, _("Port of spamd server"),
NULL);
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(port), TRUE);
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_widget_set_size_request(timeout, 64, -2);
gtk_tooltips_set_tip(tooltips, timeout,
_
("Time that is allowed for checking. If the check takes longer the check will be aborted and the message will be handled as not spam."),
max_size = gtk_spin_button_new(GTK_ADJUSTMENT(max_size_adj), 1, 0);
gtk_widget_show(max_size);
gtk_box_pack_end(GTK_BOX(hbox3), max_size, FALSE, TRUE, 0);
- gtk_widget_set_usize(max_size, 64, -2);
+ gtk_widget_set_size_request(max_size, 64, -2);
gtk_tooltips_set_tip(tooltips, max_size,
_
("Maximum size a message is allowed to have to be checked"),
("Folder that will be used to save spam. Leave empty to use the default trash folder"),
NULL);
- button4 = gtk_button_new_with_label(_("..."));
+ button4 = gtkut_get_browse_directory_btn(_("_Browse"));
gtk_widget_show(button4);
gtk_table_attach(GTK_TABLE(table), button4, 2, 3, 3, 4,
(GtkAttachOptions) (GTK_SHRINK | GTK_FILL),
config = spamassassin_get_config();
- gtk_signal_connect(GTK_OBJECT(button4), "released", GTK_SIGNAL_FUNC(foldersel_cb), page);
+ g_signal_connect(G_OBJECT(button4), "released",
+ G_CALLBACK(foldersel_cb), page);
if (config->hostname != NULL)
gtk_entry_set_text(GTK_ENTRY(hostname), config->hostname);
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);
+ g_object_set_data(G_OBJECT(menuitem), MENU_VAL_ID, &transports[i]);
+ g_signal_connect(G_OBJECT(menuitem), "activate",
+ G_CALLBACK(transport_sel_cb), page);
gtk_widget_show(menuitem);
gtk_menu_append(GTK_MENU(transport_menu), menuitem);
spamassassin_save_config();
}
+static void gtk_message_callback(gchar *message)
+{
+ statusbar_print_all(message);
+}
+
static struct SpamAssassinPage spamassassin_page;
-gint plugin_init(gchar **error)
+gint spamassassin_gtk_init(void)
{
- if ((sylpheed_get_version() > VERSION_NUMERIC)) {
- *error = g_strdup("Your sylpheed version is newer than the version the plugin was built with");
- return -1;
- }
+ static gchar *path[3];
- if ((sylpheed_get_version() < MAKE_NUMERIC_VERSION(0, 9, 3, 86))) {
- *error = g_strdup("Your sylpheed version is too old");
- return -1;
- }
+ path[0] = _("Plugins");
+ path[1] = _("SpamAssassin");
+ path[2] = NULL;
- spamassassin_page.page.path = _("Filtering/SpamAssassin");
+ spamassassin_page.page.path = path;
spamassassin_page.page.create_widget = spamassassin_create_widget_func;
spamassassin_page.page.destroy_widget = spamassassin_destroy_widget_func;
spamassassin_page.page.save_page = spamassassin_save_func;
spamassassin_page.page.weight = 35.0;
prefs_gtk_register_page((PrefsPage *) &spamassassin_page);
+ spamassassin_set_message_callback(gtk_message_callback);
debug_print("SpamAssassin GTK plugin loaded\n");
return 0;
}
-void plugin_done(void)
-{
- prefs_gtk_unregister_page((PrefsPage *) &spamassassin_page);
-
- debug_print("SpamAssassin GTK plugin unloaded\n");
-}
-
-const gchar *plugin_name(void)
-{
- return _("SpamAssassin GTK");
-}
-
-const gchar *plugin_desc(void)
-{
- return _("This plugin provides a Preferences page for the SpamAssassin "
- "plugin.\n"
- "\n"
- "You will find the options in the Other Preferences window "
- "under Filtering/SpamAssassin.\n"
- "\n"
- "With this plugin you can enable the filtering, change the "
- "SpamAssassin server host and port, set the maximum size of "
- "messages to be checked, (if the message is larger it will "
- "not be checked), configure whether spam mail should be received "
- "(default: Yes) and select the folder where spam mail will be "
- "saved.\n");
-}
-
-const gchar *plugin_type(void)
+void spamassassin_gtk_done(void)
{
- return "GTK";
+ prefs_gtk_unregister_page((PrefsPage *) &spamassassin_page);
}