[geary/mjog/mail-merge-plugin: 72/74] MailMerge: Put non-plugin classes in own namespace, rename source files
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/mail-merge-plugin: 72/74] MailMerge: Put non-plugin classes in own namespace, rename source files
- Date: Fri, 14 Aug 2020 02:09:05 +0000 (UTC)
commit afe53f46a2eda92ea7f9917f15ec6910f5ac1625
Author: Michael Gratton <mike vee net>
Date: Thu Aug 6 12:15:57 2020 +1000
MailMerge: Put non-plugin classes in own namespace, rename source files
Use a new top-level `MailMerge` namespace for non-plugin classes,
rename source files to match.
.../{util-csv.vala => mail-merge-csv.vala} | 4 ++--
.../plugin/mail-merge/mail-merge-folder.vala | 12 ++++++------
.../plugin/mail-merge/mail-merge-processor.vala | 2 +-
.../plugin/mail-merge/mail-merge-test-reader.vala | 10 +++++-----
src/client/plugin/mail-merge/mail-merge-test.vala | 2 +-
src/client/plugin/mail-merge/mail-merge.vala | 22 ++++++++++++++--------
src/client/plugin/mail-merge/meson.build | 2 +-
7 files changed, 30 insertions(+), 24 deletions(-)
---
diff --git a/src/client/plugin/mail-merge/util-csv.vala b/src/client/plugin/mail-merge/mail-merge-csv.vala
similarity index 98%
rename from src/client/plugin/mail-merge/util-csv.vala
rename to src/client/plugin/mail-merge/mail-merge-csv.vala
index 037e10e58..d3bf337bb 100644
--- a/src/client/plugin/mail-merge/util-csv.vala
+++ b/src/client/plugin/mail-merge/mail-merge-csv.vala
@@ -7,7 +7,7 @@
/** Denotes CSV-specific error conditions. */
-public errordomain Plugin.Util.Csv.DataError {
+public errordomain MailMerge.Csv.DataError {
/** The input stream contained non-text data. */
NON_TEXT_DATA,
@@ -26,7 +26,7 @@ public errordomain Plugin.Util.Csv.DataError {
* To use this class, simply construct an instance start calling
* {@link read_record}.
*/
-public class Plugin.Util.Csv.Reader : Geary.BaseObject {
+public class MailMerge.Csv.Reader : Geary.BaseObject {
// UTF byte prefixes indicating multi-byte codepoints
diff --git a/src/client/plugin/mail-merge/mail-merge-folder.vala
b/src/client/plugin/mail-merge/mail-merge-folder.vala
index 6364e4490..8b54b37af 100644
--- a/src/client/plugin/mail-merge/mail-merge-folder.vala
+++ b/src/client/plugin/mail-merge/mail-merge-folder.vala
@@ -8,7 +8,7 @@
/**
* Plugin to Fill in and send email templates using a spreadsheet.
*/
-public class Plugin.MailMergeFolder : Geary.AbstractLocalFolder {
+public class MailMerge.Folder : Geary.AbstractLocalFolder {
private class EmailIdentifier : Geary.EmailIdentifier {
@@ -119,14 +119,14 @@ public class Plugin.MailMergeFolder : Geary.AbstractLocalFolder {
private Gee.List<Geary.Email> list =
new Gee.ArrayList<Geary.Email>();
private Geary.Email template;
- private Util.Csv.Reader data;
+ private Csv.Reader data;
private GLib.Cancellable loading = new GLib.Cancellable();
- public MailMergeFolder(Geary.Account account,
- Geary.FolderRoot root,
- Geary.Email template,
- Util.Csv.Reader data) {
+ public Folder(Geary.Account account,
+ Geary.FolderRoot root,
+ Geary.Email template,
+ Csv.Reader data) {
this._account = account;
this._path = root.get_child("$Plugin.MailMerge$");
this.template = template;
diff --git a/src/client/plugin/mail-merge/mail-merge-processor.vala
b/src/client/plugin/mail-merge/mail-merge-processor.vala
index 2d02f52d1..da0295f97 100644
--- a/src/client/plugin/mail-merge/mail-merge-processor.vala
+++ b/src/client/plugin/mail-merge/mail-merge-processor.vala
@@ -8,7 +8,7 @@
/**
* Substitutes merge fields in an email with actual data.
*/
-public class Plugin.MailMergeProcessor : GLib.Object {
+public class MailMerge.Processor : GLib.Object {
public const Geary.Email.Field REQUIRED_FIELDS =
diff --git a/src/client/plugin/mail-merge/mail-merge-test-reader.vala
b/src/client/plugin/mail-merge/mail-merge-test-reader.vala
index 1d8f8e405..105836187 100644
--- a/src/client/plugin/mail-merge/mail-merge-test-reader.vala
+++ b/src/client/plugin/mail-merge/mail-merge-test-reader.vala
@@ -5,11 +5,11 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
-public class Plugin.MailMergeTestReader : ValaUnit.TestCase {
+public class MailMerge.TestReader : ValaUnit.TestCase {
- public MailMergeTestReader() {
- base("MailMergeTestReader");
+ public TestReader() {
+ base("MailMerge.TestReader");
add_test("read_simple_lf", read_simple_lf);
add_test("read_simple_crlf", read_simple_crlf);
add_test("read_no_trailing_new_line", read_no_trailing_new_line);
@@ -150,9 +150,9 @@ bar",""""""";
assert_array_is_null(eof1);
}
- private async Plugin.Util.Csv.Reader new_reader(uint8[] data)
+ private async MailMerge.Csv.Reader new_reader(uint8[] data)
throws GLib.Error {
- return yield new Plugin.Util.Csv.Reader(
+ return yield new MailMerge.Csv.Reader(
new GLib.MemoryInputStream.from_data(data, null)
);
}
diff --git a/src/client/plugin/mail-merge/mail-merge-test.vala
b/src/client/plugin/mail-merge/mail-merge-test.vala
index ad0348df0..22fab9ee0 100644
--- a/src/client/plugin/mail-merge/mail-merge-test.vala
+++ b/src/client/plugin/mail-merge/mail-merge-test.vala
@@ -17,7 +17,7 @@ int main(string[] args) {
}
GLib.TestSuite root = GLib.TestSuite.get_root();
- root.add_suite(new Plugin.MailMergeTestReader().suite);
+ root.add_suite(new MailMerge.TestReader().suite);
GLib.MainLoop loop = new GLib.MainLoop();
int ret = -1;
diff --git a/src/client/plugin/mail-merge/mail-merge.vala b/src/client/plugin/mail-merge/mail-merge.vala
index 973f417a6..de9317a85 100644
--- a/src/client/plugin/mail-merge/mail-merge.vala
+++ b/src/client/plugin/mail-merge/mail-merge.vala
@@ -65,7 +65,7 @@ public class Plugin.MailMerge :
private FolderStore? folder_store = null;
private EmailStore? email_store = null;
- private MailMergeFolder? merge_folder = null;
+ private global::MailMerge.Folder? merge_folder = null;
private GLib.SimpleAction? edit_action = null;
private GLib.SimpleAction? merge_action = null;
@@ -130,7 +130,9 @@ public class Plugin.MailMerge :
try {
Geary.Email? email = yield load_merge_email(plugin);
if (email != null) {
- is_merge = MailMergeProcessor.is_mail_merge_template(email);
+ is_merge = global::MailMerge.Processor.is_mail_merge_template(
+ email
+ );
}
} catch (GLib.Error err) {
warning("Unable to load merge template: %s", err.message);
@@ -169,7 +171,9 @@ public class Plugin.MailMerge :
GLib.Priority.DEFAULT,
this.cancellable
);
- var csv = yield new Util.Csv.Reader(csv_input, this.cancellable);
+ var csv = yield new global::MailMerge.Csv.Reader(
+ csv_input, this.cancellable
+ );
Gee.Collection<Email> emails = yield this.email_store.get_email(
Geary.Collection.single(id),
@@ -181,7 +185,7 @@ public class Plugin.MailMerge :
);
var email = Geary.Collection.first(emails);
- this.merge_folder = new Plugin.MailMergeFolder(
+ this.merge_folder = new global::MailMerge.Folder(
account_context.account,
account_context.account.local_folder_root,
yield load_merge_email(email),
@@ -298,7 +302,9 @@ public class Plugin.MailMerge :
GLib.Priority.DEFAULT,
this.cancellable
);
- var csv = yield new Util.Csv.Reader(input, this.cancellable);
+ var csv = yield new global::MailMerge.Csv.Reader(
+ input, this.cancellable
+ );
var record = yield csv.read_record();
var text_fields_menu = new GLib.Menu();
@@ -347,19 +353,19 @@ public class Plugin.MailMerge :
}
private void insert_field(Composer composer, string field) {
- composer.insert_text(MailMergeProcessor.to_field(field));
+ composer.insert_text(global::MailMerge.Processor.to_field(field));
}
private async Geary.Email load_merge_email(Email plugin) throws GLib.Error {
Geary.Email? engine = this.client_plugins.to_engine_email(plugin);
if (engine != null &&
- !engine.fields.fulfills(MailMergeProcessor.REQUIRED_FIELDS)) {
+ !engine.fields.fulfills(global::MailMerge.Processor.REQUIRED_FIELDS)) {
var account_context = this.client_plugins.to_client_account(
plugin.identifier.account
);
engine = yield account_context.emails.fetch_email_async(
engine.id,
- MailMergeProcessor.REQUIRED_FIELDS,
+ global::MailMerge.Processor.REQUIRED_FIELDS,
Geary.Folder.ListFlags.LOCAL_ONLY,
this.cancellable
);
diff --git a/src/client/plugin/mail-merge/meson.build b/src/client/plugin/mail-merge/meson.build
index 7f637158e..dcdc67e7f 100644
--- a/src/client/plugin/mail-merge/meson.build
+++ b/src/client/plugin/mail-merge/meson.build
@@ -9,8 +9,8 @@ plugin_dest = plugins_dir / plugin_name
lib_src = files(
'mail-merge-folder.vala',
+ 'mail-merge-csv.vala',
'mail-merge-processor.vala',
- 'util-csv.vala',
)
test_src = files(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]