aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-03-23 00:03:46 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-03-23 00:03:46 +0800
commit7094f32df13b8ddfe0e41c746481efb6d9f750fd (patch)
treee97c4284b0737f976895b60f3879c93e558df90e /modules/mail
parent5c3c117a73f22054fd981d5011d01bbb3d60e711 (diff)
downloadgsoc2013-evolution-7094f32df13b8ddfe0e41c746481efb6d9f750fd.tar
gsoc2013-evolution-7094f32df13b8ddfe0e41c746481efb6d9f750fd.tar.gz
gsoc2013-evolution-7094f32df13b8ddfe0e41c746481efb6d9f750fd.tar.bz2
gsoc2013-evolution-7094f32df13b8ddfe0e41c746481efb6d9f750fd.tar.lz
gsoc2013-evolution-7094f32df13b8ddfe0e41c746481efb6d9f750fd.tar.xz
gsoc2013-evolution-7094f32df13b8ddfe0e41c746481efb6d9f750fd.tar.zst
gsoc2013-evolution-7094f32df13b8ddfe0e41c746481efb6d9f750fd.zip
Add an extension to configure EWebView.
Make EWebView extensible and register an extension to automatically bind every EWebView instance to the appropriate EShellSettings.
Diffstat (limited to 'modules/mail')
-rw-r--r--modules/mail/Makefile.am2
-rw-r--r--modules/mail/e-mail-config-web-view.c100
-rw-r--r--modules/mail/e-mail-config-web-view.h30
-rw-r--r--modules/mail/e-mail-shell-backend.c15
-rw-r--r--modules/mail/evolution-module-mail.c2
5 files changed, 134 insertions, 15 deletions
diff --git a/modules/mail/Makefile.am b/modules/mail/Makefile.am
index d08a6866e7..323820217b 100644
--- a/modules/mail/Makefile.am
+++ b/modules/mail/Makefile.am
@@ -21,6 +21,8 @@ libevolution_module_mail_la_SOURCES = \
e-mail-config-format-html.h \
e-mail-config-hook.c \
e-mail-config-hook.h \
+ e-mail-config-web-view.c \
+ e-mail-config-web-view.h \
e-mail-event-hook.c \
e-mail-event-hook.h \
e-mail-junk-hook.c \
diff --git a/modules/mail/e-mail-config-web-view.c b/modules/mail/e-mail-config-web-view.c
new file mode 100644
index 0000000000..5cfb648154
--- /dev/null
+++ b/modules/mail/e-mail-config-web-view.c
@@ -0,0 +1,100 @@
+/*
+ * e-mail-config-web-view.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-web-view.h"
+
+#include <shell/e-shell.h>
+#include <e-util/e-binding.h>
+#include <e-util/e-extension.h>
+#include <misc/e-web-view.h>
+
+static void
+mail_config_web_view_realize (GtkWidget *widget)
+{
+ EShell *shell;
+ EShellSettings *shell_settings;
+
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ e_binding_new (
+ shell_settings, "mail-show-animated-images",
+ widget, "animate");
+
+ e_binding_new (
+ shell_settings, "composer-inline-spelling",
+ widget, "inline-spelling");
+
+ e_binding_new (
+ shell_settings, "composer-magic-links",
+ widget, "magic-links");
+
+ e_binding_new (
+ shell_settings, "composer-magic-smileys",
+ widget, "magic-smileys");
+}
+
+static void
+mail_config_web_view_constructed (GObject *object)
+{
+ EExtension *extension;
+ EExtensible *extensible;
+
+ extension = E_EXTENSION (object);
+ extensible = e_extension_get_extensible (extension);
+
+ /* Wait to bind shell settings until the EWebView is realized
+ * so GtkhtmlEditor has a chance to install a GtkHTMLEditorAPI.
+ * Otherwise our settings will have no effect. */
+
+ g_signal_connect (
+ extensible, "realize",
+ G_CALLBACK (mail_config_web_view_realize), NULL);
+}
+
+static void
+mail_config_web_view_class_init (EExtensionClass *class)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = mail_config_web_view_constructed;
+
+ class->extensible_type = E_TYPE_WEB_VIEW;
+}
+
+void
+e_mail_config_web_view_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (EExtensionClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) mail_config_web_view_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,
+ "EMailConfigWebView", &type_info, 0);
+}
diff --git a/modules/mail/e-mail-config-web-view.h b/modules/mail/e-mail-config-web-view.h
new file mode 100644
index 0000000000..c2a8758709
--- /dev/null
+++ b/modules/mail/e-mail-config-web-view.h
@@ -0,0 +1,30 @@
+/*
+ * e-mail-config-web-view.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_WEB_VIEW_H
+#define E_MAIL_CONFIG_WEB_VIEW_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+void e_mail_config_web_view_register_type (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_MAIL_CONFIG_WEB_VIEW_H */
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index de8d4f42d9..00b4a78dc6 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -408,28 +408,13 @@ mail_shell_backend_window_created_cb (EShell *shell,
GtkWindow *window,
EShellBackend *shell_backend)
{
- EShellSettings *shell_settings;
static gboolean first_time = TRUE;
const gchar *backend_name;
- shell_settings = e_shell_get_shell_settings (shell);
-
/* This applies to both the composer and signature editor. */
if (GTKHTML_IS_EDITOR (window)) {
GList *spell_languages;
- e_binding_new (
- shell_settings, "composer-inline-spelling",
- window, "inline-spelling");
-
- e_binding_new (
- shell_settings, "composer-magic-links",
- window, "magic-links");
-
- e_binding_new (
- shell_settings, "composer-magic-smileys",
- window, "magic-smileys");
-
spell_languages = e_load_spell_languages ();
gtkhtml_editor_set_spell_languages (
GTKHTML_EDITOR (window), spell_languages);
diff --git a/modules/mail/evolution-module-mail.c b/modules/mail/evolution-module-mail.c
index f6661cda1a..9e9744569b 100644
--- a/modules/mail/evolution-module-mail.c
+++ b/modules/mail/evolution-module-mail.c
@@ -31,6 +31,7 @@
#include "e-mail-shell-view.h"
#include "e-mail-config-format-html.h"
+#include "e-mail-config-web-view.h"
/* Module Entry Points */
void e_module_load (GTypeModule *type_module);
@@ -54,6 +55,7 @@ e_module_load (GTypeModule *type_module)
e_mail_shell_view_register_type (type_module);
e_mail_config_format_html_register_type (type_module);
+ e_mail_config_web_view_register_type (type_module);
}
G_MODULE_EXPORT void