[geary] Prevent GTK warnings when creating new account: Closes bgo#726269
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Prevent GTK warnings when creating new account: Closes bgo#726269
- Date: Fri, 14 Mar 2014 00:15:43 +0000 (UTC)
commit 6358e026f03fbb55d8f0076cd3c15e3d34333e2f
Author: Jim Nelson <jim yorba org>
Date: Thu Mar 13 17:14:33 2014 -0700
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.
src/engine/db/db-connection.vala | 6 +++++-
src/engine/db/db-versioned-database.vala | 5 +++--
src/engine/imap-db/imap-db-database.vala | 4 ++++
3 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/engine/db/db-connection.vala b/src/engine/db/db-connection.vala
index c9c6693..71c29b7 100644
--- a/src/engine/db/db-connection.vala
+++ b/src/engine/db/db-connection.vala
@@ -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);
diff --git a/src/engine/db/db-versioned-database.vala b/src/engine/db/db-versioned-database.vala
index 850738d..c1f38e9 100644
--- a/src/engine/db/db-versioned-database.vala
+++ b/src/engine/db/db-versioned-database.vala
@@ -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)
diff --git a/src/engine/imap-db/imap-db-database.vala b/src/engine/imap-db/imap-db-database.vala
index ef297db..b0292d0 100644
--- a/src/engine/imap-db/imap-db-database.vala
+++ b/src/engine/imap-db/imap-db-database.vala
@@ -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();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]