This commit is contained in:
guinux 2015-03-11 19:42:04 +01:00
parent 68c8820f3b
commit 847a6bc559
2 changed files with 23 additions and 5 deletions

View File

@ -38,6 +38,7 @@ namespace Pamac {
private HashTable<string, Json.Array> aur_results; private HashTable<string, Json.Array> aur_results;
private UpdateInfos[] aur_updates; private UpdateInfos[] aur_updates;
private bool aur_updates_checked; private bool aur_updates_checked;
private bool locked;
public signal void emit_event (uint primary_event, uint secondary_event, string[] details); public signal void emit_event (uint primary_event, uint secondary_event, string[] details);
public signal void emit_providers (string depend, string[] providers); public signal void emit_providers (string depend, string[] providers);
@ -61,6 +62,8 @@ namespace Pamac {
databases_lock_mutex = Mutex (); databases_lock_mutex = Mutex ();
aur_results = new HashTable<string, Json.Array> (str_hash, str_equal); aur_results = new HashTable<string, Json.Array> (str_hash, str_equal);
aur_updates_checked = false; aur_updates_checked = false;
locked = false;
Timeout.add (500, check_pacman_running);
refresh_handle (); refresh_handle ();
} }
@ -81,6 +84,21 @@ namespace Pamac {
previous_percent = 0; previous_percent = 0;
} }
private bool check_pacman_running () {
var lockfile = File.new_for_path ("/var/lib/pacman/db.lck");
if (locked) {
if (lockfile.query_exists () == false) {
locked = false;
refresh_handle ();
}
} else {
if (lockfile.query_exists () == true) {
locked = true;
}
}
return true;
}
public void start_write_pamac_config (HashTable<string,Variant> new_pamac_conf, GLib.BusName sender) { public void start_write_pamac_config (HashTable<string,Variant> new_pamac_conf, GLib.BusName sender) {
var pamac_config = new Pamac.Config ("/etc/pamac.conf"); var pamac_config = new Pamac.Config ("/etc/pamac.conf");
try { try {
@ -289,7 +307,6 @@ namespace Pamac {
public void start_refresh (int force, bool emit_finish_signal) { public void start_refresh (int force, bool emit_finish_signal) {
refresh.begin (force, (obj, res) => { refresh.begin (force, (obj, res) => {
var err = refresh.end (res); var err = refresh.end (res);
refresh_handle ();
if (emit_finish_signal) { if (emit_finish_signal) {
refresh_finished (err); refresh_finished (err);
} }
@ -1033,7 +1050,6 @@ namespace Pamac {
public void start_trans_commit (GLib.BusName sender) { public void start_trans_commit (GLib.BusName sender) {
trans_commit.begin (sender, (obj, res) => { trans_commit.begin (sender, (obj, res) => {
var err = trans_commit.end (res); var err = trans_commit.end (res);
refresh_handle ();
aur_updates_checked = false; aur_updates_checked = false;
trans_commit_finished (err); trans_commit_finished (err);
}); });

View File

@ -1319,13 +1319,15 @@ namespace Pamac {
//} else if (sysupgrade_after_build) { //} else if (sysupgrade_after_build) {
//sysupgrade_simple (enable_downgrade); //sysupgrade_simple (enable_downgrade);
} else { } else {
if (build_status == 0) if (build_status == 0) {
spawn_in_term ({"echo", dgettext (null, "Transaction successfully finished") + ".\n"}); spawn_in_term ({"echo", dgettext (null, "Transaction successfully finished") + ".\n"});
else } else {
spawn_in_term ({"echo"}); spawn_in_term ({"echo"});
}
progress_dialog.hide (); progress_dialog.hide ();
while (Gtk.events_pending ()) while (Gtk.events_pending ()) {
Gtk.main_iteration (); Gtk.main_iteration ();
}
finished (false); finished (false);
} }
} }