0.8.8claws33
authorChristoph Hohmann <reboot@gmx.ch>
Wed, 1 Jan 2003 16:30:29 +0000 (16:30 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Wed, 1 Jan 2003 16:30:29 +0000 (16:30 +0000)
* src/mainwindow.c
* src/gtk/Makefile.am
* src/gtk/pluginwindow.c                ** NEW **
* src/gtk/pluginwindow.h                ** NEW **
        add plugin window

* src/plugins/demo/demo.c
* src/plugins/spamassassin/spamassassin.c
* src/plugins/spamassassin/spamassassin_gtk.c
        write better plugin descriptions

ChangeLog.claws
configure.in
src/gtk/Makefile.am
src/gtk/pluginwindow.c [new file with mode: 0644]
src/gtk/pluginwindow.h [new file with mode: 0644]
src/mainwindow.c
src/plugins/demo/demo.c
src/plugins/spamassassin/spamassassin.c
src/plugins/spamassassin/spamassassin_gtk.c

index 62a048b..91aaaf9 100644 (file)
@@ -1,4 +1,17 @@
-2001-12-31 [christoph] 0.8.8claws32
+2003-01-01 [christoph] 0.8.8claws33
+
+       * src/mainwindow.c
+       * src/gtk/Makefile.am
+       * src/gtk/pluginwindow.c                ** NEW **
+       * src/gtk/pluginwindow.h                ** NEW **
+               add plugin window
+
+       * src/plugins/demo/demo.c
+       * src/plugins/spamassassin/spamassassin.c
+       * src/plugins/spamassassin/spamassassin_gtk.c
+               write better plugin descriptions
+
+2002-12-31 [christoph] 0.8.8claws32
 
        * src/gtk/prefswindow.c
        * src/plugins/spamassassin/spamassassin_gtk.c
index 1088b73..6e520b9 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws32
+EXTRA_VERSION=claws33
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index bb82fd7..67abeb8 100644 (file)
@@ -6,6 +6,7 @@ libsylpheedgtk_la_SOURCES = \
        gtkstext.c gtkstext.h \
        manage_window.c manage_window.h \
        menu.c menu.h \
+       pluginwindow.c pluginwindow.h \
        prefswindow.c prefswindow.h \
        sslcertwindow.c sslcertwindow.h
 
diff --git a/src/gtk/pluginwindow.c b/src/gtk/pluginwindow.c
new file mode 100644 (file)
index 0000000..cb90232
--- /dev/null
@@ -0,0 +1,205 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto and 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 <string.h>
+
+#include <gtk/gtk.h>
+
+#include "intl.h"
+#include "plugin.h"
+
+typedef struct _PluginWindow
+{
+       GtkWidget *window;
+       GtkWidget *plugin_list;
+       GtkWidget *plugin_desc;
+
+       Plugin *selected_plugin;
+} PluginWindow;
+
+static void close_cb(GtkButton *button, PluginWindow *pluginwindow)
+{
+       gtk_widget_destroy(pluginwindow->window);
+       g_free(pluginwindow);
+}
+
+static void set_plugin_list(PluginWindow *pluginwindow)
+{
+       GSList *plugins, *cur;
+       gchar *text[1];
+       gint row;
+       GtkCList *clist = GTK_CLIST(pluginwindow->plugin_list);
+       
+       plugins = plugin_get_list();
+       gtk_clist_freeze(clist);
+       gtk_clist_clear(clist);
+       
+       for(cur = plugins; cur != NULL; cur = g_slist_next(cur)) {
+               Plugin *plugin = (Plugin *) cur->data;
+               
+               text[0] = (gchar *) plugin_get_name(plugin);
+               row = gtk_clist_append(clist, text);
+               gtk_clist_set_row_data(clist, row, plugin);
+       }
+       gtk_clist_thaw(clist);
+}
+
+static void select_row_cb(GtkCList *clist, gint row, gint column,
+                         GdkEventButton *event, PluginWindow *pluginwindow)
+{
+       Plugin *plugin;
+       GtkEditable *plugin_desc = GTK_EDITABLE(pluginwindow->plugin_desc);
+       const gchar *text;
+       gint pos = 0;
+       
+       plugin = (Plugin *) gtk_clist_get_row_data(clist, row);
+       pluginwindow->selected_plugin = plugin;
+
+       gtk_editable_delete_text(plugin_desc, 0, -1);
+       text = plugin_get_desc(plugin);
+       gtk_editable_insert_text(plugin_desc, text, strlen(text), &pos);
+}
+
+void pluginwindow_create()
+{
+       PluginWindow *pluginwindow;
+       /* ---------------------- code made by glade ---------------------- */
+       GtkWidget *window;
+       GtkWidget *vbox1;
+       GtkWidget *hbox2;
+       GtkWidget *scrolledwindow2;
+       GtkWidget *plugin_list;
+       GtkWidget *label12;
+       GtkWidget *vbox2;
+       GtkWidget *frame2;
+       GtkWidget *label13;
+       GtkWidget *scrolledwindow3;
+       GtkWidget *plugin_desc;
+       GtkWidget *hbuttonbox1;
+       GtkWidget *load_btn;
+       GtkWidget *unload_btn;
+       GtkWidget *close_btn;
+
+       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+       gtk_container_set_border_width(GTK_CONTAINER(window), 8);
+       gtk_window_set_default_size(GTK_WINDOW(window), 480, 300);
+       gtk_window_set_title(GTK_WINDOW(window), _("Plugins"));
+       gtk_window_set_position(GTK_WINDOW(window),
+                               GTK_WIN_POS_CENTER);
+       gtk_window_set_modal(GTK_WINDOW(window), TRUE);
+
+       vbox1 = gtk_vbox_new(FALSE, 4);
+       gtk_widget_show(vbox1);
+       gtk_container_add(GTK_CONTAINER(window), vbox1);
+
+       hbox2 = gtk_hbox_new(FALSE, 8);
+       gtk_widget_show(hbox2);
+       gtk_box_pack_start(GTK_BOX(vbox1), hbox2, TRUE, TRUE, 0);
+
+       scrolledwindow2 = gtk_scrolled_window_new(NULL, NULL);
+       gtk_widget_show(scrolledwindow2);
+       gtk_box_pack_start(GTK_BOX(hbox2), scrolledwindow2, TRUE, TRUE, 0);
+       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
+                                      (scrolledwindow2), GTK_POLICY_NEVER,
+                                      GTK_POLICY_ALWAYS);
+
+       plugin_list = gtk_clist_new(1);
+       gtk_widget_show(plugin_list);
+       gtk_container_add(GTK_CONTAINER(scrolledwindow2), plugin_list);
+       gtk_clist_set_column_width(GTK_CLIST(plugin_list), 0, 80);
+       gtk_clist_column_titles_show(GTK_CLIST(plugin_list));
+
+       label12 = gtk_label_new(_("Plugins"));
+       gtk_widget_show(label12);
+       gtk_clist_set_column_widget(GTK_CLIST(plugin_list), 0, label12);
+       gtk_label_set_justify(GTK_LABEL(label12), GTK_JUSTIFY_LEFT);
+       gtk_misc_set_alignment(GTK_MISC(label12), 7.45058e-09, 0.5);
+
+       vbox2 = gtk_vbox_new(FALSE, 0);
+       gtk_widget_show(vbox2);
+       gtk_box_pack_start(GTK_BOX(hbox2), vbox2, TRUE, TRUE, 0);
+
+       frame2 = gtk_frame_new(NULL);
+       gtk_widget_show(frame2);
+       gtk_box_pack_start(GTK_BOX(vbox2), frame2, FALSE, TRUE, 0);
+
+       label13 = gtk_label_new(_("Description"));
+       gtk_widget_show(label13);
+       gtk_container_add(GTK_CONTAINER(frame2), label13);
+       gtk_misc_set_alignment(GTK_MISC(label13), 7.45058e-09, 0.5);
+       gtk_misc_set_padding(GTK_MISC(label13), 2, 2);
+
+       scrolledwindow3 = gtk_scrolled_window_new(NULL, NULL);
+       gtk_widget_show(scrolledwindow3);
+       gtk_box_pack_start(GTK_BOX(vbox2), scrolledwindow3, TRUE, TRUE, 0);
+       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
+                                      (scrolledwindow3), GTK_POLICY_NEVER,
+                                      GTK_POLICY_ALWAYS);
+
+       plugin_desc = gtk_text_new(NULL, NULL);
+       gtk_widget_show(plugin_desc);
+       gtk_container_add(GTK_CONTAINER(scrolledwindow3), plugin_desc);
+
+       hbuttonbox1 = gtk_hbutton_box_new();
+       gtk_widget_show(hbuttonbox1);
+       gtk_box_pack_start(GTK_BOX(vbox1), hbuttonbox1, FALSE, FALSE, 0);
+       gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox1),
+                                 GTK_BUTTONBOX_END);
+       gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbuttonbox1), 0);
+
+       load_btn = gtk_button_new_with_label(_("Load Plugin"));
+       gtk_widget_show(load_btn);
+       gtk_container_add(GTK_CONTAINER(hbuttonbox1), load_btn);
+       GTK_WIDGET_SET_FLAGS(load_btn, GTK_CAN_DEFAULT);
+
+       unload_btn = gtk_button_new_with_label(_("Unload Plugin"));
+       gtk_widget_show(unload_btn);
+       gtk_container_add(GTK_CONTAINER(hbuttonbox1), unload_btn);
+       GTK_WIDGET_SET_FLAGS(unload_btn, GTK_CAN_DEFAULT);
+
+       close_btn = gtk_button_new_with_label(_("Close"));
+       gtk_widget_show(close_btn);
+       gtk_container_add(GTK_CONTAINER(hbuttonbox1), close_btn);
+       GTK_WIDGET_SET_FLAGS(close_btn, GTK_CAN_DEFAULT);
+       /* ----------------------------------------------------------- */
+
+       gtk_text_set_word_wrap(GTK_TEXT(plugin_desc), TRUE);
+       gtk_widget_set_sensitive(GTK_WIDGET(load_btn), FALSE);
+       gtk_widget_set_sensitive(GTK_WIDGET(unload_btn), FALSE);
+
+       pluginwindow = g_new0(PluginWindow, 1);
+
+       gtk_signal_connect(GTK_OBJECT(close_btn), "released",
+                          GTK_SIGNAL_FUNC(close_cb), pluginwindow);
+       gtk_signal_connect(GTK_OBJECT(plugin_list), "select-row",
+                          GTK_SIGNAL_FUNC(select_row_cb), pluginwindow);
+
+       pluginwindow->window = window;
+       pluginwindow->plugin_list = plugin_list;
+       pluginwindow->plugin_desc = plugin_desc;
+       pluginwindow->selected_plugin = NULL;
+
+       set_plugin_list(pluginwindow);
+
+       gtk_widget_show(window);
+}
diff --git a/src/gtk/pluginwindow.h b/src/gtk/pluginwindow.h
new file mode 100644 (file)
index 0000000..f480f90
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto and 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 PLUGINWINDOW_H
+#define PLUGINWINDOW_H 1
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+void pluginwindow_create();
+
+#endif
index faf60fd..779ff8e 100644 (file)
@@ -85,6 +85,7 @@
 #include "ssl_manager.h"
 #include "sslcertwindow.h"
 #include "prefswindow.h"
+#include "pluginwindow.h"
 
 #define AC_LABEL_WIDTH 240
 
@@ -374,6 +375,8 @@ static void account_menu_cb  (GtkMenuItem   *menuitem,
 
 static void prefs_open_cb      (GtkMenuItem    *menuitem,
                                 gpointer        data);
+static void plugins_open_cb    (GtkMenuItem    *menuitem,
+                                gpointer        data);
 
 static void online_switch_clicked(GtkButton     *btn, 
                                  gpointer data);
@@ -698,6 +701,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
                                                NULL, NULL, 0, "<Branch>"},
        {N_("/_Configuration/---"),             NULL, NULL, 0, "<Separator>"},
        {N_("/_Configuration/Preferences..."),  NULL, prefs_open_cb, 0, NULL},
+       {N_("/_Configuration/Plugins..."),      NULL, plugins_open_cb, 0, NULL},
 
        {N_("/_Help"),                          NULL, NULL, 0, "<Branch>"},
        {N_("/_Help/_Manual (Local)"),          NULL, manual_open_cb, MANUAL_MANUAL_LOCAL, NULL},
@@ -2608,6 +2612,11 @@ static void prefs_open_cb(GtkMenuItem *menuitem, gpointer data)
        prefswindow_create();
 }
 
+static void plugins_open_cb(GtkMenuItem *menuitem, gpointer data)
+{
+       pluginwindow_create();
+}
+
 static void manual_open_cb(MainWindow *mainwin, guint action,
                           GtkWidget *widget)
 {
index fd46655..caa134d 100644 (file)
@@ -55,10 +55,13 @@ void plugin_done()
 
 const gchar *plugin_name()
 {
-       return "Dummy plugin";
+       return "Demo";
 }
 
 const gchar *plugin_desc()
 {
-       return "Plugin that does nothing and never loads";
+       return "This Plugin is only a demo of how to write plugins for Sylpheed. "
+              "It installs a hook for new log output and writes it to stdout."
+              "\n\n"
+              "It is not really usefull";
 }
index 28400dd..99a4743 100644 (file)
@@ -232,6 +232,15 @@ const gchar *plugin_name()
 
 const gchar *plugin_desc()
 {
-       return "Check incoming mails for spam with SpamAssassin";
+       return "This plugin checks all messages that are received from a POP "
+              "account for spam using a SpamAssassin server. You will need "
+              "a SpamAssassin Server (spamd) running somewhere.\n"
+              "\n"
+              "When a message is identified as spam it can be deleted or "
+              "saved into a special folder.\n"
+              "\n"
+              "This plugin only contains the actual function for filtering "
+              "and deleting or moving the message. You probably want to load "
+              "a User Interface plugin too. Otherwise you would have to "
+              "manually write the plugin configuration.\n";
 }
-
index 651d91d..87088fb 100644 (file)
@@ -282,5 +282,16 @@ const gchar *plugin_name()
 
 const gchar *plugin_desc()
 {
-       return "";
+       return "This plugin provides a Preferences page for the SpamAssassin "
+              "plugin.\n"
+              "\n"
+              "You will find the options in the Preferences window under "
+              "Filtering/SpamAssassin.\n"
+              "\n"
+              "With this plugin you can enable the filtering, change the "
+              "SpamAssassin server's host  and port, the maximum size that "
+              "a message is allowed to have (if the message is larger it "
+              "will not be checked), set the option if spam mails "
+              "should be received at all (default) and select the folder "
+              "where spam mails will be saved.\n";
 }