Add an extension to configure EMFormatHTML.
Make EMFormatHTML extensible and register an extension to automatically bind every EMFormatHTML instance to the appropriate EShellSettings.
This commit is contained in:
committed by
Michael Meeks
parent
3fb2b21c08
commit
ffe2f1e1ee
@ -2664,32 +2664,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);
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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 \
|
||||
|
||||
93
modules/mail/e-mail-config-format-html.c
Normal file
93
modules/mail/e-mail-config-format-html.c
Normal file
@ -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);
|
||||
}
|
||||
30
modules/mail/e-mail-config-format-html.h
Normal file
30
modules/mail/e-mail-config-format-html.h
Normal file
@ -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 */
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user