real update .files db in background

This commit is contained in:
guinux 2017-08-08 11:06:37 +02:00
parent c06def8405
commit 9c6c435b05
2 changed files with 20 additions and 15 deletions

View File

@ -141,8 +141,8 @@ namespace Pamac {
(alpm_action) => { (alpm_action) => {
alpm_action.run (); alpm_action.run ();
}, },
// only one thread created so alpm action will run one after one // two threads at a time
1, 2,
// no exclusive thread // no exclusive thread
false false
); );

View File

@ -456,19 +456,24 @@ namespace Pamac {
} }
public void start_refresh (bool force) { public void start_refresh (bool force) {
string action = dgettext (null, "Synchronizing package databases") + "..."; check_authorization.begin ((obj, res) => {
reset_progress_box (action); bool authorized = check_authorization.end (res);
connecting_system_daemon (); if (authorized) {
connecting_dbus_signals (); string action = dgettext (null, "Synchronizing package databases") + "...";
try { reset_progress_box (action);
system_daemon.refresh_finished.connect (on_refresh_finished); connecting_system_daemon ();
system_daemon.start_refresh (force); connecting_dbus_signals ();
} catch (IOError e) { try {
stderr.printf ("IOError: %s\n", e.message); system_daemon.refresh_finished.connect (on_refresh_finished);
system_daemon.refresh_finished.disconnect (on_refresh_finished); system_daemon.start_refresh (force);
success = false; } catch (IOError e) {
finish_transaction (); stderr.printf ("IOError: %s\n", e.message);
} system_daemon.refresh_finished.disconnect (on_refresh_finished);
success = false;
finish_transaction ();
}
}
});
} }
public void refresh_handle () { public void refresh_handle () {