File bgo-339879-search-contacts.patch of Package evolution

Index: addressbook/gui/widgets/addresstypes.xml
===================================================================
--- addressbook/gui/widgets/addresstypes.xml	(revision 37007)
+++ addressbook/gui/widgets/addresstypes.xml	(working copy)
@@ -79,7 +79,7 @@
  </part>
  <part name="sexp">
    <title>Expression</title>
-   <input type="code" name="code"/>
+   <input type="rawcode" name="rawcode"/>
   </part>
 </partset>
 
Index: filter/filter-code.h
===================================================================
--- filter/filter-code.h	(revision 37007)
+++ filter/filter-code.h	(working copy)
@@ -49,7 +49,7 @@ struct _FilterCodeClass {
 };
 
 GType filter_code_get_type (void);
-FilterCode *filter_code_new (void);
+FilterCode *filter_code_new (gboolean raw_code);
 
 /* methods */
 
Index: filter/rule-context.c
===================================================================
--- filter/rule-context.c	(revision 37007)
+++ filter/rule-context.c	(working copy)
@@ -906,7 +906,9 @@ new_element(RuleContext *rc, const char 
 		/* 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")) {
Index: filter/filter-code.c
===================================================================
--- filter/filter-code.c	(revision 37007)
+++ filter/filter-code.c	(working copy)
@@ -98,9 +98,16 @@ filter_code_finalise (GObject *obj)
  * 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 @@ build_code (FilterElement *fe, GString *
 {
 	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 */
openSUSE Build Service is sponsored by