mu: don't need a path argument for index

We get it from the store.
This commit is contained in:
Dirk-Jan C. Binnema 2020-01-20 12:32:29 +02:00
parent 232f370936
commit bb932fa217
3 changed files with 13 additions and 11 deletions

View File

@ -331,18 +331,19 @@ mu_index_set_max_msg_size (MuIndex *index, guint max_size)
MuError
mu_index_run (MuIndex *index, const char *path,
gboolean reindex, gboolean lazycheck,
mu_index_run (MuIndex *index, gboolean reindex, gboolean lazycheck,
MuIndexStats *stats,
MuIndexMsgCallback msg_cb, MuIndexDirCallback dir_cb,
void *user_data)
{
MuIndexCallbackData cb_data;
MuError rv;
MuIndexCallbackData cb_data;
MuError rv;
const char *path;
g_return_val_if_fail (index && index->_store, MU_ERROR);
g_return_val_if_fail (msg_cb, MU_ERROR);
path = mu_store_maildir (index->_store);
if (!check_path (path))
return MU_ERROR;
@ -390,15 +391,17 @@ on_stats_maildir_file (const char *fullpath, const char *mdir,
MuError
mu_index_stats (MuIndex *index, const char *path,
mu_index_stats (MuIndex *index,
MuIndexStats *stats, MuIndexMsgCallback cb_msg,
MuIndexDirCallback cb_dir, void *user_data)
{
MuIndexCallbackData cb_data;
const char *path;
MuIndexCallbackData cb_data;
g_return_val_if_fail (index, MU_ERROR);
g_return_val_if_fail (cb_msg, MU_ERROR);
path = mu_store_maildir (index->_store);
if (!check_path (path))
return MU_ERROR;

View File

@ -106,7 +106,6 @@ typedef MuError (*MuIndexDirCallback) (const char* path, gboolean enter,
* start the indexing process
*
* @param index a valid MuIndex instance
* @param path the path to index. This must be an absolute path
* @param force if != 0, force re-indexing already index messages; this is
* obviously a lot slower than only indexing new/changed messages
* @param lazycheck whether ignore subdirectoryies that have up-to-date
@ -123,7 +122,7 @@ typedef MuError (*MuIndexDirCallback) (const char* path, gboolean enter,
* MU_STOP if the user stopped or MU_ERROR in
* case of some error.
*/
MuError mu_index_run (MuIndex *index, const char *path, gboolean force,
MuError mu_index_run (MuIndex *index, gboolean force,
gboolean lazycheck, MuIndexStats *stats,
MuIndexMsgCallback msg_cb,
MuIndexDirCallback dir_cb, void *user_data);
@ -135,7 +134,6 @@ MuError mu_index_run (MuIndex *index, const char *path, gboolean force,
* mu_index_run sees, when there are updates in the Maildir
*
* @param index a valid MuIndex instance
* @param path the path to get stats for; this must be an absolute path
* @param stats a structure with some statistics about the results;
* note that this function does *not* reset the struct values to allow
* for cumulative stats from multiple calls. If needed, you can use
@ -148,7 +146,7 @@ MuError mu_index_run (MuIndex *index, const char *path, gboolean force,
* MU_STOP if the user stopped or MU_ERROR in
* case of some error.
*/
MuError mu_index_stats (MuIndex *index, const char *path, MuIndexStats *stats,
MuError mu_index_stats (MuIndex *index, MuIndexStats *stats,
MuIndexMsgCallback msg_cb, MuIndexDirCallback dir_cb,
void *user_data);

View File

@ -305,7 +305,8 @@ cmd_index (MuIndex *midx, MuConfig *opts, MuIndexStats *stats, GError **err)
newline_before_on();
rv = mu_index_run (midx, opts->maildir, opts->rebuild,
rv = mu_index_run (midx,
opts->rebuild,
opts->lazycheck, stats,
show_progress ?
(MuIndexMsgCallback)index_msg_cb :