diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/Makefile.am | 12 | ||||
-rw-r--r-- | mail/em-filter-context.c | 4 | ||||
-rw-r--r-- | mail/em-filter-editor-folder-element.c | 230 | ||||
-rw-r--r-- | mail/em-filter-editor-folder-element.h | 73 | ||||
-rw-r--r-- | mail/em-filter-folder-element.c | 362 | ||||
-rw-r--r-- | mail/em-filter-folder-element.h | 77 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 2 | ||||
-rw-r--r-- | mail/em-folder-utils.c | 4 | ||||
-rw-r--r-- | mail/em-vfolder-context.h | 72 | ||||
-rw-r--r-- | mail/em-vfolder-editor-context.c (renamed from mail/em-vfolder-context.c) | 100 | ||||
-rw-r--r-- | mail/em-vfolder-editor-context.h | 73 | ||||
-rw-r--r-- | mail/em-vfolder-editor-rule.c (renamed from mail/em-vfolder-rule.c) | 338 | ||||
-rw-r--r-- | mail/em-vfolder-editor-rule.h | 81 | ||||
-rw-r--r-- | mail/em-vfolder-editor.c | 10 | ||||
-rw-r--r-- | mail/em-vfolder-editor.h | 2 | ||||
-rw-r--r-- | mail/em-vfolder-rule.h | 91 | ||||
-rw-r--r-- | mail/mail-autofilter.c | 12 | ||||
-rw-r--r-- | mail/mail-autofilter.h | 2 | ||||
-rw-r--r-- | mail/mail-vfolder.c | 14 | ||||
-rw-r--r-- | mail/mail-vfolder.h | 2 |
20 files changed, 583 insertions, 978 deletions
diff --git a/mail/Makefile.am b/mail/Makefile.am index 0273c245f6..ebc3f6669f 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -68,7 +68,7 @@ mailinclude_HEADERS = \ em-event.h \ em-filter-context.h \ em-filter-editor.h \ - em-filter-folder-element.h \ + em-filter-editor-folder-element.h \ em-filter-rule.h \ em-filter-source-element.h \ em-folder-properties.h \ @@ -86,9 +86,9 @@ mailinclude_HEADERS = \ em-subscription-editor.h \ em-sync-stream.h \ em-utils.h \ - em-vfolder-context.h \ + em-vfolder-editor-context.h \ + em-vfolder-editor-rule.h \ em-vfolder-editor.h \ - em-vfolder-rule.h \ mail-autofilter.h \ mail-guess-servers.h \ mail-send-recv.h \ @@ -133,7 +133,7 @@ libevolution_mail_la_SOURCES = \ em-event.c \ em-filter-context.c \ em-filter-editor.c \ - em-filter-folder-element.c \ + em-filter-editor-folder-element.c \ em-filter-rule.c \ em-filter-source-element.c \ em-folder-properties.c \ @@ -151,9 +151,9 @@ libevolution_mail_la_SOURCES = \ em-subscription-editor.c \ em-sync-stream.c \ em-utils.c \ - em-vfolder-context.c \ + em-vfolder-editor-context.c \ + em-vfolder-editor-rule.c \ em-vfolder-editor.c \ - em-vfolder-rule.c \ mail-autofilter.c \ mail-guess-servers.c \ mail-send-recv.c \ diff --git a/mail/em-filter-context.c b/mail/em-filter-context.c index 6a5822c7a1..41c27ff375 100644 --- a/mail/em-filter-context.c +++ b/mail/em-filter-context.c @@ -34,7 +34,7 @@ #include "em-filter-source-element.h" /* For poking into filter-folder guts */ -#include "em-filter-folder-element.h" +#include "em-filter-editor-folder-element.h" #define EM_FILTER_CONTEXT_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ @@ -236,7 +236,7 @@ filter_context_new_element (ERuleContext *context, priv = EM_FILTER_CONTEXT_GET_PRIVATE (context); if (strcmp (type, "folder") == 0) - return em_filter_folder_element_new (priv->session); + return em_filter_editor_folder_element_new (priv->session); if (strcmp (type, "system-flag") == 0) return e_filter_option_new (); diff --git a/mail/em-filter-editor-folder-element.c b/mail/em-filter-editor-folder-element.c new file mode 100644 index 0000000000..5943ff18a9 --- /dev/null +++ b/mail/em-filter-editor-folder-element.c @@ -0,0 +1,230 @@ +/* + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Authors: + * Not Zed <notzed@lostzed.mmc.com.au> + * Jeffrey Stedfast <fejj@ximian.com> + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <string.h> + +#include <gtk/gtk.h> +#include <glib/gi18n.h> + +#include "em-filter-editor-folder-element.h" +#include "mail/em-folder-selection-button.h" +#include "mail/em-utils.h" +#include "shell/e-shell.h" +#include "filter/e-filter-part.h" +#include "libevolution-utils/e-alert.h" + +#define EM_FILTER_EDITOR_FOLDER_ELEMENT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), EM_TYPE_FILTER_EDITOR_FOLDER_ELEMENT, EMFilterEditorFolderElementPrivate)) + +struct _EMFilterEditorFolderElementPrivate { + EMailSession *session; +}; + +enum { + PROP_0, + PROP_SESSION +}; + +G_DEFINE_TYPE ( + EMFilterEditorFolderElement, + em_filter_editor_folder_element, + EM_TYPE_FILTER_FOLDER_ELEMENT) + +static void +filter_editor_folder_element_set_session (EMFilterEditorFolderElement *element, + EMailSession *session) +{ + if (session == NULL) { + EShell *shell; + EShellBackend *shell_backend; + EMailBackend *backend; + + shell = e_shell_get_default (); + shell_backend = e_shell_get_backend_by_name (shell, "mail"); + + backend = E_MAIL_BACKEND (shell_backend); + session = e_mail_backend_get_session (backend); + } + + g_return_if_fail (E_IS_MAIL_SESSION (session)); + g_return_if_fail (element->priv->session == NULL); + + element->priv->session = g_object_ref (session); +} + +static void +filter_editor_folder_element_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_SESSION: + filter_editor_folder_element_set_session ( + EM_FILTER_EDITOR_FOLDER_ELEMENT (object), + g_value_get_object (value)); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +filter_editor_folder_element_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_SESSION: + g_value_set_object ( + value, + em_filter_editor_folder_element_get_session ( + EM_FILTER_EDITOR_FOLDER_ELEMENT (object))); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +filter_editor_folder_element_selected_cb (EMFolderSelectionButton *button, + EMFilterEditorFolderElement *ff) +{ + GtkWidget *toplevel; + const gchar *uri; + + uri = em_folder_selection_button_get_folder_uri (button); + + em_filter_folder_element_set_uri ((EMFilterFolderElement *) ff, uri); + + toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button)); + gtk_window_present (GTK_WINDOW (toplevel)); +} + +static void +filter_editor_folder_element_dispose (GObject *object) +{ + EMFilterEditorFolderElementPrivate *priv; + + priv = EM_FILTER_EDITOR_FOLDER_ELEMENT_GET_PRIVATE (object); + if (priv->session != NULL) { + g_object_unref (priv->session); + priv->session = NULL; + } + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (em_filter_editor_folder_element_parent_class)->dispose (object); +} + +static void +filter_editor_folder_element_finalize (GObject *object) +{ + EMFilterEditorFolderElementPrivate *priv; + + priv = EM_FILTER_EDITOR_FOLDER_ELEMENT_GET_PRIVATE (object); + + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (em_filter_editor_folder_element_parent_class)->finalize (object); +} + +static GtkWidget * +filter_editor_folder_element_get_widget (EFilterElement *fe) +{ + EMFilterEditorFolderElement *ff = (EMFilterEditorFolderElement *) fe; + EMailSession *session; + GtkWidget *button; + + session = em_filter_editor_folder_element_get_session (ff); + + button = em_folder_selection_button_new ( + session, _("Select Folder"), NULL); + em_folder_selection_button_set_folder_uri ( + EM_FOLDER_SELECTION_BUTTON (button), em_filter_folder_element_get_uri ((EMFilterFolderElement *) ff)); + gtk_widget_show (button); + + g_signal_connect ( + button, "selected", + G_CALLBACK (filter_editor_folder_element_selected_cb), ff); + + return button; +} + +static void +em_filter_editor_folder_element_class_init (EMFilterEditorFolderElementClass *class) +{ + GObjectClass *object_class; + EFilterElementClass *filter_element_class; + + g_type_class_add_private (class, sizeof (EMFilterEditorFolderElementPrivate)); + + object_class = G_OBJECT_CLASS (class); + object_class->set_property = filter_editor_folder_element_set_property; + object_class->get_property = filter_editor_folder_element_get_property; + object_class->dispose = filter_editor_folder_element_dispose; + object_class->finalize = filter_editor_folder_element_finalize; + + filter_element_class = E_FILTER_ELEMENT_CLASS (class); + filter_element_class->get_widget = filter_editor_folder_element_get_widget; + + g_object_class_install_property ( + object_class, + PROP_SESSION, + g_param_spec_object ( + "session", + NULL, + NULL, + E_TYPE_MAIL_SESSION, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); +} + +static void +em_filter_editor_folder_element_init (EMFilterEditorFolderElement *element) +{ + element->priv = EM_FILTER_EDITOR_FOLDER_ELEMENT_GET_PRIVATE (element); +} + +EFilterElement * +em_filter_editor_folder_element_new (EMailSession *session) +{ + g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL); + + return g_object_new ( + EM_TYPE_FILTER_EDITOR_FOLDER_ELEMENT, + "session", session, NULL); +} + +EMailSession * +em_filter_editor_folder_element_get_session (EMFilterEditorFolderElement *element) +{ + g_return_val_if_fail (EM_IS_FILTER_EDITOR_FOLDER_ELEMENT (element), NULL); + + return element->priv->session; +} diff --git a/mail/em-filter-editor-folder-element.h b/mail/em-filter-editor-folder-element.h new file mode 100644 index 0000000000..acb84bb10e --- /dev/null +++ b/mail/em-filter-editor-folder-element.h @@ -0,0 +1,73 @@ +/* + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Authors: + * Not Zed <notzed@lostzed.mmc.com.au> + * Jeelementrey Stedfast <fejj@ximian.com> + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef EM_FILTER_EDITOR_FOLDER_ELEMENT_H +#define EM_FILTER_EDITOR_FOLDER_ELEMENT_H + +#include <filter/e-filter-element.h> +#include <libemail-utils/em-filter-folder-element.h> +#include <libemail-engine/e-mail-session.h> + +/* Standard GObject macros */ +#define EM_TYPE_FILTER_EDITOR_FOLDER_ELEMENT \ + (em_filter_editor_folder_element_get_type ()) +#define EM_FILTER_EDITOR_FOLDER_ELEMENT(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), EM_TYPE_FILTER_EDITOR_FOLDER_ELEMENT, EMFilterEditorFolderElement)) +#define EM_FILTER_EDITOR_FOLDER_ELEMENT_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), EM_TYPE_FILTER_EDITOR_FOLDER_ELEMENT, EMFilterEditorFolderElementClass)) +#define EM_IS_FILTER_EDITOR_FOLDER_ELEMENT(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), EM_TYPE_FILTER_EDITOR_FOLDER_ELEMENT)) +#define EM_IS_FILTER_EDITOR_FOLDER_ELEMENT_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), EM_TYPE_FILTER_EDITOR_FOLDER_ELEMENT)) +#define EM_FILTER_EDITOR_FOLDER_ELEMENT_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), EM_TYPE_FILTER_EDITOR_FOLDER_ELEMENT, EMFilterEditorFolderElementClass)) + +G_BEGIN_DECLS + +typedef struct _EMFilterEditorFolderElement EMFilterEditorFolderElement; +typedef struct _EMFilterEditorFolderElementClass EMFilterEditorFolderElementClass; +typedef struct _EMFilterEditorFolderElementPrivate EMFilterEditorFolderElementPrivate; + +struct _EMFilterEditorFolderElement { + EMFilterFolderElement parent; + EMFilterEditorFolderElementPrivate *priv; +}; + +struct _EMFilterEditorFolderElementClass { + EMFilterFolderElementClass parent_class; +}; + +GType em_filter_editor_folder_element_get_type (void); +EFilterElement *em_filter_editor_folder_element_new (EMailSession *session); +EMailSession * em_filter_editor_folder_element_get_session + (EMFilterEditorFolderElement *element); + +G_END_DECLS + +#endif /* EM_FILTER_EDITOR_FOLDER_ELEMENT_H */ diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c deleted file mode 100644 index 7b88991d92..0000000000 --- a/mail/em-filter-folder-element.c +++ /dev/null @@ -1,362 +0,0 @@ -/* - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Not Zed <notzed@lostzed.mmc.com.au> - * Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> - -#include <gtk/gtk.h> -#include <glib/gi18n.h> - -#include "em-filter-folder-element.h" -#include "mail/em-folder-selection-button.h" -#include "mail/em-utils.h" -#include "shell/e-shell.h" -#include "filter/e-filter-part.h" -#include "libevolution-utils/e-alert.h" - -#define EM_FILTER_FOLDER_ELEMENT_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), EM_TYPE_FILTER_FOLDER_ELEMENT, EMFilterFolderElementPrivate)) - -struct _EMFilterFolderElementPrivate { - EMailSession *session; - gchar *uri; -}; - -enum { - PROP_0, - PROP_SESSION -}; - -G_DEFINE_TYPE ( - EMFilterFolderElement, - em_filter_folder_element, - E_TYPE_FILTER_ELEMENT) - -static void -filter_folder_element_selected_cb (EMFolderSelectionButton *button, - EMFilterFolderElement *ff) -{ - GtkWidget *toplevel; - const gchar *uri; - - uri = em_folder_selection_button_get_folder_uri (button); - - 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)); -} - -static void -filter_folder_element_set_session (EMFilterFolderElement *element, - EMailSession *session) -{ - /* FIXME Dirty hack. Session should be passed in always. */ - if (session == NULL) { - EShell *shell; - EShellBackend *shell_backend; - EMailBackend *backend; - - shell = e_shell_get_default (); - shell_backend = e_shell_get_backend_by_name (shell, "mail"); - - backend = E_MAIL_BACKEND (shell_backend); - session = e_mail_backend_get_session (backend); - } - - g_return_if_fail (E_IS_MAIL_SESSION (session)); - g_return_if_fail (element->priv->session == NULL); - - element->priv->session = g_object_ref (session); -} - -static void -filter_folder_element_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - switch (property_id) { - case PROP_SESSION: - filter_folder_element_set_session ( - EM_FILTER_FOLDER_ELEMENT (object), - g_value_get_object (value)); - return; - } - - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -} - -static void -filter_folder_element_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - switch (property_id) { - case PROP_SESSION: - g_value_set_object ( - value, - em_filter_folder_element_get_session ( - EM_FILTER_FOLDER_ELEMENT (object))); - return; - } - - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -} - -static void -filter_folder_element_dispose (GObject *object) -{ - EMFilterFolderElementPrivate *priv; - - priv = EM_FILTER_FOLDER_ELEMENT_GET_PRIVATE (object); - - if (priv->session != NULL) { - g_object_unref (priv->session); - priv->session = NULL; - } - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (em_filter_folder_element_parent_class)->dispose (object); -} - -static void -filter_folder_element_finalize (GObject *object) -{ - EMFilterFolderElementPrivate *priv; - - priv = EM_FILTER_FOLDER_ELEMENT_GET_PRIVATE (object); - - g_free (priv->uri); - - /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (em_filter_folder_element_parent_class)->finalize (object); -} - -static gboolean -filter_folder_element_validate (EFilterElement *fe, - EAlert **alert) -{ - EMFilterFolderElement *ff = (EMFilterFolderElement *) fe; - - g_warn_if_fail (alert == NULL || *alert == NULL); - - if (ff->priv->uri != NULL && *ff->priv->uri != '\0') - return TRUE; - - if (alert) - *alert = e_alert_new ("mail:no-folder", NULL); - - return FALSE; -} - -static gint -filter_folder_element_eq (EFilterElement *fe, - EFilterElement *cm) -{ - return E_FILTER_ELEMENT_CLASS ( - em_filter_folder_element_parent_class)->eq (fe, cm) && - strcmp (((EMFilterFolderElement *) fe)->priv->uri, - ((EMFilterFolderElement *) cm)->priv->uri)== 0; -} - -static xmlNodePtr -filter_folder_element_xml_encode (EFilterElement *fe) -{ - xmlNodePtr value, work; - EMFilterFolderElement *ff = (EMFilterFolderElement *) fe; - - value = xmlNewNode (NULL, (xmlChar *) "value"); - xmlSetProp (value, (xmlChar *) "name", (xmlChar *) fe->name); - xmlSetProp (value, (xmlChar *) "type", (xmlChar *) "folder"); - - work = xmlNewChild (value, NULL, (xmlChar *) "folder", NULL); - xmlSetProp (work, (xmlChar *) "uri", (xmlChar *) ff->priv->uri); - - return value; -} - -static gint -filter_folder_element_xml_decode (EFilterElement *fe, - xmlNodePtr node) -{ - EMFilterFolderElement *ff = (EMFilterFolderElement *) fe; - xmlNodePtr n; - - xmlFree (fe->name); - fe->name = (gchar *) xmlGetProp(node, (xmlChar *) "name"); - - n = node->children; - while (n) { - if (!strcmp((gchar *) n->name, "folder")) { - gchar *uri; - - uri = (gchar *) xmlGetProp(n, (xmlChar *) "uri"); - g_free (ff->priv->uri); - ff->priv->uri = g_strdup (uri); - xmlFree (uri); - break; - } - n = n->next; - } - - return 0; -} - -static GtkWidget * -filter_folder_element_get_widget (EFilterElement *fe) -{ - EMFilterFolderElement *ff = (EMFilterFolderElement *) fe; - EMailSession *session; - GtkWidget *button; - - session = em_filter_folder_element_get_session (ff); - - button = em_folder_selection_button_new ( - session, _("Select Folder"), NULL); - em_folder_selection_button_set_folder_uri ( - EM_FOLDER_SELECTION_BUTTON (button), ff->priv->uri); - gtk_widget_show (button); - - g_signal_connect ( - button, "selected", - G_CALLBACK (filter_folder_element_selected_cb), ff); - - return button; -} - -static void -filter_folder_element_build_code (EFilterElement *fe, - GString *out, - EFilterPart *ff) -{ - /* We are doing nothing on purpose. */ -} - -static void -filter_folder_element_format_sexp (EFilterElement *fe, - GString *out) -{ - EMFilterFolderElement *ff = (EMFilterFolderElement *) fe; - - camel_sexp_encode_string (out, ff->priv->uri); -} - -static void -filter_folder_element_copy_value (EFilterElement *de, - EFilterElement *se) -{ - if (EM_IS_FILTER_FOLDER_ELEMENT (se)) { - em_filter_folder_element_set_uri ( - EM_FILTER_FOLDER_ELEMENT (de), - EM_FILTER_FOLDER_ELEMENT (se)->priv->uri); - } else { - E_FILTER_ELEMENT_CLASS ( - em_filter_folder_element_parent_class)->copy_value (de, se); - } -} -static void -em_filter_folder_element_class_init (EMFilterFolderElementClass *class) -{ - GObjectClass *object_class; - EFilterElementClass *filter_element_class; - - g_type_class_add_private (class, sizeof (EMFilterFolderElementPrivate)); - - object_class = G_OBJECT_CLASS (class); - object_class->set_property = filter_folder_element_set_property; - object_class->get_property = filter_folder_element_get_property; - object_class->dispose = filter_folder_element_dispose; - object_class->finalize = filter_folder_element_finalize; - - filter_element_class = E_FILTER_ELEMENT_CLASS (class); - filter_element_class->validate = filter_folder_element_validate; - filter_element_class->eq = filter_folder_element_eq; - filter_element_class->xml_encode = filter_folder_element_xml_encode; - filter_element_class->xml_decode = filter_folder_element_xml_decode; - filter_element_class->get_widget = filter_folder_element_get_widget; - filter_element_class->build_code = filter_folder_element_build_code; - filter_element_class->format_sexp = filter_folder_element_format_sexp; - filter_element_class->copy_value = filter_folder_element_copy_value; - - g_object_class_install_property ( - object_class, - PROP_SESSION, - g_param_spec_object ( - "session", - NULL, - NULL, - E_TYPE_MAIL_SESSION, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); -} - -static void -em_filter_folder_element_init (EMFilterFolderElement *element) -{ - element->priv = EM_FILTER_FOLDER_ELEMENT_GET_PRIVATE (element); -} - -EFilterElement * -em_filter_folder_element_new (EMailSession *session) -{ - g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL); - - return g_object_new ( - EM_TYPE_FILTER_FOLDER_ELEMENT, - "session", session, NULL); -} - -EMailSession * -em_filter_folder_element_get_session (EMFilterFolderElement *element) -{ - g_return_val_if_fail (EM_IS_FILTER_FOLDER_ELEMENT (element), NULL); - - return element->priv->session; -} - -const gchar * -em_filter_folder_element_get_uri (EMFilterFolderElement *element) -{ - g_return_val_if_fail (EM_IS_FILTER_FOLDER_ELEMENT (element), NULL); - - return element->priv->uri; -} - -void -em_filter_folder_element_set_uri (EMFilterFolderElement *element, - const gchar *uri) -{ - g_return_if_fail (EM_IS_FILTER_FOLDER_ELEMENT (element)); - - g_free (element->priv->uri); - element->priv->uri = g_strdup (uri); -} - diff --git a/mail/em-filter-folder-element.h b/mail/em-filter-folder-element.h deleted file mode 100644 index f5a1741795..0000000000 --- a/mail/em-filter-folder-element.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Not Zed <notzed@lostzed.mmc.com.au> - * Jeelementrey Stedfast <fejj@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef EM_FILTER_FOLDER_ELEMENT_H -#define EM_FILTER_FOLDER_ELEMENT_H - -#include <filter/e-filter-element.h> -#include <libemail-engine/e-mail-session.h> - -/* Standard GObject macros */ -#define EM_TYPE_FILTER_FOLDER_ELEMENT \ - (em_filter_folder_element_get_type ()) -#define EM_FILTER_FOLDER_ELEMENT(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), EM_TYPE_FILTER_FOLDER_ELEMENT, EMFilterFolderElement)) -#define EM_FILTER_FOLDER_ELEMENT_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), EM_TYPE_FILTER_FOLDER_ELEMENT, EMFilterFolderElementClass)) -#define EM_IS_FILTER_FOLDER_ELEMENT(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), EM_TYPE_FILTER_FOLDER_ELEMENT)) -#define EM_IS_FILTER_FOLDER_ELEMENT_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), EM_TYPE_FILTER_FOLDER_ELEMENT)) -#define EM_FILTER_FOLDER_ELEMENT_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), EM_TYPE_FILTER_FOLDER_ELEMENT, EMFilterFolderElementClass)) - -G_BEGIN_DECLS - -typedef struct _EMFilterFolderElement EMFilterFolderElement; -typedef struct _EMFilterFolderElementClass EMFilterFolderElementClass; -typedef struct _EMFilterFolderElementPrivate EMFilterFolderElementPrivate; - -struct _EMFilterFolderElement { - EFilterElement parent; - EMFilterFolderElementPrivate *priv; -}; - -struct _EMFilterFolderElementClass { - EFilterElementClass parent_class; -}; - -GType em_filter_folder_element_get_type (void); -EFilterElement *em_filter_folder_element_new (EMailSession *session); -EMailSession * em_filter_folder_element_get_session - (EMFilterFolderElement *element); -const gchar * em_filter_folder_element_get_uri - (EMFilterFolderElement *element); -void em_filter_folder_element_set_uri - (EMFilterFolderElement *element, - const gchar *uri); - -G_END_DECLS - -#endif /* EM_FILTER_FOLDER_ELEMENT_H */ diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 2a6f0b5b25..d8234f9498 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -46,7 +46,7 @@ #include "misc/e-selectable.h" -#include "em-vfolder-rule.h" +#include "em-vfolder-editor-rule.h" #include "libemail-utils/mail-mt.h" #include "libemail-engine/e-mail-folder-utils.h" diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index 3ffdd6c859..cbf458a799 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -44,7 +44,7 @@ #include "libevolution-utils/e-alert-dialog.h" #include "e-util/e-dialog-utils.h" -#include "em-vfolder-rule.h" +#include "em-vfolder-editor-rule.h" #include "libemail-utils/mail-mt.h" #include "libemail-engine/e-mail-folder-utils.h" @@ -655,7 +655,7 @@ em_folder_utils_create_folder (GtkWindow *parent, else skip_slash = folder_name; - rule = em_vfolder_rule_new (session); + rule = em_vfolder_editor_rule_new (session); e_filter_rule_set_name (rule, skip_slash); vfolder_gui_add_rule (EM_VFOLDER_RULE (rule)); } else { diff --git a/mail/em-vfolder-context.h b/mail/em-vfolder-context.h deleted file mode 100644 index 2d1c6ef0fc..0000000000 --- a/mail/em-vfolder-context.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Not Zed <notzed@lostzed.mmc.com.au> - * Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef EM_VFOLDER_CONTEXT_H -#define EM_VFOLDER_CONTEXT_H - -#include <filter/e-rule-context.h> -#include <libemail-engine/e-mail-session.h> - -/* Standard GObject macros */ -#define EM_TYPE_VFOLDER_CONTEXT \ - (em_vfolder_context_get_type ()) -#define EM_VFOLDER_CONTEXT(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), EM_TYPE_VFOLDER_CONTEXT, EMVFolderContext)) -#define EM_VFOLDER_CONTEXT_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), EM_TYPE_VFOLDER_CONTEXT, EMVFolderContextClass)) -#define EM_IS_VFOLDER_CONTEXT(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), EM_TYPE_VFOLDER_CONTEXT)) -#define EM_IS_VFOLDER_CONTEXT_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), EM_TYPE_VFOLDER_CONTEXT)) -#define EM_VFOLDER_CONTEXT_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), EM_TYPE_VFOLDER_CONTEXT, EMVFolderContextClass)) - -G_BEGIN_DECLS - -typedef struct _EMVFolderContext EMVFolderContext; -typedef struct _EMVFolderContextClass EMVFolderContextClass; -typedef struct _EMVFolderContextPrivate EMVFolderContextPrivate; - -struct _EMVFolderContext { - ERuleContext parent; - EMVFolderContextPrivate *priv; -}; - -struct _EMVFolderContextClass { - ERuleContextClass parent_class; -}; - -GType em_vfolder_context_get_type (void); -EMVFolderContext * - em_vfolder_context_new (EMailSession *session); -EMailSession * em_vfolder_context_get_session (EMVFolderContext *context); - -G_END_DECLS - -#endif /* EM_VFOLDER_CONTEXT_H */ diff --git a/mail/em-vfolder-context.c b/mail/em-vfolder-editor-context.c index 665700e9f5..89e0048bba 100644 --- a/mail/em-vfolder-context.c +++ b/mail/em-vfolder-editor-context.c @@ -27,20 +27,21 @@ #endif #include <string.h> - -#include "em-vfolder-context.h" -#include "em-vfolder-rule.h" +#include <shell/e-shell.h> +#include "mail/em-utils.h" +#include "em-vfolder-editor-context.h" +#include "em-vfolder-editor-rule.h" #include "filter/e-filter-option.h" #include "filter/e-filter-int.h" -#include "em-filter-folder-element.h" +#include "em-filter-editor-folder-element.h" -#define EM_VFOLDER_CONTEXT_GET_PRIVATE(obj) \ +#define EM_VFOLDER_EDITOR_CONTEXT_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), EM_TYPE_VFOLDER_CONTEXT, EMVFolderContextPrivate)) + ((obj), EM_TYPE_VFOLDER_EDITOR_CONTEXT, EMVFolderEditorContextPrivate)) -struct _EMVFolderContextPrivate { - EMailSession *session; +struct _EMVFolderEditorContextPrivate { + EMailSession *session; }; enum { @@ -49,14 +50,26 @@ enum { }; G_DEFINE_TYPE ( - EMVFolderContext, - em_vfolder_context, - E_TYPE_RULE_CONTEXT) + EMVFolderEditorContext, + em_vfolder_editor_context, + EM_TYPE_VFOLDER_CONTEXT) static void -vfolder_context_set_session (EMVFolderContext *context, +vfolder_editor_context_set_session (EMVFolderEditorContext *context, EMailSession *session) { + if (session == NULL) { + EShell *shell; + EShellBackend *shell_backend; + EMailBackend *backend; + + shell = e_shell_get_default (); + shell_backend = e_shell_get_backend_by_name (shell, "mail"); + + backend = E_MAIL_BACKEND (shell_backend); + session = e_mail_backend_get_session (backend); + } + g_return_if_fail (E_IS_MAIL_SESSION (session)); g_return_if_fail (context->priv->session == NULL); @@ -64,15 +77,15 @@ vfolder_context_set_session (EMVFolderContext *context, } static void -vfolder_context_set_property (GObject *object, +vfolder_editor_context_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { switch (property_id) { case PROP_SESSION: - vfolder_context_set_session ( - EM_VFOLDER_CONTEXT (object), + vfolder_editor_context_set_session ( + EM_VFOLDER_EDITOR_CONTEXT (object), g_value_get_object (value)); return; } @@ -81,7 +94,7 @@ vfolder_context_set_property (GObject *object, } static void -vfolder_context_get_property (GObject *object, +vfolder_editor_context_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) @@ -90,8 +103,8 @@ vfolder_context_get_property (GObject *object, case PROP_SESSION: g_value_set_object ( value, - em_vfolder_context_get_session ( - EM_VFOLDER_CONTEXT (object))); + em_vfolder_editor_context_get_session ( + EM_VFOLDER_EDITOR_CONTEXT (object))); return; } @@ -99,28 +112,27 @@ vfolder_context_get_property (GObject *object, } static void -vfolder_context_dispose (GObject *object) +vfolder_editor_context_dispose (GObject *object) { - EMVFolderContextPrivate *priv; - - priv = EM_VFOLDER_CONTEXT_GET_PRIVATE (object); + EMVFolderEditorContextPrivate *priv; + priv = EM_VFOLDER_EDITOR_CONTEXT_GET_PRIVATE (object); if (priv->session != NULL) { g_object_unref (priv->session); priv->session = NULL; } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (em_vfolder_context_parent_class)->dispose (object); + G_OBJECT_CLASS (em_vfolder_editor_context_parent_class)->dispose (object); } static EFilterElement * -vfolder_context_new_element (ERuleContext *context, +vfolder_editor_context_new_element (ERuleContext *context, const gchar *type) { - EMVFolderContextPrivate *priv; + EMVFolderEditorContextPrivate *priv; - priv = EM_VFOLDER_CONTEXT_GET_PRIVATE (context); + priv = EM_VFOLDER_EDITOR_CONTEXT_GET_PRIVATE (context); if (strcmp (type, "system-flag") == 0) return e_filter_option_new (); @@ -129,31 +141,31 @@ vfolder_context_new_element (ERuleContext *context, return e_filter_int_new_type("score", -3, 3); if (strcmp (type, "folder") == 0) - return em_filter_folder_element_new (priv->session); + return em_filter_editor_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 em_filter_editor_folder_element_new (priv->session); - return E_RULE_CONTEXT_CLASS (em_vfolder_context_parent_class)-> + return E_RULE_CONTEXT_CLASS (em_vfolder_editor_context_parent_class)-> new_element (context, type); } static void -em_vfolder_context_class_init (EMVFolderContextClass *class) +em_vfolder_editor_context_class_init (EMVFolderEditorContextClass *class) { GObjectClass *object_class; ERuleContextClass *rule_context_class; - g_type_class_add_private (class, sizeof (EMVFolderContextPrivate)); + g_type_class_add_private (class, sizeof (EMVFolderEditorContextPrivate)); object_class = G_OBJECT_CLASS (class); - object_class->set_property = vfolder_context_set_property; - object_class->get_property = vfolder_context_get_property; - object_class->dispose = vfolder_context_dispose; + object_class->set_property = vfolder_editor_context_set_property; + object_class->get_property = vfolder_editor_context_get_property; + object_class->dispose = vfolder_editor_context_dispose; rule_context_class = E_RULE_CONTEXT_CLASS (class); - rule_context_class->new_element = vfolder_context_new_element; + rule_context_class->new_element = vfolder_editor_context_new_element; g_object_class_install_property ( object_class, @@ -164,13 +176,13 @@ em_vfolder_context_class_init (EMVFolderContextClass *class) NULL, E_TYPE_MAIL_SESSION, G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_CONSTRUCT_ONLY)); } static void -em_vfolder_context_init (EMVFolderContext *context) +em_vfolder_editor_context_init (EMVFolderEditorContext *context) { - context->priv = EM_VFOLDER_CONTEXT_GET_PRIVATE (context); + context->priv = EM_VFOLDER_EDITOR_CONTEXT_GET_PRIVATE (context); e_rule_context_add_part_set ( E_RULE_CONTEXT (context), "partset", E_TYPE_FILTER_PART, @@ -178,7 +190,7 @@ em_vfolder_context_init (EMVFolderContext *context) (ERuleContextNextPartFunc) e_rule_context_next_part); e_rule_context_add_rule_set ( - E_RULE_CONTEXT (context), "ruleset", EM_TYPE_VFOLDER_RULE, + E_RULE_CONTEXT (context), "ruleset", EM_TYPE_VFOLDER_EDITOR_RULE, (ERuleContextRuleFunc) e_rule_context_add_rule, (ERuleContextNextRuleFunc) e_rule_context_next_rule); @@ -186,19 +198,19 @@ em_vfolder_context_init (EMVFolderContext *context) E_RULE_CONTEXT_THREADING | E_RULE_CONTEXT_GROUPING; } -EMVFolderContext * -em_vfolder_context_new (EMailSession *session) +EMVFolderEditorContext * +em_vfolder_editor_context_new (EMailSession *session) { g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL); return g_object_new ( - EM_TYPE_VFOLDER_CONTEXT, "session", session, NULL); + EM_TYPE_VFOLDER_EDITOR_CONTEXT, "session", session, NULL); } EMailSession * -em_vfolder_context_get_session (EMVFolderContext *context) +em_vfolder_editor_context_get_session (EMVFolderEditorContext *context) { - g_return_val_if_fail (EM_IS_VFOLDER_CONTEXT (context), NULL); + g_return_val_if_fail (EM_IS_VFOLDER_EDITOR_CONTEXT (context), NULL); return context->priv->session; } diff --git a/mail/em-vfolder-editor-context.h b/mail/em-vfolder-editor-context.h new file mode 100644 index 0000000000..062d8bf08a --- /dev/null +++ b/mail/em-vfolder-editor-context.h @@ -0,0 +1,73 @@ +/* + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Authors: + * Not Zed <notzed@lostzed.mmc.com.au> + * Jeffrey Stedfast <fejj@ximian.com> + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef EM_VFOLDER_EDITOR_CONTEXT_H +#define EM_VFOLDER_EDITOR_CONTEXT_H + +#include <filter/e-rule-context.h> +#include <libemail-utils/em-vfolder-context.h> +#include <libemail-engine/e-mail-session.h> + +/* Standard GObject macros */ +#define EM_TYPE_VFOLDER_EDITOR_CONTEXT \ + (em_vfolder_editor_context_get_type ()) +#define EM_VFOLDER_EDITOR_CONTEXT(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), EM_TYPE_VFOLDER_EDITOR_CONTEXT, EMVFolderEditorContext)) +#define EM_VFOLDER_EDITOR_CONTEXT_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), EM_TYPE_VFOLDER_EDITOR_CONTEXT, EMVFolderEditorContextClass)) +#define EM_IS_VFOLDER_EDITOR_CONTEXT(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), EM_TYPE_VFOLDER_EDITOR_CONTEXT)) +#define EM_IS_VFOLDER_EDITOR_CONTEXT_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), EM_TYPE_VFOLDER_EDITOR_CONTEXT)) +#define EM_VFOLDER_EDITOR_CONTEXT_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), EM_TYPE_VFOLDER_EDITOR_CONTEXT, EMVFolderEditorContextClass)) + +G_BEGIN_DECLS + +typedef struct _EMVFolderEditorContext EMVFolderEditorContext; +typedef struct _EMVFolderEditorContextClass EMVFolderEditorContextClass; +typedef struct _EMVFolderEditorContextPrivate EMVFolderEditorContextPrivate; + +struct _EMVFolderEditorContext { + EMVFolderContext parent; + EMVFolderEditorContextPrivate *priv; +}; + +struct _EMVFolderEditorContextClass { + EMVFolderContextClass parent_class; +}; + +GType em_vfolder_editor_context_get_type (void); +EMVFolderEditorContext * + em_vfolder_editor_context_new (EMailSession *session); +EMailSession * em_vfolder_editor_context_get_session (EMVFolderEditorContext *context); + +G_END_DECLS + +#endif /* EM_VFOLDER_EDITOR_CONTEXT_H */ diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-editor-rule.c index adea1b92f0..377bf1e23e 100644 --- a/mail/em-vfolder-rule.c +++ b/mail/em-vfolder-editor-rule.c @@ -41,19 +41,19 @@ #include "em-folder-selector.h" #include "em-folder-tree.h" #include "em-utils.h" -#include "em-vfolder-context.h" -#include "em-vfolder-rule.h" +#include "em-vfolder-editor-context.h" +#include "em-vfolder-editor-rule.h" -#define EM_VFOLDER_RULE_GET_PRIVATE(obj) \ +#define EM_VFOLDER_EDITOR_RULE_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), EM_TYPE_VFOLDER_RULE, EMVFolderRulePrivate)) + ((obj), EM_TYPE_VFOLDER_EDITOR_RULE, EMVFolderEditorRulePrivate)) -#define EM_VFOLDER_RULE_GET_PRIVATE(obj) \ +#define EM_VFOLDER_EDITOR_RULE_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), EM_TYPE_VFOLDER_RULE, EMVFolderRulePrivate)) + ((obj), EM_TYPE_VFOLDER_EDITOR_RULE, EMVFolderEditorRulePrivate)) -struct _EMVFolderRulePrivate { - EMailSession *session; +struct _EMVFolderEditorRulePrivate { + EMailSession *session; }; enum { @@ -61,28 +61,15 @@ enum { PROP_SESSION }; -static gint validate (EFilterRule *, EAlert **alert); -static gint vfolder_eq (EFilterRule *fr, EFilterRule *cm); -static xmlNodePtr xml_encode (EFilterRule *); -static gint xml_decode (EFilterRule *, xmlNodePtr, ERuleContext *f); -static void rule_copy (EFilterRule *dest, EFilterRule *src); static GtkWidget *get_widget (EFilterRule *fr, ERuleContext *f); -/* DO NOT internationalise these strings */ -static const gchar *with_names[] = { - "specific", - "local_remote_active", - "remote_active", - "local" -}; - G_DEFINE_TYPE ( - EMVFolderRule, - em_vfolder_rule, - E_TYPE_FILTER_RULE) + EMVFolderEditorRule, + em_vfolder_editor_rule, + EM_TYPE_VFOLDER_RULE) static void -vfolder_rule_set_session (EMVFolderRule *rule, +vfolder_editor_rule_set_session (EMVFolderEditorRule *rule, EMailSession *session) { if (session == NULL) { @@ -104,15 +91,15 @@ vfolder_rule_set_session (EMVFolderRule *rule, } static void -vfolder_rule_set_property (GObject *object, +vfolder_editor_rule_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { switch (property_id) { case PROP_SESSION: - vfolder_rule_set_session ( - EM_VFOLDER_RULE (object), + vfolder_editor_rule_set_session ( + EM_VFOLDER_EDITOR_RULE (object), g_value_get_object (value)); return; } @@ -121,7 +108,7 @@ vfolder_rule_set_property (GObject *object, } static void -vfolder_rule_get_property (GObject *object, +vfolder_editor_rule_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) @@ -130,8 +117,8 @@ vfolder_rule_get_property (GObject *object, case PROP_SESSION: g_value_set_object ( value, - em_vfolder_rule_get_session ( - EM_VFOLDER_RULE (object))); + em_vfolder_editor_rule_get_session ( + EM_VFOLDER_EDITOR_RULE (object))); return; } @@ -139,54 +126,44 @@ vfolder_rule_get_property (GObject *object, } static void -vfolder_rule_dispose (GObject *object) +vfolder_editor_rule_dispose (GObject *object) { - EMVFolderRulePrivate *priv; - - priv = EM_VFOLDER_RULE_GET_PRIVATE (object); + EMVFolderEditorRulePrivate *priv; + priv = EM_VFOLDER_EDITOR_RULE_GET_PRIVATE (object); if (priv->session != NULL) { g_object_unref (priv->session); priv->session = NULL; } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (em_vfolder_rule_parent_class)->dispose (object); + G_OBJECT_CLASS (em_vfolder_editor_rule_parent_class)->dispose (object); } static void -vfolder_rule_finalize (GObject *object) +vfolder_editor_rule_finalize (GObject *object) { - EMVFolderRule *rule = EM_VFOLDER_RULE (object); - gchar *uri; - - while ((uri = g_queue_pop_head (&rule->sources)) != NULL) - g_free (uri); + /* EMVFolderEditorRule *rule = EM_VFOLDER_EDITOR_RULE (object); */ /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (em_vfolder_rule_parent_class)->finalize (object); + G_OBJECT_CLASS (em_vfolder_editor_rule_parent_class)->finalize (object); } static void -em_vfolder_rule_class_init (EMVFolderRuleClass *class) +em_vfolder_editor_rule_class_init (EMVFolderEditorRuleClass *class) { GObjectClass *object_class; EFilterRuleClass *filter_rule_class; - g_type_class_add_private (class, sizeof (EMVFolderRulePrivate)); + g_type_class_add_private (class, sizeof (EMVFolderEditorRulePrivate)); object_class = G_OBJECT_CLASS (class); - object_class->set_property = vfolder_rule_set_property; - object_class->get_property = vfolder_rule_get_property; - object_class->dispose = vfolder_rule_dispose; - object_class->finalize = vfolder_rule_finalize; + object_class->set_property = vfolder_editor_rule_set_property; + object_class->get_property = vfolder_editor_rule_get_property; + object_class->dispose = vfolder_editor_rule_dispose; + object_class->finalize = vfolder_editor_rule_finalize; filter_rule_class = E_FILTER_RULE_CLASS (class); - filter_rule_class->validate = validate; - filter_rule_class->eq = vfolder_eq; - filter_rule_class->xml_encode = xml_encode; - filter_rule_class->xml_decode = xml_decode; - filter_rule_class->copy = rule_copy; filter_rule_class->get_widget = get_widget; g_object_class_install_property ( @@ -202,267 +179,28 @@ em_vfolder_rule_class_init (EMVFolderRuleClass *class) } static void -em_vfolder_rule_init (EMVFolderRule *rule) +em_vfolder_editor_rule_init (EMVFolderEditorRule *rule) { - rule->priv = EM_VFOLDER_RULE_GET_PRIVATE (rule); - rule->with = EM_VFOLDER_RULE_WITH_SPECIFIC; - rule->rule.source = g_strdup ("incoming"); + rule->priv = EM_VFOLDER_EDITOR_RULE_GET_PRIVATE (rule); } EFilterRule * -em_vfolder_rule_new (EMailSession *session) +em_vfolder_editor_rule_new (EMailSession *session) { g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL); return g_object_new ( - EM_TYPE_VFOLDER_RULE, "session", session, NULL); + EM_TYPE_VFOLDER_EDITOR_RULE, "session", session, NULL); } EMailSession * -em_vfolder_rule_get_session (EMVFolderRule *rule) +em_vfolder_editor_rule_get_session (EMVFolderEditorRule *rule) { g_return_val_if_fail (EM_IS_VFOLDER_RULE (rule), NULL); return rule->priv->session; } -void -em_vfolder_rule_add_source (EMVFolderRule *rule, - const gchar *uri) -{ - g_return_if_fail (EM_IS_VFOLDER_RULE (rule)); - g_return_if_fail (uri); - - g_queue_push_tail (&rule->sources, g_strdup (uri)); - - e_filter_rule_emit_changed (E_FILTER_RULE (rule)); -} - -const gchar * -em_vfolder_rule_find_source (EMVFolderRule *rule, - const gchar *uri) -{ - GList *link; - - g_return_val_if_fail (EM_IS_VFOLDER_RULE (rule), NULL); - - /* only does a simple string or address comparison, should - * probably do a decoded url comparison */ - link = g_queue_find_custom ( - &rule->sources, uri, (GCompareFunc) strcmp); - - return (link != NULL) ? link->data : NULL; -} - -void -em_vfolder_rule_remove_source (EMVFolderRule *rule, - const gchar *uri) -{ - gchar *found; - - g_return_if_fail (EM_IS_VFOLDER_RULE (rule)); - - found =(gchar *) em_vfolder_rule_find_source (rule, uri); - if (found != NULL) { - g_queue_remove (&rule->sources, found); - g_free (found); - e_filter_rule_emit_changed (E_FILTER_RULE (rule)); - } -} - -const gchar * -em_vfolder_rule_next_source (EMVFolderRule *rule, - const gchar *last) -{ - GList *link; - - if (last == NULL) { - link = g_queue_peek_head_link (&rule->sources); - } else { - link = g_queue_find (&rule->sources, last); - if (link == NULL) - link = g_queue_peek_head_link (&rule->sources); - else - link = g_list_next (link); - } - - return (link != NULL) ? link->data : NULL; -} - -static gint -validate (EFilterRule *fr, - EAlert **alert) -{ - g_return_val_if_fail (fr != NULL, 0); - g_warn_if_fail (alert == NULL || *alert == NULL); - - if (!fr->name || !*fr->name) { - if (alert) - *alert = e_alert_new ("mail:no-name-vfolder", NULL); - return 0; - } - - /* We have to have at least one source set in the "specific" case. - * Do not translate this string! */ - if (((EMVFolderRule *) fr)->with == EM_VFOLDER_RULE_WITH_SPECIFIC && - g_queue_is_empty (&((EMVFolderRule *) fr)->sources)) { - if (alert) - *alert = e_alert_new ("mail:vfolder-no-source", NULL); - return 0; - } - - return E_FILTER_RULE_CLASS (em_vfolder_rule_parent_class)->validate (fr, alert); -} - -static gint -queue_eq (GQueue *queue_a, - GQueue *queue_b) -{ - GList *link_a; - GList *link_b; - gint truth = TRUE; - - link_a = g_queue_peek_head_link (queue_a); - link_b = g_queue_peek_head_link (queue_b); - - while (truth && link_a != NULL && link_b != NULL) { - gchar *uri_a = link_a->data; - gchar *uri_b = link_b->data; - - truth = (strcmp (uri_a, uri_b)== 0); - - link_a = g_list_next (link_a); - link_b = g_list_next (link_b); - } - - return truth && link_a == NULL && link_b == NULL; -} - -static gint -vfolder_eq (EFilterRule *fr, - EFilterRule *cm) -{ - return E_FILTER_RULE_CLASS (em_vfolder_rule_parent_class)->eq (fr, cm) - && queue_eq ( - &((EMVFolderRule *) fr)->sources, - &((EMVFolderRule *) cm)->sources); -} - -static xmlNodePtr -xml_encode (EFilterRule *fr) -{ - EMVFolderRule *vr =(EMVFolderRule *) fr; - xmlNodePtr node, set, work; - GList *head, *link; - - node = E_FILTER_RULE_CLASS (em_vfolder_rule_parent_class)->xml_encode (fr); - g_return_val_if_fail (node != NULL, NULL); - g_return_val_if_fail (vr->with < G_N_ELEMENTS (with_names), NULL); - - set = xmlNewNode(NULL, (const guchar *)"sources"); - xmlAddChild (node, set); - xmlSetProp(set, (const guchar *)"with", (guchar *)with_names[vr->with]); - - head = g_queue_peek_head_link (&vr->sources); - for (link = head; link != NULL; link = g_list_next (link)) { - const gchar *uri = link->data; - - work = xmlNewNode (NULL, (const guchar *) "folder"); - xmlSetProp (work, (const guchar *) "uri", (guchar *) uri); - xmlAddChild (set, work); - } - - return node; -} - -static void -set_with (EMVFolderRule *vr, - const gchar *name) -{ - gint i; - - for (i = 0; i < G_N_ELEMENTS (with_names); i++) { - if (!strcmp (name, with_names[i])) { - vr->with = i; - return; - } - } - - vr->with = 0; -} - -static gint -xml_decode (EFilterRule *fr, - xmlNodePtr node, - ERuleContext *f) -{ - xmlNodePtr set, work; - gint result; - EMVFolderRule *vr =(EMVFolderRule *) fr; - gchar *tmp; - - result = E_FILTER_RULE_CLASS (em_vfolder_rule_parent_class)-> - xml_decode (fr, node, f); - if (result != 0) - return result; - - /* handle old format file, vfolder source is in filterrule */ - if (strcmp(fr->source, "incoming")!= 0) { - set_with (vr, fr->source); - g_free (fr->source); - fr->source = g_strdup("incoming"); - } - - set = node->children; - while (set) { - if (!strcmp((gchar *)set->name, "sources")) { - tmp = (gchar *)xmlGetProp(set, (const guchar *)"with"); - if (tmp) { - set_with (vr, tmp); - xmlFree (tmp); - } - work = set->children; - while (work) { - if (!strcmp((gchar *)work->name, "folder")) { - tmp = (gchar *)xmlGetProp(work, (const guchar *)"uri"); - if (tmp) { - g_queue_push_tail (&vr->sources, g_strdup (tmp)); - xmlFree (tmp); - } - } - work = work->next; - } - } - set = set->next; - } - return 0; -} - -static void -rule_copy (EFilterRule *dest, - EFilterRule *src) -{ - EMVFolderRule *vdest, *vsrc; - GList *head, *link; - gchar *uri; - - vdest =(EMVFolderRule *) dest; - vsrc =(EMVFolderRule *) src; - - while ((uri = g_queue_pop_head (&vdest->sources)) != NULL) - g_free (uri); - - head = g_queue_peek_head_link (&vsrc->sources); - for (link = head; link != NULL; link = g_list_next (link)) { - const gchar *uri = link->data; - g_queue_push_tail (&vdest->sources, g_strdup (uri)); - } - - vdest->with = vsrc->with; - - E_FILTER_RULE_CLASS (em_vfolder_rule_parent_class)->copy (dest, src); -} - enum { BUTTON_ADD, BUTTON_REMOVE, @@ -685,7 +423,7 @@ get_widget (EFilterRule *fr, GObject *object; gint i; - widget = E_FILTER_RULE_CLASS (em_vfolder_rule_parent_class)-> + widget = E_FILTER_RULE_CLASS (em_vfolder_editor_rule_parent_class)-> get_widget (fr, rc); data = g_malloc0 (sizeof (*data)); @@ -712,7 +450,7 @@ get_widget (EFilterRule *fr, object = gtk_builder_get_object (builder, "source_model"); data->model = GTK_LIST_STORE (object); - session = em_vfolder_context_get_session (EM_VFOLDER_CONTEXT (rc)); + session = em_vfolder_editor_context_get_session (EM_VFOLDER_EDITOR_CONTEXT (rc)); source = NULL; while ((source = em_vfolder_rule_next_source (vr, source))) { diff --git a/mail/em-vfolder-editor-rule.h b/mail/em-vfolder-editor-rule.h new file mode 100644 index 0000000000..39ad09797d --- /dev/null +++ b/mail/em-vfolder-editor-rule.h @@ -0,0 +1,81 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Authors: + * NotZed <notzed@ximian.com> + * Jeffrey Stedfast <fejj@ximian.com> + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef EM_VFOLDER_EDITOR_RULE_H +#define EM_VFOLDER_EDITOR_RULE_H + +#include <filter/e-filter-rule.h> +#include <libemail-utils/em-vfolder-rule.h> +#include <libemail-engine/e-mail-session.h> + +/* Standard GObject macros */ +#define EM_TYPE_VFOLDER_EDITOR_RULE \ + (em_vfolder_editor_rule_get_type ()) +#define EM_VFOLDER_EDITOR_RULE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), EM_TYPE_VFOLDER_EDITOR_RULE, EMVFolderEditorRule)) +#define EM_VFOLDER_EDITOR_RULE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), EM_TYPE_VFOLDER_EDITOR_RULE, EMVFolderEditorRuleClass)) +#define EM_IS_VFOLDER_EDITOR_RULE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), EM_TYPE_VFOLDER_EDITOR_RULE)) +#define EM_IS_VFOLDER_EDITOR_RULE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), EM_TYPE_VFOLDER_EDITOR_RULE)) +#define EM_VFOLDER_EDITOR_RULE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), EM_TYPE_VFOLDER_EDITOR_RULE, EMVFolderEditorRuleClass)) + +G_BEGIN_DECLS + +/* perhaps should be bits? */ +enum _em_vfolder_editor_rule_with_t { + EM_VFOLDER_EDITOR_RULE_WITH_SPECIFIC, + EM_VFOLDER_EDITOR_RULE_WITH_LOCAL_REMOTE_ACTIVE, + EM_VFOLDER_EDITOR_RULE_WITH_REMOTE_ACTIVE, + EM_VFOLDER_EDITOR_RULE_WITH_LOCAL +}; + +typedef struct _EMVFolderEditorRule EMVFolderEditorRule; +typedef struct _EMVFolderEditorRuleClass EMVFolderEditorRuleClass; +typedef struct _EMVFolderEditorRulePrivate EMVFolderEditorRulePrivate; + +typedef enum _em_vfolder_editor_rule_with_t em_vfolder_editor_rule_with_t; + +struct _EMVFolderEditorRule { + EMVFolderRule rule; + EMVFolderEditorRulePrivate *priv; +}; + +struct _EMVFolderEditorRuleClass { + EMVFolderRuleClass parent_class; +}; + +GType em_vfolder_editor_rule_get_type (void); +EFilterRule * em_vfolder_editor_rule_new (EMailSession *session); +EMailSession * em_vfolder_editor_rule_get_session (EMVFolderEditorRule *rule); + +G_END_DECLS + +#endif /* EM_VFOLDER_EDITOR_RULE_H */ diff --git a/mail/em-vfolder-editor.c b/mail/em-vfolder-editor.c index ef3e0fb3ca..48f1395430 100644 --- a/mail/em-vfolder-editor.c +++ b/mail/em-vfolder-editor.c @@ -34,7 +34,7 @@ #include "e-util/e-util-private.h" #include "em-vfolder-editor.h" -#include "em-vfolder-rule.h" +#include "em-vfolder-editor-rule.h" G_DEFINE_TYPE ( EMVFolderEditor, @@ -44,16 +44,16 @@ G_DEFINE_TYPE ( static EFilterRule * vfolder_editor_create_rule (ERuleEditor *rule_editor) { - EMVFolderContext *context; + EMVFolderEditorContext *context; EMailSession *session; EFilterRule *rule; EFilterPart *part; - context = EM_VFOLDER_CONTEXT (rule_editor->context); - session = em_vfolder_context_get_session (context); + context = EM_VFOLDER_EDITOR_CONTEXT (rule_editor->context); + session = em_vfolder_editor_context_get_session (context); /* create a rule with 1 part in it */ - rule = em_vfolder_rule_new (session); + rule = em_vfolder_editor_rule_new (session); part = e_rule_context_next_part (rule_editor->context, NULL); e_filter_rule_add_part (rule, e_filter_part_clone (part)); diff --git a/mail/em-vfolder-editor.h b/mail/em-vfolder-editor.h index 2548582ad7..311a63777f 100644 --- a/mail/em-vfolder-editor.h +++ b/mail/em-vfolder-editor.h @@ -25,7 +25,7 @@ #define EM_VFOLDER_EDITOR_H #include "filter/e-rule-editor.h" -#include "em-vfolder-context.h" +#include "em-vfolder-editor-context.h" /* Standard GObject macros */ #define EM_TYPE_VFOLDER_EDITOR \ diff --git a/mail/em-vfolder-rule.h b/mail/em-vfolder-rule.h deleted file mode 100644 index 1b3a4432ca..0000000000 --- a/mail/em-vfolder-rule.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * NotZed <notzed@ximian.com> - * Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef EM_VFOLDER_RULE_H -#define EM_VFOLDER_RULE_H - -#include <filter/e-filter-rule.h> -#include <libemail-engine/e-mail-session.h> - -/* Standard GObject macros */ -#define EM_TYPE_VFOLDER_RULE \ - (em_vfolder_rule_get_type ()) -#define EM_VFOLDER_RULE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), EM_TYPE_VFOLDER_RULE, EMVFolderRule)) -#define EM_VFOLDER_RULE_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), EM_TYPE_VFOLDER_RULE, EMVFolderRuleClass)) -#define EM_IS_VFOLDER_RULE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), EM_TYPE_VFOLDER_RULE)) -#define EM_IS_VFOLDER_RULE_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), EM_TYPE_VFOLDER_RULE)) -#define EM_VFOLDER_RULE_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), EM_TYPE_VFOLDER_RULE, EMVFolderRuleClass)) - -G_BEGIN_DECLS - -/* perhaps should be bits? */ -enum _em_vfolder_rule_with_t { - EM_VFOLDER_RULE_WITH_SPECIFIC, - EM_VFOLDER_RULE_WITH_LOCAL_REMOTE_ACTIVE, - EM_VFOLDER_RULE_WITH_REMOTE_ACTIVE, - EM_VFOLDER_RULE_WITH_LOCAL -}; - -typedef struct _EMVFolderRule EMVFolderRule; -typedef struct _EMVFolderRuleClass EMVFolderRuleClass; -typedef struct _EMVFolderRulePrivate EMVFolderRulePrivate; - -typedef enum _em_vfolder_rule_with_t em_vfolder_rule_with_t; - -struct _EMVFolderRule { - EFilterRule rule; - EMVFolderRulePrivate *priv; - - em_vfolder_rule_with_t with; - GQueue sources; /* uri's of the source folders */ -}; - -struct _EMVFolderRuleClass { - EFilterRuleClass parent_class; -}; - -GType em_vfolder_rule_get_type (void); -EFilterRule * em_vfolder_rule_new (EMailSession *session); -EMailSession * em_vfolder_rule_get_session (EMVFolderRule *rule); -void em_vfolder_rule_add_source (EMVFolderRule *rule, - const gchar *uri); -void em_vfolder_rule_remove_source (EMVFolderRule *rule, - const gchar *uri); -const gchar * em_vfolder_rule_find_source (EMVFolderRule *rule, - const gchar *uri); -const gchar * em_vfolder_rule_next_source (EMVFolderRule *rule, - const gchar *last); - -G_END_DECLS - -#endif /* EM_VFOLDER_RULE_H */ diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c index 597c87d9d3..4db48df056 100644 --- a/mail/mail-autofilter.c +++ b/mail/mail-autofilter.c @@ -38,8 +38,8 @@ #include "libevolution-utils/e-alert-dialog.h" #include "e-util/e-util-private.h" -#include "em-vfolder-context.h" -#include "em-vfolder-rule.h" +#include "em-vfolder-editor-context.h" +#include "em-vfolder-editor-rule.h" #include "em-vfolder-editor.h" #include "em-filter-context.h" @@ -317,9 +317,9 @@ em_vfolder_rule_from_message (EMVFolderContext *context, uri = e_mail_folder_uri_from_folder (folder); - session = em_vfolder_context_get_session (context); + session = em_vfolder_editor_context_get_session ((EMVFolderEditorContext *) context); - rule = em_vfolder_rule_new (session); + rule = em_vfolder_editor_rule_new (session); em_vfolder_rule_add_source (EM_VFOLDER_RULE (rule), uri); rule_from_message (rule, E_RULE_CONTEXT (context), msg, flags); @@ -344,9 +344,9 @@ em_vfolder_rule_from_address (EMVFolderContext *context, uri = e_mail_folder_uri_from_folder (folder); - session = em_vfolder_context_get_session (context); + session = em_vfolder_editor_context_get_session ((EMVFolderEditorContext *) context); - rule = em_vfolder_rule_new (session); + rule = em_vfolder_editor_rule_new (session); em_vfolder_rule_add_source (EM_VFOLDER_RULE (rule), uri); rule_from_address (rule, E_RULE_CONTEXT (context), addr, flags); diff --git a/mail/mail-autofilter.h b/mail/mail-autofilter.h index 34593b0f95..a9e4254f9b 100644 --- a/mail/mail-autofilter.h +++ b/mail/mail-autofilter.h @@ -28,7 +28,7 @@ #include <filter/e-filter-rule.h> #include <mail/em-filter-context.h> -#include <mail/em-vfolder-context.h> +#include <libemail-utils/em-vfolder-context.h> #include <libemail-engine/e-mail-session.h> enum { diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index a9fd42e5db..1435c39ae5 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -42,9 +42,9 @@ #include "e-mail-backend.h" #include "em-folder-tree-model.h" #include "em-utils.h" -#include "em-vfolder-context.h" +#include "em-vfolder-editor-context.h" #include "em-vfolder-editor.h" -#include "em-vfolder-rule.h" +#include "em-vfolder-editor-rule.h" #include "mail-autofilter.h" #include "mail-vfolder.h" #include "e-mail-ui-session.h" @@ -713,7 +713,7 @@ rule_changed (EFilterRule *rule, const gchar *full_name; full_name = camel_folder_get_full_name (folder); - session = em_vfolder_rule_get_session (EM_VFOLDER_RULE (rule)); + session = em_vfolder_editor_rule_get_session (EM_VFOLDER_EDITOR_RULE (rule)); service = camel_session_get_service ( CAMEL_SESSION (session), E_MAIL_SESSION_VFOLDER_UID); @@ -815,7 +815,7 @@ context_rule_added (ERuleContext *ctx, d(printf("rule added: %s\n", rule->name)); - session = em_vfolder_rule_get_session (EM_VFOLDER_RULE (rule)); + session = em_vfolder_editor_rule_get_session (EM_VFOLDER_EDITOR_RULE (rule)); service = camel_session_get_service ( CAMEL_SESSION (session), E_MAIL_SESSION_VFOLDER_UID); @@ -848,7 +848,7 @@ context_rule_removed (ERuleContext *ctx, d(printf("rule removed; %s\n", rule->name)); - session = em_vfolder_rule_get_session (EM_VFOLDER_RULE (rule)); + session = em_vfolder_editor_rule_get_session (EM_VFOLDER_EDITOR_RULE (rule)); service = camel_session_get_service ( CAMEL_SESSION (session), E_MAIL_SESSION_VFOLDER_UID); @@ -1043,7 +1043,7 @@ vfolder_load_storage (EMailBackend *backend) /* load our rules */ user = g_build_filename (config_dir, "vfolders.xml", NULL); - context = em_vfolder_context_new (session); + context = (EMVFolderContext *) em_vfolder_editor_context_new (session); xmlfile = g_build_filename (EVOLUTION_PRIVDATADIR, "vfoldertypes.xml", NULL); if (e_rule_context_load ((ERuleContext *) context, @@ -1283,7 +1283,7 @@ vfolder_clone_rule (EMailSession *session, g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL); - rule = em_vfolder_rule_new (session); + rule = em_vfolder_editor_rule_new (session); xml = e_filter_rule_xml_encode (in); e_filter_rule_xml_decode (rule, xml, (ERuleContext *) context); diff --git a/mail/mail-vfolder.h b/mail/mail-vfolder.h index efebc17762..fc03e881d9 100644 --- a/mail/mail-vfolder.h +++ b/mail/mail-vfolder.h @@ -27,7 +27,7 @@ #include <filter/e-filter-part.h> #include <filter/e-filter-rule.h> #include <mail/e-mail-backend.h> -#include <mail/em-vfolder-rule.h> +#include <libemail-utils/em-vfolder-rule.h> #include <shell/e-shell-view.h> void vfolder_load_storage (EMailBackend *backend); |