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

This commit is contained in:
Michael James Gratton 2018-01-15 16:17:11 +11:00
parent cbfb7d571d
commit a0ff57c158
20 changed files with 62 additions and 52 deletions

View file

@ -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

View file

@ -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);
}

View file

@ -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;

View file

@ -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;

View file

@ -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 {

View file

@ -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(

View file

@ -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"));

View file

@ -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);
}

View file

@ -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) {

View file

@ -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) {

View file

@ -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);
}

View file

@ -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));
}
/**

View file

@ -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;
}

View file

@ -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() {

View file

@ -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
);
}
}

View file

@ -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 {

View file

@ -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.
*

View file

@ -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() {

View file

@ -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,

View file

@ -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]);
};
}
/*