Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions po/POTFILES
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ src/Dialogs/AliasDialog/Alias.vala
src/Dialogs/AliasDialog/AliasDialog.vala
src/Dialogs/SignatureDialog/Signature.vala
src/Dialogs/SignatureDialog/SignatureDialog.vala
src/FolderList/AccountItemModel.vala
src/FolderList/FolderItemModel.vala
src/FolderList/FolderList.vala
src/FolderList/GroupedFolderItemModel.vala
src/FolderList/SessionItemModel.vala
src/FoldersView/AccountSavedState.vala
src/FoldersView/AccountSourceItem.vala
src/FoldersView/FoldersListView.vala
src/FoldersView/FolderSourceItem.vala
src/FoldersView/GroupedFolderSourceItem.vala
src/FoldersView/SessionSourceItem.vala
src/MessageList/MessageList.vala
src/MessageList/MessageListItem.vala
src/MessageList/AttachmentButton.vala
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@
* Authored by: Corentin Noël <corentin@elementary.io>
*/

public class Mail.AccountSourceItem : Mail.SourceList.ExpandableItem, Mail.SourceListSortable {
public class Mail.AccountItemModel : Mail.SourceList.ExpandableItem, Mail.SourceListSortable {
public Mail.Backend.Account account { get; construct; }

public signal void loaded ();
public signal void start_edit (Mail.SourceList.Item item);

private GLib.Cancellable connect_cancellable;
private Gee.HashMap<string, FolderSourceItem> folder_items;
private Gee.HashMap<string, FolderItemModel> folder_items;
private AccountSavedState saved_state;
private unowned Camel.OfflineStore offlinestore;

public AccountSourceItem (Mail.Backend.Account account) {
public AccountItemModel (Mail.Backend.Account account) {
Object (account: account);
}

construct {
visible = true;
connect_cancellable = new GLib.Cancellable ();
folder_items = new Gee.HashMap<string, FolderSourceItem> ();
folder_items = new Gee.HashMap<string, FolderItemModel> ();
saved_state = new AccountSavedState (account);
saved_state.bind_with_expandable_item (this);

Expand All @@ -50,7 +50,7 @@ public class Mail.AccountSourceItem : Mail.SourceList.ExpandableItem, Mail.Sourc
offlinestore.folder_renamed.connect (folder_renamed);
}

~AccountSourceItem () {
~AccountItemModel () {
connect_cancellable.cancel ();
}

Expand All @@ -66,14 +66,14 @@ public class Mail.AccountSourceItem : Mail.SourceList.ExpandableItem, Mail.Sourc
}

private void folder_renamed (string old_name, Camel.FolderInfo folder_info) {
FolderSourceItem item;
FolderItemModel item;
folder_items.unset (old_name, out item);
item.update_infos (folder_info);
folder_items[item.full_name] = item;
}

private void folder_deleted (Camel.FolderInfo folder_info) {
Mail.FolderSourceItem? item = folder_items[folder_info.full_name];
Mail.FolderItemModel? item = folder_items[folder_info.full_name];
if (item != null) {
item.parent.remove (item);
folder_items.unset (folder_info.full_name);
Expand Down Expand Up @@ -114,7 +114,7 @@ public class Mail.AccountSourceItem : Mail.SourceList.ExpandableItem, Mail.Sourc
private void show_info (Camel.FolderInfo? _folderinfo, Mail.SourceList.ExpandableItem item) {
var folderinfo = _folderinfo;
while (folderinfo != null) {
var folder_item = new FolderSourceItem (account, folderinfo);
var folder_item = new FolderItemModel (account, folderinfo);
saved_state.bind_with_expandable_item (folder_item);
folder_items[folderinfo.full_name] = folder_item;
folder_item.start_edit.connect (() => start_edit (folder_item));
Expand All @@ -134,9 +134,9 @@ public class Mail.AccountSourceItem : Mail.SourceList.ExpandableItem, Mail.Sourc
}

public int compare (Mail.SourceList.Item a, Mail.SourceList.Item b) {
if (a is Mail.FolderSourceItem && b is Mail.FolderSourceItem) {
var folder_a = (Mail.FolderSourceItem) a;
var folder_b = (Mail.FolderSourceItem) b;
if (a is Mail.FolderItemModel && b is Mail.FolderItemModel) {
var folder_a = (Mail.FolderItemModel) a;
var folder_b = (Mail.FolderItemModel) b;

return folder_a.pos - folder_b.pos;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Authored by: Corentin Noël <corentin@elementary.io>
*/

public class Mail.FolderSourceItem : Mail.SourceList.ExpandableItem {
public class Mail.FolderItemModel : Mail.SourceList.ExpandableItem {
public signal void start_edit ();

public Camel.FolderInfo folder_info { get; private set; }
Expand All @@ -33,7 +33,7 @@ public class Mail.FolderSourceItem : Mail.SourceList.ExpandableItem {
private Cancellable cancellable;
private string old_name;

public FolderSourceItem (Backend.Account account, Camel.FolderInfo folderinfo) {
public FolderItemModel (Backend.Account account, Camel.FolderInfo folderinfo) {
Object (account: account);
update_infos (folderinfo);
}
Expand All @@ -42,7 +42,7 @@ public class Mail.FolderSourceItem : Mail.SourceList.ExpandableItem {
cancellable = new GLib.Cancellable ();
}

~FolderSourceItem () {
~FolderItemModel () {
cancellable.cancel ();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
* Authored by: Corentin Noël <corentin@elementary.io>
*/

public class Mail.FoldersListView : Gtk.Grid {
public class Mail.FolderList : Gtk.Grid {
public signal void folder_selected (Gee.Map<Backend.Account, Camel.FolderInfo?> folder_info_per_account);

public Hdy.HeaderBar header_bar { get; private set; }

private Mail.SourceList source_list;
private Mail.SessionSourceItem session_source_item;
private Mail.SessionItemModel session_source_item;
private static GLib.Settings settings;

static construct {
Expand Down Expand Up @@ -105,7 +105,7 @@ public class Mail.FoldersListView : Gtk.Grid {

var session = Mail.Backend.Session.get_default ();

session_source_item = new Mail.SessionSourceItem (session);
session_source_item = new Mail.SessionItemModel (session);
source_list.root.add (session_source_item);

session.get_accounts ().foreach ((account) => {
Expand All @@ -119,16 +119,16 @@ public class Mail.FoldersListView : Gtk.Grid {
return;
}

if (item is FolderSourceItem) {
unowned FolderSourceItem folder_item = (FolderSourceItem) item;
if (item is FolderItemModel) {
unowned FolderItemModel folder_item = (FolderItemModel) item;
var folder_info_per_account = new Gee.HashMap<Mail.Backend.Account, Camel.FolderInfo?> ();
folder_info_per_account.set (folder_item.account, folder_item.folder_info);
folder_selected (folder_info_per_account.read_only_view);

settings.set ("selected-folder", "(ss)", folder_item.account.service.uid, folder_item.full_name);

} else if (item is GroupedFolderSourceItem) {
unowned GroupedFolderSourceItem grouped_folder_item = (GroupedFolderSourceItem) item;
} else if (item is GroupedFolderItemModel) {
unowned GroupedFolderItemModel grouped_folder_item = (GroupedFolderItemModel) item;
folder_selected (grouped_folder_item.get_folder_info_per_account ());

settings.set ("selected-folder", "(ss)", "GROUPED", grouped_folder_item.name);
Expand Down Expand Up @@ -158,7 +158,7 @@ public class Mail.FoldersListView : Gtk.Grid {
}

private void add_account (Mail.Backend.Account account) {
var account_item = new Mail.AccountSourceItem (account);
var account_item = new Mail.AccountItemModel (account);
account_item.start_edit.connect ((item) => source_list.start_editing_item (item));
source_list.root.add (account_item);
account_item.load.begin ((obj, res) => {
Expand All @@ -177,12 +177,12 @@ public class Mail.FoldersListView : Gtk.Grid {

private bool select_saved_folder (Mail.SourceList.ExpandableItem item, string selected_folder_name) {
foreach (var child in item.children) {
if (child is FolderSourceItem) {
if (child is FolderItemModel) {
if (select_saved_folder ((Mail.SourceList.ExpandableItem) child, selected_folder_name)) {
return true;
}

unowned FolderSourceItem folder_item = (FolderSourceItem) child;
unowned FolderItemModel folder_item = (FolderItemModel) child;
if (folder_item.full_name == selected_folder_name) {
source_list.selected = child;

Expand All @@ -191,8 +191,8 @@ public class Mail.FoldersListView : Gtk.Grid {
folder_selected (folder_info_per_account.read_only_view);
return true;
}
} else if (child is GroupedFolderSourceItem) {
unowned GroupedFolderSourceItem grouped_folder_item = (GroupedFolderSourceItem) child;
} else if (child is GroupedFolderItemModel) {
unowned GroupedFolderItemModel grouped_folder_item = (GroupedFolderItemModel) child;
if (grouped_folder_item.name == selected_folder_name) {
source_list.selected = child;
folder_selected (grouped_folder_item.get_folder_info_per_account ());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
* Boston, MA 02110-1301 USA
*/

public class Mail.GroupedFolderSourceItem : Mail.SourceList.Item {
public class Mail.GroupedFolderItemModel : Mail.SourceList.Item {
public Mail.Backend.Session session { get; construct; }
public Camel.FolderInfoFlags folder_type { get; construct; }

private GLib.Cancellable connect_cancellable;
private Gee.HashMap<Backend.Account, Camel.FolderInfo?> account_folderinfo;

public GroupedFolderSourceItem (Mail.Backend.Session session, Camel.FolderInfoFlags folder_type) {
public GroupedFolderItemModel (Mail.Backend.Session session, Camel.FolderInfoFlags folder_type) {
Object (session: session, folder_type: folder_type);
}

Expand Down Expand Up @@ -62,7 +62,7 @@ public class Mail.GroupedFolderSourceItem : Mail.SourceList.Item {
session.account_removed.connect (removed_account);
}

~GroupedFolderSourceItem () {
~GroupedFolderItemModel () {
connect_cancellable.cancel ();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
* Boston, MA 02110-1301 USA
*/

public class Mail.SessionSourceItem : Mail.SourceList.ExpandableItem {
public class Mail.SessionItemModel : Mail.SourceList.ExpandableItem {
public Mail.Backend.Session session { get; construct; }

public SessionSourceItem (Mail.Backend.Session session) {
public SessionItemModel (Mail.Backend.Session session) {
Object (session: session);
}

Expand All @@ -30,9 +30,9 @@
expanded = true;
collapsible = false;

add (new GroupedFolderSourceItem (session, Camel.FolderInfoFlags.TYPE_INBOX));
add (new GroupedFolderSourceItem (session, Camel.FolderInfoFlags.TYPE_ARCHIVE));
add (new GroupedFolderSourceItem (session, Camel.FolderInfoFlags.TYPE_SENT));
add (new GroupedFolderItemModel (session, Camel.FolderInfoFlags.TYPE_INBOX));
add (new GroupedFolderItemModel (session, Camel.FolderInfoFlags.TYPE_ARCHIVE));
add (new GroupedFolderItemModel (session, Camel.FolderInfoFlags.TYPE_SENT));

session.account_added.connect (added_account);
session.account_removed.connect (removed_account);
Expand Down
10 changes: 5 additions & 5 deletions src/FoldersView/AccountSavedState.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ public class Mail.AccountSavedState : GLib.Object {
public unowned Mail.Backend.Account account { get; construct; }

private GLib.Settings settings;
private Gee.HashMap<string, FolderSourceItem> items;
private Gee.HashMap<string, FolderItemModel> items;

public AccountSavedState (Mail.Backend.Account account) {
Object (account: account);
}

construct {
settings = new GLib.Settings.with_path ("io.elementary.mail.accounts", "/io/elementary/mail/accounts/%s/".printf (account.service.uid));
items = new Gee.HashMap<string, FolderSourceItem> ();
items = new Gee.HashMap<string, FolderItemModel> ();
}

public void bind_with_expandable_item (Mail.SourceList.ExpandableItem item) {
if (item is AccountSourceItem) {
if (item is AccountItemModel) {
settings.bind ("expanded", item, "expanded", SettingsBindFlags.DEFAULT | SettingsBindFlags.GET_NO_CHANGES);
} else if (item is FolderSourceItem) {
var folder_item = (FolderSourceItem) item;
} else if (item is FolderItemModel) {
var folder_item = (FolderItemModel) item;
items[folder_item.full_name] = folder_item;
if (folder_item.full_name in settings.get_strv ("expanded-folders")) {
item.expanded = true;
Expand Down
4 changes: 2 additions & 2 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Mail.MainWindow : Hdy.ApplicationWindow {
private Gtk.Paned paned_end;
private Gtk.Paned paned_start;

private FoldersListView folders_list_view;
private FolderList folders_list_view;
private Granite.Widgets.Toast move_toast;
private Granite.Widgets.Toast error_toast;
private ConversationList conversation_list;
Expand Down Expand Up @@ -108,7 +108,7 @@ public class Mail.MainWindow : Hdy.ApplicationWindow {
);
}

folders_list_view = new FoldersListView ();
folders_list_view = new FolderList ();
conversation_list = new ConversationList ();

message_list = new MessageList ();
Expand Down
10 changes: 5 additions & 5 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ vala_files = files(
'Dialogs/AliasDialog/AliasDialog.vala',
'Dialogs/SignatureDialog/Signature.vala',
'Dialogs/SignatureDialog/SignatureDialog.vala',
'FolderList' / 'AccountItemModel.vala',
'FolderList' / 'FolderItemModel.vala',
'FolderList' / 'FolderList.vala',
'FolderList' / 'GroupedFolderItemModel.vala',
'FolderList' / 'SessionItemModel.vala',
'FoldersView/AccountSavedState.vala',
'FoldersView/AccountSourceItem.vala',
'FoldersView/FoldersListView.vala',
'FoldersView/FolderSourceItem.vala',
'FoldersView/GroupedFolderSourceItem.vala',
'FoldersView/SessionSourceItem.vala',
'MessageList/AttachmentButton.vala',
'MessageList/FolderPopover/FolderPopover.vala',
'MessageList/FolderPopover/FolderRow.vala',
Expand Down
Loading