aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-04-02 19:55:50 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-04-02 21:23:19 +0800
commit4e4fcdad46e710f18d3d802d9734fc53213bc6b8 (patch)
tree3b7c8fa6f8e0176e1bc8ba24f1b77be1c1805c68
parenta7cdda3232a8c0b0ed4d0ea279a67b9cf72cbb7c (diff)
downloadgsoc2013-evolution-4e4fcdad46e710f18d3d802d9734fc53213bc6b8.tar.gz
gsoc2013-evolution-4e4fcdad46e710f18d3d802d9734fc53213bc6b8.tar.zst
gsoc2013-evolution-4e4fcdad46e710f18d3d802d9734fc53213bc6b8.zip
Miscellaneous cleanup bits from WebKit branch.
-rw-r--r--addressbook/gui/merging/Makefile.am3
-rw-r--r--addressbook/gui/widgets/eab-contact-display.c63
-rw-r--r--calendar/gui/e-cal-component-preview.c6
-rw-r--r--modules/addressbook/e-book-shell-content.c7
-rw-r--r--modules/mail/e-mail-shell-view-private.c19
-rw-r--r--widgets/misc/e-web-view.c85
-rw-r--r--widgets/misc/e-web-view.h5
7 files changed, 109 insertions, 79 deletions
diff --git a/addressbook/gui/merging/Makefile.am b/addressbook/gui/merging/Makefile.am
index e10c3ef765..01af6b2534 100644
--- a/addressbook/gui/merging/Makefile.am
+++ b/addressbook/gui/merging/Makefile.am
@@ -7,7 +7,8 @@ libeabbookmerging_la_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/widgets \
-I$(top_srcdir)/addressbook \
- $(EVOLUTION_ADDRESSBOOK_CFLAGS)
+ $(EVOLUTION_ADDRESSBOOK_CFLAGS) \
+ $(GNOME_PLATFORM_CFLAGS)
libeabbookmerging_la_SOURCES = \
eab-contact-compare.c \
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
index dda6081137..8c0e37fccc 100644
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ b/addressbook/gui/widgets/eab-contact-display.c
@@ -984,31 +984,11 @@ contact_display_url_requested (GtkHTML *html,
}
static void
-contact_display_link_clicked (GtkHTML *html,
- const gchar *uri)
-{
- EABContactDisplay *display;
- gsize length;
-
- display = EAB_CONTACT_DISPLAY (html);
-
- length = strlen ("internal-mailto:");
- if (g_ascii_strncasecmp (uri, "internal-mailto:", length) == 0) {
- gint index;
-
- index = atoi (uri + length);
- contact_display_emit_send_message (display, index);
- return;
- }
-
- /* Chain up to parent's link_clicked() method. */
- GTK_HTML_CLASS (parent_class)->link_clicked (html, uri);
-}
-
-static void
-contact_display_on_url (GtkHTML *html,
- const gchar *uri)
+contact_display_hovering_over_link (EWebView *web_view,
+ const gchar *title,
+ const gchar *uri)
{
+ EWebViewClass *web_view_class;
EABContactDisplay *display;
EContact *contact;
const gchar *name;
@@ -1020,7 +1000,7 @@ contact_display_on_url (GtkHTML *html,
if (!g_str_has_prefix (uri, "internal-mailto:"))
goto chainup;
- display = EAB_CONTACT_DISPLAY (html);
+ display = EAB_CONTACT_DISPLAY (web_view);
contact = eab_contact_display_get_contact (display);
name = e_contact_get_const (contact, E_CONTACT_FILE_AS);
@@ -1029,14 +1009,37 @@ contact_display_on_url (GtkHTML *html,
g_return_if_fail (name != NULL);
message = g_strdup_printf (_("Click to mail %s"), name);
- e_web_view_status_message (E_WEB_VIEW (html), message);
+ e_web_view_status_message (web_view, message);
g_free (message);
return;
chainup:
- /* Chain up to parent's on_url() method. */
- GTK_HTML_CLASS (parent_class)->on_url (html, uri);
+ /* Chain up to parent's hovering_over_link() method. */
+ web_view_class = E_WEB_VIEW_CLASS (parent_class);
+ web_view_class->hovering_over_link (web_view, title, uri);
+}
+
+static void
+contact_display_link_clicked (EWebView *web_view,
+ const gchar *uri)
+{
+ EABContactDisplay *display;
+ gsize length;
+
+ display = EAB_CONTACT_DISPLAY (web_view);
+
+ length = strlen ("internal-mailto:");
+ if (g_ascii_strncasecmp (uri, "internal-mailto:", length) == 0) {
+ gint index;
+
+ index = atoi (uri + length);
+ contact_display_emit_send_message (display, index);
+ return;
+ }
+
+ /* Chain up to parent's link_clicked() method. */
+ E_WEB_VIEW_CLASS (parent_class)->link_clicked (web_view, uri);
}
static void
@@ -1086,10 +1089,10 @@ eab_contact_display_class_init (EABContactDisplayClass *class)
html_class = GTK_HTML_CLASS (class);
html_class->url_requested = contact_display_url_requested;
- html_class->link_clicked = contact_display_link_clicked;
- html_class->on_url = contact_display_on_url;
web_view_class = E_WEB_VIEW_CLASS (class);
+ web_view_class->hovering_over_link = contact_display_hovering_over_link;
+ web_view_class->link_clicked = contact_display_link_clicked;
web_view_class->update_actions = contact_display_update_actions;
g_object_class_install_property (
diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c
index 77fa25c995..dbc0fc884f 100644
--- a/calendar/gui/e-cal-component-preview.c
+++ b/calendar/gui/e-cal-component-preview.c
@@ -401,14 +401,8 @@ cal_component_preview_class_init (ECalComponentPreviewClass *class)
static void
cal_component_preview_init (ECalComponentPreview *preview)
{
- GtkHTML *html;
-
preview->priv = E_CAL_COMPONENT_PREVIEW_GET_PRIVATE (preview);
- html = GTK_HTML (preview);
- gtk_html_set_default_content_type (html, "charset=utf-8");
- gtk_html_load_empty (html);
-
preview->priv->zone = icaltimezone_get_utc_timezone ();
}
diff --git a/modules/addressbook/e-book-shell-content.c b/modules/addressbook/e-book-shell-content.c
index e83658a248..4a48677d13 100644
--- a/modules/addressbook/e-book-shell-content.c
+++ b/modules/addressbook/e-book-shell-content.c
@@ -189,6 +189,7 @@ book_shell_content_constructed (GObject *object)
EShellView *shell_view;
EShellWindow *shell_window;
EShellContent *shell_content;
+ EShellTaskbar *shell_taskbar;
GConfBridge *bridge;
GtkWidget *container;
GtkWidget *widget;
@@ -202,6 +203,7 @@ book_shell_content_constructed (GObject *object)
shell_content = E_SHELL_CONTENT (object);
shell_view = e_shell_content_get_shell_view (shell_content);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell_taskbar = e_shell_view_get_shell_taskbar (shell_view);
shell = e_shell_window_get_shell (shell_window);
container = GTK_WIDGET (object);
@@ -233,6 +235,11 @@ book_shell_content_constructed (GObject *object)
widget, "send-message",
G_CALLBACK (book_shell_content_send_message_cb), object);
+ g_signal_connect_swapped (
+ widget, "status-message",
+ G_CALLBACK (e_shell_taskbar_set_message),
+ shell_taskbar);
+
widget = e_preview_pane_new (E_WEB_VIEW (widget));
gtk_paned_pack2 (GTK_PANED (container), widget, FALSE, FALSE);
priv->preview_pane = g_object_ref (widget);
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 00dcb2ff1d..55765f34f6 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -257,19 +257,6 @@ mail_shell_view_reader_changed_cb (EMailShellView *mail_shell_view,
}
static void
-mail_shell_view_reader_status_message_cb (EMailShellView *mail_shell_view,
- const gchar *status_message)
-{
- EShellView *shell_view;
- EShellTaskbar *shell_taskbar;
-
- shell_view = E_SHELL_VIEW (mail_shell_view);
- shell_taskbar = e_shell_view_get_shell_taskbar (shell_view);
-
- e_shell_taskbar_set_message (shell_taskbar, status_message);
-}
-
-static void
mail_shell_view_scroll_cb (EMailShellView *mail_shell_view,
GtkOrientation orientation,
GtkScrollType scroll_type,
@@ -426,6 +413,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
EShellContent *shell_content;
EShellSettings *shell_settings;
EShellSidebar *shell_sidebar;
+ EShellTaskbar *shell_taskbar;
EShellWindow *shell_window;
EShellSearchbar *searchbar;
EMFormatHTMLDisplay *html_display;
@@ -447,6 +435,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
shell_backend = e_shell_view_get_shell_backend (shell_view);
shell_content = e_shell_view_get_shell_content (shell_view);
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ shell_taskbar = e_shell_view_get_shell_taskbar (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
ui_manager = e_shell_window_get_ui_manager (shell_window);
@@ -573,8 +562,8 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
g_signal_connect_swapped (
web_view, "status-message",
- G_CALLBACK (mail_shell_view_reader_status_message_cb),
- mail_shell_view);
+ G_CALLBACK (e_shell_taskbar_set_message),
+ shell_taskbar);
/* Need to keep the handler ID so we can disconnect it in
* dispose(). The shell outlives us and we don't want it
diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c
index d245437e84..7a0dc6de56 100644
--- a/widgets/misc/e-web-view.c
+++ b/widgets/misc/e-web-view.c
@@ -767,30 +767,71 @@ web_view_url_requested (GtkHTML *html,
}
static void
-web_view_link_clicked (GtkHTML *html,
- const gchar *uri)
+web_view_gtkhtml_link_clicked (GtkHTML *html,
+ const gchar *uri)
{
- gpointer parent;
+ EWebViewClass *class;
+ EWebView *web_view;
- parent = gtk_widget_get_toplevel (GTK_WIDGET (html));
- parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
+ web_view = E_WEB_VIEW (html);
- e_show_uri (parent, uri);
+ class = E_WEB_VIEW_GET_CLASS (web_view);
+ g_return_if_fail (class->link_clicked != NULL);
+
+ class->link_clicked (web_view, uri);
}
static void
web_view_on_url (GtkHTML *html,
const gchar *uri)
{
+ EWebViewClass *class;
EWebView *web_view;
+
+ web_view = E_WEB_VIEW (html);
+
+ class = E_WEB_VIEW_GET_CLASS (web_view);
+ g_return_if_fail (class->hovering_over_link != NULL);
+
+ /* XXX WebKit would supply a title here. */
+ class->hovering_over_link (web_view, NULL, uri);
+}
+
+static void
+web_view_iframe_created (GtkHTML *html,
+ GtkHTML *iframe)
+{
+ g_signal_connect_swapped (
+ iframe, "button-press-event",
+ G_CALLBACK (web_view_button_press_event_cb), html);
+}
+
+static gchar *
+web_view_extract_uri (EWebView *web_view,
+ GdkEventButton *event,
+ GtkHTML *html)
+{
+ gchar *uri;
+
+ if (event != NULL)
+ uri = gtk_html_get_url_at (html, event->x, event->y);
+ else
+ uri = gtk_html_get_cursor_url (html);
+
+ return uri;
+}
+
+static void
+web_view_hovering_over_link (EWebView *web_view,
+ const gchar *title,
+ const gchar *uri)
+{
CamelInternetAddress *address;
CamelURL *curl;
const gchar *format = NULL;
gchar *message = NULL;
gchar *who;
- web_view = E_WEB_VIEW (html);
-
if (uri == NULL || *uri == '\0')
goto exit;
@@ -833,27 +874,15 @@ exit:
}
static void
-web_view_iframe_created (GtkHTML *html,
- GtkHTML *iframe)
-{
- g_signal_connect_swapped (
- iframe, "button-press-event",
- G_CALLBACK (web_view_button_press_event_cb), html);
-}
-
-static gchar *
-web_view_extract_uri (EWebView *web_view,
- GdkEventButton *event,
- GtkHTML *html)
+web_view_link_clicked (EWebView *web_view,
+ const gchar *uri)
{
- gchar *uri;
+ gpointer parent;
- if (event != NULL)
- uri = gtk_html_get_url_at (html, event->x, event->y);
- else
- uri = gtk_html_get_cursor_url (html);
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (web_view));
+ parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
- return uri;
+ e_show_uri (parent, uri);
}
static void
@@ -1083,11 +1112,13 @@ e_web_view_class_init (EWebViewClass *class)
html_class = GTK_HTML_CLASS (class);
html_class->url_requested = web_view_url_requested;
- html_class->link_clicked = web_view_link_clicked;
+ html_class->link_clicked = web_view_gtkhtml_link_clicked;
html_class->on_url = web_view_on_url;
html_class->iframe_created = web_view_iframe_created;
class->extract_uri = web_view_extract_uri;
+ class->hovering_over_link = web_view_hovering_over_link;
+ class->link_clicked = web_view_link_clicked;
class->load_string = web_view_load_string;
class->copy_clipboard = web_view_copy_clipboard;
class->cut_clipboard = web_view_cut_clipboard;
diff --git a/widgets/misc/e-web-view.h b/widgets/misc/e-web-view.h
index 7d8eb4c8d0..56477ef257 100644
--- a/widgets/misc/e-web-view.h
+++ b/widgets/misc/e-web-view.h
@@ -69,6 +69,11 @@ struct _EWebViewClass {
gchar * (*extract_uri) (EWebView *web_view,
GdkEventButton *event,
GtkHTML *frame);
+ void (*hovering_over_link) (EWebView *web_view,
+ const gchar *title,
+ const gchar *uri);
+ void (*link_clicked) (EWebView *web_view,
+ const gchar *uri);
void (*load_string) (EWebView *web_view,
const gchar *load_string);