make updates unactivatable when a transaction is running

This commit is contained in:
guinux 2016-04-24 11:06:25 +02:00
parent f0ac44bc4f
commit 47b2c34db3

View File

@ -56,6 +56,8 @@ namespace Pamac {
public Pamac.Transaction transaction; public Pamac.Transaction transaction;
public bool transaction_running;
public UpdaterWindow (Gtk.Application application) { public UpdaterWindow (Gtk.Application application) {
Object (application: application); Object (application: application);
@ -66,6 +68,7 @@ namespace Pamac {
transaction_infobox.visible = false; transaction_infobox.visible = false;
stackswitcher.visible = false; stackswitcher.visible = false;
aur_scrolledwindow.visible = false; aur_scrolledwindow.visible = false;
transaction_running = false;
Timeout.add (100, populate_window); Timeout.add (100, populate_window);
} }
@ -111,6 +114,7 @@ namespace Pamac {
[GtkCallback] [GtkCallback]
void on_repos_select_update_toggled (string path) { void on_repos_select_update_toggled (string path) {
if (!transaction_running) {
Gtk.TreePath treepath = new Gtk.TreePath.from_string (path); Gtk.TreePath treepath = new Gtk.TreePath.from_string (path);
Gtk.TreeIter iter; Gtk.TreeIter iter;
string pkgname; string pkgname;
@ -125,9 +129,11 @@ namespace Pamac {
} }
set_transaction_infobox_visible (); set_transaction_infobox_visible ();
} }
}
[GtkCallback] [GtkCallback]
void on_aur_select_update_toggled (string path) { void on_aur_select_update_toggled (string path) {
if (!transaction_running) {
Gtk.TreePath treepath = new Gtk.TreePath.from_string (path); Gtk.TreePath treepath = new Gtk.TreePath.from_string (path);
Gtk.TreeIter iter; Gtk.TreeIter iter;
string pkgname; string pkgname;
@ -142,6 +148,7 @@ namespace Pamac {
} }
set_transaction_infobox_visible (); set_transaction_infobox_visible ();
} }
}
[GtkCallback] [GtkCallback]
void on_preferences_button_clicked () { void on_preferences_button_clicked () {
@ -152,6 +159,7 @@ namespace Pamac {
[GtkCallback] [GtkCallback]
void on_apply_button_clicked () { void on_apply_button_clicked () {
transaction_running = true;
transaction.sysupgrade (false); transaction.sysupgrade (false);
details_button.visible = true; details_button.visible = true;
cancel_button.visible = true; cancel_button.visible = true;
@ -193,6 +201,7 @@ namespace Pamac {
} }
void populate_updates_list () { void populate_updates_list () {
transaction_running = false;
apply_button.visible = true; apply_button.visible = true;
apply_button.grab_default (); apply_button.grab_default ();
details_button.visible = false; details_button.visible = false;