[geary/mjog/vala-switch-warnings] Fix vala mainline switch statement build warnings




commit 850bb3139f6063f7a03f94cb228546377155bc6e
Author: Michael Gratton <mike vee net>
Date:   Mon Aug 17 10:33:33 2020 +1000

    Fix vala mainline switch statement build warnings

 src/client/accounts/accounts-editor-list-pane.vala | 14 +++++++-
 src/client/accounts/accounts-editor-row.vala       |  6 +++-
 .../accounts/accounts-editor-servers-pane.vala     |  5 +++
 src/client/application/application-controller.vala |  8 +++++
 src/client/components/components-entry-undo.vala   |  6 ++++
 src/client/components/components-validator.vala    |  4 +++
 src/client/composer/composer-headerbar.vala        |  5 +++
 src/client/composer/composer-widget.vala           |  9 +++++
 .../conversation-list/conversation-list-view.vala  |  4 +++
 .../conversation-viewer/conversation-list-box.vala |  6 ++++
 .../plugin/special-folders/special-folders.vala    |  4 +++
 src/client/util/util-date.vala                     | 39 +++++++++++++---------
 src/engine/api/geary-account-information.vala      |  5 +++
 src/engine/api/geary-engine.vala                   |  3 ++
 src/engine/api/geary-service-provider.vala         |  6 ++++
 src/engine/imap-db/imap-db-folder.vala             |  9 +++++
 .../imap-engine/imap-engine-generic-account.vala   |  4 +++
 17 files changed, 120 insertions(+), 17 deletions(-)
---
diff --git a/src/client/accounts/accounts-editor-list-pane.vala 
b/src/client/accounts/accounts-editor-list-pane.vala
index a0a65b52c..824d74c30 100644
--- a/src/client/accounts/accounts-editor-list-pane.vala
+++ b/src/client/accounts/accounts-editor-list-pane.vala
@@ -365,6 +365,10 @@ private class Accounts.AccountListRow : AccountRow<EditorListPane,Gtk.Grid> {
         case Geary.ServiceProvider.YAHOO:
             details = _("Yahoo");
             break;
+
+        case Geary.ServiceProvider.OTHER:
+            // no-op: Use the generated label
+            break;
         }
         this.service_label.set_text(details);
     }
@@ -393,6 +397,10 @@ private class Accounts.AccountListRow : AccountRow<EditorListPane,Gtk.Grid> {
                 _("This account has encountered a problem and is unavailable")
             );
             break;
+
+        case REMOVED:
+            // Nothing to do - account is gone
+            break;
         }
 
         this.unavailable_icon.set_visible(!enabled);
@@ -440,7 +448,7 @@ private class Accounts.AddServiceProviderRow : EditorRow<EditorListPane> {
         this.provider = provider;
 
         // Translators: Label for adding a generic email account
-        string? name = _("Other email providers");
+        string? name = null;
         switch (provider) {
         case Geary.ServiceProvider.GMAIL:
             name = _("Gmail");
@@ -453,6 +461,10 @@ private class Accounts.AddServiceProviderRow : EditorRow<EditorListPane> {
         case Geary.ServiceProvider.YAHOO:
             name = _("Yahoo");
             break;
+
+        case Geary.ServiceProvider.OTHER:
+            name = _("Other email providers");
+            break;
         }
         this.service_name.set_text(name);
         this.service_name.set_hexpand(true);
diff --git a/src/client/accounts/accounts-editor-row.vala b/src/client/accounts/accounts-editor-row.vala
index 1e6ef2a27..cca825acc 100644
--- a/src/client/accounts/accounts-editor-row.vala
+++ b/src/client/accounts/accounts-editor-row.vala
@@ -273,7 +273,7 @@ internal class Accounts.ServiceProviderRow<PaneType> :
 
     public ServiceProviderRow(Geary.ServiceProvider provider,
                               string other_type_label) {
-        string? label = other_type_label;
+        string? label = null;
         switch (provider) {
         case Geary.ServiceProvider.GMAIL:
             label = _("Gmail");
@@ -286,6 +286,10 @@ internal class Accounts.ServiceProviderRow<PaneType> :
         case Geary.ServiceProvider.YAHOO:
             label = _("Yahoo");
             break;
+
+        case Geary.ServiceProvider.OTHER:
+            label = other_type_label;
+            break;
         }
 
         base(
diff --git a/src/client/accounts/accounts-editor-servers-pane.vala 
b/src/client/accounts/accounts-editor-servers-pane.vala
index dcc83f183..3c9a8f1a7 100644
--- a/src/client/accounts/accounts-editor-servers-pane.vala
+++ b/src/client/accounts/accounts-editor-servers-pane.vala
@@ -127,6 +127,11 @@ internal class Accounts.EditorServersPane :
         case OTHER:
             add_row(this.details_list, this.save_sent);
             break;
+        default:
+            // XXX GMail and Outlook auto-save sent mail so don't
+            // include save sent option, but we shouldn't be
+            // hard-coding visible rows like this
+            break;
         }
 
         // Receiving
diff --git a/src/client/application/application-controller.vala 
b/src/client/application/application-controller.vala
index 59bb9d231..3755e3a0a 100644
--- a/src/client/application/application-controller.vala
+++ b/src/client/application/application-controller.vala
@@ -1572,6 +1572,10 @@ internal class Application.Controller :
                 );
             }
             break;
+
+        case Accounts.Manager.Status.REMOVED:
+            // Account is gone, no further action is required
+            break;
         }
     }
 
@@ -1678,6 +1682,10 @@ internal class Application.Controller :
                         context.tls_validation_failed = false;
                     }
                     break;
+
+                default:
+                    // No special action required for other statuses
+                    break;
                 }
 
                 if (do_restart) {
diff --git a/src/client/components/components-entry-undo.vala 
b/src/client/components/components-entry-undo.vala
index 8d11bcda6..53ff181c0 100644
--- a/src/client/components/components-entry-undo.vala
+++ b/src/client/components/components-entry-undo.vala
@@ -56,6 +56,9 @@ public class Components.EntryUndo : Geary.BaseObject {
                 case DELETE:
                     do_insert(manager.target);
                     break;
+                case NONE:
+                    // no-op
+                    break;
                 }
                 manager.events_enabled = true;
             }
@@ -73,6 +76,9 @@ public class Components.EntryUndo : Geary.BaseObject {
                 case DELETE:
                     do_delete(manager.target);
                     break;
+                case NONE:
+                    // no-op
+                    break;
                 }
                 manager.events_enabled = true;
             }
diff --git a/src/client/components/components-validator.vala b/src/client/components/components-validator.vala
index e5bf0bfdb..16f256b58 100644
--- a/src/client/components/components-validator.vala
+++ b/src/client/components/components-validator.vala
@@ -258,6 +258,10 @@ public class Components.Validator : GLib.Object {
             case Trigger.LOST_FOCUS:
                 focus_lost();
                 break;
+
+            case Trigger.MANUAL:
+                // no-op
+                break;
             }
         } else if (!this.pulse_timer.is_running) {
             this.pulse_timer.start();
diff --git a/src/client/composer/composer-headerbar.vala b/src/client/composer/composer-headerbar.vala
index 6fb21386f..1db99efa6 100644
--- a/src/client/composer/composer-headerbar.vala
+++ b/src/client/composer/composer-headerbar.vala
@@ -76,6 +76,11 @@ public class Composer.Headerbar : Gtk.HeaderBar {
             this.recipients_button.visible = true;
             this.set_attached(true);
             break;
+
+        case Widget.PresentationMode.CLOSED:
+        case Widget.PresentationMode.NONE:
+            // no-op
+            break;
         }
 
         this.show_close_button = (mode == Widget.PresentationMode.PANED
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 6a1921a67..f217a4eca 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -879,6 +879,10 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface {
             );
             this.referred_ids.add(full_context.id);
             break;
+
+        case NONE:
+            // no-op
+            break;
         }
         update_extended_headers();
 
@@ -1533,6 +1537,11 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface {
             this.subject_row.visible = false;
             set_compact_header_recipients();
             break;
+
+        case PresentationMode.CLOSED:
+        case PresentationMode.NONE:
+            // no-op
+            break;
         }
 
         update_from_field();
diff --git a/src/client/conversation-list/conversation-list-view.vala 
b/src/client/conversation-list/conversation-list-view.vala
index 89db534e2..a4d5cca6e 100644
--- a/src/client/conversation-list/conversation-list-view.vala
+++ b/src/client/conversation-list/conversation-list-view.vala
@@ -174,6 +174,10 @@ public class ConversationListView : Gtk.TreeView, Geary.BaseInterface {
                     this.get_window().beep();
                 }
                 break;
+
+            default:
+                // no-op
+                break;
             }
 
             set_cursor(target_path, null, false);
diff --git a/src/client/conversation-viewer/conversation-list-box.vala 
b/src/client/conversation-viewer/conversation-list-box.vala
index f8cd1f426..005b8f10c 100644
--- a/src/client/conversation-viewer/conversation-list-box.vala
+++ b/src/client/conversation-viewer/conversation-list-box.vala
@@ -568,6 +568,9 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
                         composer.focus(DOWN);
                         handled = true;
                         break;
+                    default:
+                        // no-op
+                        break;
                     }
                 }
             }
@@ -595,6 +598,9 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
             case Gtk.ScrollType.END:
                 value = adj.get_upper();
                 break;
+            default:
+                // no-op
+                break;
             }
             adj.set_value(value);
             this.mark_read_timer.start();
diff --git a/src/client/plugin/special-folders/special-folders.vala 
b/src/client/plugin/special-folders/special-folders.vala
index aa9e120d6..91262df60 100644
--- a/src/client/plugin/special-folders/special-folders.vala
+++ b/src/client/plugin/special-folders/special-folders.vala
@@ -100,6 +100,10 @@ public class Plugin.SpecialFolders :
                 target, get_folder_info_bar(target), PRIORITY
             );
             break;
+
+        default:
+            // no-op
+            break;
         }
     }
 
diff --git a/src/client/util/util-date.vala b/src/client/util/util-date.vala
index 1abd46aa3..88948916f 100644
--- a/src/client/util/util-date.vala
+++ b/src/client/util/util-date.vala
@@ -209,22 +209,31 @@ public string get_clock_format(ClockFormat clock_format) {
 }
 
 public string get_full_date(ClockFormat clock_format) {
-    switch(clock_format) {
-        case ClockFormat.TWELVE_HOURS:
-            /// 12 hours format for datetime that a message being replied to was received
-            /// See http://developer.gnome.org/glib/2.32/glib-GDateTime.html#g-date-time-format
-            return _("%a, %b %-e, %Y at %l:%M %P");
-        case ClockFormat.TWENTY_FOUR_HOURS:
-            /// 24 hours format for the datetime that a message being replied to was received
-            /// See http://developer.gnome.org/glib/2.32/glib-GDateTime.html#g-date-time-format
-            return _("%a, %b %-e, %Y at %H:%M");
-        case ClockFormat.LOCALE_DEFAULT:
-            /// Format for the datetime that a message being replied to was received
-            /// See http://developer.gnome.org/glib/2.32/glib-GDateTime.html#g-date-time-format
-            return _("%a, %b %-e, %Y at %X");
+    var value = "";
+    switch (clock_format) {
+    case TWELVE_HOURS:
+        /// 12 hours format for datetime that a message being replied
+        /// to was received See
+        /// http://developer.gnome.org/glib/2.32/glib-GDateTime.html#g-date-time-format
+        value = _("%a, %b %-e, %Y at %l:%M %P");
+        break;
+    case TWENTY_FOUR_HOURS:
+        /// 24 hours format for the datetime that a message being
+        /// replied to was received See
+        /// http://developer.gnome.org/glib/2.32/glib-GDateTime.html#g-date-time-format
+        value = _("%a, %b %-e, %Y at %H:%M");
+        break;
+    case LOCALE_DEFAULT:
+        /// Format for the datetime that a message being replied to
+        /// was received See
+        /// http://developer.gnome.org/glib/2.32/glib-GDateTime.html#g-date-time-format
+        value = _("%a, %b %-e, %Y at %X");
+        break;
+    case TOTAL:
+        // noop
+        break;
     }
-    GLib.assert(false); // unreachable
-    return "";
+    return value;
 }
 
 }
diff --git a/src/engine/api/geary-account-information.vala b/src/engine/api/geary-account-information.vala
index 64a5b188a..c72bed683 100644
--- a/src/engine/api/geary-account-information.vala
+++ b/src/engine/api/geary-account-information.vala
@@ -131,6 +131,8 @@ public class Geary.AccountInformation : BaseObject {
             case OUTLOOK:
                 save = false;
                 break;
+            default:
+                break;
             }
             return save;
         }
@@ -433,6 +435,9 @@ public class Geary.AccountInformation : BaseObject {
         case CUSTOM:
             outgoing = this.outgoing.credentials;
             break;
+        case NONE:
+            // no-op
+            break;
         }
         return outgoing;
     }
diff --git a/src/engine/api/geary-engine.vala b/src/engine/api/geary-engine.vala
index c91b67ff6..749f0ad55 100644
--- a/src/engine/api/geary-engine.vala
+++ b/src/engine/api/geary-engine.vala
@@ -348,6 +348,9 @@ public class Geary.Engine : BaseObject {
         case CUSTOM:
             credentials = service.credentials;
             break;
+        case NONE:
+            // no-op
+            break;
         }
 
         Geary.Smtp.ClientSession client = new Geary.Smtp.ClientSession(endpoint);
diff --git a/src/engine/api/geary-service-provider.vala b/src/engine/api/geary-service-provider.vala
index e6939bfb4..517bc3a4b 100644
--- a/src/engine/api/geary-service-provider.vala
+++ b/src/engine/api/geary-service-provider.vala
@@ -40,6 +40,9 @@ public enum Geary.ServiceProvider {
         case OUTLOOK:
             ImapEngine.OutlookAccount.setup_account(service);
             break;
+        case OTHER:
+            // no-op
+            break;
         }
     }
 
@@ -54,6 +57,9 @@ public enum Geary.ServiceProvider {
         case OUTLOOK:
             ImapEngine.OutlookAccount.setup_service(service);
             break;
+        case OTHER:
+            // no-op
+            break;
         }
     }
 
diff --git a/src/engine/imap-db/imap-db-folder.vala b/src/engine/imap-db/imap-db-folder.vala
index 9bfd6c8e1..bcb41d6ae 100644
--- a/src/engine/imap-db/imap-db-folder.vala
+++ b/src/engine/imap-db/imap-db-folder.vala
@@ -1781,6 +1781,15 @@ private class Geary.ImapDB.Folder : BaseObject, Geary.ReferenceSemantics {
                     case Geary.Email.Field.PROPERTIES:
                         append = "internaldate, internaldate_time_t, rfc822_size";
                     break;
+
+                    case NONE:
+                        // no-op
+                        break;
+
+                    case ENVELOPE:
+                    case ALL:
+                        // XXX hmm
+                        break;
                 }
             }
 
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala 
b/src/engine/imap-engine/imap-engine-generic-account.vala
index ad1f87a44..3b8536c37 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -979,6 +979,10 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
             unloc_names.add("Archive | Archives");
 
             break;
+
+        default:
+            // no-op
+            break;
         }
 
         loc_names.add_all(unloc_names);


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