[geary/mjog/fix-build-warnings: 2/2] Fix misc null and deprecation build warnings



commit deee8cc7e95be5cbbbe0059bed704d4c87301e86
Author: Michael Gratton <mike vee net>
Date:   Thu Oct 10 22:28:45 2019 +1100

    Fix misc null and deprecation build warnings

 .../application/application-plugin-manager.vala       | 10 ++++++++--
 src/client/composer/composer-widget.vala              | 19 -------------------
 .../conversation-list/conversation-list-view.vala     |  4 ++--
 src/client/util/util-migrate.vala                     |  8 ++++----
 4 files changed, 14 insertions(+), 27 deletions(-)
---
diff --git a/src/client/application/application-plugin-manager.vala 
b/src/client/application/application-plugin-manager.vala
index 89fa686b..5e0b07ba 100644
--- a/src/client/application/application-plugin-manager.vala
+++ b/src/client/application/application-plugin-manager.vala
@@ -35,10 +35,16 @@ public class Application.PluginManager : GLib.Object {
             "context", this.notifications
         );
         this.notification_extensions.extension_added.connect((info, extension) => {
-                (extension as Plugin.Notification).activate();
+                Plugin.Notification? plugin = extension as Plugin.Notification;
+                if (plugin != null) {
+                    plugin.activate();
+                }
             });
         this.notification_extensions.extension_removed.connect((info, extension) => {
-                (extension as Plugin.Notification).deactivate(this.is_shutdown);
+                Plugin.Notification? plugin = extension as Plugin.Notification;
+                if (plugin != null) {
+                    plugin.deactivate(this.is_shutdown);
+                }
             });
 
         // Load built-in plugins by default
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 879bacc7..8585cfa0 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -250,9 +250,6 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
 
     private string body_html = "";
 
-    [GtkChild]
-    private Gtk.Box composer_container;
-
     [GtkChild]
     internal Gtk.Grid editor_container;
 
@@ -307,9 +304,6 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
     [GtkChild]
     private Gtk.Box header_area;
     [GtkChild]
-
-    private Gtk.Box composer_toolbar;
-    [GtkChild]
     private Gtk.Box insert_buttons;
     [GtkChild]
     private Gtk.Box font_style_buttons;
@@ -326,9 +320,6 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
     [GtkChild]
     private Gtk.Label info_label;
 
-    [GtkChild]
-    private Gtk.Box message_area;
-
     private SimpleActionGroup composer_actions = new SimpleActionGroup();
     private SimpleActionGroup editor_actions = new SimpleActionGroup();
 
@@ -539,16 +530,6 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
         this.editor.mouse_target_changed.connect(on_mouse_target_changed);
         this.editor.selection_changed.connect(on_selection_changed);
 
-        // Place the message area before the compose toolbar in the focus chain, so that
-        // the user can tab directly from the Subject: field to the message area.
-        // TODO: after bumping the min. GTK+ version to 3.16, we can/should do this in the UI file.
-        List<Gtk.Widget> chain = new List<Gtk.Widget>();
-        chain.append(this.hidden_on_attachment_drag_over);
-        chain.append(this.message_area);
-        chain.append(this.composer_toolbar);
-        chain.append(this.attachments_box);
-        this.composer_container.set_focus_chain(chain);
-
         update_composer_view();
         load_entry_completions();
     }
diff --git a/src/client/conversation-list/conversation-list-view.vala 
b/src/client/conversation-list/conversation-list-view.vala
index 27861e3d..6a1dedf3 100644
--- a/src/client/conversation-list/conversation-list-view.vala
+++ b/src/client/conversation-list/conversation-list-view.vala
@@ -83,7 +83,7 @@ public class ConversationListView : Gtk.TreeView, Geary.BaseInterface {
     }
 
     public new ConversationListStore? get_model() {
-        return (this as Gtk.TreeView).get_model() as ConversationListStore;
+        return base.get_model() as ConversationListStore;
     }
 
     public new void set_model(ConversationListStore? new_store) {
@@ -117,7 +117,7 @@ public class ConversationListView : Gtk.TreeView, Geary.BaseInterface {
         // fire selection signals while changing the model.
         Gtk.TreeSelection selection = get_selection();
         selection.changed.disconnect(on_selection_changed);
-        (this as Gtk.TreeView).set_model(new_store);
+        base.set_model(new_store);
         this.selected.clear();
         selection.changed.connect(on_selection_changed);
     }
diff --git a/src/client/util/util-migrate.vala b/src/client/util/util-migrate.vala
index ec86c101..42033f03 100644
--- a/src/client/util/util-migrate.vala
+++ b/src/client/util/util-migrate.vala
@@ -128,11 +128,11 @@ namespace Migrate {
 
         if (oldSettingsSchema != null) {
             Settings oldSettings = new Settings.full(oldSettingsSchema, null, null);
-
-            string[] oldKeys = oldSettings.list_keys();
-            foreach (string key in newSettings.list_keys())
-                if (key in oldKeys)
+            foreach (string key in newSettings.settings_schema.list_keys()) {
+                if (oldSettingsSchema.has_key(key)) {
                     newSettings.set_value(key, oldSettings.get_value(key));
+                }
+            }
         }
 
         newSettings.set_boolean(MIGRATED_CONFIG_KEY, true);


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