[Commits] [SCM] claws branch, master, updated. 3.9.1-12-gc7cd049

mones at claws-mail.org mones at claws-mail.org
Tue May 21 00:53:21 CEST 2013


The branch master of project "claws" (Claws Mail) has been updated
       via  c7cd049a3435593a83fd823a67f1e5d3344ae14d (commit)
       via  4b8a56c56f5c683d820e84327f90307bbfdfea29 (commit)
      from  e77b9943b358fa19d29061358191f1c9e463e998 (commit)


- Log -----------------------------------------------------------------
commit c7cd049a3435593a83fd823a67f1e5d3344ae14d
Author: Ricardo Mones <ricardo at mones.org>
Date:   Mon May 20 23:52:56 2013 +0200

    Reorganise and beautify AttachWarner preferences
    
    Use frames to separate options about what to search from the
    options about where not to search and give it a more pleasant
    appearance, and, hopefully, make it easier to understand.
    
    Reworded skip quotes ckeckbox tip to warn about user-inserted
    quotation marks.

diff --git a/src/plugins/attachwarner/attachwarner_prefs.c b/src/plugins/attachwarner/attachwarner_prefs.c
index 82fe167..a635d97 100644
--- a/src/plugins/attachwarner/attachwarner_prefs.c
+++ b/src/plugins/attachwarner/attachwarner_prefs.c
@@ -69,7 +69,8 @@ static void attwarner_prefs_create_widget_func(PrefsPage * _page,
 					   gpointer data)
 {
 	struct AttachWarnerPrefsPage *page = (struct AttachWarnerPrefsPage *) _page;
-	GtkWidget *vbox, *hbox;;
+	GtkWidget *vbox, *vbox1, *vbox2;
+	GtkWidget *frame;
 	GtkWidget *label;
 	GtkWidget *scrolledwin;
 	GtkTextBuffer *buffer;
@@ -78,17 +79,17 @@ static void attwarner_prefs_create_widget_func(PrefsPage * _page,
 	GtkWidget *skip_signature_checkbox;
 	GtkWidget *case_sensitive_checkbox;
 
-	vbox = gtk_vbox_new(FALSE, 6);
-	hbox = gtk_hbox_new(FALSE, 6);
+	vbox1 = gtk_vbox_new(FALSE, 6);
+	vbox2 = gtk_vbox_new(FALSE, 6);
 	
-	label = gtk_label_new(_("Warn when matching the following regular expressions:\n(one per line)"));
+	label = gtk_label_new(_("One of the following regular expressions is matched (one per line):"));
 	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 6);
+	gtk_box_pack_start(GTK_BOX(vbox1), label, FALSE, FALSE, 0);
 
-	case_sensitive_checkbox = gtk_check_button_new_with_label(_("Case sensitive"));
+	case_sensitive_checkbox = gtk_check_button_new_with_label(_("Expressions are case sensitive"));
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(case_sensitive_checkbox),
 	    	 attwarnerprefs.case_sensitive);
-	gtk_box_pack_start(GTK_BOX(vbox), case_sensitive_checkbox, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox1), case_sensitive_checkbox, FALSE, FALSE, 0);
 	gtk_widget_show(case_sensitive_checkbox);
 
 	CLAWS_SET_TIP(case_sensitive_checkbox,
@@ -108,42 +109,52 @@ static void attwarner_prefs_create_widget_func(PrefsPage * _page,
 
 	gtk_container_add(GTK_CONTAINER(scrolledwin), page->regexp_text);
 	gtk_widget_set_size_request(page->regexp_text, -1, 100);
-	gtk_box_pack_start(GTK_BOX(vbox), scrolledwin, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox1), scrolledwin, FALSE, FALSE, 0);
 	
-	skip_quotes_checkbox = gtk_check_button_new_with_label(_("Skip quoted lines"));
+	skip_quotes_checkbox = gtk_check_button_new_with_label(_("Lines starting with quotation marks"));
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(skip_quotes_checkbox),
 	    	 attwarnerprefs.skip_quotes);
-	gtk_box_pack_start(GTK_BOX(vbox), skip_quotes_checkbox, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox2), skip_quotes_checkbox, FALSE, FALSE, 0);
 	gtk_widget_show(skip_quotes_checkbox);
 
 	CLAWS_SET_TIP(skip_quotes_checkbox,
-			_("Exclude quoted lines from checking for the regular expressions above"));
+			_("Exclude quoted lines from checking for the regular expressions above. Note that handmade quotes cannot be distinguished from quotes generated by replying."));
 	page->skip_quotes_checkbox = skip_quotes_checkbox;
 	
-	skip_fwd_redir_checkbox = gtk_check_button_new_with_label(_("Skip forwards and redirections"));
+	skip_fwd_redir_checkbox = gtk_check_button_new_with_label(_("Forwarded or redirected messages"));
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(skip_fwd_redir_checkbox),
 	    	 attwarnerprefs.skip_forwards_and_redirections);
-	gtk_box_pack_start(GTK_BOX(vbox), skip_fwd_redir_checkbox, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox2), skip_fwd_redir_checkbox, FALSE, FALSE, 0);
 	gtk_widget_show(skip_fwd_redir_checkbox);
 
 	CLAWS_SET_TIP(skip_fwd_redir_checkbox,
 			_("Don't check for missing attachments when forwarding or redirecting messages"));
 	page->skip_forwards_and_redirections = skip_fwd_redir_checkbox;
 
-	skip_signature_checkbox = gtk_check_button_new_with_label(_("Skip signature"));
+	skip_signature_checkbox = gtk_check_button_new_with_label(_("Signatures"));
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(skip_signature_checkbox),
 	    	 attwarnerprefs.skip_signature);
-	gtk_box_pack_start(GTK_BOX(vbox), skip_signature_checkbox, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox2), skip_signature_checkbox, FALSE, FALSE, 0);
 	gtk_widget_show(skip_signature_checkbox);
 
 	CLAWS_SET_TIP(skip_signature_checkbox,
 			_("Exclude lines from the first signature-separator onwards from checking for the regular expressions above"));
 	page->skip_signature = skip_signature_checkbox;
 	
-	gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 6);
-	gtk_widget_show_all(hbox);
+	vbox = gtk_vbox_new(FALSE, VSPACING);
+	gtk_container_set_border_width (GTK_CONTAINER (vbox), VBOX_BORDER);
+
+	PACK_FRAME (vbox, frame, _("Warn when"));
+	gtk_container_set_border_width(GTK_CONTAINER(vbox1), 6);
+	gtk_container_add(GTK_CONTAINER(frame), vbox1);
+
+	PACK_FRAME (vbox, frame, _("Excluding"));
+	gtk_container_set_border_width(GTK_CONTAINER(vbox2), 4);
+	gtk_container_add(GTK_CONTAINER(frame), vbox2);
+
+	gtk_widget_show_all(vbox);
 	
-	page->page.widget = hbox;
+	page->page.widget = vbox;
 }
 
 static void attwarner_prefs_destroy_widget_func(PrefsPage *_page)

commit 4b8a56c56f5c683d820e84327f90307bbfdfea29
Author: Ricardo Mones <ricardo at mones.org>
Date:   Mon May 20 22:59:57 2013 +0200

    Fix #2927 'Optional case insensitivity for the attach-warner-plugin'
    
    Based on original patch provided by Henri Bauer <henri.bauer at voila.fr>

diff --git a/src/matcher.c b/src/matcher.c
index c95655c..93df515 100644
--- a/src/matcher.c
+++ b/src/matcher.c
@@ -1188,10 +1188,12 @@ static gchar *build_complete_regexp(gchar **strings)
  *
  *\param	lines String with "\n"-separated expressions
  *\param	bool_and Operator
+ *\param	case_sensitive If the matching is case sensitive or not
  *
  *\return	MatcherList * New matcher list
  */
-MatcherList *matcherlist_new_from_lines(gchar *lines, gboolean bool_and)
+MatcherList *matcherlist_new_from_lines(gchar *lines, gboolean bool_and, 
+					gboolean case_sensitive)
 {
 	MatcherProp *m = NULL;
 	GSList *matchers = NULL;
@@ -1202,8 +1204,9 @@ MatcherList *matcherlist_new_from_lines(gchar *lines, gboolean bool_and)
 	expr = build_complete_regexp(strings);
 	debug_print("building matcherprop for expr '%s'\n", expr?expr:"NULL");
 	
-	m = matcherprop_new(MATCHCRITERIA_SUBJECT, NULL, MATCHTYPE_REGEXP, 
-			    expr, 0);
+	m = matcherprop_new(MATCHCRITERIA_SUBJECT, NULL,
+			case_sensitive? MATCHTYPE_REGEXP: MATCHTYPE_REGEXPCASE,
+			expr, 0);
 	if (m == NULL) {
 		/* print error message */
 		debug_print("failed to allocate memory for matcherprop\n");
@@ -1215,8 +1218,9 @@ MatcherList *matcherlist_new_from_lines(gchar *lines, gboolean bool_and)
 #else
 	int i = 0;
 	while (strings && strings[i] && *strings[i]) {
-		m = matcherprop_new(MATCHCRITERIA_SUBJECT, NULL, MATCHTYPE_MATCHCASE, 
-			    strings[i], 0);
+		m = matcherprop_new(MATCHCRITERIA_SUBJECT, NULL,
+			case_sensitive? MATCHTYPE_MATCH: MATCHTYPE_MATCHCASE
+			strings[i], 0);
 		if (m == NULL) {
 			/* print error message */
 			debug_print("failed to allocate memory for matcherprop\n");
diff --git a/src/matcher.h b/src/matcher.h
index 13542a6..9a6c898 100644
--- a/src/matcher.h
+++ b/src/matcher.h
@@ -163,7 +163,8 @@ MatcherProp *matcherprop_copy		(const MatcherProp *src);
 MatcherList * matcherlist_new		(GSList		*matchers, 
 					 gboolean	bool_and);
 MatcherList * matcherlist_new_from_lines(gchar		*lines,
-					 gboolean	bool_and);
+					 gboolean	bool_and,
+					 gboolean	case_sensitive);
 void matcherlist_free			(MatcherList	*cond);
 
 MatcherList *matcherlist_parse		(gchar		**str);
diff --git a/src/plugins/address_keeper/address_keeper.c b/src/plugins/address_keeper/address_keeper.c
index be4f053..673fe12 100644
--- a/src/plugins/address_keeper/address_keeper.c
+++ b/src/plugins/address_keeper/address_keeper.c
@@ -197,7 +197,7 @@ static gboolean addrk_before_send_hook(gpointer source, gpointer data)
 
 	if (addkeeperprefs.block_matching_addrs != NULL
 			&& addkeeperprefs.block_matching_addrs[0] != '\0') {
-		blocked = matcherlist_new_from_lines(addkeeperprefs.block_matching_addrs, FALSE);
+		blocked = matcherlist_new_from_lines(addkeeperprefs.block_matching_addrs, FALSE, TRUE);
 		if (blocked == NULL)
 			g_warning("couldn't allocate matcher");
 	}
diff --git a/src/plugins/attachwarner/attachwarner.c b/src/plugins/attachwarner/attachwarner.c
index e4d19a9..f5160dc 100644
--- a/src/plugins/attachwarner/attachwarner.c
+++ b/src/plugins/attachwarner/attachwarner.c
@@ -111,7 +111,7 @@ AttachWarnerMention *are_attachments_mentioned(Compose *compose)
 	AttachWarnerMention *mention = NULL;
 	MatcherList *matchers = NULL;
 
-	matchers = matcherlist_new_from_lines(attwarnerprefs.match_strings, FALSE);
+	matchers = matcherlist_new_from_lines(attwarnerprefs.match_strings, FALSE, attwarnerprefs.case_sensitive);
 
 	if (matchers == NULL) {
 		g_warning("couldn't allocate matcher");
diff --git a/src/plugins/attachwarner/attachwarner_prefs.c b/src/plugins/attachwarner/attachwarner_prefs.c
index b1b7bf7..82fe167 100644
--- a/src/plugins/attachwarner/attachwarner_prefs.c
+++ b/src/plugins/attachwarner/attachwarner_prefs.c
@@ -45,6 +45,7 @@ struct AttachWarnerPrefsPage
 	GtkWidget *skip_quotes_checkbox;
 	GtkWidget *skip_forwards_and_redirections;
 	GtkWidget *skip_signature;
+	GtkWidget *case_sensitive_checkbox;
 };
 
 struct AttachWarnerPrefsPage attwarnerprefs_page;
@@ -58,6 +59,8 @@ static PrefParam param[] = {
 	 NULL, NULL, NULL},
 	{"skip_signature", "TRUE", &attwarnerprefs.skip_signature, P_BOOL,
 	 NULL, NULL, NULL},
+	{"case_sensitive", "TRUE", &attwarnerprefs.case_sensitive, P_BOOL,
+	 NULL, NULL, NULL},
 	{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
 
@@ -73,6 +76,7 @@ static void attwarner_prefs_create_widget_func(PrefsPage * _page,
 	GtkWidget *skip_quotes_checkbox;
 	GtkWidget *skip_fwd_redir_checkbox;
 	GtkWidget *skip_signature_checkbox;
+	GtkWidget *case_sensitive_checkbox;
 
 	vbox = gtk_vbox_new(FALSE, 6);
 	hbox = gtk_hbox_new(FALSE, 6);
@@ -80,8 +84,18 @@ static void attwarner_prefs_create_widget_func(PrefsPage * _page,
 	label = gtk_label_new(_("Warn when matching the following regular expressions:\n(one per line)"));
 	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
 	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 6);
+
+	case_sensitive_checkbox = gtk_check_button_new_with_label(_("Case sensitive"));
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(case_sensitive_checkbox),
+	    	 attwarnerprefs.case_sensitive);
+	gtk_box_pack_start(GTK_BOX(vbox), case_sensitive_checkbox, FALSE, FALSE, 0);
+	gtk_widget_show(case_sensitive_checkbox);
+
+	CLAWS_SET_TIP(case_sensitive_checkbox,
+			_("Case sensitive when matching for the regular expressions in the list"));
+	page->case_sensitive_checkbox = case_sensitive_checkbox;
+
 	page->regexp_text = gtk_text_view_new();
-	
 	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(page->regexp_text));
 	gtk_text_buffer_set_text(buffer, attwarnerprefs.match_strings, -1);
 	
@@ -125,7 +139,7 @@ static void attwarner_prefs_create_widget_func(PrefsPage * _page,
 	CLAWS_SET_TIP(skip_signature_checkbox,
 			_("Exclude lines from the first signature-separator onwards from checking for the regular expressions above"));
 	page->skip_signature = skip_signature_checkbox;
-
+	
 	gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 6);
 	gtk_widget_show_all(hbox);
 	
@@ -186,6 +200,8 @@ static void attwarner_prefs_save_func(PrefsPage * _page)
 			(GTK_TOGGLE_BUTTON(page->skip_forwards_and_redirections));
 	attwarnerprefs.skip_signature = gtk_toggle_button_get_active
 			(GTK_TOGGLE_BUTTON(page->skip_signature));
+	attwarnerprefs.case_sensitive = gtk_toggle_button_get_active
+			(GTK_TOGGLE_BUTTON(page->case_sensitive_checkbox));
 
 	attwarner_save_config();
 	g_free(attwarnerprefs.match_strings);
diff --git a/src/plugins/attachwarner/attachwarner_prefs.h b/src/plugins/attachwarner/attachwarner_prefs.h
index 942a21c..0d5b27e 100644
--- a/src/plugins/attachwarner/attachwarner_prefs.h
+++ b/src/plugins/attachwarner/attachwarner_prefs.h
@@ -31,6 +31,7 @@ struct _AttachWarnerPrefs
 	gboolean	 skip_quotes;
 	gboolean	 skip_forwards_and_redirections;
 	gboolean	 skip_signature;
+	gboolean	 case_sensitive;
 };
 
 extern AttachWarnerPrefs attwarnerprefs;

-----------------------------------------------------------------------

Summary of changes:
 src/matcher.c                                 |   14 ++++--
 src/matcher.h                                 |    3 +-
 src/plugins/address_keeper/address_keeper.c   |    2 +-
 src/plugins/attachwarner/attachwarner.c       |    2 +-
 src/plugins/attachwarner/attachwarner_prefs.c |   61 ++++++++++++++++++-------
 src/plugins/attachwarner/attachwarner_prefs.h |    1 +
 6 files changed, 58 insertions(+), 25 deletions(-)


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list