evolution r37014 - in trunk: addressbook addressbook/gui/widgets filter



Author: mcrha
Date: Thu Jan  8 11:09:02 2009
New Revision: 37014
URL: http://svn.gnome.org/viewvc/evolution?rev=37014&view=rev

Log:
2009-01-08  Milan Crha  <mcrha redhat com>

	** Fix for bug #339879

	* filter/filter-code.h: (filter_code_new):
	* filter/filter-code.c: (filter_code_new), (build_code):
	* filter/rule-context.c: (new_element):
	Have two types of code expression, one "code", which adds also
	a "match-all" into the expression, and a "rawcode" without it.

	* addressbook/gui/widgets/addresstypes.xml: Use "rawcode" instead of "code"
	to have not added a "match-all" into the expression.



Modified:
   trunk/addressbook/ChangeLog
   trunk/addressbook/gui/widgets/addresstypes.xml
   trunk/filter/ChangeLog
   trunk/filter/filter-code.c
   trunk/filter/filter-code.h
   trunk/filter/rule-context.c

Modified: trunk/addressbook/gui/widgets/addresstypes.xml
==============================================================================
--- trunk/addressbook/gui/widgets/addresstypes.xml	(original)
+++ trunk/addressbook/gui/widgets/addresstypes.xml	Thu Jan  8 11:09:02 2009
@@ -79,7 +79,7 @@
  </part>
  <part name="sexp">
    <title>Expression</title>
-   <input type="code" name="code"/>
+   <input type="rawcode" name="rawcode"/>
   </part>
 </partset>
 

Modified: trunk/filter/filter-code.c
==============================================================================
--- trunk/filter/filter-code.c	(original)
+++ trunk/filter/filter-code.c	Thu Jan  8 11:09:02 2009
@@ -98,9 +98,16 @@
  * Return value: A new #FilterCode object.
  **/
 FilterCode *
-filter_code_new (void)
+filter_code_new (gboolean raw_code)
 {
-	return (FilterCode *) g_object_new (FILTER_TYPE_CODE, NULL, NULL);
+	FilterCode *fc = (FilterCode *) g_object_new (FILTER_TYPE_CODE, NULL, NULL);
+
+	if (fc && raw_code) {
+		xmlFree (((FilterInput *) fc)->type);
+		((FilterInput *) fc)->type = (char *)xmlStrdup ((const unsigned char *)"rawcode");
+	}
+
+	return fc;
 }
 
 /* here, the string IS the code */
@@ -109,14 +116,19 @@
 {
 	GList *l;
 	FilterInput *fi = (FilterInput *)fe;
+	gboolean is_rawcode = fi && fi->type && g_str_equal (fi->type, "rawcode");
+
+	if (!is_rawcode)
+		g_string_append(out, "(match-all ");
 
-	g_string_append(out, "(match-all ");
 	l = fi->values;
 	while (l) {
 		g_string_append(out, (char *)l->data);
 		l = g_list_next(l);
 	}
-	g_string_append(out, ")");
+
+	if (!is_rawcode)
+		g_string_append (out, ")");
 }
 
 /* and we have no value */

Modified: trunk/filter/filter-code.h
==============================================================================
--- trunk/filter/filter-code.h	(original)
+++ trunk/filter/filter-code.h	Thu Jan  8 11:09:02 2009
@@ -49,7 +49,7 @@
 };
 
 GType filter_code_get_type (void);
-FilterCode *filter_code_new (void);
+FilterCode *filter_code_new (gboolean raw_code);
 
 /* methods */
 

Modified: trunk/filter/rule-context.c
==============================================================================
--- trunk/filter/rule-context.c	(original)
+++ trunk/filter/rule-context.c	Thu Jan  8 11:09:02 2009
@@ -906,7 +906,9 @@
 		/* FIXME: temporary ... need real address type */
 		return (FilterElement *) filter_input_new_type_name (type);
 	} else if (!strcmp (type, "code")) {
-		return (FilterElement *) filter_code_new ();
+		return (FilterElement *) filter_code_new (FALSE);
+	} else if (!strcmp (type, "rawcode")) {
+		return (FilterElement *) filter_code_new (TRUE);
 	} else if (!strcmp (type, "colour")) {
 		return (FilterElement *) filter_colour_new ();
 	} else if (!strcmp (type, "optionlist")) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]