diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-03-23 00:03:46 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-03-23 00:03:46 +0800 |
commit | 7094f32df13b8ddfe0e41c746481efb6d9f750fd (patch) | |
tree | e97c4284b0737f976895b60f3879c93e558df90e /modules/mail/e-mail-config-web-view.c | |
parent | 5c3c117a73f22054fd981d5011d01bbb3d60e711 (diff) | |
download | gsoc2013-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/e-mail-config-web-view.c')
-rw-r--r-- | modules/mail/e-mail-config-web-view.c | 100 |
1 files changed, 100 insertions, 0 deletions
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); +} |