[geary/wip/765516-gtk-widget-conversation-viewer: 132/174] Tidy up the ConversationListBox API for accessing reply target email.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/765516-gtk-widget-conversation-viewer: 132/174] Tidy up the ConversationListBox API for accessing reply target email.
- Date: Sun, 25 Sep 2016 13:17:08 +0000 (UTC)
commit e0b6fb5f40d76eaeac567edd6820c949b90df92c
Author: Michael James Gratton <mike vee net>
Date: Mon Aug 22 11:31:06 2016 +1000
Tidy up the ConversationListBox API for accessing reply target email.
* src/client/conversation-viewer/conversation-listbox.vala
(ConversationListBox): Convert RO ::reply_target prop into a method,
reimplement to use new ::get_selection_view method. Fix call sites.
* src/client/conversation-viewer/conversation-email.vala
(ConversationEmail): Rename ::get_body_selection to
::get_selection_for_quoting to make it clear that what the returned
selection is to be used for. Fix call sites.
src/client/application/geary-controller.vala | 4 +-
.../conversation-viewer/conversation-email.vala | 2 +-
.../conversation-viewer/conversation-listbox.vala | 46 ++++++++++++--------
3 files changed, 31 insertions(+), 21 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 01058a9..d013252 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -2199,12 +2199,12 @@ public class GearyController : Geary.BaseObject {
ConversationListBox? list_view =
main_window.conversation_viewer.current_list;
if (list_view != null) {
- email_view = list_view.reply_target;
+ email_view = list_view.get_reply_target();
}
}
string? quote = null;
if (email_view != null) {
- quote = email_view.get_body_selection();
+ quote = email_view.get_selection_for_quoting();
}
create_compose_widget(compose_type, email_view.email, quote);
}
diff --git a/src/client/conversation-viewer/conversation-email.vala
b/src/client/conversation-viewer/conversation-email.vala
index fd39aec..60930a0 100644
--- a/src/client/conversation-viewer/conversation-email.vala
+++ b/src/client/conversation-viewer/conversation-email.vala
@@ -544,7 +544,7 @@ public class ConversationEmail : Gtk.Box {
/**
* Returns user-selected body HTML from a message, if any.
*/
- public string? get_body_selection() {
+ public string? get_selection_for_quoting() {
return (this.body_selection_message != null)
? this.body_selection_message.get_selection_for_quoting()
: null;
diff --git a/src/client/conversation-viewer/conversation-listbox.vala
b/src/client/conversation-viewer/conversation-listbox.vala
index 05eae5f..de129c6 100644
--- a/src/client/conversation-viewer/conversation-listbox.vala
+++ b/src/client/conversation-viewer/conversation-listbox.vala
@@ -118,24 +118,6 @@ public class ConversationListBox : Gtk.ListBox {
}
- /**
- * Returns the view for the email to be replied to, if any.
- *
- * If an email view has selected body text that view will be
- * returned. Else the last message by sort order will be returned,
- * if any.
- */
- public ConversationEmail? reply_target {
- get {
- unowned ConversationEmail? view = this.body_selected_view;
- if (view == null && this.last_email_row != null) {
- view = this.last_email_row.view;
- }
- return view;
- }
- }
-
-
/** Conversation being displayed. */
public Geary.App.Conversation conversation { get; private set; }
@@ -281,6 +263,34 @@ public class ConversationListBox : Gtk.ListBox {
}
/**
+ * Returns the email view to be replied to, if any.
+ *
+ * If an email view has a visible body and selected text, that
+ * view will be returned. Else the last message by sort order will
+ * be returned, if any.
+ */
+ public ConversationEmail? get_reply_target() {
+ ConversationEmail? view = get_selection_view();
+ if (view == null && this.last_email_row != null) {
+ view = this.last_email_row.view;
+ }
+ return view;
+ }
+
+ /**
+ * Returns the email view with a visible user selection, if any.
+ *
+ * If an email view has selected body text.
+ */
+ public ConversationEmail? get_selection_view() {
+ ConversationEmail? view = this.body_selected_view;
+ if (view != null) {
+ // XXX actually check the selected text is visible
+ }
+ return view;
+ }
+
+ /**
* Adds an an embedded composer to the view.
*/
public void add_embedded_composer(ComposerEmbed embed) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]