From a0ff57c158147eca47e2bc2b40165a4ee83a7e75 Mon Sep 17 00:00:00 2001 From: Michael James Gratton Date: Mon, 15 Jan 2018 16:17:11 +1100 Subject: [PATCH] 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-list-box.vala | 4 +-- .../conversation-message.vala | 2 +- .../conversation-web-view.vala | 2 +- src/engine/api/geary-account.vala | 11 +++---- src/engine/db/db-versioned-database.vala | 6 ++-- .../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 3e3044ff..c814abe0 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 00625c21..cb83a49d 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 4161fa3a..61dbaa9d 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 46e01ec3..d2af409d 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 241d24ae..8bd9c60d 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 2c01e9ef..432dc284 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 588d39bd..0df3a21d 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 21247c93..082bfe67 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 sort_by_path(Gee.Collection folders) { Gee.TreeSet sorted = new Gee.TreeSet(folder_path_comparator); sorted.add_all(folders); - + return Collection.to_array_list(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 e3d2029a..71c5b547 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 c964dddc..7ed3612a 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 add_folders(Gee.Collection db_folders, bool are_existing) { diff --git a/src/engine/imap/api/imap-account.vala b/src/engine/imap/api/imap-account.vala index 40d12ebf..d862ad4f 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 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 984a6f25..bda0450f 100644 --- a/src/engine/nonblocking/nonblocking-queue.vala +++ b/src/engine/nonblocking/nonblocking-queue.vala @@ -62,7 +62,7 @@ public class Geary.Nonblocking.Queue : BaseObject { * identity will be used. */ public Queue.fifo(owned Gee.EqualDataFunc? equalator = null) { - this(new Gee.LinkedList(equalator)); + this(new Gee.LinkedList((owned) equalator)); } /** @@ -73,7 +73,7 @@ public class Geary.Nonblocking.Queue : BaseObject { * ordering will be used. */ public Queue.priority(owned CompareDataFunc? comparator = null) { - this(new Gee.PriorityQueue(comparator)); + this(new Gee.PriorityQueue((owned) comparator)); } /** diff --git a/src/engine/util/util-collection.vala b/src/engine/util/util-collection.vala index 68595693..092ed34d 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.wrap() for compatibility with older versions of Gee. public Gee.ArrayList array_list_wrap(G[] a, owned Gee.EqualDataFunc? equal_func = null) { - Gee.ArrayList list = new Gee.ArrayList(equal_func); + Gee.ArrayList list = new Gee.ArrayList((owned) equal_func); add_all_array(list, a); return list; } diff --git a/src/engine/util/util-idle-manager.vala b/src/engine/util/util-idle-manager.vala index 43f2ab3f..f6bf90e0 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 929af731..ab19cc1f 100644 --- a/src/engine/util/util-iterable.vala +++ b/src/engine/util/util-iterable.vala @@ -91,7 +91,7 @@ public class Geary.Iterable : BaseObject { } public Iterable filter(owned Gee.Predicate f) { - return new Iterable(i.filter(f)); + return new Iterable(i.filter((owned) f)); } public Iterable chop(int offset, int length = -1) { @@ -166,20 +166,20 @@ public class Geary.Iterable : BaseObject { } public Gee.ArrayList to_array_list(owned Gee.EqualDataFunc? equal_func = null) { - return (Gee.ArrayList) add_all_to(new Gee.ArrayList(equal_func)); + return (Gee.ArrayList) add_all_to(new Gee.ArrayList((owned) equal_func)); } public Gee.LinkedList to_linked_list(owned Gee.EqualDataFunc? equal_func = null) { - return (Gee.LinkedList) add_all_to(new Gee.LinkedList(equal_func)); + return (Gee.LinkedList) add_all_to(new Gee.LinkedList((owned) equal_func)); } public Gee.HashSet to_hash_set(owned Gee.HashDataFunc? hash_func = null, owned Gee.EqualDataFunc? equal_func = null) { - return (Gee.HashSet) add_all_to(new Gee.HashSet(hash_func, equal_func)); + return (Gee.HashSet) add_all_to(new Gee.HashSet((owned) hash_func, (owned) equal_func)); } public Gee.TreeSet to_tree_set(owned CompareDataFunc? compare_func = null) { - return (Gee.TreeSet) add_all_to(new Gee.TreeSet(compare_func)); + return (Gee.TreeSet) add_all_to(new Gee.TreeSet((owned) compare_func)); } public Gee.Map add_all_to_map(Gee.Map c, Gee.MapFunc key_func) { @@ -189,12 +189,17 @@ public class Geary.Iterable : BaseObject { } return c; } - - public Gee.HashMap to_hash_map(Gee.MapFunc key_func, - owned Gee.HashDataFunc? key_hash_func = null, - owned Gee.EqualDataFunc? key_equal_func = null, - owned Gee.EqualDataFunc? value_equal_func = null) { - return (Gee.HashMap) add_all_to_map(new Gee.HashMap( - key_hash_func, key_equal_func, value_equal_func), key_func); + + public Gee.HashMap + to_hash_map(Gee.MapFunc key_func, + owned Gee.HashDataFunc? key_hash_func = null, + owned Gee.EqualDataFunc? key_equal_func = null, + owned Gee.EqualDataFunc? value_equal_func = null) { + return (Gee.HashMap) add_all_to_map( + new Gee.HashMap((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 4c5108eb..e53ff747 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 f4db10b7..9b75a424 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 8f493ade..b060097a 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 3c206b49..472216d5 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 3c245690..2863c713 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]); -}; +} /*