Prevent GTK warnings when creating new account: Closes bgo#726269
The code for distinguishing between a new database and an existing one being upgraded was faulty, causing the progress monitor to be started/stopped when it should've have been.
This commit is contained in:
parent
9f047ce9c2
commit
6358e026f0
3 changed files with 12 additions and 3 deletions
|
|
@ -232,7 +232,11 @@ public class Geary.Db.Connection : Geary.Db.Context {
|
|||
}
|
||||
|
||||
/**
|
||||
* See set_user_version_number().
|
||||
* Returns the user_version number maintained by SQLite.
|
||||
*
|
||||
* A new database has a user version number of zero.
|
||||
*
|
||||
* @see set_user_version_number().
|
||||
*/
|
||||
public int get_user_version_number() throws Error {
|
||||
return get_pragma_int(PRAGMA_USER_VERSION);
|
||||
|
|
|
|||
|
|
@ -77,8 +77,9 @@ public class Geary.Db.VersionedDatabase : Geary.Db.Database {
|
|||
debug("VersionedDatabase.upgrade: current database schema for %s: %d", db_file.get_path(),
|
||||
db_version);
|
||||
|
||||
// If the DB doesn't exist yet, the version number will be negative.
|
||||
bool new_db = db_version < 0;
|
||||
// If the DB doesn't exist yet, the version number will be zero, but also treat negative
|
||||
// values as new
|
||||
bool new_db = db_version <= 0;
|
||||
|
||||
// Initialize new database to version 1 (note the preincrement in the loop below)
|
||||
if (db_version < 0)
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@ private class Geary.ImapDB.Database : Geary.Db.VersionedDatabase {
|
|||
// can't call the ProgressMonitor directly, as it's hooked up to signals that expect to be
|
||||
// called in the foreground thread, so use the Idle loop for this
|
||||
Idle.add(() => {
|
||||
// don't use upgrade_monitor for new databases, as the upgrade should be near-
|
||||
// instantaneous. Also, there's some issue with GTK when starting the progress
|
||||
// monitor while GtkDialog's are in play:
|
||||
// https://bugzilla.gnome.org/show_bug.cgi?id=726269
|
||||
if (!new_db && !upgrade_monitor.is_in_progress)
|
||||
upgrade_monitor.notify_start();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue