[evolution] EMFilterFolderElement: Use the new folder URI format.



commit ed94c3461ea6a4df6dc0bd8eba31952650690e4d
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu May 5 16:20:37 2011 -0400

    EMFilterFolderElement: Use the new folder URI format.
    
    No longer need to distinguish between Camel URIs and Evolution URIs.

 mail/em-filter-folder-element.c |   36 ++++--------------------------------
 mail/em-filter-folder-element.h |    4 ----
 mail/em-vfolder-context.c       |   13 ++++---------
 3 files changed, 8 insertions(+), 45 deletions(-)
---
diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c
index 76828f7..4a5d359 100644
--- a/mail/em-filter-folder-element.c
+++ b/mail/em-filter-folder-element.c
@@ -256,10 +256,7 @@ xml_encode (EFilterElement *fe)
 
 	value = xmlNewNode(NULL, (xmlChar *) "value");
 	xmlSetProp(value, (xmlChar *) "name", (xmlChar *) fe->name);
-	if (ff->store_camel_uri)
-		xmlSetProp(value, (xmlChar *) "type", (xmlChar *) "folder-curi");
-	else
-		xmlSetProp(value, (xmlChar *) "type", (xmlChar *) "folder");
+	xmlSetProp(value, (xmlChar *) "type", (xmlChar *) "folder");
 
 	work = xmlNewChild(value, NULL, (xmlChar *) "folder", NULL);
 	xmlSetProp(work, (xmlChar *) "uri", (xmlChar *) ff->priv->uri);
@@ -272,19 +269,10 @@ xml_decode (EFilterElement *fe, xmlNodePtr node)
 {
 	EMFilterFolderElement *ff = (EMFilterFolderElement *) fe;
 	xmlNodePtr n;
-	xmlChar *type;
 
 	xmlFree (fe->name);
 	fe->name = (gchar *) xmlGetProp(node, (xmlChar *) "name");
 
-	type = xmlGetProp (node, (xmlChar *) "type");
-	if (type) {
-		ff->store_camel_uri = g_str_equal ((const gchar *) type, "folder-curi");
-		xmlFree (type);
-	} else {
-		ff->store_camel_uri = FALSE;
-	}
-
 	n = node->children;
 	while (n) {
 		if (!strcmp((gchar *) n->name, "folder")) {
@@ -310,12 +298,9 @@ folder_selected (EMFolderSelectionButton *button,
 	const gchar *uri;
 
 	uri = em_folder_selection_button_get_selection (button);
-	g_free (ff->priv->uri);
 
-	if (ff->store_camel_uri)
-		ff->priv->uri = g_strdup (uri);
-	else
-		ff->priv->uri = uri != NULL ? em_uri_from_camel (uri) : NULL;
+	g_free (ff->priv->uri);
+	ff->priv->uri = g_strdup (uri);
 
 	toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
 	gtk_window_present (GTK_WINDOW (toplevel));
@@ -327,24 +312,13 @@ get_widget (EFilterElement *fe)
 	EMFilterFolderElement *ff = (EMFilterFolderElement *) fe;
 	EMailSession *session;
 	GtkWidget *button;
-	gchar *uri;
 
 	session = em_filter_folder_element_get_session (ff);
 
-	if (ff->store_camel_uri)
-		uri = ff->priv->uri;
-	else
-		uri = em_uri_to_camel (ff->priv->uri);
-
 	button = em_folder_selection_button_new (
 		session, _("Select Folder"), NULL);
-
 	em_folder_selection_button_set_selection (
-		EM_FOLDER_SELECTION_BUTTON (button), uri);
-
-	if (!ff->store_camel_uri)
-		g_free (uri);
-
+		EM_FOLDER_SELECTION_BUTTON (button), ff->priv->uri);
 	gtk_widget_show (button);
 
 	g_signal_connect (
@@ -372,8 +346,6 @@ static void
 emff_copy_value (EFilterElement *de, EFilterElement *se)
 {
 	if (EM_IS_FILTER_FOLDER_ELEMENT (se)) {
-		((EMFilterFolderElement *) de)->store_camel_uri =
-			((EMFilterFolderElement *) se)->store_camel_uri;
 		em_filter_folder_element_set_uri (
 			EM_FILTER_FOLDER_ELEMENT (de),
 			EM_FILTER_FOLDER_ELEMENT (se)->priv->uri);
diff --git a/mail/em-filter-folder-element.h b/mail/em-filter-folder-element.h
index 95061be..f71b4c1 100644
--- a/mail/em-filter-folder-element.h
+++ b/mail/em-filter-folder-element.h
@@ -56,10 +56,6 @@ typedef struct _EMFilterFolderElementPrivate EMFilterFolderElementPrivate;
 struct _EMFilterFolderElement {
 	EFilterElement parent;
 	EMFilterFolderElementPrivate *priv;
-
-	/* TRUE if 'uri' should contain Camel URI, otherwise
-	 * contains Evolution's URI with an Account ID. */
-	gboolean store_camel_uri;
 };
 
 struct _EMFilterFolderElementClass {
diff --git a/mail/em-vfolder-context.c b/mail/em-vfolder-context.c
index 5f78da4..ebad8f2 100644
--- a/mail/em-vfolder-context.c
+++ b/mail/em-vfolder-context.c
@@ -124,18 +124,13 @@ vfolder_context_new_element (ERuleContext *context,
 	if (strcmp (type, "score") == 0)
 		return e_filter_int_new_type("score", -3, 3);
 
-	if (strcmp (type, "folder-curi") == 0) {
-		EFilterElement *element;
-
-		element = em_filter_folder_element_new (priv->session);
-		((EMFilterFolderElement *) element)->store_camel_uri = TRUE;
-
-		return element;
-	}
-
 	if (strcmp (type, "folder") == 0)
 		return em_filter_folder_element_new (priv->session);
 
+	/* XXX Legacy type name.  Same as "folder" now. */
+	if (strcmp (type, "folder-curi") == 0)
+		return em_filter_folder_element_new (priv->session);
+
 	return E_RULE_CONTEXT_CLASS (em_vfolder_context_parent_class)->
 		new_element (context, type);
 }



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