Commit 593abc80 authored by Andrea Corbellini's avatar Andrea Corbellini Committed by Jim Nelson

Jump to furst unread message when selecting a conversation: Closes #6243

Although a duplicate of #4639, where we decided not to implement this
feature in lieu of implementing #5137 (compress collapsed read messages),
since we don't know when that will be ready, this is a good stop-gap,
as current behavior is annoying with long conversations.  Andrea's
code is cleanly delineated from the other code, and should be easily
removed if/when the time comes.
parent e51f6787
......@@ -549,6 +549,7 @@ public class GearyController {
private void on_show_message_completed(Object? source, AsyncResult result) {
......@@ -339,6 +339,25 @@ public class ConversationViewer : Gtk.Box {
public void show_first_visible_email() {
// Select the first email element that does not have "hide" in its
// class list. The constraint on the id is required because there
// are some elements (like #selection_counter) that have the "email"
// class, but that are not messages.
WebKit.DOM.HTMLElement first_visible_email =, ".email[id^=message_]:not(.hide)");
if (first_visible_email != null) {
// Select the sibling which, if it exists, is the previous hidden
// message. This is a way Geary has to say "hey, this conversation
// is not new: there are some messages above".
WebKit.DOM.HTMLElement first_visible_email_sibling =
(WebKit.DOM.HTMLElement) first_visible_email.previous_sibling;
if (first_visible_email_sibling != null) {
private Geary.Email? get_email_from_element(WebKit.DOM.Element element) {
// First get the email container.
......@@ -313,5 +313,9 @@ public class ConversationWebView : WebKit.WebView {
public WebKit.DOM.HTMLDivElement create_div() throws Error {
return get_dom_document().create_element("div") as WebKit.DOM.HTMLDivElement;
public void scroll_to_element(WebKit.DOM.HTMLElement element) {
get_dom_document().get_default_view().scroll(element.offset_left, element.offset_top);
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