Miscellaneous cleanup bits from WebKit branch.
This commit is contained in:
@ -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 \
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 ();
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -256,19 +256,6 @@ mail_shell_view_reader_changed_cb (EMailShellView *mail_shell_view,
|
||||
e_mail_shell_view_update_sidebar (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,
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
web_view_link_clicked (EWebView *web_view,
|
||||
const gchar *uri)
|
||||
{
|
||||
g_signal_connect_swapped (
|
||||
iframe, "button-press-event",
|
||||
G_CALLBACK (web_view_button_press_event_cb), html);
|
||||
}
|
||||
gpointer parent;
|
||||
|
||||
static gchar *
|
||||
web_view_extract_uri (EWebView *web_view,
|
||||
GdkEventButton *event,
|
||||
GtkHTML *html)
|
||||
{
|
||||
gchar *uri;
|
||||
parent = gtk_widget_get_toplevel (GTK_WIDGET (web_view));
|
||||
parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
|
||||
|
||||
if (event != NULL)
|
||||
uri = gtk_html_get_url_at (html, event->x, event->y);
|
||||
else
|
||||
uri = gtk_html_get_cursor_url (html);
|
||||
|
||||
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;
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user