[geary/wip/765516-gtk-widget-conversation-viewer: 178/187] Remove blacklisting from ConversationListBox, use a composer signal instead.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/765516-gtk-widget-conversation-viewer: 178/187] Remove blacklisting from ConversationListBox, use a composer signal instead.
- Date: Sat, 24 Sep 2016 16:21:01 +0000 (UTC)
commit 650501d26834c5e0582f37725c792a421e518165
Author: Michael James Gratton <mike vee net>
Date: Mon Sep 19 12:20:47 2016 +1000
Remove blacklisting from ConversationListBox, use a composer signal instead.
* src/client/composer/composer-widget.vala (ComposerWidget): Add
draft_id_changed signal, emit that when the manager's draft id changes,
rather than hooking directly into the ConversationListBox.
* src/client/conversation-viewer/conversation-listbox.vala
(ConversationListBox): Remove blackisting methods, update call sites.
src/client/application/geary-controller.vala | 7 +---
src/client/composer/composer-widget.vala | 27 +++----------------
.../conversation-viewer/conversation-listbox.vala | 22 ----------------
3 files changed, 7 insertions(+), 49 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index afe206a..16c5f4c 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -2244,17 +2244,14 @@ public class GearyController : Geary.BaseObject {
message("Could not load full message: %s", e.message);
}
}
-
+
widget = new ComposerWidget(current_account, compose_type, full, quote, is_draft);
if (is_draft) {
yield widget.restore_draft_state_async(current_account);
- if (conversation_view != null) {
- conversation_view.blacklist_by_id(referred.id);
- }
}
}
widget.show_all();
-
+
// We want to keep track of the open composer windows, so we can allow the user to cancel
// an exit without losing their data.
composer_widgets.add(widget);
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index d686846..0675a66 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -362,6 +362,10 @@ public class ComposerWidget : Gtk.EventBox {
get { return (ComposerContainer) parent; }
}
+
+ public signal void draft_id_changed(Geary.EmailIdentifier id);
+
+
public ComposerWidget(Geary.Account account, ComposeType compose_type,
Geary.Email? referred = null, string? quote = null, bool is_referred_draft = false) {
this.account = account;
@@ -521,18 +525,6 @@ public class ComposerWidget : Gtk.EventBox {
chain.append(this.attachments_box);
this.composer_container.set_focus_chain(chain);
- // Remind the conversation viewer of draft ids when it
- // reloads. Need to use the signal handler's viewer instance
- // to avoid some sort of ref that is preventing the composer
- // from being finalised when closed.
- ConversationViewer conversation_viewer =
- GearyApplication.instance.controller.main_window.conversation_viewer;
- conversation_viewer.conversation_added.connect((list_view) => {
- if (this.draft_manager != null) {
- list_view.blacklist_by_id(this.draft_manager.current_draft_id);
- }
- });
-
// Don't do this in an overridden version of the destroy
// method, it somehow ends up in an infinite loop
destroy.connect(() => { close_draft_manager_async.begin(null); });
@@ -1376,11 +1368,7 @@ public class ComposerWidget : Gtk.EventBox {
}
private void on_draft_id_changed() {
- ConversationListBox? list_view =
- GearyApplication.instance.controller.main_window.conversation_viewer.current_list;
- if (list_view != null) {
- list_view.blacklist_by_id(this.draft_manager.current_draft_id);
- }
+ draft_id_changed(this.draft_manager.current_draft_id);
}
private void on_draft_manager_fatal(Error err) {
@@ -1480,11 +1468,6 @@ public class ComposerWidget : Gtk.EventBox {
} catch (Error err) {
// ignored
}
- ConversationListBox? list_view =
- GearyApplication.instance.controller.main_window.conversation_viewer.current_list;
- if (this.draft_manager != null && list_view != null) {
- list_view.unblacklist_by_id(this.draft_manager.current_draft_id);
- }
container.close_container();
}
diff --git a/src/client/conversation-viewer/conversation-listbox.vala
b/src/client/conversation-viewer/conversation-listbox.vala
index b1a365d..b342f61 100644
--- a/src/client/conversation-viewer/conversation-listbox.vala
+++ b/src/client/conversation-viewer/conversation-listbox.vala
@@ -445,28 +445,6 @@ public class ConversationListBox : Gtk.ListBox {
}
/**
- * Hides a specific email in the conversation.
- */
- public void blacklist_by_id(Geary.EmailIdentifier? id) {
- EmailRow? row = this.id_to_row.get(id);
- if (row != null) {
- row.hide();
- update_last_row();
- }
- }
-
- /**
- * Re-displays a previously blacklisted email.
- */
- public void unblacklist_by_id(Geary.EmailIdentifier? id) {
- EmailRow? row = this.id_to_row.get(id);
- if (row != null) {
- row.show();
- update_last_row();
- }
- }
-
- /**
* Loads search term matches for this list's emails.
*/
public async void load_search_terms() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]