aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2012-03-29 00:38:11 +0800
committerDan Vrátil <dvratil@redhat.com>2012-03-29 00:38:25 +0800
commit6d2c382788a4042d53f49a080acd11b499aa52f6 (patch)
tree3834f0836340918ba17594a603ba61c13b9929a0 /modules
parent6bd1c6833a2c51898ac45865767dd01ba66a95c5 (diff)
downloadgsoc2013-evolution-6d2c382788a4042d53f49a080acd11b499aa52f6.tar
gsoc2013-evolution-6d2c382788a4042d53f49a080acd11b499aa52f6.tar.gz
gsoc2013-evolution-6d2c382788a4042d53f49a080acd11b499aa52f6.tar.bz2
gsoc2013-evolution-6d2c382788a4042d53f49a080acd11b499aa52f6.tar.lz
gsoc2013-evolution-6d2c382788a4042d53f49a080acd11b499aa52f6.tar.xz
gsoc2013-evolution-6d2c382788a4042d53f49a080acd11b499aa52f6.tar.zst
gsoc2013-evolution-6d2c382788a4042d53f49a080acd11b499aa52f6.zip
WebKit port - port formatter and mail module
Diffstat (limited to 'modules')
-rw-r--r--modules/Makefile.am1
-rw-r--r--modules/addressbook/e-book-shell-content.c9
-rw-r--r--modules/mail/e-mail-config-format-html.c5
-rw-r--r--modules/mail/e-mail-config-web-view.c6
-rw-r--r--modules/mail/e-mail-shell-backend.c57
-rw-r--r--modules/mail/e-mail-shell-content.c9
-rw-r--r--modules/mail/e-mail-shell-view-actions.c116
-rw-r--r--modules/mail/e-mail-shell-view-private.c100
-rw-r--r--modules/mail/em-mailer-prefs.c6
-rw-r--r--modules/web-inspector/Makefile.am23
-rw-r--r--modules/web-inspector/evolution-web-inspector.c185
11 files changed, 351 insertions, 166 deletions
diff --git a/modules/Makefile.am b/modules/Makefile.am
index ee3cdfdb1a..671215b952 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -35,6 +35,7 @@ SUBDIRS = \
plugin-manager \
spamassassin \
startup-wizard \
+ web-inspector \
$(MONO_DIR) \
$(PYTHON_DIR) \
$(ONLINE_ACCOUNTS_DIR) \
diff --git a/modules/addressbook/e-book-shell-content.c b/modules/addressbook/e-book-shell-content.c
index 0183512f5b..f3457e8999 100644
--- a/modules/addressbook/e-book-shell-content.c
+++ b/modules/addressbook/e-book-shell-content.c
@@ -286,20 +286,11 @@ book_shell_content_constructed (GObject *object)
EAB_CONTACT_DISPLAY (widget),
EAB_CONTACT_DISPLAY_RENDER_NORMAL);
- eab_contact_display_set_orientation (
- EAB_CONTACT_DISPLAY (widget),
- priv->orientation);
-
eab_contact_display_set_show_maps (
EAB_CONTACT_DISPLAY (widget),
priv->preview_show_maps);
g_object_bind_property (
- object, "orientation",
- widget, "orientation",
- G_BINDING_SYNC_CREATE);
-
- g_object_bind_property (
object, "preview-show-maps",
widget, "show-maps",
G_BINDING_SYNC_CREATE);
diff --git a/modules/mail/e-mail-config-format-html.c b/modules/mail/e-mail-config-format-html.c
index 31ca88b744..dad5f9a518 100644
--- a/modules/mail/e-mail-config-format-html.c
+++ b/modules/mail/e-mail-config-format-html.c
@@ -76,6 +76,11 @@ mail_config_format_html_constructed (GObject *object)
extensible, "show-real-date",
G_BINDING_SYNC_CREATE);
+ g_object_bind_property (
+ shell_settings, "mail-show-animated-images",
+ extensible, "animate-images",
+ G_BINDING_SYNC_CREATE);
+
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (parent_class)->constructed (object);
}
diff --git a/modules/mail/e-mail-config-web-view.c b/modules/mail/e-mail-config-web-view.c
index 80f3f65c0f..813256efd1 100644
--- a/modules/mail/e-mail-config-web-view.c
+++ b/modules/mail/e-mail-config-web-view.c
@@ -151,12 +151,6 @@ mail_config_web_view_realize (GtkWidget *widget,
{
g_object_bind_property (
extension->shell_settings,
- "mail-show-animated-images",
- widget, "animate",
- G_BINDING_SYNC_CREATE);
-
- g_object_bind_property (
- extension->shell_settings,
"composer-inline-spelling",
widget, "inline-spelling",
G_BINDING_SYNC_CREATE);
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 25902f34df..a30c0240de 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -835,37 +835,70 @@ e_mail_labels_get_filter_options (void)
return g_slist_reverse (list);
}
+static void
+message_parsed_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ EMFormatHTML *formatter = EM_FORMAT_HTML (source_object);
+ GObject *preview = user_data;
+ EMailDisplay *display;
+
+ display = g_object_get_data (preview, "mbox-imp-display");
+ e_mail_display_set_formatter (display, formatter);
+ e_mail_display_load (display, EM_FORMAT (formatter)->uri_base);
+}
+
/* utility functions for mbox importer */
static void
mbox_create_preview_cb (GObject *preview,
GtkWidget **preview_widget)
{
- EMFormatHTMLDisplay *format;
- EWebView *web_view;
+ EMailDisplay *display;
g_return_if_fail (preview != NULL);
g_return_if_fail (preview_widget != NULL);
- format = em_format_html_display_new ();
- g_object_set_data_full (
- preview, "mbox-imp-formatter", format, g_object_unref);
- web_view = em_format_html_get_web_view (EM_FORMAT_HTML (format));
+ display = g_object_new (E_TYPE_MAIL_DISPLAY, NULL);
+ g_object_set_data_full (preview, "mbox-imp-display",
+ g_object_ref (display), g_object_unref);
- *preview_widget = GTK_WIDGET (web_view);
+ *preview_widget = GTK_WIDGET (display);
}
static void
mbox_fill_preview_cb (GObject *preview,
CamelMimeMessage *msg)
{
- EMFormatHTMLDisplay *format;
+ EMailDisplay *display;
+ EMFormat *formatter;
+ GHashTable *formatters;
+ SoupSession *session;
+ gchar *mail_uri;
g_return_if_fail (preview != NULL);
g_return_if_fail (msg != NULL);
- format = g_object_get_data (preview, "mbox-imp-formatter");
- g_return_if_fail (format != NULL);
+ display = g_object_get_data (preview, "mbox-imp-display");
+ g_return_if_fail (display != NULL);
+
+ session = webkit_get_default_session ();
+ formatters = g_object_get_data (G_OBJECT (session), "formatters");
+ if (!formatters) {
+ formatters = g_hash_table_new_full (g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free, NULL);
+ g_object_set_data (G_OBJECT (session), "formatters", formatters);
+ }
+
+ mail_uri = em_format_build_mail_uri (NULL, msg->message_id, NULL, NULL);
+
+ formatter = EM_FORMAT (em_format_html_display_new ());
+ formatter->message_uid = g_strdup (msg->message_id);
+ formatter->uri_base = g_strdup (mail_uri);
+
+ /* Don't free the mail_uri!! */
+ g_hash_table_insert (formatters, mail_uri, formatter);
- /* FIXME Not passing a GCancellable here. */
- em_format_format (EM_FORMAT (format), NULL, NULL, msg, NULL);
+ em_format_parse_async (formatter, msg, NULL, NULL,
+ message_parsed_cb, preview);
}
diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c
index 5bb60e3784..1bf6d4e29a 100644
--- a/modules/mail/e-mail-shell-content.c
+++ b/modules/mail/e-mail-shell-content.c
@@ -307,8 +307,8 @@ mail_shell_content_get_backend (EMailReader *reader)
return e_mail_reader_get_backend (reader);
}
-static EMFormatHTML *
-mail_shell_content_get_formatter (EMailReader *reader)
+static EMailDisplay *
+mail_shell_content_get_mail_display (EMailReader *reader)
{
EMailShellContent *mail_shell_content;
@@ -317,8 +317,7 @@ mail_shell_content_get_formatter (EMailReader *reader)
/* Forward this to our internal EMailView, which
* also implements the EMailReader interface. */
reader = E_MAIL_READER (mail_shell_content->priv->mail_view);
-
- return e_mail_reader_get_formatter (reader);
+ return e_mail_reader_get_mail_display (reader);
}
static gboolean
@@ -464,7 +463,7 @@ e_mail_shell_content_reader_init (EMailReaderInterface *interface)
{
interface->get_action_group = mail_shell_content_get_action_group;
interface->get_backend = mail_shell_content_get_backend;
- interface->get_formatter = mail_shell_content_get_formatter;
+ interface->get_mail_display = mail_shell_content_get_mail_display;
interface->get_hide_deleted = mail_shell_content_get_hide_deleted;
interface->get_message_list = mail_shell_content_get_message_list;
interface->get_popup_menu = mail_shell_content_get_popup_menu;
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index b39d22d13d..5487920c74 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -891,14 +891,16 @@ action_mail_smart_backward_cb (GtkAction *action,
EMailShellContent *mail_shell_content;
EMailShellSidebar *mail_shell_sidebar;
EMFolderTree *folder_tree;
- EMFormatHTML *formatter;
EMailReader *reader;
EMailView *mail_view;
GtkWidget *message_list;
GtkToggleAction *toggle_action;
- EWebView *web_view;
+ GtkWidget *window;
+ GtkAdjustment *adj;
+ EMailDisplay *display;
gboolean caret_mode;
gboolean magic_spacebar;
+ gdouble value;
/* This implements the so-called "Magic Backspace". */
@@ -914,7 +916,7 @@ action_mail_smart_backward_cb (GtkAction *action,
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
reader = E_MAIL_READER (mail_view);
- formatter = e_mail_reader_get_formatter (reader);
+ display = e_mail_reader_get_mail_display (reader);
message_list = e_mail_reader_get_message_list (reader);
magic_spacebar = e_shell_settings_get_boolean (
@@ -923,32 +925,43 @@ action_mail_smart_backward_cb (GtkAction *action,
toggle_action = GTK_TOGGLE_ACTION (ACTION (MAIL_CARET_MODE));
caret_mode = gtk_toggle_action_get_active (toggle_action);
- web_view = em_format_html_get_web_view (formatter);
-
- if (e_web_view_scroll_backward (web_view))
+ window = gtk_widget_get_parent (GTK_WIDGET (display));
+ if (!GTK_IS_SCROLLED_WINDOW (window))
return;
- if (caret_mode || !magic_spacebar)
- return;
+ adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (window));
+ value = gtk_adjustment_get_value (adj);
+ if (value == 0) {
- /* XXX Are two separate calls really necessary? */
+ if (caret_mode || !magic_spacebar)
+ return;
- if (message_list_select (
- MESSAGE_LIST (message_list),
- MESSAGE_LIST_SELECT_PREVIOUS,
- 0, CAMEL_MESSAGE_SEEN))
- return;
+ /* XXX Are two separate calls really necessary? */
- if (message_list_select (
- MESSAGE_LIST (message_list),
- MESSAGE_LIST_SELECT_PREVIOUS |
- MESSAGE_LIST_SELECT_WRAP, 0,
- CAMEL_MESSAGE_SEEN))
- return;
+ if (message_list_select (
+ MESSAGE_LIST (message_list),
+ MESSAGE_LIST_SELECT_PREVIOUS,
+ 0, CAMEL_MESSAGE_SEEN))
+ return;
+
+ if (message_list_select (
+ MESSAGE_LIST (message_list),
+ MESSAGE_LIST_SELECT_PREVIOUS |
+ MESSAGE_LIST_SELECT_WRAP,
+ 0, CAMEL_MESSAGE_SEEN))
+ return;
+
+ em_folder_tree_select_next_path (folder_tree, TRUE);
- em_folder_tree_select_prev_path (folder_tree, TRUE);
+ gtk_widget_grab_focus (message_list);
- gtk_widget_grab_focus (message_list);
+ } else {
+
+ gtk_adjustment_set_value (adj,
+ value - gtk_adjustment_get_page_increment (adj));
+
+ return;
+ }
}
static void
@@ -962,14 +975,17 @@ action_mail_smart_forward_cb (GtkAction *action,
EMailShellContent *mail_shell_content;
EMailShellSidebar *mail_shell_sidebar;
EMFolderTree *folder_tree;
- EMFormatHTML *formatter;
EMailReader *reader;
EMailView *mail_view;
GtkWidget *message_list;
+ GtkWidget *window;
+ GtkAdjustment *adj;
GtkToggleAction *toggle_action;
- EWebView *web_view;
+ EMailDisplay *display;
gboolean caret_mode;
gboolean magic_spacebar;
+ gdouble value;
+ gdouble upper;
/* This implements the so-called "Magic Spacebar". */
@@ -985,7 +1001,7 @@ action_mail_smart_forward_cb (GtkAction *action,
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
reader = E_MAIL_READER (mail_view);
- formatter = e_mail_reader_get_formatter (reader);
+ display = e_mail_reader_get_mail_display (reader);
message_list = e_mail_reader_get_message_list (reader);
magic_spacebar = e_shell_settings_get_boolean (
@@ -994,32 +1010,44 @@ action_mail_smart_forward_cb (GtkAction *action,
toggle_action = GTK_TOGGLE_ACTION (ACTION (MAIL_CARET_MODE));
caret_mode = gtk_toggle_action_get_active (toggle_action);
- web_view = em_format_html_get_web_view (formatter);
-
- if (e_web_view_scroll_forward (web_view))
+ window = gtk_widget_get_parent (GTK_WIDGET (display));
+ if (!GTK_IS_SCROLLED_WINDOW (window))
return;
- if (caret_mode || !magic_spacebar)
- return;
+ adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (window));
+ value = gtk_adjustment_get_value (adj);
+ upper = gtk_adjustment_get_upper (adj);
+ if (value + gtk_adjustment_get_page_size (adj) >= upper) {
- /* XXX Are two separate calls really necessary? */
+ if (caret_mode || !magic_spacebar)
+ return;
- if (message_list_select (
- MESSAGE_LIST (message_list),
- MESSAGE_LIST_SELECT_NEXT,
- 0, CAMEL_MESSAGE_SEEN))
- return;
+ /* XXX Are two separate calls really necessary? */
- if (message_list_select (
- MESSAGE_LIST (message_list),
- MESSAGE_LIST_SELECT_NEXT |
- MESSAGE_LIST_SELECT_WRAP,
- 0, CAMEL_MESSAGE_SEEN))
- return;
+ if (message_list_select (
+ MESSAGE_LIST (message_list),
+ MESSAGE_LIST_SELECT_NEXT,
+ 0, CAMEL_MESSAGE_SEEN))
+ return;
+
+ if (message_list_select (
+ MESSAGE_LIST (message_list),
+ MESSAGE_LIST_SELECT_NEXT |
+ MESSAGE_LIST_SELECT_WRAP,
+ 0, CAMEL_MESSAGE_SEEN))
+ return;
+
+ em_folder_tree_select_next_path (folder_tree, TRUE);
- em_folder_tree_select_next_path (folder_tree, TRUE);
+ gtk_widget_grab_focus (message_list);
- gtk_widget_grab_focus (message_list);
+ } else {
+
+ gtk_adjustment_set_value (adj,
+ value + gtk_adjustment_get_page_increment (adj));
+
+ return;
+ }
}
static void
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 8838f1a1ae..9a58f9d2b7 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -331,11 +331,10 @@ mail_shell_view_popup_event_cb (EMailShellView *mail_shell_view,
const gchar *uri)
{
EMailShellContent *mail_shell_content;
- EMFormatHTML *formatter;
+ EMailDisplay *display;
EShellView *shell_view;
EMailReader *reader;
EMailView *mail_view;
- EWebView *web_view;
GtkMenu *menu;
if (uri != NULL)
@@ -345,10 +344,9 @@ mail_shell_view_popup_event_cb (EMailShellView *mail_shell_view,
mail_view = e_mail_shell_content_get_mail_view (mail_shell_content);
reader = E_MAIL_READER (mail_view);
- formatter = e_mail_reader_get_formatter (reader);
- web_view = em_format_html_get_web_view (formatter);
+ display = e_mail_reader_get_mail_display (reader);
- if (e_web_view_get_cursor_image (web_view) != NULL)
+ if (e_web_view_get_cursor_image (E_WEB_VIEW (display)) != NULL)
return FALSE;
menu = e_mail_reader_get_popup_menu (reader);
@@ -368,76 +366,19 @@ mail_shell_view_popup_event_cb (EMailShellView *mail_shell_view,
}
static void
-mail_shell_view_scroll_cb (EMailShellView *mail_shell_view,
- GtkOrientation orientation,
- GtkScrollType scroll_type,
- gfloat position,
- GtkHTML *html)
-{
- EShell *shell;
- EShellView *shell_view;
- EShellWindow *shell_window;
- EShellSettings *shell_settings;
- EMailShellContent *mail_shell_content;
- EMailReader *reader;
- EMailView *mail_view;
- EWebView *web_view;
- GtkWidget *message_list;
- gboolean magic_spacebar;
-
- web_view = E_WEB_VIEW (html);
-
- if (html->binding_handled || e_web_view_get_caret_mode (web_view))
- return;
-
- if (orientation != GTK_ORIENTATION_VERTICAL)
- return;
-
- shell_view = E_SHELL_VIEW (mail_shell_view);
- shell_window = e_shell_view_get_shell_window (shell_view);
- shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
-
- magic_spacebar = e_shell_settings_get_boolean (
- shell_settings, "mail-magic-spacebar");
-
- if (!magic_spacebar)
- return;
-
- mail_shell_content = mail_shell_view->priv->mail_shell_content;
- mail_view = e_mail_shell_content_get_mail_view (mail_shell_content);
-
- reader = E_MAIL_READER (mail_view);
- message_list = e_mail_reader_get_message_list (reader);
-
- if (scroll_type == GTK_SCROLL_PAGE_FORWARD)
- message_list_select (
- MESSAGE_LIST (message_list),
- MESSAGE_LIST_SELECT_NEXT,
- 0, CAMEL_MESSAGE_SEEN);
- else
- message_list_select (
- MESSAGE_LIST (message_list),
- MESSAGE_LIST_SELECT_PREVIOUS,
- 0, CAMEL_MESSAGE_SEEN);
-}
-
-static void
mail_shell_view_reader_changed_cb (EMailShellView *mail_shell_view,
EMailReader *reader)
{
GtkWidget *message_list;
- EMFormatHTML *formatter;
- EWebView *web_view;
+ EMailDisplay *display;
EShellView *shell_view;
EShellTaskbar *shell_taskbar;
shell_view = E_SHELL_VIEW (mail_shell_view);
shell_taskbar = e_shell_view_get_shell_taskbar (shell_view);
- formatter = e_mail_reader_get_formatter (reader);
+ display = e_mail_reader_get_mail_display (reader);
message_list = e_mail_reader_get_message_list (reader);
- web_view = em_format_html_get_web_view (formatter);
e_shell_view_update_actions (E_SHELL_VIEW (mail_shell_view));
e_mail_shell_view_update_sidebar (mail_shell_view);
@@ -464,23 +405,17 @@ mail_shell_view_reader_changed_cb (EMailShellView *mail_shell_view,
mail_shell_view, G_CONNECT_SWAPPED);
g_signal_connect_object (
- web_view, "key-press-event",
+ display, "key-press-event",
G_CALLBACK (mail_shell_view_key_press_event_cb),
mail_shell_view, G_CONNECT_SWAPPED);
g_signal_connect_object (
- web_view, "popup-event",
+ display, "popup-event",
G_CALLBACK (mail_shell_view_popup_event_cb),
mail_shell_view, G_CONNECT_SWAPPED);
g_signal_connect_object (
- web_view, "scroll",
- G_CALLBACK (mail_shell_view_scroll_cb),
- mail_shell_view,
- G_CONNECT_AFTER | G_CONNECT_SWAPPED);
-
- g_signal_connect_object (
- web_view, "status-message",
+ display, "status-message",
G_CALLBACK (e_shell_taskbar_set_message),
shell_taskbar, G_CONNECT_SWAPPED);
}
@@ -634,7 +569,6 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
EShellTaskbar *shell_taskbar;
EShellWindow *shell_window;
EShellSearchbar *searchbar;
- EMFormatHTML *formatter;
EMFolderTree *folder_tree;
EActionComboBox *combo_box;
ERuleContext *context;
@@ -647,7 +581,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
EMailSession *session;
EMailReader *reader;
EMailView *mail_view;
- EWebView *web_view;
+ EMailDisplay *display;
const gchar *source;
guint merge_id;
gint ii = 0;
@@ -691,7 +625,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
combo_box = e_shell_searchbar_get_scope_combo_box (searchbar);
reader = E_MAIL_READER (shell_content);
- formatter = e_mail_reader_get_formatter (reader);
+ display = e_mail_reader_get_mail_display (reader);
message_list = e_mail_reader_get_message_list (reader);
em_folder_tree_set_selectable_widget (folder_tree, message_list);
@@ -710,8 +644,6 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
G_CALLBACK (mail_shell_view_search_filter_changed_cb),
mail_shell_view, G_CONNECT_SWAPPED);
- web_view = em_format_html_get_web_view (formatter);
-
g_signal_connect_object (
folder_tree, "folder-selected",
G_CALLBACK (mail_shell_view_folder_tree_selected_cb),
@@ -784,23 +716,17 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
mail_shell_view, G_CONNECT_SWAPPED);
g_signal_connect_object (
- web_view, "key-press-event",
+ display, "key-press-event",
G_CALLBACK (mail_shell_view_key_press_event_cb),
mail_shell_view, G_CONNECT_SWAPPED);
g_signal_connect_object (
- web_view, "popup-event",
+ display, "popup-event",
G_CALLBACK (mail_shell_view_popup_event_cb),
mail_shell_view, G_CONNECT_SWAPPED);
g_signal_connect_object (
- web_view, "scroll",
- G_CALLBACK (mail_shell_view_scroll_cb),
- mail_shell_view,
- G_CONNECT_AFTER | G_CONNECT_SWAPPED);
-
- g_signal_connect_object (
- web_view, "status-message",
+ display, "status-message",
G_CALLBACK (e_shell_taskbar_set_message),
shell_taskbar, G_CONNECT_SWAPPED);
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index 3f5e371296..d81656f997 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -529,10 +529,10 @@ toggle_button_init (EMMailerPrefs *prefs,
const gchar *key,
GCallback toggled)
{
- gboolean bool;
+ gboolean v_bool;
- bool = g_settings_get_boolean (prefs->settings, key);
- gtk_toggle_button_set_active (toggle, not ? !bool : bool);
+ v_bool = g_settings_get_boolean (prefs->settings, key);
+ gtk_toggle_button_set_active (toggle, not ? !v_bool : v_bool);
if (toggled) {
g_object_set_data ((GObject *) toggle, "key", (gpointer) key);
diff --git a/modules/web-inspector/Makefile.am b/modules/web-inspector/Makefile.am
new file mode 100644
index 0000000000..f8a1fc9340
--- /dev/null
+++ b/modules/web-inspector/Makefile.am
@@ -0,0 +1,23 @@
+module_LTLIBRARIES = libevolution-module-web-inspector.la
+
+libevolution_module_web_inspector_la_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/widgets \
+ -DG_LOG_DOMAIN=\"evolution-web-inspector\" \
+ $(EVOLUTION_DATA_SERVER_CFLAGS) \
+ $(GNOME_PLATFORM_CFLAGS)
+
+libevolution_module_web_inspector_la_SOURCES = \
+ evolution-web-inspector.c
+
+libevolution_module_web_inspector_la_LIBADD = \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(EVOLUTION_DATA_SERVER_LIBS) \
+ $(GNOME_PLATFORM_LIBS)
+
+libevolution_module_web_inspector_la_LDFLAGS = \
+ -module -avoid-version $(NO_UNDEFINED)
+
+-include $(top_srcdir)/git.mk
diff --git a/modules/web-inspector/evolution-web-inspector.c b/modules/web-inspector/evolution-web-inspector.c
new file mode 100644
index 0000000000..27a21e0693
--- /dev/null
+++ b/modules/web-inspector/evolution-web-inspector.c
@@ -0,0 +1,185 @@
+/*
+ * evolution-web-inspector.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 <config.h>
+#include <glib/gi18n-lib.h>
+
+#include <misc/e-web-view.h>
+#include <libebackend/e-extension.h>
+
+/* Standard GObject macros */
+#define E_TYPE_WEB_INSPECTOR \
+ (e_web_inspector_get_type ())
+#define E_WEB_INSPECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_WEB_INSPECTOR, EWebInspector))
+
+typedef struct _EWebInspector EWebInspector;
+typedef struct _EWebInspectorClass EWebInspectorClass;
+
+struct _EWebInspector {
+ EExtension parent;
+};
+
+struct _EWebInspectorClass {
+ EExtensionClass parent_class;
+};
+
+static const gchar *ui =
+"<ui>"
+" <popup name='context'>"
+" <placeholder name='inspect-menu' >"
+" <menuitem action='inspect'/>"
+" </placeholder>"
+" </popup>"
+"</ui>";
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+/* Forward Declarations */
+GType e_web_inspector_get_type (void);
+
+G_DEFINE_DYNAMIC_TYPE (EWebInspector, e_web_inspector, E_TYPE_EXTENSION)
+
+static EWebView *
+web_inspector_get_web_view (EWebInspector *extension)
+{
+ EExtensible *extensible;
+
+ extensible = e_extension_get_extensible (E_EXTENSION (extension));
+
+ return E_WEB_VIEW (extensible);
+}
+
+static void
+web_inspector_action_inspect_cb (GtkAction *action,
+ EWebInspector *extension)
+{
+ WebKitWebInspector *inspector;
+ EWebView *web_view;
+
+ web_view = web_inspector_get_web_view (extension);
+ inspector = webkit_web_view_get_inspector (WEBKIT_WEB_VIEW (web_view));
+
+ webkit_web_inspector_show (inspector);
+}
+
+static GtkActionEntry inspect_entries[] = {
+
+ { "inspect",
+ NULL,
+ N_("_Inspect..."),
+ NULL,
+ N_("Inspect the HTML content (debugging feature)"),
+ G_CALLBACK (web_inspector_action_inspect_cb) }
+};
+
+static WebKitWebView *
+web_inspector_inspect_web_view_cb (WebKitWebInspector *inspector,
+ EWebInspector *extension)
+{
+ GtkWidget *web_view;
+ GtkWidget *window;
+ const gchar *title;
+
+ title = _("Evolution Web Inspector");
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title (GTK_WINDOW (window), title);
+ gtk_widget_set_size_request (window, 600, 400);
+ gtk_widget_show (window);
+
+ web_view = webkit_web_view_new ();
+ gtk_container_add (GTK_CONTAINER (window), web_view);
+ gtk_widget_show (web_view);
+
+ return WEBKIT_WEB_VIEW (web_view);
+}
+
+static void
+web_inspector_constructed (GObject *object)
+{
+ EWebInspector *extension;
+ WebKitWebSettings *settings;
+ WebKitWebInspector *inspector;
+ GtkActionGroup *action_group;
+ GtkUIManager *ui_manager;
+ EWebView *web_view;
+ GError *error = NULL;
+
+ extension = E_WEB_INSPECTOR (object);
+ web_view = web_inspector_get_web_view (extension);
+
+ ui_manager = e_web_view_get_ui_manager (web_view);
+ action_group = e_web_view_get_action_group (web_view, "standard");
+
+ settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW (web_view));
+ g_object_set (settings, "enable-developer-extras", TRUE, NULL);
+
+ inspector = webkit_web_view_get_inspector (WEBKIT_WEB_VIEW (web_view));
+
+ g_signal_connect (
+ inspector, "inspect-web-view",
+ G_CALLBACK (web_inspector_inspect_web_view_cb), extension);
+
+ gtk_action_group_add_actions (
+ action_group, inspect_entries,
+ G_N_ELEMENTS (inspect_entries), extension);
+
+ /* Because we are loading from a hard-coded string, there is
+ * no chance of I/O errors. Failure here implies a malformed
+ * UI definition. Full stop. */
+ gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
+ if (error != NULL)
+ g_error ("%s", error->message);
+}
+
+static void
+e_web_inspector_class_init (EWebInspectorClass *class)
+{
+ GObjectClass *object_class;
+ EExtensionClass *extension_class;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = web_inspector_constructed;
+
+ extension_class = E_EXTENSION_CLASS (class);
+ extension_class->extensible_type = E_TYPE_WEB_VIEW;
+}
+
+static void
+e_web_inspector_class_finalize (EWebInspectorClass *class)
+{
+}
+
+static void
+e_web_inspector_init (EWebInspector *extension)
+{
+}
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+ e_web_inspector_register_type (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}