some fixes

This commit is contained in:
guinux 2017-07-31 14:15:36 +02:00
parent 7eb72e5ef7
commit 4a370af658
2 changed files with 60 additions and 49 deletions

View File

@ -1871,6 +1871,7 @@ namespace Pamac {
transaction_running = true;
apply_button.sensitive = false;
cancel_button.sensitive = false;
transaction_infobox.show_all ();
transaction.run ();
}
@ -1925,10 +1926,10 @@ namespace Pamac {
void run_refresh () {
this.get_window ().set_cursor (new Gdk.Cursor.for_display (Gdk.Display.get_default (), Gdk.CursorType.WATCH));
transaction.start_refresh (force_refresh);
apply_button.sensitive = false;
cancel_button.sensitive = true;
transaction_infobox.show_all ();
transaction.start_refresh (force_refresh);
}
void on_get_updates_finished (Updates updates) {

View File

@ -104,6 +104,8 @@ namespace Pamac {
timer = new Timer ();
lock_id = new BusName ("");
refresh_handle ();
check_old_lock ();
check_extern_lock ();
Timeout.add (500, check_extern_lock);
create_thread_pool ();
cancellable = new Cancellable ();
@ -175,17 +177,8 @@ namespace Pamac {
}
}
private bool check_extern_lock () {
if (lock_id == "extern") {
if (!lockfile.query_exists ()) {
lock_id = new BusName ("");
refresh_handle ();
}
} else {
private void check_old_lock () {
if (lockfile.query_exists ()) {
if (lock_id == "") {
// An extern lock appears, check if it is not a too old lock.
lock_id = new BusName ("extern");
int exit_status;
string output;
uint64 lockfile_time;
@ -235,6 +228,20 @@ namespace Pamac {
}
}
}
private bool check_extern_lock () {
if (lock_id == "extern") {
if (!lockfile.query_exists ()) {
lock_id = new BusName ("");
refresh_handle ();
}
} else {
if (lockfile.query_exists ()) {
if (lock_id == "") {
// An extern lock appears
lock_id = new BusName ("extern");
}
}
}
return true;
}
@ -490,6 +497,7 @@ namespace Pamac {
public void start_refresh (bool force, GLib.BusName sender) {
if (lock_id != sender) {
refresh_finished (false);
return;
}
force_refresh = force;
@ -874,6 +882,7 @@ namespace Pamac {
public void start_sysupgrade_prepare (bool enable_downgrade_, string[] temporary_ignorepkgs_, GLib.BusName sender) {
if (lock_id != sender) {
trans_prepare_finished (false);
return;
}
enable_downgrade = enable_downgrade_;
@ -1328,6 +1337,7 @@ namespace Pamac {
string[] to_build_,
GLib.BusName sender) {
if (lock_id != sender) {
trans_prepare_finished (false);
return;
}
flags = flags_;