Commit e553bb29 authored by Matthew Pirocchi's avatar Matthew Pirocchi

Optionally allow loading external images: Closes #5418.

parent 97f504c2
......@@ -208,6 +208,7 @@ client/ui/message-list-cell-renderer.vala
client/ui/message-list-store.vala
client/ui/message-list-view.vala
client/ui/message-viewer.vala
client/ui/message-web-view.vala
client/ui/password-dialog.vala
client/ui/preferences-dialog.vala
client/ui/webview-edit-fixer.vala
......
......@@ -690,6 +690,7 @@ public class GearyController {
if (clear_view) {
main_window.message_viewer.clear(current_folder);
main_window.message_viewer.scroll_reset();
main_window.message_viewer.external_images_info_bar.hide();
}
// Fetch full messages.
......@@ -1252,15 +1253,15 @@ public class GearyController {
}
private void on_zoom_in() {
main_window.message_viewer.zoom_in();
main_window.message_viewer.web_view.zoom_in();
}
private void on_zoom_out() {
main_window.message_viewer.zoom_out();
main_window.message_viewer.web_view.zoom_out();
}
private void on_zoom_normal() {
main_window.message_viewer.zoom_level = 1.0f;
main_window.message_viewer.web_view.zoom_level = 1.0f;
}
private Geary.RFC822.MailboxAddress get_sender() {
......
......@@ -13,7 +13,6 @@ public class MainWindow : Gtk.Window {
public MainToolbar main_toolbar { get; private set; }
public MessageListView message_list_view { get; private set; }
public MessageViewer message_viewer { get; private set; default = new MessageViewer(); }
private Gtk.Label message_overlay_label;
private int window_width;
private int window_height;
......@@ -112,12 +111,6 @@ public class MainWindow : Gtk.Window {
message_list_scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
message_list_scrolled.add(message_list_view);
// message viewer
Gtk.ScrolledWindow message_viewer_scrolled = new Gtk.ScrolledWindow(null, null);
message_viewer_scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
message_viewer_scrolled.add(message_viewer);
message_viewer.link_hover.connect(on_link_hover);
// Three-pane display.
Gtk.Box status_bar_box = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
Gtk.Statusbar status_bar = new Gtk.Statusbar();
......@@ -128,16 +121,7 @@ public class MainWindow : Gtk.Window {
// Message list left of message viewer.
messages_paned.pack1(message_list_scrolled, false, false);
Gtk.Overlay message_overlay = new Gtk.Overlay();
message_overlay.add(message_viewer_scrolled);
messages_paned.pack2(message_overlay, true, true);
message_overlay_label = new Gtk.Label(null);
message_overlay_label.ellipsize = Pango.EllipsizeMode.MIDDLE;
message_overlay_label.halign = Gtk.Align.START;
message_overlay_label.valign = Gtk.Align.END;
message_overlay.add_overlay(message_overlay_label);
messages_paned.pack2(message_viewer.content_area, true, true);
// Folder list to the left of everything.
folder_paned.pack1(status_bar_box, false, false);
......@@ -147,9 +131,5 @@ public class MainWindow : Gtk.Window {
add(main_layout);
}
private void on_link_hover(string? link) {
message_overlay_label.label = link;
}
}
This diff is collapsed.
/* Copyright 2012 Yorba Foundation
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
*/
public class MessageWebView : WebKit.WebView {
private int width = 0;
private int height = 0;
public override bool query_tooltip(int x, int y, bool keyboard_tooltip, Gtk.Tooltip tooltip) {
// Disable tooltips from within WebKit itself.
return false;
}
public override void get_preferred_height (out int minimum_height, out int natural_height) {
minimum_height = height;
natural_height = height;
}
public override void get_preferred_width (out int minimum_width, out int natural_width) {
minimum_width = width;
natural_width = width;
}
public override bool scroll_event(Gdk.EventScroll event) {
if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0) {
if (event.direction == Gdk.ScrollDirection.UP) {
zoom_in();
return true;
} else if (event.direction == Gdk.ScrollDirection.DOWN) {
zoom_out();
return true;
}
}
return false;
}
public override void parent_set(Gtk.Widget? previous_parent) {
if (get_parent() != null)
parent.size_allocate.connect(on_size_allocate);
}
private void on_size_allocate(Gtk.Allocation allocation) {
// Store the dimensions, then ask for a resize.
width = allocation.width;
height = allocation.height;
queue_resize();
}
}
......@@ -42,12 +42,6 @@ pre {
font-family: sans-serif;
white-space: pre-wrap;
}
img {
display: none;
}
img[src^="data:"] {
display: inline;
}
.button {
border: 1px transparent solid;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment