From 7c51d1c1a631a4a8daf26dd44a0aed41eb4726e0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 19 Mar 2010 19:30:48 -0400 Subject: Add an extension to configure EMFormatHTML. Make EMFormatHTML extensible and register an extension to automatically bind every EMFormatHTML instance to the appropriate EShellSettings. --- 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 ++ 4 files changed, 129 insertions(+) create mode 100644 modules/mail/e-mail-config-format-html.c create mode 100644 modules/mail/e-mail-config-format-html.h (limited to 'modules/mail') diff --git a/modules/mail/Makefile.am b/modules/mail/Makefile.am index 65a5c30d1f..d08a6866e7 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 0000000000..a92a943976 --- /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 + * + */ + +#include "e-mail-config-format-html.h" + +#include +#include +#include +#include + +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 0000000000..bed76d88b7 --- /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 + * + */ + +#ifndef E_MAIL_CONFIG_FORMAT_HTML_H +#define E_MAIL_CONFIG_FORMAT_HTML_H + +#include + +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 1bb58c7742..f6661cda1a 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 -- cgit v1.2.3