Simplify message view CSS so uncollapsed message same state: Closes #5498

This commit is contained in:
Robert Schroll 2012-07-05 11:41:28 -07:00 committed by Jim Nelson
parent 9f72d161f9
commit ace7494c67
3 changed files with 30 additions and 22 deletions

View file

@ -677,6 +677,7 @@ public class GearyController {
foreach (Geary.Email email in messages_to_add)
main_window.message_viewer.add_message(email);
main_window.message_viewer.unhide_last_email();
main_window.message_viewer.scroll_reset();
// Mark as read.

View file

@ -469,6 +469,18 @@ public class MessageViewer : WebKit.WebView {
bind_event(this, ".attachment_container .attachment", "click", (Callback) on_attachment_clicked, this);
bind_event(this, ".attachment_container .attachment", "contextmenu", (Callback) on_attachment_menu, this);
}
public void unhide_last_email() {
WebKit.DOM.HTMLElement last_email = (WebKit.DOM.HTMLElement) container.get_last_child().previous_sibling;
if (last_email != null) {
WebKit.DOM.DOMTokenList class_list = last_email.get_class_list();
try {
class_list.remove("hide");
} catch (Error error) {
// Expected, if not hidden
}
}
}
private WebKit.DOM.HTMLElement? closest_ancestor(WebKit.DOM.Element element, string selector) {
try {
@ -685,13 +697,10 @@ public class MessageViewer : WebKit.WebView {
return;
WebKit.DOM.DOMTokenList class_list = email_element.get_class_list();
if (class_list.contains("hide")) {
class_list.add("show");
if (class_list.contains("hide"))
class_list.remove("hide");
} else {
class_list.remove("show");
else
class_list.add("hide");
}
} catch (Error error) {
warning("Error toggling message: %s", error.message);
}

View file

@ -160,46 +160,44 @@ img[src^="data:"] {
background-color: #ccc !important;
}
.email.hide:not(:last-of-type) {
.email.hide {
background-color: #e8e8e8
}
.email.hide:not(:last-of-type) .body,
.email.hide:not(:last-of-type) > .attachment_container,
.email:not(.hide) .header_container .preview,
.email:last-of-type .header_container .preview {
display: none;
.email.hide .body,
.email.hide > .attachment_container,
.email:not(.hide) .header_container .preview {
display: none;
}
.email:not(:last-of-type) .header_container {
.email .header_container {
cursor: pointer;
}
.email:not(.hide) .header .field .value {
cursor: auto;
}
.email.hide:not(:last-of-type) .header {
.email.hide .header {
padding: 5px 0;
text-align: right;
}
.email.hide:not(:last-of-type) .header .field {
.email.hide .header .field {
display: inline;
margin-right: 2px;
text-align: left;
}
.email.hide:not(:last-of-type) .header .field:not(:first-child) {
.email.hide .header .field:not(:first-child) {
display: inline-block;
}
.email.hide:not(:last-of-type) .header .field:not(.important),
.email.hide:not(:last-of-type) .header .field .title {
.email.hide .header .field:not(.important),
.email.hide .header .field .title {
display: none;
}
.email.hide:not(:last-of-type) .header .field .value {
.email.hide .header .field .value {
margin-left: 0;
}
.email.hide:not(:last-of-type) .header .field .not_hidden_only,
.email:not(.hide) .header .field .hidden_only,
.email:last-of-type .header .field .hidden_only {
.email.hide .header .field .not_hidden_only,
.email:not(.hide) .header .field .hidden_only {
display: none;
}
.email.hide:not(:last-of-type) .header .field a {
.email.hide .header .field a {
pointer-events: none;
}