Rename classes and files to reflect Conversation-centricism
Geary originally only dealt in email messages, and so the original classes' names reflected that. When we switched to conversation-based views, those names were not changed, making the code slightly difficult to understand. This converts those client classes into Conversation* names.
This commit is contained in:
parent
96fa5c6066
commit
093b5be917
9 changed files with 137 additions and 137 deletions
|
|
@ -209,7 +209,7 @@ client/dialogs/password-dialog.vala
|
|||
client/dialogs/preferences-dialog.vala
|
||||
|
||||
client/models/folder-list.vala
|
||||
client/models/message-list-store.vala
|
||||
client/models/conversation-list-store.vala
|
||||
|
||||
client/notification/libindicate.vala
|
||||
client/notification/new-messages-indicator.vala
|
||||
|
|
@ -236,11 +236,11 @@ client/util/util-keyring.vala
|
|||
client/util/util-menu.vala
|
||||
client/util/util-webkit.vala
|
||||
|
||||
client/views/formatted-message-data.vala
|
||||
client/views/message-list-cell-renderer.vala
|
||||
client/views/message-list-view.vala
|
||||
client/views/message-viewer.vala
|
||||
client/views/message-web-view.vala
|
||||
client/views/formatted-conversation-data.vala
|
||||
client/views/conversation-list-cell-renderer.vala
|
||||
client/views/conversation-list-view.vala
|
||||
client/views/conversation-viewer.vala
|
||||
client/views/conversation-web-view.vala
|
||||
)
|
||||
|
||||
set(CONSOLE_SRC
|
||||
|
|
|
|||
|
|
@ -100,23 +100,23 @@ public class GearyController {
|
|||
enable_message_buttons(false);
|
||||
|
||||
// Connect to various UI signals.
|
||||
main_window.message_list_view.conversations_selected.connect(on_conversations_selected);
|
||||
main_window.message_list_view.load_more.connect(on_load_more);
|
||||
main_window.message_list_view.mark_conversation.connect(on_mark_conversation);
|
||||
main_window.conversation_list_view.conversations_selected.connect(on_conversations_selected);
|
||||
main_window.conversation_list_view.load_more.connect(on_load_more);
|
||||
main_window.conversation_list_view.mark_conversation.connect(on_mark_conversation);
|
||||
main_window.folder_list.folder_selected.connect(on_folder_selected);
|
||||
main_window.folder_list.copy_conversation.connect(on_copy_conversation);
|
||||
main_window.folder_list.move_conversation.connect(on_move_conversation);
|
||||
main_window.main_toolbar.copy_folder_menu.folder_selected.connect(on_copy_conversation);
|
||||
main_window.main_toolbar.move_folder_menu.folder_selected.connect(on_move_conversation);
|
||||
main_window.message_viewer.link_selected.connect(on_link_selected);
|
||||
main_window.message_viewer.reply_to_message.connect(on_reply_to_message);
|
||||
main_window.message_viewer.reply_all_message.connect(on_reply_all_message);
|
||||
main_window.message_viewer.forward_message.connect(on_forward_message);
|
||||
main_window.message_viewer.mark_message.connect(on_message_viewer_mark_message);
|
||||
main_window.message_viewer.open_attachment.connect(on_open_attachment);
|
||||
main_window.message_viewer.save_attachments.connect(on_save_attachments);
|
||||
main_window.conversation_viewer.link_selected.connect(on_link_selected);
|
||||
main_window.conversation_viewer.reply_to_message.connect(on_reply_to_message);
|
||||
main_window.conversation_viewer.reply_all_message.connect(on_reply_all_message);
|
||||
main_window.conversation_viewer.forward_message.connect(on_forward_message);
|
||||
main_window.conversation_viewer.mark_message.connect(on_conversation_viewer_mark_message);
|
||||
main_window.conversation_viewer.open_attachment.connect(on_open_attachment);
|
||||
main_window.conversation_viewer.save_attachments.connect(on_save_attachments);
|
||||
|
||||
main_window.message_list_view.grab_focus();
|
||||
main_window.conversation_list_view.grab_focus();
|
||||
|
||||
set_busy(false);
|
||||
|
||||
|
|
@ -258,7 +258,7 @@ public class GearyController {
|
|||
account.folders_added_removed.disconnect(on_folders_added_removed);
|
||||
|
||||
main_window.title = GearyApplication.NAME;
|
||||
main_window.message_list_store.account_owner_email = null;
|
||||
main_window.conversation_list_store.account_owner_email = null;
|
||||
main_window.folder_list.remove_all_branches();
|
||||
|
||||
if (inbox_folder != null) {
|
||||
|
|
@ -296,7 +296,7 @@ public class GearyController {
|
|||
|
||||
if (account.settings.service_provider == Geary.ServiceProvider.YAHOO)
|
||||
main_window.title = GearyApplication.NAME + "!";
|
||||
main_window.message_list_store.account_owner_email = account.settings.email.address;
|
||||
main_window.conversation_list_store.account_owner_email = account.settings.email.address;
|
||||
|
||||
main_window.folder_list.set_user_folders_root_name(_("Labels"));
|
||||
load_folders.begin(cancellable_folder);
|
||||
|
|
@ -369,7 +369,7 @@ public class GearyController {
|
|||
debug("switching to %s", folder.to_string());
|
||||
|
||||
current_folder = folder;
|
||||
main_window.message_list_store.set_current_folder(current_folder, cancellable_folder);
|
||||
main_window.conversation_list_store.set_current_folder(current_folder, cancellable_folder);
|
||||
|
||||
// The current folder may be null if the user rapidly switches between folders. If they have
|
||||
// done that then this folder selection is invalid anyways, so just return.
|
||||
|
|
@ -381,7 +381,7 @@ public class GearyController {
|
|||
update_ui();
|
||||
|
||||
current_conversations = new Geary.ConversationMonitor(current_folder, false,
|
||||
MessageListStore.REQUIRED_FIELDS);
|
||||
ConversationListStore.REQUIRED_FIELDS);
|
||||
|
||||
current_conversations.scan_started.connect(on_scan_started);
|
||||
current_conversations.scan_error.connect(on_scan_error);
|
||||
|
|
@ -390,8 +390,8 @@ public class GearyController {
|
|||
current_conversations.conversation_trimmed.connect(on_conversation_trimmed);
|
||||
current_conversations.email_flags_changed.connect(on_email_flags_changed);
|
||||
|
||||
main_window.message_list_store.set_conversation_monitor(current_conversations);
|
||||
main_window.message_list_view.set_conversation_monitor(current_conversations);
|
||||
main_window.conversation_list_store.set_conversation_monitor(current_conversations);
|
||||
main_window.conversation_list_view.set_conversation_monitor(current_conversations);
|
||||
|
||||
yield current_conversations.start_monitoring_async(FETCH_EMAIL_CHUNK_COUNT, cancellable_folder);
|
||||
}
|
||||
|
|
@ -415,7 +415,7 @@ public class GearyController {
|
|||
main_window.folder_list.select_path(inbox_folder.get_path());
|
||||
Geary.Conversation? conversation = current_conversations.get_conversation_for_email(email.id);
|
||||
if (conversation != null)
|
||||
main_window.message_list_view.select_conversation(conversation);
|
||||
main_window.conversation_list_view.select_conversation(conversation);
|
||||
}
|
||||
|
||||
private void on_indicator_activated_application(uint32 timestamp) {
|
||||
|
|
@ -448,12 +448,12 @@ public class GearyController {
|
|||
|
||||
private void on_conversation_trimmed(Geary.Conversation conversation, Geary.Email email) {
|
||||
if (is_viewed_conversation(conversation))
|
||||
main_window.message_viewer.remove_message(email);
|
||||
main_window.conversation_viewer.remove_message(email);
|
||||
}
|
||||
|
||||
private void on_load_more() {
|
||||
debug("on_load_more");
|
||||
Geary.EmailIdentifier? low_id = main_window.message_list_store.get_lowest_email_id();
|
||||
Geary.EmailIdentifier? low_id = main_window.conversation_list_store.get_lowest_email_id();
|
||||
if (low_id == null)
|
||||
return;
|
||||
|
||||
|
|
@ -474,7 +474,7 @@ public class GearyController {
|
|||
}
|
||||
|
||||
private void on_email_flags_changed(Geary.Conversation conversation, Geary.Email email) {
|
||||
main_window.message_viewer.update_flags(email);
|
||||
main_window.conversation_viewer.update_flags(email);
|
||||
}
|
||||
|
||||
private void on_select_folder_completed(Object? source, AsyncResult result) {
|
||||
|
|
@ -500,7 +500,7 @@ public class GearyController {
|
|||
do_show_message.begin(conversation.get_emails(Geary.Conversation.Ordering.DATE_ASCENDING),
|
||||
cancellable_message, true, on_show_message_completed);
|
||||
} else if (current_folder != null) {
|
||||
main_window.message_viewer.show_multiple_selected(selected.size);
|
||||
main_window.conversation_viewer.show_multiple_selected(selected.size);
|
||||
if (selected.size > 1) {
|
||||
enable_multiple_message_buttons();
|
||||
} else {
|
||||
|
|
@ -515,9 +515,9 @@ public class GearyController {
|
|||
|
||||
// Clear view before we yield, to make sure it happens
|
||||
if (clear_view) {
|
||||
main_window.message_viewer.clear(current_folder, account.settings);
|
||||
main_window.message_viewer.scroll_reset();
|
||||
main_window.message_viewer.external_images_info_bar.hide();
|
||||
main_window.conversation_viewer.clear(current_folder, account.settings);
|
||||
main_window.conversation_viewer.scroll_reset();
|
||||
main_window.conversation_viewer.external_images_info_bar.hide();
|
||||
}
|
||||
|
||||
// Fetch full messages.
|
||||
|
|
@ -525,7 +525,7 @@ public class GearyController {
|
|||
Gee.Collection<Geary.Email> messages_to_add = new Gee.HashSet<Geary.Email>();
|
||||
foreach (Geary.Email email in messages) {
|
||||
Geary.Email full_email = yield current_folder.fetch_email_async(email.id,
|
||||
MessageViewer.REQUIRED_FIELDS | Geary.ComposedEmail.REQUIRED_REPLY_FIELDS,
|
||||
ConversationViewer.REQUIRED_FIELDS | Geary.ComposedEmail.REQUIRED_REPLY_FIELDS,
|
||||
Geary.Folder.ListFlags.NONE, cancellable);
|
||||
|
||||
if (cancellable.is_cancelled())
|
||||
|
|
@ -537,11 +537,11 @@ public class GearyController {
|
|||
unread_ids.add(full_email.id);
|
||||
}
|
||||
|
||||
// Add messages. message_viewer.add_message only adds new messages
|
||||
// Add messages. conversation_viewer.add_message only adds new messages
|
||||
foreach (Geary.Email email in messages_to_add)
|
||||
main_window.message_viewer.add_message(email);
|
||||
main_window.conversation_viewer.add_message(email);
|
||||
|
||||
main_window.message_viewer.unhide_last_email();
|
||||
main_window.conversation_viewer.unhide_last_email();
|
||||
|
||||
// Mark as read.
|
||||
yield mark_as_read_async(unread_ids, cancellable);
|
||||
|
|
@ -815,7 +815,7 @@ public class GearyController {
|
|||
}
|
||||
}
|
||||
|
||||
private void on_message_viewer_mark_message(Geary.Email message, Geary.EmailFlags? flags_to_add,
|
||||
private void on_conversation_viewer_mark_message(Geary.Email message, Geary.EmailFlags? flags_to_add,
|
||||
Geary.EmailFlags? flags_to_remove) {
|
||||
Geary.FolderSupportsMark? supports_mark = current_folder as Geary.FolderSupportsMark;
|
||||
if (supports_mark == null)
|
||||
|
|
@ -1057,7 +1057,7 @@ public class GearyController {
|
|||
}
|
||||
|
||||
private void on_reply_to_message_action() {
|
||||
Geary.Email? message = main_window.message_viewer.get_last_message();
|
||||
Geary.Email? message = main_window.conversation_viewer.get_last_message();
|
||||
if (message != null)
|
||||
on_reply_to_message(message);
|
||||
}
|
||||
|
|
@ -1068,7 +1068,7 @@ public class GearyController {
|
|||
}
|
||||
|
||||
private void on_reply_all_message_action() {
|
||||
Geary.Email? message = main_window.message_viewer.get_last_message();
|
||||
Geary.Email? message = main_window.conversation_viewer.get_last_message();
|
||||
if (message != null)
|
||||
on_reply_all_message(message);
|
||||
}
|
||||
|
|
@ -1079,7 +1079,7 @@ public class GearyController {
|
|||
}
|
||||
|
||||
private void on_forward_message_action() {
|
||||
Geary.Email? message = main_window.message_viewer.get_last_message();
|
||||
Geary.Email? message = main_window.conversation_viewer.get_last_message();
|
||||
if (message != null)
|
||||
on_forward_message(message);
|
||||
}
|
||||
|
|
@ -1097,7 +1097,7 @@ public class GearyController {
|
|||
? Geary.Collection.get_first<Geary.Conversation>(selected_conversations) : null;
|
||||
|
||||
// If the user clicked the toolbar button, we want to move focus back to the message list.
|
||||
main_window.message_list_view.grab_focus();
|
||||
main_window.conversation_list_view.grab_focus();
|
||||
set_busy(true);
|
||||
|
||||
// Collect all the emails into one pool and then delete.
|
||||
|
|
@ -1144,15 +1144,15 @@ public class GearyController {
|
|||
}
|
||||
|
||||
private void on_zoom_in() {
|
||||
main_window.message_viewer.web_view.zoom_in();
|
||||
main_window.conversation_viewer.web_view.zoom_in();
|
||||
}
|
||||
|
||||
private void on_zoom_out() {
|
||||
main_window.message_viewer.web_view.zoom_out();
|
||||
main_window.conversation_viewer.web_view.zoom_out();
|
||||
}
|
||||
|
||||
private void on_zoom_normal() {
|
||||
main_window.message_viewer.web_view.zoom_level = 1.0f;
|
||||
main_window.conversation_viewer.web_view.zoom_level = 1.0f;
|
||||
}
|
||||
|
||||
private Geary.RFC822.MailboxAddress get_sender() {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
public class MessageListStore : Gtk.ListStore {
|
||||
public class ConversationListStore : Gtk.ListStore {
|
||||
public const Geary.Email.Field REQUIRED_FIELDS =
|
||||
Geary.Email.Field.ENVELOPE | Geary.Email.Field.FLAGS;
|
||||
|
||||
|
|
@ -12,21 +12,21 @@ public class MessageListStore : Gtk.ListStore {
|
|||
Geary.Email.Field.ENVELOPE | Geary.Email.Field.FLAGS | Geary.Email.Field.PREVIEW;
|
||||
|
||||
public enum Column {
|
||||
MESSAGE_DATA,
|
||||
MESSAGE_OBJECT;
|
||||
CONVERSATION_DATA,
|
||||
CONVERSATION_OBJECT;
|
||||
|
||||
public static Type[] get_types() {
|
||||
return {
|
||||
typeof (FormattedMessageData), // MESSAGE_DATA
|
||||
typeof (Geary.Conversation) // MESSAGE_OBJECT
|
||||
typeof (FormattedConversationData), // CONVERSATION_DATA
|
||||
typeof (Geary.Conversation) // CONVERSATION_OBJECT
|
||||
};
|
||||
}
|
||||
|
||||
public string to_string() {
|
||||
switch (this) {
|
||||
case MESSAGE_DATA:
|
||||
case CONVERSATION_DATA:
|
||||
return "data";
|
||||
case MESSAGE_OBJECT:
|
||||
case CONVERSATION_OBJECT:
|
||||
return "envelope";
|
||||
|
||||
default:
|
||||
|
|
@ -47,7 +47,7 @@ public class MessageListStore : Gtk.ListStore {
|
|||
|
||||
public signal void conversations_added_finished();
|
||||
|
||||
public MessageListStore() {
|
||||
public ConversationListStore() {
|
||||
set_column_types(Column.get_types());
|
||||
set_default_sort_func(sort_by_date);
|
||||
set_sort_column_id(Gtk.SortColumn.DEFAULT, Gtk.SortType.DESCENDING);
|
||||
|
|
@ -139,7 +139,7 @@ public class MessageListStore : Gtk.ListStore {
|
|||
Gee.List<Geary.Email>? emails = null;
|
||||
try {
|
||||
emails = yield current_folder.list_email_by_sparse_id_async(emails_needing_previews,
|
||||
MessageListStore.WITH_PREVIEW_FIELDS, flags, cancellable_folder);
|
||||
ConversationListStore.WITH_PREVIEW_FIELDS, flags, cancellable_folder);
|
||||
} catch (Error err) {
|
||||
// Ignore NOT_FOUND, as that's entirely possible when waiting for the remote to open
|
||||
if (!(err is Geary.EngineError.NOT_FOUND))
|
||||
|
|
@ -174,7 +174,7 @@ public class MessageListStore : Gtk.ListStore {
|
|||
// if all preview fields present and it's the same email, don't need to refresh
|
||||
if (need_preview == null || (current_preview != null &&
|
||||
need_preview.id.equals(current_preview.id) &&
|
||||
current_preview.fields.is_all_set(MessageListStore.WITH_PREVIEW_FIELDS))) {
|
||||
current_preview.fields.is_all_set(ConversationListStore.WITH_PREVIEW_FIELDS))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -191,7 +191,7 @@ public class MessageListStore : Gtk.ListStore {
|
|||
return null;
|
||||
}
|
||||
|
||||
FormattedMessageData? message_data = get_message_data_at_iter(iter);
|
||||
FormattedConversationData? message_data = get_message_data_at_iter(iter);
|
||||
return message_data == null ? null : message_data.preview;
|
||||
}
|
||||
|
||||
|
|
@ -204,11 +204,11 @@ public class MessageListStore : Gtk.ListStore {
|
|||
}
|
||||
|
||||
private void set_row(Gtk.TreeIter iter, Geary.Conversation conversation, Geary.Email preview) {
|
||||
FormattedMessageData message_data = new FormattedMessageData(conversation, preview,
|
||||
current_folder, account_owner_email);
|
||||
FormattedConversationData conversation_data = new FormattedConversationData(conversation,
|
||||
preview, current_folder, account_owner_email);
|
||||
set(iter,
|
||||
Column.MESSAGE_DATA, message_data,
|
||||
Column.MESSAGE_OBJECT, conversation);
|
||||
Column.CONVERSATION_DATA, conversation_data,
|
||||
Column.CONVERSATION_OBJECT, conversation);
|
||||
}
|
||||
|
||||
private void refresh_conversation(Geary.Conversation conversation) {
|
||||
|
|
@ -225,7 +225,7 @@ public class MessageListStore : Gtk.ListStore {
|
|||
return;
|
||||
}
|
||||
|
||||
FormattedMessageData? existing_message_data = get_message_data_at_iter(iter);
|
||||
FormattedConversationData? existing_message_data = get_message_data_at_iter(iter);
|
||||
|
||||
if (existing_message_data == null || !existing_message_data.preview.id.equals(last_email.id))
|
||||
set_row(iter, conversation, last_email);
|
||||
|
|
@ -239,7 +239,7 @@ public class MessageListStore : Gtk.ListStore {
|
|||
return;
|
||||
}
|
||||
|
||||
FormattedMessageData? existing_message_data = get_message_data_at_iter(iter);
|
||||
FormattedConversationData? existing_message_data = get_message_data_at_iter(iter);
|
||||
if (existing_message_data == null)
|
||||
return;
|
||||
|
||||
|
|
@ -269,14 +269,14 @@ public class MessageListStore : Gtk.ListStore {
|
|||
|
||||
private Geary.Conversation? get_conversation_at_iter(Gtk.TreeIter iter) {
|
||||
Geary.Conversation? conversation;
|
||||
get(iter, Column.MESSAGE_OBJECT, out conversation);
|
||||
get(iter, Column.CONVERSATION_OBJECT, out conversation);
|
||||
|
||||
return conversation;
|
||||
}
|
||||
|
||||
private FormattedMessageData? get_message_data_at_iter(Gtk.TreeIter iter) {
|
||||
FormattedMessageData? message_data;
|
||||
get(iter, Column.MESSAGE_DATA, out message_data);
|
||||
private FormattedConversationData? get_message_data_at_iter(Gtk.TreeIter iter) {
|
||||
FormattedConversationData? message_data;
|
||||
get(iter, Column.CONVERSATION_DATA, out message_data);
|
||||
|
||||
return message_data;
|
||||
}
|
||||
|
|
@ -358,8 +358,8 @@ public class MessageListStore : Gtk.ListStore {
|
|||
private int sort_by_date(Gtk.TreeModel model, Gtk.TreeIter aiter, Gtk.TreeIter biter) {
|
||||
Geary.Conversation a, b;
|
||||
|
||||
get(aiter, Column.MESSAGE_OBJECT, out a);
|
||||
get(biter, Column.MESSAGE_OBJECT, out b);
|
||||
get(aiter, Column.CONVERSATION_OBJECT, out a);
|
||||
get(biter, Column.CONVERSATION_OBJECT, out b);
|
||||
|
||||
return compare_conversation_ascending(a, b);
|
||||
}
|
||||
|
|
@ -9,23 +9,23 @@ public class MainWindow : Gtk.Window {
|
|||
private const int FOLDER_LIST_WIDTH = 100;
|
||||
|
||||
public FolderList folder_list { get; private set; default = new FolderList(); }
|
||||
public MessageListStore message_list_store { get; private set; default = new MessageListStore(); }
|
||||
public ConversationListStore conversation_list_store { get; private set; default = new ConversationListStore(); }
|
||||
public MainToolbar main_toolbar { get; private set; }
|
||||
public MessageListView message_list_view { get; private set; }
|
||||
public MessageViewer message_viewer { get; private set; default = new MessageViewer(); }
|
||||
public ConversationListView conversation_list_view { get; private set; }
|
||||
public ConversationViewer conversation_viewer { get; private set; default = new ConversationViewer(); }
|
||||
|
||||
private int window_width;
|
||||
private int window_height;
|
||||
private bool window_maximized;
|
||||
private Gtk.Paned folder_paned = new Gtk.Paned(Gtk.Orientation.HORIZONTAL);
|
||||
private Gtk.Paned messages_paned = new Gtk.Paned(Gtk.Orientation.HORIZONTAL);
|
||||
private Gtk.Paned conversations_paned = new Gtk.Paned(Gtk.Orientation.HORIZONTAL);
|
||||
private Gtk.Spinner spinner = new Gtk.Spinner();
|
||||
private bool is_shown = false;
|
||||
|
||||
public MainWindow() {
|
||||
title = GearyApplication.NAME;
|
||||
|
||||
message_list_view = new MessageListView(message_list_store);
|
||||
conversation_list_view = new ConversationListView(conversation_list_store);
|
||||
|
||||
add_accel_group(GearyApplication.instance.ui_manager.get_accel_group());
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ public class MainWindow : Gtk.Window {
|
|||
maximize();
|
||||
|
||||
folder_paned.set_position(GearyApplication.instance.config.folder_list_pane_position);
|
||||
messages_paned.set_position(GearyApplication.instance.config.messages_pane_position);
|
||||
conversations_paned.set_position(GearyApplication.instance.config.messages_pane_position);
|
||||
|
||||
base.show_all();
|
||||
is_shown = true;
|
||||
|
|
@ -60,7 +60,7 @@ public class MainWindow : Gtk.Window {
|
|||
|
||||
// Save pane positions.
|
||||
GearyApplication.instance.config.folder_list_pane_position = folder_paned.get_position();
|
||||
GearyApplication.instance.config.messages_pane_position = messages_paned.get_position();
|
||||
GearyApplication.instance.config.messages_pane_position = conversations_paned.get_position();
|
||||
}
|
||||
|
||||
base.destroy();
|
||||
|
|
@ -106,10 +106,10 @@ public class MainWindow : Gtk.Window {
|
|||
folder_list_scrolled.add(folder_list);
|
||||
|
||||
// message list
|
||||
Gtk.ScrolledWindow message_list_scrolled = new Gtk.ScrolledWindow(null, null);
|
||||
message_list_scrolled.set_size_request(MESSAGE_LIST_WIDTH, -1);
|
||||
message_list_scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
|
||||
message_list_scrolled.add(message_list_view);
|
||||
Gtk.ScrolledWindow conversation_list_scrolled = new Gtk.ScrolledWindow(null, null);
|
||||
conversation_list_scrolled.set_size_request(MESSAGE_LIST_WIDTH, -1);
|
||||
conversation_list_scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
|
||||
conversation_list_scrolled.add(conversation_list_view);
|
||||
|
||||
// Three-pane display.
|
||||
Gtk.Box status_bar_box = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
|
||||
|
|
@ -120,12 +120,12 @@ public class MainWindow : Gtk.Window {
|
|||
get_style_context().add_class("sidebar-pane-separator");
|
||||
|
||||
// Message list left of message viewer.
|
||||
messages_paned.pack1(message_list_scrolled, false, false);
|
||||
messages_paned.pack2(message_viewer.content_area, true, true);
|
||||
conversations_paned.pack1(conversation_list_scrolled, false, false);
|
||||
conversations_paned.pack2(conversation_viewer.content_area, true, true);
|
||||
|
||||
// Folder list to the left of everything.
|
||||
folder_paned.pack1(status_bar_box, false, false);
|
||||
folder_paned.pack2(messages_paned, true, false);
|
||||
folder_paned.pack2(conversations_paned, true, false);
|
||||
|
||||
main_layout.pack_end(folder_paned, true, true, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
public class MessageListCellRenderer : Gtk.CellRenderer {
|
||||
private static FormattedMessageData? example_data = null;
|
||||
public class ConversationListCellRenderer : Gtk.CellRenderer {
|
||||
private static FormattedConversationData? example_data = null;
|
||||
|
||||
// Mail message data.
|
||||
public FormattedMessageData data { get; set; }
|
||||
public FormattedConversationData data { get; set; }
|
||||
|
||||
public MessageListCellRenderer() {
|
||||
public ConversationListCellRenderer() {
|
||||
}
|
||||
|
||||
public override void get_size(Gtk.Widget widget, Gdk.Rectangle? cell_area, out int x_offset,
|
||||
|
|
@ -33,7 +33,7 @@ public class MessageListCellRenderer : Gtk.CellRenderer {
|
|||
// Note: this must be called by the parent TreeView.
|
||||
public static void style_changed(Gtk.Widget widget) {
|
||||
if (example_data == null) {
|
||||
example_data = new FormattedMessageData.create_example();
|
||||
example_data = new FormattedConversationData.create_example();
|
||||
}
|
||||
|
||||
example_data.calculate_sizes(widget);
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
public class MessageListView : Gtk.TreeView {
|
||||
public class ConversationListView : Gtk.TreeView {
|
||||
const int LOAD_MORE_HEIGHT = 100;
|
||||
|
||||
private bool enable_load_more = true;
|
||||
|
|
@ -14,6 +14,8 @@ public class MessageListView : Gtk.TreeView {
|
|||
private double last_upper = -1.0;
|
||||
private bool reset_adjustment = false;
|
||||
private Gee.Set<Geary.Conversation> selected = new Gee.HashSet<Geary.Conversation>();
|
||||
private ConversationListStore conversation_list_store;
|
||||
private Geary.ConversationMonitor? conversation_monitor;
|
||||
|
||||
public signal void conversations_selected(Gee.Set<Geary.Conversation> selected);
|
||||
|
||||
|
|
@ -24,19 +26,17 @@ public class MessageListView : Gtk.TreeView {
|
|||
public signal void mark_conversation(Geary.Conversation conversation,
|
||||
Geary.EmailFlags? flags_to_add, Geary.EmailFlags? flags_to_remove, bool only_mark_preview);
|
||||
|
||||
private MessageListStore message_list_store;
|
||||
private Geary.ConversationMonitor? conversation_monitor;
|
||||
|
||||
public MessageListView(MessageListStore message_list_store) {
|
||||
this.message_list_store = message_list_store;
|
||||
set_model(message_list_store);
|
||||
public ConversationListView(ConversationListStore conversation_list_store) {
|
||||
this.conversation_list_store = conversation_list_store;
|
||||
set_model(conversation_list_store);
|
||||
|
||||
set_show_expanders(false);
|
||||
set_headers_visible(false);
|
||||
enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
|
||||
|
||||
append_column(create_column(MessageListStore.Column.MESSAGE_DATA, new MessageListCellRenderer(),
|
||||
MessageListStore.Column.MESSAGE_DATA.to_string(), 0));
|
||||
append_column(create_column(ConversationListStore.Column.CONVERSATION_DATA,
|
||||
new ConversationListCellRenderer(), ConversationListStore.Column.CONVERSATION_DATA.to_string(),
|
||||
0));
|
||||
|
||||
Gtk.TreeSelection selection = get_selection();
|
||||
selection.changed.connect(on_selection_changed);
|
||||
|
|
@ -45,8 +45,8 @@ public class MessageListView : Gtk.TreeView {
|
|||
show.connect(on_show);
|
||||
|
||||
get_model().row_deleted.connect(on_row_deleted);
|
||||
message_list_store.conversations_added_began.connect(on_conversations_added_began);
|
||||
message_list_store.conversations_added_finished.connect(on_conversations_added_finished);
|
||||
conversation_list_store.conversations_added_began.connect(on_conversations_added_began);
|
||||
conversation_list_store.conversations_added_finished.connect(on_conversations_added_finished);
|
||||
button_press_event.connect(on_button_press);
|
||||
|
||||
// Set up drag and drop.
|
||||
|
|
@ -132,7 +132,7 @@ public class MessageListView : Gtk.TreeView {
|
|||
(event.state & Gdk.ModifierType.CONTROL_MASK) == 0 &&
|
||||
event.type == Gdk.EventType.BUTTON_PRESS && cell_x < 25 && cell_y < 25) {
|
||||
|
||||
Geary.Conversation conversation = message_list_store.get_conversation_at_path(path);
|
||||
Geary.Conversation conversation = conversation_list_store.get_conversation_at_path(path);
|
||||
Geary.EmailFlags flags = new Geary.EmailFlags();
|
||||
flags.add(Geary.EmailFlags.FLAGGED);
|
||||
if (conversation.is_flagged()) {
|
||||
|
|
@ -147,7 +147,7 @@ public class MessageListView : Gtk.TreeView {
|
|||
|
||||
private void on_style_changed() {
|
||||
// Recalculate dimensions of child cells.
|
||||
MessageListCellRenderer.style_changed(this);
|
||||
ConversationListCellRenderer.style_changed(this);
|
||||
}
|
||||
|
||||
private void on_show() {
|
||||
|
|
@ -170,7 +170,7 @@ public class MessageListView : Gtk.TreeView {
|
|||
}
|
||||
}
|
||||
|
||||
private static Gtk.TreeViewColumn create_column(MessageListStore.Column column,
|
||||
private static Gtk.TreeViewColumn create_column(ConversationListStore.Column column,
|
||||
Gtk.CellRenderer renderer, string attr, int width = 0) {
|
||||
Gtk.TreeViewColumn view_column = new Gtk.TreeViewColumn.with_attributes(column.to_string(),
|
||||
renderer, attr, column);
|
||||
|
|
@ -210,7 +210,7 @@ public class MessageListView : Gtk.TreeView {
|
|||
// Conversations are selected, so collect them and signal if different
|
||||
Gee.HashSet<Geary.Conversation> new_selected = new Gee.HashSet<Geary.Conversation>();
|
||||
foreach (Gtk.TreePath path in paths) {
|
||||
Geary.Conversation? conversation = message_list_store.get_conversation_at_path(path);
|
||||
Geary.Conversation? conversation = conversation_list_store.get_conversation_at_path(path);
|
||||
if (conversation != null)
|
||||
new_selected.add(conversation);
|
||||
}
|
||||
|
|
@ -230,7 +230,7 @@ public class MessageListView : Gtk.TreeView {
|
|||
}
|
||||
|
||||
public void select_conversation(Geary.Conversation conversation) {
|
||||
Gtk.TreePath path = message_list_store.get_path_for_conversation(conversation);
|
||||
Gtk.TreePath path = conversation_list_store.get_path_for_conversation(conversation);
|
||||
if (path != null)
|
||||
set_cursor(path, null, false);
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
public class MessageViewer : Object {
|
||||
public class ConversationViewer : Object {
|
||||
public const Geary.Email.Field REQUIRED_FIELDS =
|
||||
Geary.Email.Field.HEADER
|
||||
| Geary.Email.Field.BODY
|
||||
|
|
@ -81,7 +81,7 @@ public class MessageViewer : Object {
|
|||
private Geary.AccountSettings? current_settings = null;
|
||||
private bool load_external_images = false;
|
||||
|
||||
public MessageViewer() {
|
||||
public ConversationViewer() {
|
||||
Gtk.Box box = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
|
||||
|
||||
external_images_info_bar = new Gtk.InfoBar.with_buttons(
|
||||
|
|
@ -98,7 +98,7 @@ public class MessageViewer : Object {
|
|||
}
|
||||
box.pack_start(external_images_info_bar, false, false);
|
||||
|
||||
web_view = new MessageWebView();
|
||||
web_view = new ConversationWebView();
|
||||
|
||||
web_view.valign = Gtk.Align.START;
|
||||
web_view.vexpand = true;
|
||||
|
|
@ -121,12 +121,12 @@ public class MessageViewer : Object {
|
|||
string html_text = GearyApplication.instance.read_theme_file("message-viewer.html") ?? "";
|
||||
web_view.load_string(html_text, "text/html", "UTF8", "");
|
||||
|
||||
Gtk.ScrolledWindow message_viewer_scrolled = new Gtk.ScrolledWindow(null, null);
|
||||
message_viewer_scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
|
||||
message_viewer_scrolled.add(web_view);
|
||||
Gtk.ScrolledWindow conversation_viewer_scrolled = new Gtk.ScrolledWindow(null, null);
|
||||
conversation_viewer_scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
|
||||
conversation_viewer_scrolled.add(web_view);
|
||||
|
||||
Gtk.Overlay message_overlay = new Gtk.Overlay();
|
||||
message_overlay.add(message_viewer_scrolled);
|
||||
message_overlay.add(conversation_viewer_scrolled);
|
||||
|
||||
message_overlay_label = new Gtk.Label(null);
|
||||
message_overlay_label.ellipsize = Pango.EllipsizeMode.MIDDLE;
|
||||
|
|
@ -680,10 +680,10 @@ public class MessageViewer : Object {
|
|||
}
|
||||
|
||||
private static void on_context_menu(WebKit.DOM.Element clicked_element, WebKit.DOM.Event event,
|
||||
MessageViewer message_viewer) {
|
||||
Geary.Email email = message_viewer.get_email_from_element(clicked_element);
|
||||
ConversationViewer conversation_viewer) {
|
||||
Geary.Email email = conversation_viewer.get_email_from_element(clicked_element);
|
||||
if (email != null)
|
||||
message_viewer.show_context_menu(email);
|
||||
conversation_viewer.show_context_menu(email);
|
||||
}
|
||||
|
||||
private void show_context_menu(Geary.Email email) {
|
||||
|
|
@ -748,32 +748,32 @@ public class MessageViewer : Object {
|
|||
}
|
||||
|
||||
private static void on_menu_clicked(WebKit.DOM.Element element, WebKit.DOM.Event event,
|
||||
MessageViewer message_viewer) {
|
||||
ConversationViewer conversation_viewer) {
|
||||
event.stop_propagation();
|
||||
Geary.Email email = message_viewer.get_email_from_element(element);
|
||||
Geary.Email email = conversation_viewer.get_email_from_element(element);
|
||||
if (email != null)
|
||||
message_viewer.show_message_menu(email);
|
||||
conversation_viewer.show_message_menu(email);
|
||||
}
|
||||
|
||||
private static void on_unstar_clicked(WebKit.DOM.Element element, WebKit.DOM.Event event,
|
||||
MessageViewer message_viewer) {
|
||||
ConversationViewer conversation_viewer) {
|
||||
event.stop_propagation();
|
||||
Geary.Email? email = message_viewer.get_email_from_element(element);
|
||||
Geary.Email? email = conversation_viewer.get_email_from_element(element);
|
||||
if (email != null)
|
||||
message_viewer.unflag_message(email);
|
||||
conversation_viewer.unflag_message(email);
|
||||
}
|
||||
|
||||
private static void on_star_clicked(WebKit.DOM.Element element, WebKit.DOM.Event event,
|
||||
MessageViewer message_viewer) {
|
||||
ConversationViewer conversation_viewer) {
|
||||
event.stop_propagation();
|
||||
Geary.Email? email = message_viewer.get_email_from_element(element);
|
||||
Geary.Email? email = conversation_viewer.get_email_from_element(element);
|
||||
if (email != null)
|
||||
message_viewer.flag_message(email);
|
||||
conversation_viewer.flag_message(email);
|
||||
}
|
||||
|
||||
private static void on_value_clicked(WebKit.DOM.Element element, WebKit.DOM.Event event,
|
||||
MessageViewer message_viewer) {
|
||||
if (!message_viewer.is_hidden_email(element))
|
||||
ConversationViewer conversation_viewer) {
|
||||
if (!conversation_viewer.is_hidden_email(element))
|
||||
event.stop_propagation(); // Don't allow toggle
|
||||
}
|
||||
|
||||
|
|
@ -792,8 +792,8 @@ public class MessageViewer : Object {
|
|||
}
|
||||
|
||||
private static void on_body_toggle_clicked(WebKit.DOM.Element element, WebKit.DOM.Event event,
|
||||
MessageViewer message_viewer) {
|
||||
message_viewer.on_body_toggle_clicked_self(element);
|
||||
ConversationViewer conversation_viewer) {
|
||||
conversation_viewer.on_body_toggle_clicked_self(element);
|
||||
}
|
||||
|
||||
private void on_body_toggle_clicked_self(WebKit.DOM.Element element) {
|
||||
|
|
@ -813,8 +813,8 @@ public class MessageViewer : Object {
|
|||
}
|
||||
|
||||
private static void on_attachment_clicked(WebKit.DOM.Element element, WebKit.DOM.Event event,
|
||||
MessageViewer message_viewer) {
|
||||
message_viewer.on_attachment_clicked_self(element);
|
||||
ConversationViewer conversation_viewer) {
|
||||
conversation_viewer.on_attachment_clicked_self(element);
|
||||
}
|
||||
|
||||
private void on_attachment_clicked_self(WebKit.DOM.Element element) {
|
||||
|
|
@ -835,12 +835,12 @@ public class MessageViewer : Object {
|
|||
}
|
||||
|
||||
private static void on_attachment_menu(WebKit.DOM.Element element, WebKit.DOM.Event event,
|
||||
MessageViewer message_viewer) {
|
||||
ConversationViewer conversation_viewer) {
|
||||
event.stop_propagation();
|
||||
Geary.Email? email = message_viewer.get_email_from_element(element);
|
||||
Geary.Attachment? attachment = message_viewer.get_attachment_from_element(element);
|
||||
Geary.Email? email = conversation_viewer.get_email_from_element(element);
|
||||
Geary.Attachment? attachment = conversation_viewer.get_attachment_from_element(element);
|
||||
if (email != null && attachment != null)
|
||||
message_viewer.show_attachment_menu(email, attachment);
|
||||
conversation_viewer.show_attachment_menu(email, attachment);
|
||||
}
|
||||
|
||||
private void on_message_menu_selection_done() {
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
public class MessageWebView : WebKit.WebView {
|
||||
public class ConversationWebView : WebKit.WebView {
|
||||
private int width = 0;
|
||||
private int height = 0;
|
||||
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
// Stores formatted data for a message.
|
||||
public class FormattedMessageData : Object {
|
||||
public class FormattedConversationData : Object {
|
||||
private const string STYLE_EXAMPLE = "Gg"; // Use both upper and lower case to get max height.
|
||||
private const int LINE_SPACING = 4;
|
||||
private const int TEXT_LEFT = LINE_SPACING * 2 + IconFactory.UNREAD_ICON_SIZE;
|
||||
|
|
@ -28,9 +28,9 @@ public class FormattedMessageData : Object {
|
|||
public Geary.Email? preview { get; private set; default = null; }
|
||||
|
||||
// Creates a formatted message data from an e-mail.
|
||||
public FormattedMessageData(Geary.Conversation conversation, Geary.Email preview,
|
||||
public FormattedConversationData(Geary.Conversation conversation, Geary.Email preview,
|
||||
Geary.Folder folder, string account_owner_email) {
|
||||
assert(preview.fields.fulfills(MessageListStore.REQUIRED_FIELDS));
|
||||
assert(preview.fields.fulfills(ConversationListStore.REQUIRED_FIELDS));
|
||||
|
||||
// Load preview-related data.
|
||||
this.date = (preview.date != null)
|
||||
|
|
@ -48,7 +48,7 @@ public class FormattedMessageData : Object {
|
|||
}
|
||||
|
||||
// Creates an example message (used interally for styling calculations.)
|
||||
public FormattedMessageData.create_example() {
|
||||
public FormattedConversationData.create_example() {
|
||||
this.is_unread = false;
|
||||
this.is_flagged = false;
|
||||
this.date = STYLE_EXAMPLE;
|
||||
|
|
@ -173,8 +173,8 @@ public class FormattedMessageData : Object {
|
|||
}
|
||||
|
||||
if (recalc_dims) {
|
||||
FormattedMessageData.preview_height = preview_height;
|
||||
FormattedMessageData.cell_height = y + preview_height;
|
||||
FormattedConversationData.preview_height = preview_height;
|
||||
FormattedConversationData.cell_height = y + preview_height;
|
||||
} else {
|
||||
// Flagged indicator.
|
||||
if (is_flagged) {
|
||||
Loading…
Add table
Add a link
Reference in a new issue