[geary/wip/730682-refine-convo-list: 6/11] Show conversation subject in main toolbar, not in individual messages.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/730682-refine-convo-list: 6/11] Show conversation subject in main toolbar, not in individual messages.
- Date: Fri, 5 Jan 2018 04:21:06 +0000 (UTC)
commit c10f246de641906db51669f20e66f1c07236dabf
Author: Michael James Gratton <mike vee net>
Date: Wed Jan 3 22:39:07 2018 +1100
Show conversation subject in main toolbar, not in individual messages.
src/client/components/main-toolbar.vala | 3 +
src/client/components/main-window.vala | 48 ++++++++++++-------
.../conversation-viewer/conversation-message.vala | 1 -
ui/conversation-message.ui | 6 +-
ui/main-toolbar.ui | 1 +
5 files changed, 37 insertions(+), 22 deletions(-)
---
diff --git a/src/client/components/main-toolbar.vala b/src/client/components/main-toolbar.vala
index c725f25..ab72bd6 100644
--- a/src/client/components/main-toolbar.vala
+++ b/src/client/components/main-toolbar.vala
@@ -14,6 +14,7 @@ public class MainToolbar : Gtk.Box {
// Used to form the title of the folder header
public string account { get; set; }
public string folder { get; set; }
+ public string subject { get; set; }
// Close button settings
public bool show_close_button { get; set; default = false; }
@@ -74,6 +75,8 @@ public class MainToolbar : Gtk.Box {
this.bind_property("account", this.folder_header, "title", BindingFlags.SYNC_CREATE);
this.bind_property("folder", this.folder_header, "subtitle", BindingFlags.SYNC_CREATE);
}
+ this.bind_property("subject", this.conversation_header, "title", BindingFlags.SYNC_CREATE);
+ this.bind_property("subject", this.conversation_header, "tooltip-text", BindingFlags.SYNC_CREATE);
this.bind_property("show-close-button-left", this.folder_header, "show-close-button",
BindingFlags.SYNC_CREATE);
this.bind_property("show-close-button-right", this.conversation_header, "show-close-button",
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index ec177a8..9466629 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -811,27 +811,39 @@ public class MainWindow : Gtk.ApplicationWindow {
SimpleAction find_action = get_action(
GearyController.ACTION_FIND_IN_CONVERSATION
);
- if (target != null) {
- if (target != current &&
- !this.conversation_viewer.is_composer_visible) {
- this.conversation_viewer.load_conversation.begin(
- target,
- this.application.config,
- this.application.controller.avatar_session,
- (obj, ret) => {
- try {
- this.conversation_viewer.load_conversation.end(ret);
- this.application.controller.enable_message_buttons(true);
- find_action.set_enabled(true);
- } catch (Error err) {
- debug("Unable to load conversation: %s",
- err.message);
- }
- }
+ if (target != null &&
+ target != current &&
+ !this.conversation_viewer.is_composer_visible) {
+
+ string subject = "";
+ Geary.Email? preview_message = target.get_earliest_recv_email(
+ Geary.App.Conversation.Location.ANYWHERE
+ );
+ if (preview_message != null) {
+ subject = Geary.String.reduce_whitespace(
+ EmailUtil.strip_subject_prefixes(preview_message)
);
}
- } else {
+
+ this.main_toolbar.subject = subject;
+ this.conversation_viewer.load_conversation.begin(
+ target,
+ this.application.config,
+ this.application.controller.avatar_session,
+ (obj, ret) => {
+ try {
+ this.conversation_viewer.load_conversation.end(ret);
+ this.application.controller.enable_message_buttons(true);
+ find_action.set_enabled(true);
+ } catch (Error err) {
+ debug("Unable to load conversation: %s",
+ err.message);
+ }
+ }
+ );
+ } else if (target == null) {
find_action.set_enabled(false);
+ this.main_toolbar.subject = "";
this.application.controller.enable_message_buttons(false);
this.conversation_viewer.show_none_selected();
}
diff --git a/src/client/conversation-viewer/conversation-message.vala
b/src/client/conversation-viewer/conversation-message.vala
index 2c01e9e..7be78c3 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -356,7 +356,6 @@ public class ConversationMessage : Gtk.Grid {
this.date.set_tooltip_text(date_tooltip);
if (this.message.subject != null) {
this.subject.set_text(this.message.subject.value);
- this.subject.set_visible(true);
this.subject_searchable = this.message.subject.value.casefold();
}
fill_header_addresses(this.to_header, this.message.to);
diff --git a/ui/conversation-message.ui b/ui/conversation-message.ui
index 8e6a1b3..aef36eb 100644
--- a/ui/conversation-message.ui
+++ b/ui/conversation-message.ui
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.20.2 -->
<interface>
- <requires lib="gtk+" version="3.14"/>
+ <requires lib="gtk+" version="3.20"/>
<template class="ConversationMessage" parent="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkGrid" id="summary">
@@ -285,7 +286,6 @@
</child>
<child>
<object class="GtkLabel" id="subject">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
diff --git a/ui/main-toolbar.ui b/ui/main-toolbar.ui
index dca27b6..6fa69e2 100644
--- a/ui/main-toolbar.ui
+++ b/ui/main-toolbar.ui
@@ -153,6 +153,7 @@
<object class="GtkHeaderBar" id="conversation_header">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="has_subtitle">False</property>
<child>
<object class="GtkBox" id="reply_forward_buttons">
<property name="visible">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]