forked from cromer/pamac-classic
improve transaction cancellation
This commit is contained in:
parent
1315bb265e
commit
70fe12c83c
@ -41,5 +41,5 @@ manager_resources.c: $(MANAGER_GRESOURCE_FILE) $(MANAGER_RESOURCES_FILES)
|
||||
updater_resources.c: $(UPDATER_GRESOURCE_FILE) $(UPDATER_RESOURCES_FILES)
|
||||
glib-compile-resources $(UPDATER_GRESOURCE_FILE) --target=updater_resources.c --generate-source
|
||||
|
||||
installer_resources.c: $(INSTALLER_GRESOURCE_FILE) $(INSTALLER_RESOURCES_FILE)
|
||||
installer_resources.c: $(INSTALLER_GRESOURCE_FILE) $(INSTALLER_RESOURCES_FILES)
|
||||
glib-compile-resources $(INSTALLER_GRESOURCE_FILE) --target=installer_resources.c --generate-source
|
||||
|
@ -398,6 +398,11 @@ namespace Pamac {
|
||||
emit_event (0, 0, {});
|
||||
databases_lock_mutex.lock ();
|
||||
}
|
||||
if (cancellable.is_cancelled ()) {
|
||||
databases_lock_mutex.unlock ();
|
||||
cancellable.reset ();
|
||||
return;
|
||||
}
|
||||
write_log_file ("synchronizing package lists");
|
||||
current_error = ErrorInfos ();
|
||||
int force = (force_refresh) ? 1 : 0;
|
||||
@ -1335,6 +1340,11 @@ namespace Pamac {
|
||||
emit_event (0, 0, {});
|
||||
databases_lock_mutex.lock ();
|
||||
}
|
||||
if (cancellable.is_cancelled ()) {
|
||||
databases_lock_mutex.unlock ();
|
||||
cancellable.reset ();
|
||||
return false;
|
||||
}
|
||||
current_error = ErrorInfos ();
|
||||
cancellable.reset ();
|
||||
if (alpm_handle.trans_init (flags) == -1) {
|
||||
@ -1353,7 +1363,11 @@ namespace Pamac {
|
||||
private void sysupgrade_prepare () {
|
||||
current_error = ErrorInfos ();
|
||||
if (!trans_init (0)) {
|
||||
if (cancellable.is_cancelled ()) {
|
||||
trans_prepare_finished (true);
|
||||
} else {
|
||||
trans_prepare_finished (false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
add_ignorepkgs ();
|
||||
@ -1609,10 +1623,14 @@ namespace Pamac {
|
||||
trans_release ();
|
||||
trans_prepare_finished (false);
|
||||
}
|
||||
} else {
|
||||
if (cancellable.is_cancelled ()) {
|
||||
trans_prepare_finished (true);
|
||||
} else {
|
||||
trans_prepare_finished (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void start_trans_prepare (Alpm.TransFlag flags_,
|
||||
string[] to_install_,
|
||||
|
@ -997,6 +997,7 @@ namespace Pamac {
|
||||
action = dgettext (null, "Checking dependencies") + "...";
|
||||
break;
|
||||
case 3: //Alpm.Event.Type.FILECONFLICTS_START
|
||||
start_transaction ();
|
||||
action = dgettext (null, "Checking file conflicts") + "...";
|
||||
break;
|
||||
case 5: //Alpm.Event.Type.RESOLVEDEPS_START
|
||||
@ -1105,6 +1106,7 @@ namespace Pamac {
|
||||
case 41: //Alpm.Event.Type.HOOK_START
|
||||
switch (secondary_event) {
|
||||
case 1: //Alpm.HookWhen.PRE_TRANSACTION
|
||||
start_transaction ();
|
||||
action = dgettext (null, "Running pre-transaction hooks") + "...";
|
||||
break;
|
||||
case 2: //Alpm.HookWhen.POST_TRANSACTION
|
||||
|
Loading…
Reference in New Issue
Block a user