aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
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 /widgets
parenta7cdda3232a8c0b0ed4d0ea279a67b9cf72cbb7c (diff)
downloadgsoc2013-evolution-4e4fcdad46e710f18d3d802d9734fc53213bc6b8.tar.gz
gsoc2013-evolution-4e4fcdad46e710f18d3d802d9734fc53213bc6b8.tar.zst
gsoc2013-evolution-4e4fcdad46e710f18d3d802d9734fc53213bc6b8.zip
Miscellaneous cleanup bits from WebKit branch.
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/e-web-view.c85
-rw-r--r--widgets/misc/e-web-view.h5
2 files changed, 63 insertions, 27 deletions
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);