This commit is contained in:
guinux 2017-09-09 09:43:18 +02:00
parent c524d1fde3
commit 282aedada1
4 changed files with 28 additions and 5 deletions

View File

@ -50,11 +50,13 @@ namespace Pamac {
important_details = false;
// integrate progress box and term widget
progress_dialog = new ProgressDialog ();
transaction = new Pamac.Transaction (progress_dialog as Gtk.ApplicationWindow);
transaction = new Transaction (progress_dialog as Gtk.ApplicationWindow);
transaction.mode = Transaction.Mode.INSTALLER;
transaction.finished.connect (on_transaction_finished);
transaction.important_details_outpout.connect (on_important_details_outpout);
progress_dialog.box.pack_start (transaction.progress_box);
progress_dialog.box.reorder_child (transaction.progress_box, 0);
transaction.term_window.height_request = 200;
progress_dialog.expander.add (transaction.term_window);
progress_dialog.close_button.clicked.connect (on_close_button_clicked);
progress_dialog.close_button.visible = false;

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const string VERSION = "5.1.0";
const string VERSION = "5.1.1";
namespace Pamac {

View File

@ -379,6 +379,7 @@ namespace Pamac {
} catch (Error e) {
stderr.printf ("Error: %s\n", e.message);
}
refresh_handle ();
generate_mirrors_list_finished ();
}

View File

@ -102,9 +102,15 @@ namespace Pamac {
BUILD = (1 << 2)
}
public enum Mode {
MANAGER,
INSTALLER
}
UserDaemon user_daemon;
SystemDaemon system_daemon;
public Mode mode;
Pamac.Config pamac_config;
public bool check_aur_updates { get { return pamac_config.check_aur_updates; } }
public bool enable_aur { get { return pamac_config.enable_aur; } }
@ -173,6 +179,7 @@ namespace Pamac {
public signal void get_updates_finished (Updates updates);
public Transaction (Gtk.ApplicationWindow? application_window) {
mode = Mode.MANAGER;
pamac_config = new Pamac.Config ("/etc/pamac.conf");
flags = (1 << 4); //Alpm.TransFlag.CASCADE
if (pamac_config.recurse) {
@ -214,8 +221,6 @@ namespace Pamac {
term_window = new Gtk.ScrolledWindow (null, term.vadjustment);
term_window.expand = true;
term_window.visible = true;
// height 200 needed for installer
term_window.height_request = 200;
term_window.propagate_natural_height = true;
term_window.add (term);
build_cancellable = new Cancellable ();
@ -1030,6 +1035,20 @@ namespace Pamac {
}
if (summary.to_upgrade.length > 0) {
type |= Type.UPDATE;
if (mode == Mode.INSTALLER) {
foreach (unowned UpdateInfos infos in summary.to_upgrade) {
dsize += infos.download_size;
transaction_summary.add (infos.name);
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
1, infos.name,
2, infos.new_version,
3, "(%s)".printf (infos.old_version));
}
Gtk.TreePath path = transaction_sum_dialog.sum_list.get_path (iter);
int pos = (path.get_indices ()[0]) - (summary.to_upgrade.length - 1);
transaction_sum_dialog.sum_list.get_iter (out iter, new Gtk.TreePath.from_indices (pos));
transaction_sum_dialog.sum_list.set (iter, 0, "<b>%s</b>".printf (dgettext (null, "To upgrade") + ":"));
}
}
if (dsize == 0) {
transaction_sum_dialog.top_label.visible = false;
@ -1604,7 +1623,7 @@ namespace Pamac {
if (success) {
show_warnings ();
Type type = set_transaction_sum ();
if (no_confirm_commit || type == Type.UPDATE) {
if (mode != Mode.INSTALLER && (no_confirm_commit || type == Type.UPDATE)) {
// no_confirm_commit or only updates
to_install.remove_all ();
start_commit ();
@ -1755,6 +1774,7 @@ namespace Pamac {
}
void on_generate_mirrors_list_finished () {
refresh_handle ();
system_daemon.generate_mirrors_list_data.disconnect (on_generate_mirrors_list_data);
system_daemon.generate_mirrors_list_finished.disconnect (on_generate_mirrors_list_finished);
reset_progress_box ("");