[evolution-data-server/openismus-phonenumber-work] sqlite: Reduce country-code rebuild spam on startup
- From: Mathias Hasselmann <hasselmm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/openismus-phonenumber-work] sqlite: Reduce country-code rebuild spam on startup
- Date: Tue, 11 Dec 2012 14:21:22 +0000 (UTC)
commit 3129acd441f785cc1e4fc7f1469bf03810e5a2a7
Author: Mathias Hasselmann <mathias openismus com>
Date: Tue Dec 11 13:59:44 2012 +0100
sqlite: Reduce country-code rebuild spam on startup
Only print the message if we really have to do something.
.../libedata-book/e-book-backend-sqlitedb.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend-sqlitedb.c b/addressbook/libedata-book/e-book-backend-sqlitedb.c
index 79335c4..ae9e93e 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -3916,7 +3916,7 @@ validate_county_code (EBookBackendSqliteDB *ebsdb,
#error Cannot resolve default 2-letter country code. Find a replacement for _NL_ADDRESS_COUNTRY_AB2 or implement code to parse the locale name.
#endif /* HAVE__NL_ADDRESS_COUNTRY_AB2 */
- if (country_code == NULL) {
+ if (country_code == NULL || strlen (country_code) != 2) {
g_warning ("Cannot derive 2-letter country code from current locale.");
country_code = "ZZ";
}
@@ -3928,15 +3928,17 @@ validate_county_code (EBookBackendSqliteDB *ebsdb,
g_free (ebsdb->priv->country_code);
ebsdb->priv->country_code = g_strdup (country_code);
- g_print ("The country code has changed %s. "
- "Must rebuilding %s parameters and indexes for stored vCards.\n",
- ebsdb->priv->country_code, EVC_X_E164);
-
stmt = sqlite3_mprintf ("SELECT uid, vcard, NULL FROM %Q", folderid);
success = book_backend_sql_exec (
ebsdb->priv->db, stmt, addto_vcard_list_cb, &vcard_data, error);
sqlite3_free (stmt);
+ if (vcard_data) {
+ g_print ("The country code has changed to \"%s\". "
+ "Must rebuild %s parameters and indexes for stored vCards.\n",
+ ebsdb->priv->country_code, EVC_X_E164);
+ }
+
for (l = vcard_data; success && l; l = l->next) {
EbSdbSearchData *const s_data = l->data;
EContact *contact = e_contact_new_from_vcard_with_uid (s_data->vcard, s_data->uid);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]