CVS: sylpheedclaws/sylpheed-claws/src toolbar.c,1.43.2.57,1.43.2.58 toolbar.h,1.19.2.13,1.19.2.14

[email protected] Fri, 22 Dec 2006 09:55:41 +0000
Newsgroups gmane.mail.sylpheed.claws.cvs
Message-ID <[email protected]>
Update of /pack/anoncvs/sylpheedclaws/sylpheed-claws/src
In directory sunsite.dk:/tmp/cvs-serv19611/src

Modified Files:
      Tag: gtk2
	toolbar.c toolbar.h 
Log Message:
2006-12-22 [colin]	2.6.1cvs64

	* src/toolbar.c
	* src/toolbar.h
		Add a combo to the learn spam button
	* src/plugins/bogofilter/bogofilter.c
	* src/plugins/bogofilter/bogofilter_gtk.c
	* src/plugins/bogofilter/bogofilter.h
		Allow to store Unsure mails in a specific
		folder to make better teaching easier

Index: toolbar.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/toolbar.c,v
retrieving revision 1.43.2.57
retrieving revision 1.43.2.58
diff -u -d -r1.43.2.57 -r1.43.2.58
--- toolbar.c	2006/12/16 17:12:16	1.43.2.57
+++ toolbar.c	2006/12/22 09:55:37	1.43.2.58
@@ -89,6 +89,8 @@
 /* toolbar callbacks */
 static void toolbar_reply			(gpointer 	 data, 
 						 guint 		 action);
+static void toolbar_learn			(gpointer 	 data, 
+						 guint 		 action);
 static void toolbar_delete_cb			(GtkWidget	*widget,
 					 	 gpointer        data);
 static void toolbar_trash_cb			(GtkWidget	*widget,
@@ -238,6 +240,11 @@
 	{N_("/For_ward as attachment"), "<shift>F", toolbar_reply, COMPOSE_FORWARD_AS_ATTACH, NULL},
 	{N_("/Redirec_t"),		NULL, 	    toolbar_reply, COMPOSE_REDIRECT, NULL}
 };
+static GtkItemFactoryEntry learn_entries[] =
+{
+	{N_("/Learn as _Spam"),		NULL,	toolbar_learn, TRUE, NULL},
+	{N_("/Learn as _Ham"), 		NULL,	toolbar_learn, FALSE, NULL}
+};
 
 
 gint toolbar_ret_val_from_descr(const gchar *descr)
@@ -1007,6 +1014,34 @@
 	}
 }
 
+static void toolbar_learn(gpointer data, guint as_spam)
+{
+	ToolbarItem *toolbar_item = (ToolbarItem*)data;
+	MainWindow *mainwin;
+	MessageView *msgview;
+
+	g_return_if_fail(toolbar_item != NULL);
+
+	switch (toolbar_item->type) {
+	case TOOLBAR_MAIN:
+		mainwin = (MainWindow*)toolbar_item->parent;
+		if (as_spam) 
+			mainwindow_learn(mainwin, TRUE);
+		else
+			mainwindow_learn(mainwin, FALSE);
+		break;
+	case TOOLBAR_MSGVIEW:
+		msgview = (MessageView*)toolbar_item->parent;
+		if (as_spam) 
+			messageview_learn(msgview, TRUE);
+		else
+			messageview_learn(msgview, FALSE);
+		break;
+	default:
+		debug_print("toolbar event not supported\n");
+	}
+}
+
 static void toolbar_learn_cb(GtkWidget *widget, gpointer data)
 {
 	ToolbarItem *toolbar_item = (ToolbarItem*)data;
@@ -1443,6 +1478,7 @@
 	ComboButton *replysender_combo;
 	ComboButton *fwd_combo;
 	ComboButton *compose_combo;
+	ComboButton *ham_combo;
 
 	GtkTooltips *toolbar_tips;
 	ToolbarSylpheedActions *action_item;
@@ -1559,6 +1595,17 @@
 			gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips), 
 					     toolbar_data->learn_ham_btn,
 					   _("Learn Ham"), NULL);			
+			n_menu_entries = sizeof(learn_entries) / 
+				sizeof(learn_entries[0]);
+			ham_combo = gtkut_combo_button_create(toolbar_data->learn_spam_btn,
+					      learn_entries, n_menu_entries,
+					      "<LearnSpam>", (gpointer)toolbar_item);
+			gtk_button_set_relief(GTK_BUTTON(ham_combo->arrow),
+					      GTK_RELIEF_NONE);
+			gtk_toolbar_append_widget(GTK_TOOLBAR(toolbar),
+				  		  GTK_WIDGET_PTR(ham_combo),
+				 		  _("Learn as..."), "Learn");
+			toolbar_data->ham_combo = ham_combo;
 			break;
 		case A_REPLY_MESSAGE:
 			toolbar_data->reply_btn = item;
@@ -1967,6 +2014,10 @@
 
 	if (toolbar->learn_spam_btn)
 		SET_WIDGET_COND(toolbar->learn_spam_btn, 
+			M_TARGET_EXIST|M_CAN_LEARN_SPAM);
+
+	if (toolbar->ham_combo)
+		SET_WIDGET_COND(GTK_WIDGET_PTR(toolbar->ham_combo),
 			M_TARGET_EXIST|M_CAN_LEARN_SPAM);
 
 	if (toolbar->cancel_inc_btn)

Index: toolbar.h
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/toolbar.h,v
retrieving revision 1.19.2.13
retrieving revision 1.19.2.14
diff -u -d -r1.19.2.13 -r1.19.2.14
--- toolbar.h	2006/12/16 17:12:16	1.19.2.13
+++ toolbar.h	2006/12/22 09:55:37	1.19.2.14
@@ -79,6 +79,8 @@
 	GtkWidget *separator;
 	GtkWidget *learn_spam_btn;
 	GtkWidget *learn_ham_btn;
+	ComboButton *ham_combo;
+	
 	GtkWidget *cancel_inc_btn;
 	
 	ComposeButtonType compose_btn_type;