diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-11-04 07:16:05 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-11-04 07:16:05 +0000 |
commit | 0bc96105b64744bb3d786c65c6736aa0df5cbf40 (patch) | |
tree | debaee52e8bfa47a6c1c4589e5cdba62cd455f88 | |
parent | de0ef006b2bcae3fbddf0ee549cf96497a25ad9f (diff) |
added preset menu for junk learning commands.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@713 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ChangeLog.ja | 7 | ||||
-rw-r--r-- | libsylph/prefs_common.c | 9 | ||||
-rw-r--r-- | src/prefs_common_dialog.c | 61 |
4 files changed, 82 insertions, 2 deletions
@@ -1,5 +1,12 @@ 2005-11-04 + * src/prefs_common_dialog.c: prefs_junk_create(): added preset menu + for learning commands. + * libsylph/prefs_common.c: made the default junk commands on win32 + bsfilter. + +2005-11-04 + * src/summaryview.c: summary_junk_func(): follow the 'mark_junk_as_read' setting. diff --git a/ChangeLog.ja b/ChangeLog.ja index a002943e..b00d8458 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,12 @@ 2005-11-04 + * src/prefs_common_dialog.c: prefs_junk_create(): 学習コマンドの + プリセットメニューを追加。 + * libsylph/prefs_common.c: win32 でのデフォルトの迷惑メールコマンドを + bsfilter にした。 + +2005-11-04 + * src/summaryview.c: summary_junk_func(): 'mark_junk_as_read' の設定 に従うようにした。 diff --git a/libsylph/prefs_common.c b/libsylph/prefs_common.c index a2b83d0e..c8a4f1c8 100644 --- a/libsylph/prefs_common.c +++ b/libsylph/prefs_common.c @@ -259,12 +259,21 @@ static PrefParam param[] = { /* Junk mail */ {"enable_junk", "FALSE", &prefs_common.enable_junk, P_BOOL}, +#ifdef G_OS_WIN32 + {"junk_learn_command", "bsfilterw -su", &prefs_common.junk_learncmd, + P_STRING}, + {"nojunk_learn_command", "bsfilterw -cu", + &prefs_common.nojunk_learncmd, P_STRING}, + {"junk_classify_command", "bsfilterw", + &prefs_common.junk_classify_cmd, P_STRING}, +#else {"junk_learn_command", "bogofilter -s -I", &prefs_common.junk_learncmd, P_STRING}, {"nojunk_learn_command", "bogofilter -n -I", &prefs_common.nojunk_learncmd, P_STRING}, {"junk_classify_command", "bogofilter -I", &prefs_common.junk_classify_cmd, P_STRING}, +#endif {"junk_folder", NULL, &prefs_common.junk_folder, P_STRING}, {"filter_junk_on_receive", "FALSE", &prefs_common.filter_junk_on_recv, P_BOOL}, diff --git a/src/prefs_common_dialog.c b/src/prefs_common_dialog.c index a43bc55a..45e0a81c 100644 --- a/src/prefs_common_dialog.c +++ b/src/prefs_common_dialog.c @@ -1559,6 +1559,43 @@ static void prefs_message_create(void) message.chkbtn_inline_image = chkbtn_inline_image; } +static const struct { + gchar *junk_cmd; + gchar *nojunk_cmd; + gchar *classify_cmd; +} junk_presets[] = { +#ifdef G_OS_WIN32 + {"bogofilter -s -I", "bogofilter -n -I", "bogofilter -I"}, + {"bsfilterw -su", "bsfilterw -cu", "bsfilterw"} +#else + {"bogofilter -s -I", "bogofilter -n -I", "bogofilter -I"}, + {"bsfilter -su", "bsfilter -cu", "bsfilter"} +#endif +}; + +enum +{ + JUNK_NONE, + JUNK_BOGOFILTER, + JUNK_BSFILTER +}; + +static void prefs_junk_preset_activated(GtkMenuItem *menuitem, gpointer data) +{ + gint i; + + i = (gint)g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID); + if (i > 0) { + i--; + gtk_entry_set_text(GTK_ENTRY(junk.entry_junk_learncmd), + junk_presets[i].junk_cmd); + gtk_entry_set_text(GTK_ENTRY(junk.entry_nojunk_learncmd), + junk_presets[i].nojunk_cmd); + gtk_entry_set_text(GTK_ENTRY(junk.entry_classify_cmd), + junk_presets[i].classify_cmd); + } +} + static void prefs_junk_create(void) { GtkWidget *vbox1; @@ -1567,6 +1604,9 @@ static void prefs_junk_create(void) GtkWidget *hbox; GtkWidget *chkbtn_enable_junk; GtkWidget *label; + GtkWidget *optmenu_preset; + GtkWidget *menu; + GtkWidget *menuitem; GtkWidget *entry_junk_learncmd; GtkWidget *entry_nojunk_learncmd; GtkWidget *entry_classify_cmd; @@ -1591,10 +1631,27 @@ static void prefs_junk_create(void) gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); SET_TOGGLE_SENSITIVITY (chkbtn_enable_junk, vbox2); + hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); + label = gtk_label_new (_("Learning command:")); gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + + optmenu_preset = gtk_option_menu_new (); + gtk_widget_show (optmenu_preset); + gtk_box_pack_end (GTK_BOX (hbox), optmenu_preset, FALSE, FALSE, 0); + + menu = gtk_menu_new (); + MENUITEM_ADD (menu, menuitem, _("(Select preset)"), 0); + MENUITEM_ADD (menu, menuitem, "bogofilter", JUNK_BOGOFILTER); + g_signal_connect (G_OBJECT (menuitem), "activate", + G_CALLBACK (prefs_junk_preset_activated), NULL); + MENUITEM_ADD (menu, menuitem, "bsfilter", JUNK_BSFILTER); + g_signal_connect (G_OBJECT (menuitem), "activate", + G_CALLBACK (prefs_junk_preset_activated), NULL); + gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_preset), menu); hbox = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox); |