[geary/mjog/invert-folder-class-hierarchy: 327/362] Geary.ImapDb.Folder: Make path and properties actual GObject properties
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/invert-folder-class-hierarchy: 327/362] Geary.ImapDb.Folder: Make path and properties actual GObject properties
- Date: Wed, 24 Feb 2021 11:54:50 +0000 (UTC)
commit b218735a7108b0b07cd1a79f8adf41daa9d94912
Author: Michael Gratton <mike vee net>
Date: Sat Feb 13 17:32:46 2021 +1100
Geary.ImapDb.Folder: Make path and properties actual GObject properties
src/engine/imap-db/imap-db-account.vala | 9 +++++----
src/engine/imap-db/imap-db-folder.vala | 18 ++++--------------
.../imap-engine/gmail/imap-engine-gmail-account.vala | 4 ++--
.../imap-engine/imap-engine-generic-account.vala | 13 ++++++-------
src/engine/imap-engine/imap-engine-minimal-folder.vala | 6 +++---
.../imap-engine/other/imap-engine-other-account.vala | 4 ++--
.../outlook/imap-engine-outlook-account.vala | 4 ++--
.../imap-engine/yahoo/imap-engine-yahoo-account.vala | 4 ++--
test/engine/imap-db/imap-db-account-test.vala | 14 +++++++-------
test/engine/imap-db/imap-db-folder-test.vala | 6 +++---
10 files changed, 36 insertions(+), 46 deletions(-)
---
diff --git a/src/engine/imap-db/imap-db-account.vala b/src/engine/imap-db/imap-db-account.vala
index 577787f0b..abc975d8d 100644
--- a/src/engine/imap-db/imap-db-account.vala
+++ b/src/engine/imap-db/imap-db-account.vala
@@ -450,7 +450,7 @@ private class Geary.ImapDB.Account : BaseObject {
// return current if already created
ImapDB.Folder? folder = get_local_folder(path);
if (folder != null) {
- folder.set_properties(properties);
+ folder.properties = properties;
} else {
folder = new Geary.ImapDB.Folder(
db,
@@ -1124,7 +1124,7 @@ private class Geary.ImapDB.Account : BaseObject {
continue;
// Remove the folder that triggered this event.
- paths.remove(source.get_path());
+ paths.remove(source.path);
if (paths.size == 0)
continue;
@@ -1153,8 +1153,9 @@ private class Geary.ImapDB.Account : BaseObject {
if (folder == null)
continue;
- folder.get_properties().set_status_unseen(folder.get_properties().email_unread +
- unread_change.get(path));
+ folder.properties.set_status_unseen(
+ folder.properties.email_unread + unread_change.get(path)
+ );
}
}
diff --git a/src/engine/imap-db/imap-db-folder.vala b/src/engine/imap-db/imap-db-folder.vala
index 43eed2631..695f3a70b 100644
--- a/src/engine/imap-db/imap-db-folder.vala
+++ b/src/engine/imap-db/imap-db-folder.vala
@@ -91,14 +91,16 @@ private class Geary.ImapDB.Folder : BaseObject, Geary.ReferenceSemantics {
}
}
+ internal Geary.Folder.Path path { get; private set; }
+
+ internal Geary.Imap.FolderProperties properties { get; set; }
+
protected int manual_ref_count { get; protected set; }
private Geary.Db.Database db;
- private Geary.Folder.Path path;
private GLib.File attachments_path;
private string account_owner_email;
private int64 folder_id;
- private Geary.Imap.FolderProperties properties;
/**
* Fired after one or more emails have been fetched with all Fields, and
@@ -127,18 +129,6 @@ private class Geary.ImapDB.Folder : BaseObject, Geary.ReferenceSemantics {
this.properties = properties;
}
- public unowned Geary.Folder.Path get_path() {
- return path;
- }
-
- public Geary.Imap.FolderProperties get_properties() {
- return properties;
- }
-
- internal void set_properties(Geary.Imap.FolderProperties properties) {
- this.properties = properties;
- }
-
public async int get_email_count_async(ListFlags flags, Cancellable? cancellable) throws Error {
int count = 0;
yield db.exec_transaction_async(Db.TransactionType.RO, (cx) => {
diff --git a/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
b/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
index c09986b11..a82000e72 100644
--- a/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
+++ b/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
@@ -50,12 +50,12 @@ private class Geary.ImapEngine.GmailAccount : Geary.ImapEngine.GenericAccount {
}
protected override MinimalFolder new_folder(ImapDB.Folder local_folder) {
- Folder.Path path = local_folder.get_path();
+ Folder.Path path = local_folder.path;
Folder.SpecialUse use = NONE;
if (Imap.MailboxSpecifier.folder_path_is_inbox(path)) {
use = INBOX;
} else {
- use = local_folder.get_properties().attrs.get_special_use();
+ use = local_folder.properties.attrs.get_special_use();
// There can be only one Inbox
if (use == INBOX) {
use = NONE;
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala
b/src/engine/imap-engine/imap-engine-generic-account.vala
index 0a2eff987..a34d5c2e8 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -686,7 +686,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
Account.folder_path_comparator
);
foreach(ImapDB.Folder db_folder in db_folders) {
- Folder.Path path = db_folder.get_path();
+ Folder.Path path = db_folder.path;
if (!this.remote_folders.has_key(path)) {
MinimalFolder folder = new_folder(db_folder);
if (folder.used_as == NONE) {
@@ -1135,9 +1135,7 @@ internal class Geary.ImapEngine.LoadFolders : AccountOperation {
if (children != null) {
foreach (ImapDB.Folder child in children) {
this.folders.add(child);
- yield enumerate_local_folders_async(
- child.get_path(), cancellable
- );
+ yield enumerate_local_folders_async(child.path, cancellable);
}
}
}
@@ -1309,8 +1307,9 @@ internal class Geary.ImapEngine.UpdateRemoteFolders : AccountOperation {
if (remote_folder.properties.is_openable.is_possible()) {
ImapDB.Folder local_folder = minimal_folder.local_folder;
- if (remote_folder.properties.have_contents_changed(local_folder.get_properties(),
- minimal_folder.to_string())) {
+ if (remote_folder.properties.have_contents_changed(
+ local_folder.properties,
+ minimal_folder.to_string())) {
altered_paths.add(remote_folder.path);
}
}
@@ -1479,7 +1478,7 @@ internal class Geary.ImapEngine.RefreshFolderUnseen : FolderOperation {
ImapDB.Folder local_folder = folder.local_folder;
if (remote_folder.properties.have_contents_changed(
- local_folder.get_properties(),
+ local_folder.properties,
this.folder.to_string())) {
yield local_folder.update_folder_status(
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index 446ee162f..303dcd4a5 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -51,7 +51,7 @@ private class Geary.ImapEngine.MinimalFolder : BaseObject,
/** {@inheritDoc} */
public Folder.Path path {
get {
- return local_folder.get_path();
+ return local_folder.path;
}
}
@@ -125,7 +125,7 @@ private class Geary.ImapEngine.MinimalFolder : BaseObject,
this.local_folder.email_complete.connect(on_email_complete);
this._used_as = use;
- this._properties = local_folder.get_properties();
+ this._properties = local_folder.properties;
this.replay_queue = new ReplayQueue(this);
this.replay_queue.remotely_executed.connect(this.on_remote_status_check);
@@ -403,7 +403,7 @@ private class Geary.ImapEngine.MinimalFolder : BaseObject,
throws GLib.Error {
debug("Begin normalizing remote and local folders");
- Geary.Imap.FolderProperties local_properties = this.local_folder.get_properties();
+ Geary.Imap.FolderProperties local_properties = this.local_folder.properties;
Geary.Imap.FolderProperties remote_properties = session.folder.properties;
/*
diff --git a/src/engine/imap-engine/other/imap-engine-other-account.vala
b/src/engine/imap-engine/other/imap-engine-other-account.vala
index 42ff6a1ac..e35a7be8d 100644
--- a/src/engine/imap-engine/other/imap-engine-other-account.vala
+++ b/src/engine/imap-engine/other/imap-engine-other-account.vala
@@ -16,12 +16,12 @@ private class Geary.ImapEngine.OtherAccount : Geary.ImapEngine.GenericAccount {
}
protected override MinimalFolder new_folder(ImapDB.Folder local_folder) {
- Folder.Path path = local_folder.get_path();
+ Folder.Path path = local_folder.path;
Folder.SpecialUse use = NONE;
if (Imap.MailboxSpecifier.folder_path_is_inbox(path)) {
use = INBOX;
} else {
- use = local_folder.get_properties().attrs.get_special_use();
+ use = local_folder.properties.attrs.get_special_use();
// There can be only one Inbox
if (use == INBOX) {
use = NONE;
diff --git a/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
b/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
index e9c3edb56..8fe578c59 100644
--- a/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
+++ b/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
@@ -38,12 +38,12 @@ private class Geary.ImapEngine.OutlookAccount : Geary.ImapEngine.GenericAccount
}
protected override MinimalFolder new_folder(ImapDB.Folder local_folder) {
- Folder.Path path = local_folder.get_path();
+ Folder.Path path = local_folder.path;
Folder.SpecialUse use = NONE;
if (Imap.MailboxSpecifier.folder_path_is_inbox(path)) {
use = INBOX;
} else {
- use = local_folder.get_properties().attrs.get_special_use();
+ use = local_folder.properties.attrs.get_special_use();
// There can be only one Inbox
if (use == INBOX) {
use = NONE;
diff --git a/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
b/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
index bdcf7eeba..a6b9b497b 100644
--- a/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
+++ b/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
@@ -38,7 +38,7 @@ private class Geary.ImapEngine.YahooAccount : Geary.ImapEngine.GenericAccount {
}
protected override MinimalFolder new_folder(ImapDB.Folder local_folder) {
- Folder.Path path = local_folder.get_path();
+ Folder.Path path = local_folder.path;
Folder.SpecialUse use = NONE;
if (Imap.MailboxSpecifier.folder_path_is_inbox(path)) {
use = INBOX;
@@ -47,7 +47,7 @@ private class Geary.ImapEngine.YahooAccount : Geary.ImapEngine.GenericAccount {
// SPECIAL-USE via its CAPABILITIES, it lists the
// appropriate attributes in LIST results anyway, so we
// can just consult that. :|
- use = local_folder.get_properties().attrs.get_special_use();
+ use = local_folder.properties.attrs.get_special_use();
// There can be only one Inbox
if (use == INBOX) {
use = NONE;
diff --git a/test/engine/imap-db/imap-db-account-test.vala b/test/engine/imap-db/imap-db-account-test.vala
index 15613ff68..41b433603 100644
--- a/test/engine/imap-db/imap-db-account-test.vala
+++ b/test/engine/imap-db/imap-db-account-test.vala
@@ -162,10 +162,10 @@ class Geary.ImapDB.AccountTest : TestCase {
Folder test1 = traverse(result).first();
assert_equal<int?>(result.size, 1, "Base folder not listed");
- assert_equal(test1.get_path().name, "test1", "Base folder name");
+ assert_equal(test1.path.name, "test1", "Base folder name");
this.account.list_folders_async.begin(
- test1.get_path(),
+ test1.path,
null,
this.async_completion
);
@@ -173,10 +173,10 @@ class Geary.ImapDB.AccountTest : TestCase {
Folder test2 = traverse(result).first();
assert_equal<int?>(result.size, 1, "Child folder not listed");
- assert_equal(test2.get_path().name, "test2", "Child folder name");
+ assert_equal(test2.path.name, "test2", "Child folder name");
this.account.list_folders_async.begin(
- test2.get_path(),
+ test2.path,
null,
this.async_completion
);
@@ -184,7 +184,7 @@ class Geary.ImapDB.AccountTest : TestCase {
Folder test3 = traverse(result).first();
assert_equal<int?>(result.size, 1, "Grandchild folder not listed");
- assert_equal(test3.get_path().name, "test3", "Grandchild folder name");
+ assert_equal(test3.path.name, "test3", "Grandchild folder name");
}
public void delete_folder() throws GLib.Error {
@@ -268,7 +268,7 @@ class Geary.ImapDB.AccountTest : TestCase {
Folder? result = this.account.fetch_folder_async.end(async_result());
assert_non_null(result);
- assert_equal(result.get_path().name, "test1");
+ assert_equal(result.path.name, "test1");
}
public void fetch_child_folder() throws GLib.Error {
@@ -287,7 +287,7 @@ class Geary.ImapDB.AccountTest : TestCase {
Folder? result = this.account.fetch_folder_async.end(async_result());
assert_non_null(result);
- assert_equal(result.get_path().name, "test2");
+ assert_equal(result.path.name, "test2");
}
public void fetch_nonexistent_folder() throws GLib.Error {
diff --git a/test/engine/imap-db/imap-db-folder-test.vala b/test/engine/imap-db/imap-db-folder-test.vala
index bce1fb43c..a05a233df 100644
--- a/test/engine/imap-db/imap-db-folder-test.vala
+++ b/test/engine/imap-db/imap-db-folder-test.vala
@@ -95,7 +95,7 @@ class Geary.ImapDB.FolderTest : TestCase {
assert_equal<int?>(results.size, 1);
assert_true(results.get(mock));
- assert_equal(this.folder.get_properties().email_unread, 0);
+ assert_equal(this.folder.properties.email_unread, 0);
}
public void create_unread_email() throws GLib.Error {
@@ -115,7 +115,7 @@ class Geary.ImapDB.FolderTest : TestCase {
assert_equal<int?>(results.size, 1);
assert_true(results.get(mock));
- assert_equal<int?>(this.folder.get_properties().email_unread, 1);
+ assert_equal<int?>(this.folder.properties.email_unread, 1);
}
public void create_no_unread_update() throws GLib.Error {
@@ -135,7 +135,7 @@ class Geary.ImapDB.FolderTest : TestCase {
assert_equal<int?>(results.size, 1);
assert_true(results.get(mock));
- assert_equal<int?>(this.folder.get_properties().email_unread, 0);
+ assert_equal<int?>(this.folder.properties.email_unread, 0);
}
public void merge_email() throws GLib.Error {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]