[geary] Remove --enabled-deprecated vala warnings, fix a bunch of them.



commit a0ff57c158147eca47e2bc2b40165a4ee83a7e75
Author: Michael James Gratton <mike vee net>
Date:   Mon Jan 15 16:17:11 2018 +1100

    Remove --enabled-deprecated vala warnings, fix a bunch of them.

 bindings/metadata/WebKit2-4.0.metadata             |    4 +++
 src/client/application/geary-application.vala      |    4 +-
 src/client/components/main-window.vala             |    4 +-
 src/client/composer/composer-widget.vala           |   10 +++---
 .../conversation-viewer/conversation-list-box.vala |    4 +-
 .../conversation-viewer/conversation-message.vala  |    2 +-
 .../conversation-viewer/conversation-web-view.vala |    2 +-
 src/engine/api/geary-account.vala                  |   11 ++++---
 src/engine/db/db-versioned-database.vala           |    6 ++--
 .../imap-engine/imap-engine-generic-account.vala   |    3 +-
 src/engine/imap/api/imap-account.vala              |    4 +-
 src/engine/nonblocking/nonblocking-queue.vala      |    4 +-
 src/engine/util/util-collection.vala               |    2 +-
 src/engine/util/util-idle-manager.vala             |    4 +-
 src/engine/util/util-iterable.vala                 |   29 +++++++++++--------
 src/engine/util/util-js.vala                       |    2 +-
 src/engine/util/util-synchronization.vala          |    6 ++--
 src/engine/util/util-timeout-manager.vala          |    8 +++---
 src/meson.build                                    |    1 -
 src/sqlite3-unicodesn/fts3_unicode2.c              |    4 +-
 20 files changed, 62 insertions(+), 52 deletions(-)
---
diff --git a/bindings/metadata/WebKit2-4.0.metadata b/bindings/metadata/WebKit2-4.0.metadata
index 3e3044f..c814abe 100644
--- a/bindings/metadata/WebKit2-4.0.metadata
+++ b/bindings/metadata/WebKit2-4.0.metadata
@@ -6,8 +6,12 @@ JavascriptResult
 //Forward upstream
 Download
   .failed#signal.error type="WebKit.DownloadError"
+PrintCustomWidget
+  .apply#signal skip
+  .update#signal skip
 PrintOperation
   .failed#signal.error type="WebKit.PrintError"
+WebContext.initialize_notification_permissions#method skip
 WebResource
   .failed#signal.error type="GLib.Error"
 WebView
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index 00625c2..cb83a49 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -64,7 +64,7 @@ public class GearyApplication : Gtk.Application {
     private const int64 FORCE_SHUTDOWN_USEC = 5 * USEC_PER_SEC;
 
 
-    [Deprecated]
+    [Version (deprecated = true)]
     public static GearyApplication instance {
         get { return _instance; }
         private set {
@@ -336,7 +336,7 @@ public class GearyApplication : Gtk.Application {
      *
      * @deprecated Use {@link GioUtil.create_builder} instead.
      */
-    [Deprecated]
+    [Version (deprecated = true)]
     public Gtk.Builder create_builder(string name) {
         return GioUtil.create_builder(name);
     }
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 4161fa3..61dbaa9 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -189,8 +189,8 @@ public class MainWindow : Gtk.ApplicationWindow {
 
                 return true;
             };
-            bind_property("current-folder", this, "title", BindingFlags.SYNC_CREATE, title_func);
-            main_toolbar.bind_property("account", this, "title", BindingFlags.SYNC_CREATE, title_func);
+            bind_property("current-folder", this, "title", BindingFlags.SYNC_CREATE, (owned) title_func);
+            main_toolbar.bind_property("account", this, "title", BindingFlags.SYNC_CREATE, (owned) 
title_func);
             main_layout.pack_start(main_toolbar, false, true, 0);
         } else {
             main_toolbar.show_close_button = true;
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 46e01ec..d2af409 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -423,9 +423,9 @@ public class ComposerWidget : Gtk.EventBox {
                 return true;
             };
         bind_property("draft-save-text", this, "toolbar-text", BindingFlags.SYNC_CREATE,
-            set_toolbar_text);
+                      (owned) set_toolbar_text);
         bind_property("can-delete-quote", this, "toolbar-text", BindingFlags.SYNC_CREATE,
-            set_toolbar_text);
+                      (owned) set_toolbar_text);
         this.to_entry = new EmailEntry(this);
         this.to_entry.changed.connect(on_envelope_changed);
         this.to_box.add(to_entry);
@@ -1518,8 +1518,8 @@ public class ComposerWidget : Gtk.EventBox {
                         // automatically, so add it if asked to and it
                         // hasn't already been added
                         if (do_add &&
-                            !(file in this.attached_files) &&
-                            !(content_id in this.inline_files)) {
+                            !this.attached_files.contains(file) &&
+                            !this.inline_files.has_key(content_id)) {
                             if (type == Geary.Mime.DispositionType.INLINE) {
                                 add_inline_part(file, content_id);
                             } else {
@@ -2216,7 +2216,7 @@ public class ComposerWidget : Gtk.EventBox {
         if (this.pointer_url != null &&
             this.actions.get_action_state(ACTION_COMPOSE_AS_HTML).get_boolean()) {
             Gdk.EventButton? button = (Gdk.EventButton) event;
-            Gdk.Rectangle location = new Gdk.Rectangle();
+            Gdk.Rectangle location = Gdk.Rectangle();
             location.x = (int) button.x;
             location.y = (int) button.y;
 
diff --git a/src/client/conversation-viewer/conversation-list-box.vala 
b/src/client/conversation-viewer/conversation-list-box.vala
index 241d24a..8bd9c60 100644
--- a/src/client/conversation-viewer/conversation-list-box.vala
+++ b/src/client/conversation-viewer/conversation-list-box.vala
@@ -559,7 +559,7 @@ public class ConversationListBox : Gtk.ListBox {
             if (this.cancellable.is_cancelled()) {
                 break;
             }
-            if (!(full_email.id in this.email_rows)) {
+            if (!this.email_rows.has_key(full_email.id)) {
                 EmailRow row = add_email(full_email);
                 if (row.is_expanded &&
                     (first_expanded_row == null ||
@@ -1090,7 +1090,7 @@ public class ConversationListBox : Gtk.ListBox {
         Geary.App.Conversation conversation, Geary.Email part_email) {
         // Don't add rows that are already present, or that are
         // currently being edited.
-        if (!(part_email.id in this.email_rows) &&
+        if (!this.email_rows.has_key(part_email.id) &&
             part_email.id != this.draft_id) {
             load_full_email.begin(part_email.id, (obj, ret) => {
                     try {
diff --git a/src/client/conversation-viewer/conversation-message.vala 
b/src/client/conversation-viewer/conversation-message.vala
index 2c01e9e..432dc28 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -815,7 +815,7 @@ public class ConversationMessage : Gtk.Grid {
 
         if (hit_test.context_is_image()) {
             string uri = hit_test.get_image_uri();
-            set_action_enabled(ACTION_SAVE_IMAGE, uri in this.resources);
+            set_action_enabled(ACTION_SAVE_IMAGE, this.resources.has_key(uri));
             model.append_section(
                 null,
                 set_action_param_value(
diff --git a/src/client/conversation-viewer/conversation-web-view.vala 
b/src/client/conversation-viewer/conversation-web-view.vala
index 588d39b..0df3a21 100644
--- a/src/client/conversation-viewer/conversation-web-view.vala
+++ b/src/client/conversation-viewer/conversation-web-view.vala
@@ -202,7 +202,7 @@ public class ConversationWebView : ClientWebView {
                 context,
                 Geary.JS.get_property(context, details, "location"));
 
-            Gdk.Rectangle location = new Gdk.Rectangle();
+            Gdk.Rectangle location = Gdk.Rectangle();
             location.x = (int) Geary.JS.to_number(
                 context,
                 Geary.JS.get_property(context, js_location, "x"));
diff --git a/src/engine/api/geary-account.vala b/src/engine/api/geary-account.vala
index 21247c9..082bfe6 100644
--- a/src/engine/api/geary-account.vala
+++ b/src/engine/api/geary-account.vala
@@ -153,17 +153,18 @@ public abstract class Geary.Account : BaseObject {
     }
 
     /**
-     * A utility method to sort a Gee.Collection of {@link Folder}s by their {@link FolderPath}s
-     * to ensure they comport with {@link folders_available_unavailable} and
-     * {@link folders_added_removed} signals' contracts.
+     * A utility method to sort a Gee.Collection of {@link Folder}s by
+     * their {@link FolderPath}s to ensure they comport with {@link
+     * folders_available_unavailable}, {@link folders_created}, {@link
+     * folders_deleted} signals' contracts.
      */
     protected Gee.List<Geary.Folder> sort_by_path(Gee.Collection<Geary.Folder> folders) {
         Gee.TreeSet<Geary.Folder> sorted = new Gee.TreeSet<Geary.Folder>(folder_path_comparator);
         sorted.add_all(folders);
-        
+
         return Collection.to_array_list<Geary.Folder>(sorted);
     }
-    
+
     private int folder_path_comparator(Geary.Folder a, Geary.Folder b) {
         return a.path.compare_to(b.path);
     }
diff --git a/src/engine/db/db-versioned-database.vala b/src/engine/db/db-versioned-database.vala
index e3d2029..71c5b54 100644
--- a/src/engine/db/db-versioned-database.vala
+++ b/src/engine/db/db-versioned-database.vala
@@ -6,9 +6,9 @@
 
 public class Geary.Db.VersionedDatabase : Geary.Db.Database {
     public delegate void WorkCallback();
-    
-    private static Mutex upgrade_mutex = new Mutex();
-    
+
+    private static Mutex upgrade_mutex = Mutex();
+
     public File schema_dir { get; private set; }
     
     public VersionedDatabase(File db_file, File schema_dir) {
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala 
b/src/engine/imap-engine/imap-engine-generic-account.vala
index c964ddd..7ed3612 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -514,7 +514,8 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
      * equivalents need to exist beforehand — they are not created.
      *
      * If `are_existing` is true, the folders are assumed to have been
-     * seen before and the {@link folders_added} signal is not fired.
+     * seen before and the {@link Geary.Account.folders_created} signal is
+     * not fired.
      */
     internal Gee.List<Geary.Folder> add_folders(Gee.Collection<ImapDB.Folder> db_folders,
                                                 bool are_existing) {
diff --git a/src/engine/imap/api/imap-account.vala b/src/engine/imap/api/imap-account.vala
index 40d12eb..d862ad4 100644
--- a/src/engine/imap/api/imap-account.vala
+++ b/src/engine/imap/api/imap-account.vala
@@ -122,7 +122,7 @@ private class Geary.Imap.Account : BaseObject {
         Gee.List<MailboxInformation> mailboxes = yield send_list_async(session, path, false, cancellable);
         bool exists = mailboxes.is_empty;
         if (!exists) {
-            this.folders.remove(path);
+            this.folders.unset(path);
         }
 
         // XXX fire some signal here
@@ -225,7 +225,7 @@ private class Geary.Imap.Account : BaseObject {
                     folder.properties.set_status_unseen(data.unseen);
                     folder.properties.set_status_message_count(data.messages, false);
                 } catch (ImapError e) {
-                    this.folders.remove(path);
+                    this.folders.unset(path);
                     // XXX notify someone
                     throw_not_found(path);
                 }
diff --git a/src/engine/nonblocking/nonblocking-queue.vala b/src/engine/nonblocking/nonblocking-queue.vala
index 984a6f2..bda0450 100644
--- a/src/engine/nonblocking/nonblocking-queue.vala
+++ b/src/engine/nonblocking/nonblocking-queue.vala
@@ -62,7 +62,7 @@ public class Geary.Nonblocking.Queue<G> : BaseObject {
      * identity will be used.
      */
     public Queue.fifo(owned Gee.EqualDataFunc<G>? equalator = null) {
-        this(new Gee.LinkedList<G>(equalator));
+        this(new Gee.LinkedList<G>((owned) equalator));
     }
 
     /**
@@ -73,7 +73,7 @@ public class Geary.Nonblocking.Queue<G> : BaseObject {
      * ordering will be used.
      */
     public Queue.priority(owned CompareDataFunc<G>? comparator = null) {
-        this(new Gee.PriorityQueue<G>(comparator));
+        this(new Gee.PriorityQueue<G>((owned) comparator));
     }
 
     /**
diff --git a/src/engine/util/util-collection.vala b/src/engine/util/util-collection.vala
index 6859569..092ed34 100644
--- a/src/engine/util/util-collection.vala
+++ b/src/engine/util/util-collection.vala
@@ -14,7 +14,7 @@ public inline bool is_empty(Gee.Collection? c) {
 
 // A substitute for ArrayList<G>.wrap() for compatibility with older versions of Gee.
 public Gee.ArrayList<G> array_list_wrap<G>(G[] a, owned Gee.EqualDataFunc<G>? equal_func = null) {
-    Gee.ArrayList<G> list = new Gee.ArrayList<G>(equal_func);
+    Gee.ArrayList<G> list = new Gee.ArrayList<G>((owned) equal_func);
     add_all_array<G>(list, a);
     return list;
 }
diff --git a/src/engine/util/util-idle-manager.vala b/src/engine/util/util-idle-manager.vala
index 43f2ab3..f6bf90e 100644
--- a/src/engine/util/util-idle-manager.vala
+++ b/src/engine/util/util-idle-manager.vala
@@ -53,8 +53,8 @@ public class Geary.IdleManager : BaseObject {
      * The idle function will be by default not running, and hence
      * needs to be started by a call to {@link schedule}.
      */
-    public IdleManager(IdleFunc callback) {
-        this.callback = callback;
+    public IdleManager(owned IdleFunc callback) {
+        this.callback = (owned) callback;
     }
 
     ~IdleManager() {
diff --git a/src/engine/util/util-iterable.vala b/src/engine/util/util-iterable.vala
index 929af73..ab19cc1 100644
--- a/src/engine/util/util-iterable.vala
+++ b/src/engine/util/util-iterable.vala
@@ -91,7 +91,7 @@ public class Geary.Iterable<G> : BaseObject {
     }
     
     public Iterable<G> filter(owned Gee.Predicate<G> f) {
-        return new Iterable<G>(i.filter(f));
+        return new Iterable<G>(i.filter((owned) f));
     }
     
     public Iterable<G> chop(int offset, int length = -1) {
@@ -166,20 +166,20 @@ public class Geary.Iterable<G> : BaseObject {
     }
     
     public Gee.ArrayList<G> to_array_list(owned Gee.EqualDataFunc<G>? equal_func = null) {
-        return (Gee.ArrayList<G>) add_all_to(new Gee.ArrayList<G>(equal_func));
+        return (Gee.ArrayList<G>) add_all_to(new Gee.ArrayList<G>((owned) equal_func));
     }
     
     public Gee.LinkedList<G> to_linked_list(owned Gee.EqualDataFunc<G>? equal_func = null) {
-        return (Gee.LinkedList<G>) add_all_to(new Gee.LinkedList<G>(equal_func));
+        return (Gee.LinkedList<G>) add_all_to(new Gee.LinkedList<G>((owned) equal_func));
     }
     
     public Gee.HashSet<G> to_hash_set(owned Gee.HashDataFunc<G>? hash_func = null,
         owned Gee.EqualDataFunc<G>? equal_func = null) {
-        return (Gee.HashSet<G>) add_all_to(new Gee.HashSet<G>(hash_func, equal_func));
+        return (Gee.HashSet<G>) add_all_to(new Gee.HashSet<G>((owned) hash_func, (owned) equal_func));
     }
     
     public Gee.TreeSet<G> to_tree_set(owned CompareDataFunc<G>? compare_func = null) {
-        return (Gee.TreeSet<G>) add_all_to(new Gee.TreeSet<G>(compare_func));
+        return (Gee.TreeSet<G>) add_all_to(new Gee.TreeSet<G>((owned) compare_func));
     }
     
     public Gee.Map<K, G> add_all_to_map<K>(Gee.Map<K, G> c, Gee.MapFunc<K, G> key_func) {
@@ -189,12 +189,17 @@ public class Geary.Iterable<G> : BaseObject {
         }
         return c;
     }
-    
-    public Gee.HashMap<K, G> to_hash_map<K>(Gee.MapFunc<K, G> key_func,
-        owned Gee.HashDataFunc<K>? key_hash_func = null,
-        owned Gee.EqualDataFunc<K>? key_equal_func = null,
-        owned Gee.EqualDataFunc<G>? value_equal_func = null) {
-        return (Gee.HashMap<K, G>) add_all_to_map<K>(new Gee.HashMap<K, G>(
-            key_hash_func, key_equal_func, value_equal_func), key_func);
+
+    public Gee.HashMap<K, G>
+        to_hash_map<K>(Gee.MapFunc<K, G> key_func,
+                       owned Gee.HashDataFunc<K>? key_hash_func = null,
+                       owned Gee.EqualDataFunc<K>? key_equal_func = null,
+                       owned Gee.EqualDataFunc<G>? value_equal_func = null) {
+            return (Gee.HashMap<K, G>) add_all_to_map<K>(
+                new Gee.HashMap<K, G>((owned) key_hash_func,
+                                      (owned) key_equal_func,
+                                      (owned) value_equal_func),
+                key_func
+            );
     }
 }
diff --git a/src/engine/util/util-js.vala b/src/engine/util/util-js.vala
index 4c5108e..e53ff74 100644
--- a/src/engine/util/util-js.vala
+++ b/src/engine/util/util-js.vala
@@ -122,7 +122,7 @@ namespace Geary.JS {
                                                 global::JS.Object object,
                                                 string name)
         throws Geary.JS.Error {
-        global::JS.String js_name = new global::JS.String.create_with_utf8_cstring(name);
+        global::JS.String js_name = global::JS.String.create_with_utf8_cstring(name);
         global::JS.Value? err = null;
         global::JS.Value prop = object.get_property(context, js_name, out err);
         try {
diff --git a/src/engine/util/util-synchronization.vala b/src/engine/util/util-synchronization.vala
index f4db10b..9b75a42 100644
--- a/src/engine/util/util-synchronization.vala
+++ b/src/engine/util/util-synchronization.vala
@@ -29,11 +29,11 @@ public class SpinWaiter : BaseObject {
      * the {@link PollService} to execute.  If poll_msec is zero or less, PollService will be
      * called constantly.
      */
-    public SpinWaiter(int poll_msec, PollService cb) {
+    public SpinWaiter(int poll_msec, owned PollService cb) {
         this.poll_msec = poll_msec;
-        this.cb = cb;
+        this.cb = (owned) cb;
     }
-    
+
     /**
      * Spins waiting for a completion state to be reached.
      *
diff --git a/src/engine/util/util-timeout-manager.vala b/src/engine/util/util-timeout-manager.vala
index 8f493ad..b060097 100644
--- a/src/engine/util/util-timeout-manager.vala
+++ b/src/engine/util/util-timeout-manager.vala
@@ -60,10 +60,10 @@ public class Geary.TimeoutManager : BaseObject {
      * The timeout will be by default not running, and hence needs to be
      * started by a call to {@link start}.
      */
-    public TimeoutManager.seconds(uint interval, TimeoutFunc callback) {
+    public TimeoutManager.seconds(uint interval, owned TimeoutFunc callback) {
         this.use_seconds = true;
         this.interval = interval;
-        this.callback = callback;
+        this.callback = (owned) callback;
     }
 
     /**
@@ -72,10 +72,10 @@ public class Geary.TimeoutManager : BaseObject {
      * The timeout will be by default not running, and hence needs to be
      * started by a call to {@link start}.
      */
-    public TimeoutManager.milliseconds(uint interval, TimeoutFunc callback) {
+    public TimeoutManager.milliseconds(uint interval, owned TimeoutFunc callback) {
         this.use_seconds = false;
         this.interval = interval;
-        this.callback = callback;
+        this.callback = (owned) callback;
     }
 
     ~TimeoutManager() {
diff --git a/src/meson.build b/src/meson.build
index 3c206b4..472216d 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -22,7 +22,6 @@ geary_vala_options = [
   '--target-glib=@0@'.format(target_glib),
   '--thread',
   '--enable-checking',
-  '--enable-deprecated',
 ]
 
 # Symbols for valac's preprocessor must be defined as compiler args,
diff --git a/src/sqlite3-unicodesn/fts3_unicode2.c b/src/sqlite3-unicodesn/fts3_unicode2.c
index 3c24569..2863c71 100644
--- a/src/sqlite3-unicodesn/fts3_unicode2.c
+++ b/src/sqlite3-unicodesn/fts3_unicode2.c
@@ -39,7 +39,7 @@ int sqlite3FtsUnicodeIsalnum(int c){
   ** C. It is not possible to represent a range larger than 1023 codepoints 
   ** using this format.
   */
-  const static unsigned int aEntry[] = {
+  static const unsigned int aEntry[] = {
     0x00000030, 0x0000E807, 0x00016C06, 0x0001EC2F, 0x0002AC07,
     0x0002D001, 0x0002D803, 0x0002EC01, 0x0002FC01, 0x00035C01,
     0x0003DC01, 0x000B0804, 0x000B480E, 0x000B9407, 0x000BB401,
@@ -203,7 +203,7 @@ static int remove_diacritic(int c){
   }
   assert( key>=aDia[iRes] );
   return ((c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : (int)aChar[iRes]);
-};
+}
 
 
 /*


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