* fix _MuStore initialization; proliferate API change

This commit is contained in:
djcb
2012-06-20 20:33:58 +03:00
parent 2b43ed461b
commit dea26471d0
5 changed files with 17 additions and 24 deletions

View File

@ -50,10 +50,9 @@ struct _MuStore {
public:
/* create a read-write MuStore */
_MuStore (const char *path, const char *contacts_path,
const char **my_addresses,
bool rebuild) :_my_addresses(NULL) {
bool rebuild) {
init (path, contacts_path, my_addresses, rebuild, false);
init (path, contacts_path, rebuild, false);
if (rebuild)
_db = new Xapian::WritableDatabase
@ -78,7 +77,7 @@ public:
/* create a read-only MuStore */
_MuStore (const char *path) {
init (path, NULL, NULL, false, false);
init (path, NULL, false, false);
_db = new Xapian::Database (path);
if (mu_store_needs_upgrade(this))
@ -89,9 +88,9 @@ public:
}
void init (const char *path, const char *contacts_path,
const char **my_addresses,
bool rebuild, bool read_only) {
_my_addresses = NULL;
_batch_size = DEFAULT_BATCH_SIZE;
_contacts = 0;
_in_transaction = false;
@ -100,8 +99,6 @@ public:
_read_only = read_only;
_ref_count = 1;
_version = NULL;
set_my_addresses (my_addresses);
}
void set_my_addresses (const char **my_addresses) {
@ -118,7 +115,6 @@ public:
}
}
void check_set_version () {
/* check version...*/
gchar *version;

View File

@ -123,14 +123,14 @@ add_synonyms (MuStore *store)
MuStore*
mu_store_new_writable (const char* xpath, const char *contacts_cache,
const char **my_addresses, gboolean rebuild, GError **err)
gboolean rebuild, GError **err)
{
g_return_val_if_fail (xpath, NULL);
try {
try {
MuStore *store;
store = new _MuStore (xpath, contacts_cache, my_addresses,
store = new _MuStore (xpath, contacts_cache,
rebuild ? true : false);
add_synonyms (store);
return store;

View File

@ -36,15 +36,13 @@ typedef struct _MuStore MuStore;
*
* @param path the path to the database
* @param ccachepath path where to cache the contacts information, or NULL
* @param my_addresses, array of strings with regexps for my e-mail addresses (or NULL)
* (used for the contactac information)
* @param err to receive error info or NULL. err->code is MuError value
*
* @return a new MuStore object with ref count == 1, or NULL in case
* of error; free with mu_store_unref
*/
MuStore* mu_store_new_writable (const char *xpath,
const char *ccachepath, const char **my_addresses,
const char *ccachepath,
gboolean rebuild, GError **err)
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;

View File

@ -44,7 +44,7 @@ test_mu_store_new_destroy (void)
g_assert (tmpdir);
err = NULL;
store = mu_store_new_writable (tmpdir, NULL, NULL, FALSE, &err);
store = mu_store_new_writable (tmpdir, NULL, FALSE, &err);
g_assert (store);
g_assert (err == NULL);
@ -68,7 +68,7 @@ test_mu_store_version (void)
g_assert (tmpdir);
err = NULL;
store = mu_store_new_writable (tmpdir, NULL, NULL, FALSE, &err);
store = mu_store_new_writable (tmpdir, NULL, FALSE, &err);
g_assert (store);
mu_store_unref (store);
store = mu_store_new_read_only (tmpdir, &err);
@ -95,7 +95,7 @@ test_mu_store_store_msg_and_count (void)
tmpdir = test_mu_common_get_random_tmpdir();
g_assert (tmpdir);
store = mu_store_new_writable (tmpdir, NULL, NULL, FALSE, NULL);
store = mu_store_new_writable (tmpdir, NULL, FALSE, NULL);
g_assert (store);
g_assert_cmpuint (0,==,mu_store_count (store, NULL));
@ -151,7 +151,7 @@ test_mu_store_store_msg_remove_and_count (void)
tmpdir = test_mu_common_get_random_tmpdir();
g_assert (tmpdir);
store = mu_store_new_writable (tmpdir, NULL, NULL, FALSE, NULL);
store = mu_store_new_writable (tmpdir, NULL, FALSE, NULL);
g_assert (store);
g_assert_cmpuint (0,==,mu_store_count (store, NULL));