[evolution-data-server/email-factory-3-4: 4/13] More saner changes and new files
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/email-factory-3-4: 4/13] More saner changes and new files
- Date: Mon, 2 Jan 2012 14:46:07 +0000 (UTC)
commit 3a087d420973841edd06e978725c4fc9433adf1d
Author: Srinivasa Ragavan <sragavan gnome org>
Date: Mon Oct 10 11:24:58 2011 +0530
More saner changes and new files
configure.ac | 11 +-
mail/Makefile.am | 2 +-
.../Makefile.am | 11 +-
.../libemail-engine.pc.in | 0
mail/{libemailutils => libemail-utils}/Makefile.am | 11 +-
.../e-account-utils.c | 0
.../e-account-utils.h | 0
.../e-marshal.list | 0
mail/libemail-utils/e-signature-list.c | 494 +++++++++++++
mail/libemail-utils/e-signature-list.h | 92 +++
mail/libemail-utils/e-signature.c | 747 ++++++++++++++++++++
mail/libemail-utils/e-signature.h | 90 +++
.../libemail-utils.pc.in | 0
mail/{libemailutils => libemail-utils}/mail-mt.c | 0
14 files changed, 1449 insertions(+), 9 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 83d06fa..c0a06ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1288,6 +1288,9 @@ AC_SUBST(E_BACKEND_LIBS)
dnl ******************************
dnl Email daemon
dnl ******************************
+EVO_SET_COMPILE_FLAGS(EMAIL_ENGINE, libebook-1.2)
+AC_SUBST(E_BACKEND_CFLAGS)
+AC_SUBST(E_BACKEND_LIBS)
dnl ******************************
dnl evolution-addressbook flags
@@ -1577,10 +1580,10 @@ libedataserverui/Makefile
libedataserverui/libedataserverui.pc
mail/Makefile
mail/libegdbus/Makefile
-mail/libemailengine/Makefile
-mail/libemailengine/libemail-engine.pc
-mail/libemailutils/Makefile
-mail/libemailutils/libemail-utils.pc
+mail/libemail-engine/Makefile
+mail/libemail-engine/libemail-engine.pc
+mail/libemail-utils/Makefile
+mail/libemail-utils/libemail-utils.pc
mail/daemon/Makefile
services/Makefile
services/evolution-addressbook-factory/Makefile
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 4125c8e..85cced5 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = libemailutils libemailengine libegdbus daemon
+SUBDIRS = libemail-utils libemail-engine libegdbus daemon
DISTCHECK_CONFIGURE_FLAGS=
diff --git a/mail/libemailengine/Makefile.am b/mail/libemail-engine/Makefile.am
similarity index 73%
rename from mail/libemailengine/Makefile.am
rename to mail/libemail-engine/Makefile.am
index 88ba3f8..7b20cd4 100644
--- a/mail/libemailengine/Makefile.am
+++ b/mail/libemail-engine/Makefile.am
@@ -1,17 +1,19 @@
lib_LTLIBRARIES = libemail-engine.la
-AM_CFLAGS = -I$(top_builddir) @GNOME_PLATFORM_CFLAGS@ -Wall -Werror -g3 -O0 -ggdb -DPKGDATADIR="\"$(pkgdatadir)\""
+AM_CFLAGS = -I$(top_builddir) -I$(top_builddir)/mail @GNOME_PLATFORM_CFLAGS@ -Wall -Werror -g3 -O0 -ggdb -DPKGDATADIR="\"$(pkgdatadir)\""
AM_LDFLAGS = @GNOME_PLATFORM_LIBS@
libemail_engine_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
+ $(EMAIL_ENGINE_CFLAGS) \
$(CAMEL_CFLAGS) \
$(GNOME_PLATFORM_CFLAGS)
libemail_engine_la_LIBADD = \
$(CAMEL_LIBS) \
+ $(EMAIL_ENGINE_LIBS) \
$(GNOME_PLATFORM_LIBS) \
$(top_builddir)/camel/libcamel-1.2.la \
$(top_builddir)/camel/libcamel-provider-1.2.la \
@@ -22,6 +24,13 @@ libemail_engine_la_LIBADD = \
libemail_engine_la_LDFLAGS =
libemail_engine_la_SOURCES = \
+ e-mail-local.c \
+ e-mail-folder-utils.c \
+ mail-tools.c \
+ e-mail-utils.c \
+ mail-config.c \
+ e-mail-junk-filter.c \
+ mail-ops.c \
e-mail-session.c \
mail-folder-cache.c
diff --git a/mail/libemailengine/libemail-engine.pc.in b/mail/libemail-engine/libemail-engine.pc.in
similarity index 100%
rename from mail/libemailengine/libemail-engine.pc.in
rename to mail/libemail-engine/libemail-engine.pc.in
diff --git a/mail/libemailutils/Makefile.am b/mail/libemail-utils/Makefile.am
similarity index 81%
rename from mail/libemailutils/Makefile.am
rename to mail/libemail-utils/Makefile.am
index fc665cd..8cd90dd 100644
--- a/mail/libemailutils/Makefile.am
+++ b/mail/libemail-utils/Makefile.am
@@ -1,7 +1,7 @@
lib_LTLIBRARIES = libemail-utils.la
-AM_CFLAGS = @GNOME_PLATFORM_CFLAGS@ -Wall -Werror -g3 -O0 -ggdb -DPKGDATADIR="\"$(pkgdatadir)\""
+AM_CFLAGS = -I. -I$(top_builddir)/mail @GNOME_PLATFORM_CFLAGS@ -Wall -Werror -g3 -O0 -ggdb -DPKGDATADIR="\"$(pkgdatadir)\""
AM_LDFLAGS = @GNOME_PLATFORM_LIBS@
@@ -26,14 +26,19 @@ libemail_utils_la_LDFLAGS =
libemail_utils_la_SOURCES = \
e-marshal.c \
e-account-utils.c \
- mail-mt.c
+ mail-mt.c \
+ e-signature.c \
+ e-signature-list.c
libmailutilsincludedir = $(includedir)/libemail-utils
libmailutilsinclude_HEADERS = \
e-marshal.h \
e-account-utils.h \
- mail-mt.h
+ mail-mt.h \
+ e-signature.h \
+ e-signature-list.h
+
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libemail-utils.pc
diff --git a/mail/libemailutils/e-account-utils.c b/mail/libemail-utils/e-account-utils.c
similarity index 100%
rename from mail/libemailutils/e-account-utils.c
rename to mail/libemail-utils/e-account-utils.c
diff --git a/mail/libemailutils/e-account-utils.h b/mail/libemail-utils/e-account-utils.h
similarity index 100%
rename from mail/libemailutils/e-account-utils.h
rename to mail/libemail-utils/e-account-utils.h
diff --git a/mail/libemailutils/e-marshal.list b/mail/libemail-utils/e-marshal.list
similarity index 100%
rename from mail/libemailutils/e-marshal.list
rename to mail/libemail-utils/e-marshal.list
diff --git a/mail/libemail-utils/e-signature-list.c b/mail/libemail-utils/e-signature-list.c
new file mode 100644
index 0000000..1f03cd3
--- /dev/null
+++ b/mail/libemail-utils/e-signature-list.c
@@ -0,0 +1,494 @@
+/*
+ *
+ * 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:
+ * Jeffrey Stedfast <fejj ximian com>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "e-signature-list.h"
+
+#include <string.h>
+
+#include <libedataserver/e-uid.h>
+
+struct _ESignatureListPrivate {
+ GConfClient *gconf;
+ guint notify_id;
+ gboolean resave;
+};
+
+enum {
+ SIGNATURE_ADDED,
+ SIGNATURE_CHANGED,
+ SIGNATURE_REMOVED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+G_DEFINE_TYPE (
+ ESignatureList,
+ e_signature_list,
+ E_TYPE_LIST)
+
+static void
+e_signature_list_dispose (GObject *object)
+{
+ ESignatureList *list = (ESignatureList *) object;
+
+ if (list->priv->gconf) {
+ if (list->priv->notify_id != 0)
+ gconf_client_notify_remove (
+ list->priv->gconf, list->priv->notify_id);
+ g_object_unref (list->priv->gconf);
+ list->priv->gconf = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (e_signature_list_parent_class)->dispose (object);
+}
+
+static void
+e_signature_list_class_init (ESignatureListClass *class)
+{
+ GObjectClass *object_class;
+
+ g_type_class_add_private (class, sizeof (ESignatureListPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = e_signature_list_dispose;
+
+ signals[SIGNATURE_ADDED] = g_signal_new (
+ "signature-added",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ESignatureListClass, signature_added),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_SIGNATURE);
+
+ signals[SIGNATURE_CHANGED] = g_signal_new (
+ "signature-changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ESignatureListClass, signature_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_SIGNATURE);
+
+ signals[SIGNATURE_REMOVED] = g_signal_new (
+ "signature-removed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ESignatureListClass, signature_removed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_SIGNATURE);
+}
+
+static void
+e_signature_list_init (ESignatureList *signature_list)
+{
+ signature_list->priv = G_TYPE_INSTANCE_GET_PRIVATE (
+ signature_list, E_TYPE_SIGNATURE_LIST, ESignatureListPrivate);
+}
+
+static GSList *
+add_autogen (ESignatureList *list,
+ GSList *new_sigs)
+{
+ ESignature *autogen;
+
+ autogen = e_signature_new ();
+ e_signature_set_autogenerated (autogen, TRUE);
+
+ e_list_append (E_LIST (list), autogen);
+
+ return g_slist_prepend (new_sigs, autogen);
+}
+
+static void
+gconf_signatures_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ ESignatureList *signature_list = user_data;
+ GSList *list, *l, *n, *new_sigs = NULL;
+ gboolean have_autogen = FALSE;
+ gboolean resave = FALSE;
+ ESignature *signature;
+ EList *old_sigs;
+ EIterator *iter;
+ gboolean found;
+ gchar *uid;
+
+ old_sigs = e_list_duplicate (E_LIST (signature_list));
+
+ list = gconf_client_get_list (
+ client, "/apps/evolution/mail/signatures",
+ GCONF_VALUE_STRING, NULL);
+ for (l = list; l; l = l->next) {
+ found = FALSE;
+ if ((uid = e_signature_uid_from_xml (l->data))) {
+ /* See if this is an existing signature */
+ iter = e_list_get_iterator (old_sigs);
+ while (e_iterator_is_valid (iter)) {
+ const gchar *signature_uid;
+
+ signature = (ESignature *) e_iterator_get (iter);
+ signature_uid = e_signature_get_uid (signature);
+ if (!strcmp (signature_uid, uid)) {
+ /* The signature still exists, so remove
+ * it from "old_sigs" and update it. */
+ found = TRUE;
+ e_iterator_delete (iter);
+ if (e_signature_set_from_xml (
+ signature, l->data))
+ g_signal_emit (
+ signature_list,
+ signals[SIGNATURE_CHANGED],
+ 0, signature);
+
+ have_autogen |=
+ e_signature_get_autogenerated (
+ signature);
+
+ break;
+ }
+
+ e_iterator_next (iter);
+ }
+
+ g_object_unref (iter);
+ }
+
+ if (!found) {
+ resave = TRUE;
+
+ /* Must be a new signature */
+ signature = e_signature_new_from_xml (l->data);
+ if (signature) {
+ have_autogen |=
+ e_signature_get_autogenerated (signature);
+
+ e_list_append (E_LIST (signature_list), signature);
+ new_sigs = g_slist_prepend (new_sigs, signature);
+ }
+ }
+
+ g_free (uid);
+ }
+
+ if (!have_autogen) {
+ new_sigs = add_autogen (signature_list, new_sigs);
+ resave = TRUE;
+ }
+
+ if (new_sigs != NULL) {
+ /* Now emit signals for each added signature. */
+ l = g_slist_reverse (new_sigs);
+ while (l != NULL) {
+ n = l->next;
+ signature = l->data;
+ g_signal_emit (
+ signature_list,
+ signals[SIGNATURE_ADDED], 0,
+ signature);
+ g_object_unref (signature);
+ g_slist_free_1 (l);
+ l = n;
+ }
+ }
+
+ /* Anything left in old_sigs must have been deleted */
+ iter = e_list_get_iterator (old_sigs);
+ while (e_iterator_is_valid (iter)) {
+ signature = (ESignature *) e_iterator_get (iter);
+ e_list_remove (E_LIST (signature_list), signature);
+ g_signal_emit (
+ signature_list, signals[SIGNATURE_REMOVED], 0,
+ signature);
+ e_iterator_next (iter);
+ }
+
+ g_object_unref (iter);
+ g_object_unref (old_sigs);
+
+ signature_list->priv->resave = resave;
+}
+
+static gpointer
+copy_func (gconstpointer data,
+ gpointer closure)
+{
+ GObject *object = (GObject *) data;
+
+ g_object_ref (object);
+
+ return object;
+}
+
+static void
+free_func (gpointer data,
+ gpointer closure)
+{
+ g_object_unref (data);
+}
+
+/**
+ * e_signature_list_new:
+ * @gconf: a #GConfClient
+ *
+ * Reads the list of signaturess from @gconf and listens for changes.
+ * Will emit #signature_added, #signature_changed, and #signature_removed
+ * signals according to notifications from GConf.
+ *
+ * You can modify the list using e_list_append(), e_list_remove(), and
+ * e_iterator_delete(). After adding, removing, or changing accounts,
+ * you must call e_signature_list_save() to push the changes back to
+ * GConf.
+ *
+ * Return value: the list of signatures
+ **/
+ESignatureList *
+e_signature_list_new (GConfClient *gconf)
+{
+ ESignatureList *signature_list;
+
+ g_return_val_if_fail (GCONF_IS_CLIENT (gconf), NULL);
+
+ signature_list = g_object_new (E_TYPE_SIGNATURE_LIST, NULL);
+ e_signature_list_construct (signature_list, gconf);
+
+ return signature_list;
+}
+
+void
+e_signature_list_construct (ESignatureList *signature_list,
+ GConfClient *gconf)
+{
+ g_return_if_fail (GCONF_IS_CLIENT (gconf));
+
+ e_list_construct (E_LIST (signature_list), copy_func, free_func, NULL);
+ signature_list->priv->gconf = gconf;
+ g_object_ref (gconf);
+
+ gconf_client_add_dir (signature_list->priv->gconf,
+ "/apps/evolution/mail/signatures",
+ GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+
+ signature_list->priv->notify_id =
+ gconf_client_notify_add (signature_list->priv->gconf,
+ "/apps/evolution/mail/signatures",
+ gconf_signatures_changed, signature_list,
+ NULL, NULL);
+
+ gconf_signatures_changed (signature_list->priv->gconf,
+ signature_list->priv->notify_id,
+ NULL, signature_list);
+
+ if (signature_list->priv->resave) {
+ e_signature_list_save (signature_list);
+ signature_list->priv->resave = FALSE;
+ }
+}
+
+/**
+ * e_signature_list_save:
+ * @signature_list: an #ESignatureList
+ *
+ * Saves @signature_list to GConf. Signals will be emitted for changes.
+ **/
+void
+e_signature_list_save (ESignatureList *signature_list)
+{
+ GSList *list = NULL;
+ ESignature *signature;
+ EIterator *iter;
+ gchar *xmlbuf;
+
+ for (iter = e_list_get_iterator (E_LIST (signature_list));
+ e_iterator_is_valid (iter);
+ e_iterator_next (iter)) {
+ signature = (ESignature *) e_iterator_get (iter);
+
+ if ((xmlbuf = e_signature_to_xml (signature)))
+ list = g_slist_append (list, xmlbuf);
+ }
+
+ g_object_unref (iter);
+
+ gconf_client_set_list (signature_list->priv->gconf,
+ "/apps/evolution/mail/signatures",
+ GCONF_VALUE_STRING, list, NULL);
+
+ while (list) {
+ g_free (list->data);
+ list = g_slist_remove (list, list->data);
+ }
+
+ gconf_client_suggest_sync (signature_list->priv->gconf, NULL);
+}
+
+/**
+ * e_signature_list_add:
+ * @signature_list: signature list
+ * @signature: signature to add
+ *
+ * Add an signature to the signature list. Will emit the signature-changed
+ * event.
+ **/
+void
+e_signature_list_add (ESignatureList *signature_list,
+ ESignature *signature)
+{
+ e_list_append ((EList *) signature_list, signature);
+ g_signal_emit (signature_list, signals[SIGNATURE_ADDED], 0, signature);
+}
+
+/**
+ * e_signature_list_change:
+ * @signature_list: signature list
+ * @signature: signature to change
+ *
+ * Signal that the details of an signature have changed.
+ **/
+void
+e_signature_list_change (ESignatureList *signature_list,
+ ESignature *signature)
+{
+ /* maybe the signature should do this itself ... */
+ g_signal_emit (signature_list, signals[SIGNATURE_CHANGED], 0, signature);
+}
+
+/**
+ * e_signature_list_remove:
+ * @signature_list: signature list
+ * @signature: signature
+ *
+ * Remove an signature from the signature list, and emit the
+ * signature-removed signal. If the signature was the default signature,
+ * then reset the default to the first signature.
+ **/
+void
+e_signature_list_remove (ESignatureList *signature_list,
+ ESignature *signature)
+{
+ /* not sure if need to ref but no harm */
+ g_object_ref (signature);
+ e_list_remove ((EList *) signature_list, signature);
+ g_signal_emit (signature_list, signals[SIGNATURE_REMOVED], 0, signature);
+ g_object_unref (signature);
+}
+
+/**
+ * e_signature_list_find_by_name:
+ * @signature_list: an #ESignatureList
+ * @name: the signature name to find
+ *
+ * Searches @signature_list for the given signature name.
+ *
+ * Returns: the matching signature or %NULL if it doesn't exist
+ **/
+ESignature *
+e_signature_list_find_by_name (ESignatureList *signature_list,
+ const gchar *signature_name)
+{
+ ESignature *signature = NULL;
+ EIterator *it;
+
+ g_return_val_if_fail (E_IS_SIGNATURE_LIST (signature_list), NULL);
+
+ /* this could use a callback for more flexibility ...
+ * ... but this makes the common cases easier */
+
+ if (signature_name == NULL)
+ return NULL;
+
+ for (it = e_list_get_iterator (E_LIST (signature_list));
+ e_iterator_is_valid (it);
+ e_iterator_next (it)) {
+ const gchar *value;
+
+ /* XXX EIterator misuses const. */
+ signature = (ESignature *) e_iterator_get (it);
+ value = e_signature_get_name (signature);
+
+ if (g_strcmp0 (value, signature_name) == 0)
+ break;
+
+ signature = NULL;
+ }
+
+ g_object_unref (it);
+
+ return signature;
+}
+
+/**
+ * e_signature_list_find_by_uid:
+ * @signature_list: an #ESignatureList
+ * @name: the signature UID to find
+ *
+ * Searches @signature_list for the given signature UID.
+ *
+ * Returns: the matching signature or %NULL if it doesn't exist
+ **/
+ESignature *
+e_signature_list_find_by_uid (ESignatureList *signature_list,
+ const gchar *signature_uid)
+{
+ ESignature *signature = NULL;
+ EIterator *it;
+
+ g_return_val_if_fail (E_IS_SIGNATURE_LIST (signature_list), NULL);
+
+ /* this could use a callback for more flexibility ...
+ * ... but this makes the common cases easier */
+
+ if (signature_uid == NULL)
+ return NULL;
+
+ for (it = e_list_get_iterator (E_LIST (signature_list));
+ e_iterator_is_valid (it);
+ e_iterator_next (it)) {
+ const gchar *value = NULL;
+
+ /* XXX EIterator misuses const. */
+ signature = (ESignature *) e_iterator_get (it);
+ value = e_signature_get_uid (signature);
+
+ if (g_strcmp0 (value, signature_uid) == 0)
+ break;
+
+ signature = NULL;
+ }
+
+ g_object_unref (it);
+
+ return signature;
+}
diff --git a/mail/libemail-utils/e-signature-list.h b/mail/libemail-utils/e-signature-list.h
new file mode 100644
index 0000000..4e929c8
--- /dev/null
+++ b/mail/libemail-utils/e-signature-list.h
@@ -0,0 +1,92 @@
+/*
+ *
+ * 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:
+ * Jeffrey Stedfast <fejj ximian com>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_SIGNATURE_LIST_H
+#define E_SIGNATURE_LIST_H
+
+#include <libedataserver/e-list.h>
+#include "libemail-utils/e-signature.h"
+
+#include <gconf/gconf-client.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SIGNATURE_LIST \
+ (e_signature_list_get_type ())
+#define E_SIGNATURE_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SIGNATURE_LIST, ESignatureList))
+#define E_SIGNATURE_LIST_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SIGNATURE_LIST, ESignatureListClass))
+#define E_IS_SIGNATURE_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SIGNATURE_LIST))
+#define E_IS_SIGNATURE_LIST_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SIGNATURE_LIST))
+#define E_SIGNATURE_LIST_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SIGNATURE_LIST, ESignatureListClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ESignatureList ESignatureList;
+typedef struct _ESignatureListClass ESignatureListClass;
+typedef struct _ESignatureListPrivate ESignatureListPrivate;
+
+struct _ESignatureList {
+ EList parent;
+ ESignatureListPrivate *priv;
+};
+
+struct _ESignatureListClass {
+ EListClass parent_class;
+
+ /* Signals */
+ void (*signature_added) (ESignatureList *signature_list,
+ ESignature *signature);
+ void (*signature_changed) (ESignatureList *signature_list,
+ ESignature *signature);
+ void (*signature_removed) (ESignatureList *signature_list,
+ ESignature *signature);
+};
+
+GType e_signature_list_get_type (void);
+ESignatureList *e_signature_list_new (GConfClient *client);
+void e_signature_list_construct (ESignatureList *signature_list,
+ GConfClient *client);
+void e_signature_list_save (ESignatureList *signature_list);
+void e_signature_list_add (ESignatureList *signature_list,
+ ESignature *signature);
+void e_signature_list_change (ESignatureList *signature_list,
+ ESignature *signature);
+void e_signature_list_remove (ESignatureList *signature_list,
+ ESignature *signature);
+ESignature * e_signature_list_find_by_name (ESignatureList *signature_list,
+ const gchar *signature_name);
+ESignature * e_signature_list_find_by_uid (ESignatureList *signature_list,
+ const gchar *signature_uid);
+
+G_END_DECLS
+
+#endif /* E_SIGNATURE_LIST_H */
diff --git a/mail/libemail-utils/e-signature.c b/mail/libemail-utils/e-signature.c
new file mode 100644
index 0000000..185378d
--- /dev/null
+++ b/mail/libemail-utils/e-signature.c
@@ -0,0 +1,747 @@
+/*
+ *
+ * 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/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+
+#include <libxml/tree.h>
+#include <libxml/parser.h>
+#include <libxml/xmlmemory.h>
+
+#include <glib/gi18n-lib.h>
+#include <gconf/gconf-client.h>
+
+#include <libedataserver/e-uid.h>
+#include <libedataserver/e-data-server-util.h>
+
+#include "e-signature.h"
+
+struct _ESignaturePrivate {
+ gchar *filename;
+ gchar *name;
+ gchar *uid;
+
+ gboolean autogenerated;
+ gboolean is_html;
+ gboolean is_script;
+};
+
+enum {
+ PROP_0,
+ PROP_AUTOGENERATED,
+ PROP_FILENAME,
+ PROP_IS_HTML,
+ PROP_IS_SCRIPT,
+ PROP_NAME,
+ PROP_UID
+};
+
+G_DEFINE_TYPE (
+ ESignature,
+ e_signature,
+ G_TYPE_OBJECT)
+
+static gboolean
+xml_set_bool (xmlNodePtr node,
+ const gchar *name,
+ gboolean *val)
+{
+ gboolean v_boolean;
+ gchar *buf;
+
+ if ((buf = (gchar *) xmlGetProp (node, (xmlChar *) name))) {
+ v_boolean = (!strcmp (buf, "true") || !strcmp (buf, "yes"));
+ xmlFree (buf);
+
+ if (v_boolean != *val) {
+ *val = v_boolean;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static gboolean
+xml_set_prop (xmlNodePtr node,
+ const gchar *name,
+ gchar **val)
+{
+ gchar *buf, *new_val;
+
+ buf = (gchar *) xmlGetProp (node, (xmlChar *) name);
+ new_val = g_strdup (buf);
+ xmlFree (buf);
+
+ /* We can use strcmp here whether the value is UTF8 or
+ * not, since we only care if the bytes changed.
+ */
+ if (!*val || strcmp (*val, new_val)) {
+ g_free (*val);
+ *val = new_val;
+ return TRUE;
+ } else {
+ g_free (new_val);
+ return FALSE;
+ }
+}
+
+static gboolean
+xml_set_content (xmlNodePtr node,
+ gchar **val)
+{
+ gchar *buf, *new_val;
+
+ buf = (gchar *) xmlNodeGetContent (node);
+ new_val = g_strdup (buf);
+ xmlFree (buf);
+
+ /* We can use strcmp here whether the value is UTF8 or
+ * not, since we only care if the bytes changed. */
+ if (!*val || strcmp (*val, new_val)) {
+ g_free (*val);
+ *val = new_val;
+ return TRUE;
+ } else {
+ g_free (new_val);
+ return FALSE;
+ }
+}
+
+static void
+signature_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_AUTOGENERATED:
+ e_signature_set_autogenerated (
+ E_SIGNATURE (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_FILENAME:
+ e_signature_set_filename (
+ E_SIGNATURE (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_IS_HTML:
+ e_signature_set_is_html (
+ E_SIGNATURE (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_IS_SCRIPT:
+ e_signature_set_is_script (
+ E_SIGNATURE (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_NAME:
+ e_signature_set_name (
+ E_SIGNATURE (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_UID:
+ e_signature_set_uid (
+ E_SIGNATURE (object),
+ g_value_get_string (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+signature_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_AUTOGENERATED:
+ g_value_set_boolean (
+ value, e_signature_get_autogenerated (
+ E_SIGNATURE (object)));
+ return;
+
+ case PROP_FILENAME:
+ g_value_set_string (
+ value, e_signature_get_filename (
+ E_SIGNATURE (object)));
+ return;
+
+ case PROP_IS_HTML:
+ g_value_set_boolean (
+ value, e_signature_get_is_html (
+ E_SIGNATURE (object)));
+ return;
+
+ case PROP_IS_SCRIPT:
+ g_value_set_boolean (
+ value, e_signature_get_is_script (
+ E_SIGNATURE (object)));
+ return;
+
+ case PROP_NAME:
+ g_value_set_string (
+ value, e_signature_get_name (
+ E_SIGNATURE (object)));
+ return;
+
+ case PROP_UID:
+ g_value_set_string (
+ value, e_signature_get_uid (
+ E_SIGNATURE (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+signature_finalize (GObject *object)
+{
+ ESignaturePrivate *priv;
+
+ priv = E_SIGNATURE (object)->priv;
+
+ g_free (priv->filename);
+ g_free (priv->name);
+ g_free (priv->uid);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (e_signature_parent_class)->finalize (object);
+}
+
+static void
+e_signature_class_init (ESignatureClass *class)
+{
+ GObjectClass *object_class;
+
+ g_type_class_add_private (class, sizeof (ESignaturePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = signature_set_property;
+ object_class->get_property = signature_get_property;
+ object_class->finalize = signature_finalize;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_AUTOGENERATED,
+ g_param_spec_boolean (
+ "autogenerated",
+ "Autogenerated",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FILENAME,
+ g_param_spec_string (
+ "filename",
+ "Filename",
+ NULL,
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_IS_HTML,
+ g_param_spec_boolean (
+ "is-html",
+ "Is HTML",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_IS_SCRIPT,
+ g_param_spec_boolean (
+ "is-script",
+ "Is Script",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_NAME,
+ g_param_spec_string (
+ "name",
+ "Name",
+ NULL,
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_UID,
+ g_param_spec_string (
+ "uid",
+ "UID",
+ NULL,
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+}
+
+static void
+e_signature_init (ESignature *signature)
+{
+ signature->priv = G_TYPE_INSTANCE_GET_PRIVATE (
+ signature, E_TYPE_SIGNATURE, ESignaturePrivate);
+}
+
+/**
+ * e_signature_new:
+ *
+ * Returns a new signature which can be filled in and
+ * added to an #ESignatureList.
+ *
+ * Returns: a new #ESignature
+ **/
+ESignature *
+e_signature_new (void)
+{
+ ESignature *signature;
+
+ signature = g_object_new (E_TYPE_SIGNATURE, NULL);
+ signature->priv->uid = e_uid_new ();
+
+ return signature;
+}
+
+/**
+ * e_signature_new_from_xml:
+ * @xml: an XML signature description
+ *
+ * Return value: a new #ESignature based on the data in @xml, or %NULL
+ * if @xml could not be parsed as valid signature data.
+ **/
+ESignature *
+e_signature_new_from_xml (const gchar *xml)
+{
+ ESignature *signature;
+
+ signature = g_object_new (E_TYPE_SIGNATURE, NULL);
+
+ if (!e_signature_set_from_xml (signature, xml)) {
+ g_object_unref (signature);
+ return NULL;
+ }
+
+ return signature;
+}
+
+/**
+ * e_signature_uid_from_xml:
+ * @xml: an XML signature description
+ *
+ * Return value: the permanent UID of the signature described by @xml
+ * (or %NULL if @xml could not be parsed or did not contain a uid).
+ * The caller must free this string.
+ **/
+gchar *
+e_signature_uid_from_xml (const gchar *xml)
+{
+ xmlNodePtr node;
+ xmlDocPtr doc;
+ gchar *uid = NULL;
+
+ if (!(doc = xmlParseDoc ((xmlChar *) xml)))
+ return NULL;
+
+ node = doc->children;
+ if (strcmp ((gchar *)node->name, "signature") != 0) {
+ xmlFreeDoc (doc);
+ return NULL;
+ }
+
+ xml_set_prop (node, "uid", &uid);
+ xmlFreeDoc (doc);
+
+ return uid;
+}
+
+/**
+ * e_signature_set_from_xml:
+ * @signature: an #ESignature
+ * @xml: an XML signature description.
+ *
+ * Changes @signature to match @xml.
+ *
+ * Returns: %TRUE if the signature was loaded or %FALSE otherwise
+ **/
+gboolean
+e_signature_set_from_xml (ESignature *signature,
+ const gchar *xml)
+{
+ gboolean changed = FALSE;
+ xmlNodePtr node, cur;
+ xmlDocPtr doc;
+ gboolean bool;
+ gchar *buf;
+
+ if (!(doc = xmlParseDoc ((xmlChar *) xml)))
+ return FALSE;
+
+ node = doc->children;
+ if (strcmp ((gchar *)node->name, "signature") != 0) {
+ xmlFreeDoc (doc);
+ return FALSE;
+ }
+
+ buf = NULL;
+ xml_set_prop (node, "uid", &buf);
+
+ if (buf && *buf) {
+ g_free (signature->priv->uid);
+ signature->priv->uid = buf;
+ }
+
+ changed |= xml_set_prop (node, "name", &signature->priv->name);
+ changed |= xml_set_bool (node, "auto", &signature->priv->autogenerated);
+
+ if (e_signature_get_autogenerated (signature)) {
+ xmlFreeDoc (doc);
+
+ return changed;
+ }
+
+ buf = NULL;
+ xml_set_prop (node, "format", &buf);
+ if (buf && !strcmp (buf, "text/html"))
+ bool = TRUE;
+ else
+ bool = FALSE;
+ g_free (buf);
+
+ if (e_signature_get_is_html (signature) != bool) {
+ e_signature_set_is_html (signature, bool);
+ changed = TRUE;
+ }
+
+ cur = node->children;
+ while (cur) {
+ if (!strcmp ((gchar *)cur->name, "filename")) {
+ changed |= xml_set_content (
+ cur, &signature->priv->filename);
+ changed |= xml_set_bool (
+ cur, "script", &signature->priv->is_script);
+ break;
+ } else if (!strcmp ((gchar *)cur->name, "script")) {
+ /* this is for handling 1.4 signature script definitions */
+ changed |= xml_set_content (
+ cur, &signature->priv->filename);
+ if (!e_signature_get_is_script (signature)) {
+ e_signature_set_is_script (signature, TRUE);
+ changed = TRUE;
+ }
+ break;
+ }
+ cur = cur->next;
+ }
+
+ /* If the signature is not a script, replace the directory
+ * part with the current signatures directory. This makes
+ * moving the signatures directory transparent. */
+ if (!e_signature_get_is_script (signature)) {
+ const gchar *user_data_dir;
+ gchar *basename;
+ gchar *filename;
+
+ user_data_dir = e_get_user_data_dir ();
+
+ filename = signature->priv->filename;
+ basename = g_path_get_basename (filename);
+ signature->priv->filename = g_build_filename (
+ user_data_dir, "signatures", basename, NULL);
+ g_free (basename);
+ g_free (filename);
+ }
+
+ xmlFreeDoc (doc);
+
+ return changed;
+}
+
+/**
+ * e_signature_to_xml:
+ * @signature: an #ESignature
+ *
+ * Return value: an XML representation of @signature, which the caller
+ * must free.
+ **/
+gchar *
+e_signature_to_xml (ESignature *signature)
+{
+ xmlChar *xmlbuf;
+ gchar *tmp;
+ xmlNodePtr root, node;
+ xmlDocPtr doc;
+ const gchar *string;
+ gint n;
+
+ doc = xmlNewDoc ((xmlChar *) "1.0");
+
+ root = xmlNewDocNode (doc, NULL, (xmlChar *) "signature", NULL);
+ xmlDocSetRootElement (doc, root);
+
+ string = e_signature_get_name (signature);
+ xmlSetProp (root, (xmlChar *) "name", (xmlChar *) string);
+
+ string = e_signature_get_uid (signature);
+ xmlSetProp (root, (xmlChar *) "uid", (xmlChar *) string);
+
+ if (e_signature_get_autogenerated (signature))
+ string = "true";
+ else
+ string = "false";
+ xmlSetProp (root, (xmlChar *) "auto", (xmlChar *) string);
+
+ if (!e_signature_get_autogenerated (signature)) {
+ if (e_signature_get_is_html (signature))
+ string = "text/html";
+ else
+ string = "text/plain";
+ xmlSetProp (root, (xmlChar *) "format", (xmlChar *) string);
+
+ string = e_signature_get_filename (signature);
+ if (string != NULL) {
+
+ /* For scripts we save the full filename,
+ * for normal signatures just the basename. */
+ if (e_signature_get_is_script (signature)) {
+ node = xmlNewTextChild (
+ root, NULL, (xmlChar *) "filename",
+ (xmlChar *) string);
+ xmlSetProp (
+ node, (xmlChar *) "script",
+ (xmlChar *) "true");
+ } else {
+ gchar *basename;
+
+ basename = g_path_get_basename (string);
+ node = xmlNewTextChild (
+ root, NULL, (xmlChar *) "filename",
+ (xmlChar *) basename);
+ g_free (basename);
+ }
+ }
+ } else {
+ /* this is to make Evolution-1.4 and older 1.5 versions happy */
+ xmlSetProp (root, (xmlChar *) "format", (xmlChar *) "text/html");
+ }
+
+ xmlDocDumpMemory (doc, &xmlbuf, &n);
+ xmlFreeDoc (doc);
+
+ /* remap to glib memory */
+ tmp = g_malloc (n + 1);
+ memcpy (tmp, xmlbuf, n);
+ tmp[n] = '\0';
+ xmlFree (xmlbuf);
+
+ return tmp;
+}
+
+gboolean
+e_signature_is_equal (ESignature *signature1,
+ ESignature *signature2)
+{
+ const gchar *uid1;
+ const gchar *uid2;
+
+ g_return_val_if_fail (E_IS_SIGNATURE (signature1), FALSE);
+ g_return_val_if_fail (E_IS_SIGNATURE (signature2), FALSE);
+
+ /* XXX Simply compares the UIDs. Not fool-proof. */
+ uid1 = e_signature_get_uid (signature1);
+ uid2 = e_signature_get_uid (signature2);
+
+ return (g_strcmp0 (uid1, uid2) == 0);
+}
+
+gboolean
+e_signature_get_autogenerated (ESignature *signature)
+{
+ g_return_val_if_fail (E_IS_SIGNATURE (signature), FALSE);
+
+ return signature->priv->autogenerated;
+}
+
+void
+e_signature_set_autogenerated (ESignature *signature,
+ gboolean autogenerated)
+{
+ g_return_if_fail (E_IS_SIGNATURE (signature));
+
+ if (signature->priv->autogenerated == autogenerated)
+ return;
+
+ signature->priv->autogenerated = autogenerated;
+
+ /* Autogenerated flags overrides several properties. */
+ g_object_freeze_notify (G_OBJECT (signature));
+ g_object_notify (G_OBJECT (signature), "autogenerated");
+ g_object_notify (G_OBJECT (signature), "filename");
+ g_object_notify (G_OBJECT (signature), "is-html");
+ g_object_notify (G_OBJECT (signature), "is-script");
+ g_object_notify (G_OBJECT (signature), "name");
+ g_object_thaw_notify (G_OBJECT (signature));
+}
+
+const gchar *
+e_signature_get_filename (ESignature *signature)
+{
+ g_return_val_if_fail (E_IS_SIGNATURE (signature), NULL);
+
+ /* Autogenerated flags overrides the filename property. */
+ if (e_signature_get_autogenerated (signature))
+ return NULL;
+
+ return signature->priv->filename;
+}
+
+void
+e_signature_set_filename (ESignature *signature,
+ const gchar *filename)
+{
+ g_return_if_fail (E_IS_SIGNATURE (signature));
+
+ g_free (signature->priv->filename);
+ signature->priv->filename = g_strdup (filename);
+
+ g_object_notify (G_OBJECT (signature), "filename");
+}
+
+gboolean
+e_signature_get_is_html (ESignature *signature)
+{
+ g_return_val_if_fail (E_IS_SIGNATURE (signature), FALSE);
+
+ /* Autogenerated flag overrides the is-html property. */
+ if (e_signature_get_autogenerated (signature))
+ return FALSE;
+
+ return signature->priv->is_html;
+}
+
+void
+e_signature_set_is_html (ESignature *signature,
+ gboolean is_html)
+{
+ g_return_if_fail (E_IS_SIGNATURE (signature));
+
+ if (signature->priv->is_html == is_html)
+ return;
+
+ signature->priv->is_html = is_html;
+
+ g_object_notify (G_OBJECT (signature), "is-html");
+}
+
+gboolean
+e_signature_get_is_script (ESignature *signature)
+{
+ g_return_val_if_fail (E_IS_SIGNATURE (signature), FALSE);
+
+ /* Autogenerated flags overrides the is-script property. */
+ if (e_signature_get_autogenerated (signature))
+ return FALSE;
+
+ return signature->priv->is_script;
+}
+
+void
+e_signature_set_is_script (ESignature *signature,
+ gboolean is_script)
+{
+ g_return_if_fail (E_IS_SIGNATURE (signature));
+
+ if (signature->priv->is_script == is_script)
+ return;
+
+ signature->priv->is_script = is_script;
+
+ g_object_notify (G_OBJECT (signature), "is-script");
+}
+
+const gchar *
+e_signature_get_name (ESignature *signature)
+{
+ g_return_val_if_fail (E_IS_SIGNATURE (signature), NULL);
+
+ /* Autogenerated flag overrides the name property. */
+ if (e_signature_get_autogenerated (signature))
+ return _("Autogenerated");
+
+ return signature->priv->name;
+}
+
+void
+e_signature_set_name (ESignature *signature,
+ const gchar *name)
+{
+ g_return_if_fail (E_IS_SIGNATURE (signature));
+
+ g_free (signature->priv->name);
+ signature->priv->name = g_strdup (name);
+
+ g_object_notify (G_OBJECT (signature), "name");
+}
+
+const gchar *
+e_signature_get_uid (ESignature *signature)
+{
+ g_return_val_if_fail (E_IS_SIGNATURE (signature), NULL);
+
+ return signature->priv->uid;
+}
+
+void
+e_signature_set_uid (ESignature *signature,
+ const gchar *uid)
+{
+ g_return_if_fail (E_IS_SIGNATURE (signature));
+
+ g_free (signature->priv->uid);
+
+ if (uid == NULL)
+ signature->priv->uid = e_uid_new ();
+ else
+ signature->priv->uid = g_strdup (uid);
+
+ g_object_notify (G_OBJECT (signature), "uid");
+}
diff --git a/mail/libemail-utils/e-signature.h b/mail/libemail-utils/e-signature.h
new file mode 100644
index 0000000..fad1faf
--- /dev/null
+++ b/mail/libemail-utils/e-signature.h
@@ -0,0 +1,90 @@
+/*
+ *
+ * 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/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_SIGNATURE_H
+#define E_SIGNATURE_H
+
+#include <glib-object.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SIGNATURE \
+ (e_signature_get_type ())
+#define E_SIGNATURE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SIGNATURE, ESignature))
+#define E_SIGNATURE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SIGNATURE, ESignatureClass))
+#define E_IS_SIGNATURE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SIGNATURE))
+#define E_IS_SIGNATURE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SIGNATURE))
+#define E_SIGNATURE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SIGNATURE, ESignatureClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ESignature ESignature;
+typedef struct _ESignatureClass ESignatureClass;
+typedef struct _ESignaturePrivate ESignaturePrivate;
+
+struct _ESignature {
+ GObject parent;
+ ESignaturePrivate *priv;
+};
+
+struct _ESignatureClass {
+ GObjectClass parent_class;
+};
+
+GType e_signature_get_type (void);
+ESignature * e_signature_new (void);
+ESignature * e_signature_new_from_xml (const gchar *xml);
+gchar * e_signature_uid_from_xml (const gchar *xml);
+gboolean e_signature_set_from_xml (ESignature *signature,
+ const gchar *xml);
+gchar * e_signature_to_xml (ESignature *signature);
+gboolean e_signature_is_equal (ESignature *signature1,
+ ESignature *signature2);
+gboolean e_signature_get_autogenerated (ESignature *signature);
+void e_signature_set_autogenerated (ESignature *signature,
+ gboolean autogenerated);
+const gchar * e_signature_get_filename (ESignature *signature);
+void e_signature_set_filename (ESignature *signature,
+ const gchar *filename);
+gboolean e_signature_get_is_html (ESignature *signature);
+void e_signature_set_is_html (ESignature *signature,
+ gboolean is_html);
+gboolean e_signature_get_is_script (ESignature *signature);
+void e_signature_set_is_script (ESignature *signature,
+ gboolean is_script);
+const gchar * e_signature_get_name (ESignature *signature);
+void e_signature_set_name (ESignature *signature,
+ const gchar *name);
+const gchar * e_signature_get_uid (ESignature *signature);
+void e_signature_set_uid (ESignature *signature,
+ const gchar *uid);
+
+G_END_DECLS
+
+#endif /* E_SIGNATURE_H */
diff --git a/mail/libemailutils/libemail-utils.pc.in b/mail/libemail-utils/libemail-utils.pc.in
similarity index 100%
rename from mail/libemailutils/libemail-utils.pc.in
rename to mail/libemail-utils/libemail-utils.pc.in
diff --git a/mail/libemailutils/mail-mt.c b/mail/libemail-utils/mail-mt.c
similarity index 100%
rename from mail/libemailutils/mail-mt.c
rename to mail/libemail-utils/mail-mt.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]