[client] Fix sync noitification pop-up problem.

This commit is contained in:
Jiaqiang Xu 2014-08-04 14:00:11 +08:00
parent 64526c4e14
commit 759efd3545
2 changed files with 16 additions and 6 deletions

View File

@ -375,11 +375,18 @@ transition_sync_state (SyncTask *task, int new_state)
sync_state_str[new_state]);
}
if ((task->state == SYNC_STATE_MERGE || task->state == SYNC_STATE_UPLOAD) &&
new_state == SYNC_STATE_DONE &&
need_notify_sync(task->repo))
{
notify_sync (task->repo);
if (!task->server_side_merge) {
if ((task->state == SYNC_STATE_MERGE ||
task->state == SYNC_STATE_UPLOAD) &&
new_state == SYNC_STATE_DONE &&
need_notify_sync(task->repo))
notify_sync (task->repo);
} else {
if (((task->state == SYNC_STATE_INIT && task->uploaded) ||
task->state == SYNC_STATE_FETCH) &&
new_state == SYNC_STATE_DONE &&
need_notify_sync(task->repo))
notify_sync (task->repo);
}
task->state = new_state;
@ -1798,8 +1805,10 @@ on_repo_uploaded (SeafileSession *seaf,
task->repo->head->commit_id);
if (!task->server_side_merge)
transition_sync_state (task, SYNC_STATE_DONE);
else
else {
task->uploaded = TRUE;
start_sync_repo_proc (manager, task);
}
} else if (tx_task->state == TASK_STATE_CANCELED) {
transition_sync_state (task, SYNC_STATE_CANCELED);
} else if (tx_task->state == TASK_STATE_ERROR) {

View File

@ -78,6 +78,7 @@ struct _SyncTask {
struct CcnetTimer *commit_timer;
gboolean server_side_merge;
gboolean uploaded;
SeafRepo *repo; /* for convenience, only valid when in_sync. */
};