[geary/mjog/special-type-cleanup: 4/6] Rename other uses of spam in the codebase to junk



commit ec382470fd225d2daa0559daadc5a3e721385a30
Author: Michael Gratton <mike vee net>
Date:   Fri Mar 27 18:20:38 2020 +1100

    Rename other uses of spam in the codebase to junk

 src/client/accounts/accounts-manager.vala           | 17 ++++++++++++-----
 src/client/application/application-main-window.vala | 12 ++++++------
 src/engine/api/geary-account-information.vala       | 14 +++++++-------
 ui/main-toolbar-menus.ui                            |  6 ++----
 4 files changed, 27 insertions(+), 22 deletions(-)
---
diff --git a/src/client/accounts/accounts-manager.vala b/src/client/accounts/accounts-manager.vala
index b7b49c23..ab2e390e 100644
--- a/src/client/accounts/accounts-manager.vala
+++ b/src/client/accounts/accounts-manager.vala
@@ -1022,6 +1022,7 @@ public class Accounts.AccountConfigV1 : AccountConfig, GLib.Object {
 
     private const string FOLDER_ARCHIVE = "archive_folder";
     private const string FOLDER_DRAFTS = "drafts_folder";
+    private const string FOLDER_JUNK = "junk_folder";
     private const string FOLDER_SENT = "sent_folder";
     private const string FOLDER_SPAM = "spam_folder";
     private const string FOLDER_TRASH = "trash_folder";
@@ -1110,7 +1111,13 @@ public class Accounts.AccountConfigV1 : AccountConfig, GLib.Object {
         account.archive_folder_path = load_folder(folder_config, FOLDER_ARCHIVE);
         account.drafts_folder_path = load_folder(folder_config, FOLDER_DRAFTS);
         account.sent_folder_path = load_folder(folder_config, FOLDER_SENT);
-        account.spam_folder_path = load_folder(folder_config, FOLDER_SPAM);
+        // v3.32-3.36 used spam instead of junk
+        if (folder_config.has_key(FOLDER_SPAM)) {
+            account.junk_folder_path = load_folder(folder_config, FOLDER_SPAM);
+        }
+        if (folder_config.has_key(FOLDER_JUNK)) {
+            account.junk_folder_path = load_folder(folder_config, FOLDER_JUNK);
+        }
         account.trash_folder_path = load_folder(folder_config, FOLDER_TRASH);
 
         return account;
@@ -1146,7 +1153,7 @@ public class Accounts.AccountConfigV1 : AccountConfig, GLib.Object {
         save_folder(folder_config, FOLDER_ARCHIVE, account.archive_folder_path);
         save_folder(folder_config, FOLDER_DRAFTS, account.drafts_folder_path);
         save_folder(folder_config, FOLDER_SENT, account.sent_folder_path);
-        save_folder(folder_config, FOLDER_SPAM, account.spam_folder_path);
+        save_folder(folder_config, FOLDER_JUNK, account.junk_folder_path);
         save_folder(folder_config, FOLDER_TRASH, account.trash_folder_path);
     }
 
@@ -1273,7 +1280,7 @@ public class Accounts.AccountConfigLegacy : AccountConfig, GLib.Object {
         info.sent_folder_path = Geary.AccountInformation.build_folder_path(
             config.get_string_list(SENT_MAIL_FOLDER_KEY)
         );
-        info.spam_folder_path = Geary.AccountInformation.build_folder_path(
+        info.junk_folder_path = Geary.AccountInformation.build_folder_path(
             config.get_string_list(SPAM_FOLDER_KEY)
         );
         info.trash_folder_path = Geary.AccountInformation.build_folder_path(
@@ -1330,8 +1337,8 @@ public class Accounts.AccountConfigLegacy : AccountConfig, GLib.Object {
         );
         config.set_string_list(
             SPAM_FOLDER_KEY,
-            (info.spam_folder_path != null
-             ? new Gee.ArrayList<string>.wrap(info.spam_folder_path.as_array())
+            (info.junk_folder_path != null
+             ? new Gee.ArrayList<string>.wrap(info.junk_folder_path.as_array())
              : empty)
         );
         config.set_string_list(
diff --git a/src/client/application/application-main-window.vala 
b/src/client/application/application-main-window.vala
index 7f149719..5d774105 100644
--- a/src/client/application/application-main-window.vala
+++ b/src/client/application/application-main-window.vala
@@ -28,7 +28,7 @@ public class Application.MainWindow :
     public const string ACTION_SHOW_COPY_MENU = "show-copy-menu";
     public const string ACTION_SHOW_MARK_MENU = "show-mark-menu";
     public const string ACTION_SHOW_MOVE_MENU = "show-move-menu";
-    public const string ACTION_TOGGLE_SPAM = "toggle-conversation-spam";
+    public const string ACTION_TOGGLE_JUNK = "toggle-conversation-junk";
     public const string ACTION_TRASH_CONVERSATION = "trash-conversation";
     public const string ACTION_ZOOM = "zoom";
 
@@ -59,7 +59,7 @@ public class Application.MainWindow :
         { ACTION_MARK_AS_UNREAD, on_mark_as_unread },
         { ACTION_MARK_AS_STARRED, on_mark_as_starred },
         { ACTION_MARK_AS_UNSTARRED, on_mark_as_unstarred },
-        { ACTION_TOGGLE_SPAM, on_mark_as_spam_toggle },
+        { ACTION_TOGGLE_JUNK, on_mark_as_junk_toggle },
         // Message viewer
         { ACTION_ZOOM, on_zoom, "s" },
     };
@@ -406,7 +406,7 @@ public class Application.MainWindow :
     /** Keybinding signal for junking the current selection. */
     [Signal (action=true)]
     public virtual signal void junk_conversations() {
-        activate_action(get_window_action(ACTION_TOGGLE_SPAM));
+        activate_action(get_window_action(ACTION_TOGGLE_JUNK));
     }
 
     /** Keybinding signal for trashing the current selection. */
@@ -2237,8 +2237,8 @@ public class Application.MainWindow :
         get_window_action(ACTION_MARK_AS_UNSTARRED).set_enabled(starred_selected);
 
         // If we're in Drafts/Outbox, we also shouldn't set a message as junk
-        bool in_spam_folder = (selected_folder.special_folder_type == JUNK);
-        get_window_action(ACTION_TOGGLE_SPAM).set_enabled(!in_spam_folder &&
+        bool in_junk_folder = (selected_folder.special_folder_type == JUNK);
+        get_window_action(ACTION_TOGGLE_JUNK).set_enabled(!in_junk_folder &&
             selected_folder.special_folder_type != Geary.SpecialFolderType.DRAFTS &&
             selected_folder.special_folder_type != Geary.SpecialFolderType.OUTBOX);
     }
@@ -2339,7 +2339,7 @@ public class Application.MainWindow :
         }
     }
 
-    private void on_mark_as_spam_toggle() {
+    private void on_mark_as_junk_toggle() {
         Geary.Folder? source = this.selected_folder;
         if (source != null) {
             Geary.SpecialFolderType destination =
diff --git a/src/engine/api/geary-account-information.vala b/src/engine/api/geary-account-information.vala
index c13f9de8..91c3da80 100644
--- a/src/engine/api/geary-account-information.vala
+++ b/src/engine/api/geary-account-information.vala
@@ -180,8 +180,8 @@ public class Geary.AccountInformation : BaseObject {
     /** Sent special folder path. */
     public Geary.FolderPath? sent_folder_path { get; set; default = null; }
 
-    /** Spam special folder path. */
-    public Geary.FolderPath? spam_folder_path { get; set; default = null; }
+    /** Junk special folder path. */
+    public Geary.FolderPath? junk_folder_path { get; set; default = null; }
 
     /** Trash special folder path. */
     public Geary.FolderPath? trash_folder_path { get; set; default = null; }
@@ -289,7 +289,7 @@ public class Geary.AccountInformation : BaseObject {
 
         this.drafts_folder_path = other.drafts_folder_path;
         this.sent_folder_path = other.sent_folder_path;
-        this.spam_folder_path = other.spam_folder_path;
+        this.junk_folder_path = other.junk_folder_path;
         this.trash_folder_path = other.trash_folder_path;
         this.archive_folder_path = other.archive_folder_path;
 
@@ -387,7 +387,7 @@ public class Geary.AccountInformation : BaseObject {
                 return this.sent_folder_path;
 
             case Geary.SpecialFolderType.JUNK:
-                return this.spam_folder_path;
+                return this.junk_folder_path;
 
             case Geary.SpecialFolderType.TRASH:
                 return this.trash_folder_path;
@@ -422,8 +422,8 @@ public class Geary.AccountInformation : BaseObject {
             break;
 
             case Geary.SpecialFolderType.JUNK:
-                old_path = this.spam_folder_path;
-                this.spam_folder_path = new_path;
+                old_path = this.junk_folder_path;
+                this.junk_folder_path = new_path;
             break;
 
             case Geary.SpecialFolderType.TRASH:
@@ -541,7 +541,7 @@ public class Geary.AccountInformation : BaseObject {
                 this.outgoing.equal_to(other.outgoing) &&
                 this.drafts_folder_path == other.drafts_folder_path &&
                 this.sent_folder_path == other.sent_folder_path &&
-                this.spam_folder_path == other.spam_folder_path &&
+                this.junk_folder_path == other.junk_folder_path &&
                 this.trash_folder_path == other.trash_folder_path &&
                 this.archive_folder_path == other.archive_folder_path &&
                 this.config_dir == other.config_dir &&
diff --git a/ui/main-toolbar-menus.ui b/ui/main-toolbar-menus.ui
index a5ed964c..ebbc72f0 100644
--- a/ui/main-toolbar-menus.ui
+++ b/ui/main-toolbar-menus.ui
@@ -18,8 +18,8 @@
       <attribute name="action">win.mark-conversation-unstarred</attribute>
     </item>
     <item>
-      <attribute name="label" translatable="yes">Toggle as S_pam</attribute>
-      <attribute name="action">win.toggle-conversation-spam</attribute>
+      <attribute name="label" translatable="yes">Toggle as _Junk</attribute>
+      <attribute name="action">win.toggle-conversation-junk</attribute>
     </item>
   </menu>
   <menu id="main_menu">
@@ -48,7 +48,5 @@
         <attribute name="action">app.about</attribute>
       </item>
     </section>
-
   </menu>
 </interface>
-


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]