[evolution/express] Add an extension to configure EMFormatHTML.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/express] Add an extension to configure EMFormatHTML.
- Date: Sun, 21 Mar 2010 04:15:06 +0000 (UTC)
commit cb3b12ff53fa0010bd0c357795cf00e144426133
Author: Matthew Barnes <mbarnes redhat com>
Date: Fri Mar 19 19:30:48 2010 -0400
Add an extension to configure EMFormatHTML.
Make EMFormatHTML extensible and register an extension to automatically
bind every EMFormatHTML instance to the appropriate EShellSettings.
mail/e-mail-reader.c | 22 -------
mail/em-format-html.c | 12 ++++
modules/mail/Makefile.am | 2 +
modules/mail/e-mail-config-format-html.c | 93 ++++++++++++++++++++++++++++++
modules/mail/e-mail-config-format-html.h | 30 ++++++++++
modules/mail/evolution-module-mail.c | 4 +
6 files changed, 141 insertions(+), 22 deletions(-)
---
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 81a518d..747275d 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -2297,32 +2297,10 @@ e_mail_reader_init (EMailReader *reader)
/* Bind properties. */
- e_binding_new_full (
- shell_settings, "mail-citation-color",
- html_display, "citation-color",
- e_binding_transform_string_to_color,
- NULL, NULL);
-
- e_binding_new (
- shell_settings, "mail-image-loading-policy",
- html_display, "image-loading-policy");
-
- e_binding_new (
- shell_settings, "mail-only-local-photos",
- html_display, "only-local-photos");
-
e_binding_new (
shell_settings, "mail-show-animated-images",
web_view, "animate");
- e_binding_new (
- shell_settings, "mail-show-sender-photo",
- html_display, "show-sender-photo");
-
- e_binding_new (
- shell_settings, "mail-show-real-date",
- html_display, "show-real-date");
-
action_name = "mail-caret-mode";
action = e_mail_reader_get_action (reader, action_name);
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 26c6f92..7cf5a1f 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -47,6 +47,7 @@
#include "e-util/e-icon-factory.h"
#include "e-util/e-util-private.h"
#include "e-util/e-util.h"
+#include "e-util/e-extensible.h"
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-stream.h>
@@ -965,6 +966,8 @@ efh_init (EMFormatHTML *efh,
g_signal_connect_swapped (
efh, "notify::mark-citations",
G_CALLBACK (em_format_redraw), NULL);
+
+ e_extensible_load_extensions (E_EXTENSIBLE (efh));
}
GType
@@ -986,9 +989,18 @@ em_format_html_get_type (void)
NULL /* value_table */
};
+ static const GInterfaceInfo extensible_info = {
+ (GInterfaceInitFunc) NULL,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL /* interface_data */
+ };
+
type = g_type_register_static (
em_format_get_type(), "EMFormatHTML",
&type_info, G_TYPE_FLAG_ABSTRACT);
+
+ g_type_add_interface_static (
+ type, E_TYPE_EXTENSIBLE, &extensible_info);
}
return type;
diff --git a/modules/mail/Makefile.am b/modules/mail/Makefile.am
index 65a5c30..d08a686 100644
--- a/modules/mail/Makefile.am
+++ b/modules/mail/Makefile.am
@@ -17,6 +17,8 @@ libevolution_module_mail_la_SOURCES = \
evolution-module-mail.c \
e-mail-attachment-handler.c \
e-mail-attachment-handler.h \
+ e-mail-config-format-html.c \
+ e-mail-config-format-html.h \
e-mail-config-hook.c \
e-mail-config-hook.h \
e-mail-event-hook.c \
diff --git a/modules/mail/e-mail-config-format-html.c b/modules/mail/e-mail-config-format-html.c
new file mode 100644
index 0000000..a92a943
--- /dev/null
+++ b/modules/mail/e-mail-config-format-html.c
@@ -0,0 +1,93 @@
+/*
+ * e-mail-config-format-html.c
+ *
+ * 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/>
+ *
+ */
+
+#include "e-mail-config-format-html.h"
+
+#include <shell/e-shell.h>
+#include <e-util/e-binding.h>
+#include <e-util/e-extension.h>
+#include <mail/em-format-html.h>
+
+static void
+mail_config_format_html_constructed (GObject *object)
+{
+ EExtension *extension;
+ EExtensible *extensible;
+ EShellSettings *shell_settings;
+ EShell *shell;
+
+ extension = E_EXTENSION (object);
+ extensible = e_extension_get_extensible (extension);
+
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ e_binding_new_full (
+ shell_settings, "mail-citation-color",
+ extensible, "citation-color",
+ e_binding_transform_string_to_color,
+ NULL, NULL);
+
+ e_binding_new (
+ shell_settings, "mail-image-loading-policy",
+ extensible, "image-loading-policy");
+
+ e_binding_new (
+ shell_settings, "mail-only-local-photos",
+ extensible, "only-local-photos");
+
+ e_binding_new (
+ shell_settings, "mail-show-sender-photo",
+ extensible, "show-sender-photo");
+
+ e_binding_new (
+ shell_settings, "mail-show-real-date",
+ extensible, "show-real-date");
+}
+
+static void
+mail_config_format_html_class_init (EExtensionClass *class)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = mail_config_format_html_constructed;
+
+ class->extensible_type = EM_TYPE_FORMAT_HTML;
+}
+
+void
+e_mail_config_format_html_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (EExtensionClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) mail_config_format_html_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EExtension),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) NULL,
+ NULL /* value_table */
+ };
+
+ g_type_module_register_type (
+ type_module, E_TYPE_EXTENSION,
+ "EMailConfigFormatHTML", &type_info, 0);
+}
diff --git a/modules/mail/e-mail-config-format-html.h b/modules/mail/e-mail-config-format-html.h
new file mode 100644
index 0000000..bed76d8
--- /dev/null
+++ b/modules/mail/e-mail-config-format-html.h
@@ -0,0 +1,30 @@
+/*
+ * e-mail-config-format-html.h
+ *
+ * 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/>
+ *
+ */
+
+#ifndef E_MAIL_CONFIG_FORMAT_HTML_H
+#define E_MAIL_CONFIG_FORMAT_HTML_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+void e_mail_config_format_html_register_type (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_MAIL_CONFIG_FORMAT_HTML_H */
diff --git a/modules/mail/evolution-module-mail.c b/modules/mail/evolution-module-mail.c
index 1bb58c7..f6661cd 100644
--- a/modules/mail/evolution-module-mail.c
+++ b/modules/mail/evolution-module-mail.c
@@ -30,6 +30,8 @@
#include "e-mail-shell-sidebar.h"
#include "e-mail-shell-view.h"
+#include "e-mail-config-format-html.h"
+
/* Module Entry Points */
void e_module_load (GTypeModule *type_module);
void e_module_unload (GTypeModule *type_module);
@@ -50,6 +52,8 @@ e_module_load (GTypeModule *type_module)
e_mail_shell_content_register_type (type_module);
e_mail_shell_sidebar_register_type (type_module);
e_mail_shell_view_register_type (type_module);
+
+ e_mail_config_format_html_register_type (type_module);
}
G_MODULE_EXPORT void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]