forked from cromer/pamac-classic
fix #141
This commit is contained in:
parent
2285ad17fd
commit
7af6ee34f0
@ -78,7 +78,7 @@ namespace Pamac {
|
|||||||
bool populate_window () {
|
bool populate_window () {
|
||||||
this.get_window ().set_cursor (new Gdk.Cursor.for_display (Gdk.Display.get_default (), Gdk.CursorType.WATCH));
|
this.get_window ().set_cursor (new Gdk.Cursor.for_display (Gdk.Display.get_default (), Gdk.CursorType.WATCH));
|
||||||
|
|
||||||
repos_updates_list = new Gtk.ListStore (6, typeof (bool), typeof (string), typeof (string), typeof (string),typeof (string), typeof (string));
|
repos_updates_list = new Gtk.ListStore (7, typeof (bool), typeof (string), typeof (string), typeof (string),typeof (string), typeof (string), typeof (uint64));
|
||||||
repos_updates_treeview.set_model (repos_updates_list);
|
repos_updates_treeview.set_model (repos_updates_list);
|
||||||
aur_updates_list = new Gtk.ListStore (4, typeof (bool), typeof (string), typeof (string), typeof (string));
|
aur_updates_list = new Gtk.ListStore (4, typeof (bool), typeof (string), typeof (string), typeof (string));
|
||||||
aur_updates_treeview.set_model (aur_updates_list);
|
aur_updates_treeview.set_model (aur_updates_list);
|
||||||
@ -103,22 +103,32 @@ namespace Pamac {
|
|||||||
|
|
||||||
void set_transaction_infobox_visible () {
|
void set_transaction_infobox_visible () {
|
||||||
bool visible = false;
|
bool visible = false;
|
||||||
|
uint64 total_dsize = 0;
|
||||||
repos_updates_list.foreach ((model, path, iter) => {
|
repos_updates_list.foreach ((model, path, iter) => {
|
||||||
bool selected;
|
bool selected;
|
||||||
repos_updates_list.get (iter, 0, out selected);
|
uint64 dsize;
|
||||||
visible = selected;
|
repos_updates_list.get (iter, 0, out selected, 6, out dsize);
|
||||||
return visible;
|
visible |= selected;
|
||||||
|
if (selected) {
|
||||||
|
total_dsize += dsize;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
aur_updates_list.foreach ((model, path, iter) => {
|
aur_updates_list.foreach ((model, path, iter) => {
|
||||||
bool selected;
|
bool selected;
|
||||||
aur_updates_list.get (iter, 0, out selected);
|
aur_updates_list.get (iter, 0, out selected);
|
||||||
visible = selected;
|
visible |= selected;
|
||||||
return visible;
|
return visible;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
transaction_infobox.visible = visible;
|
transaction_infobox.visible = visible;
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
if (total_dsize != 0) {
|
||||||
|
transaction.progress_box.action_label.set_markup("<b>%s: %s</b>".printf (dgettext (null, "Total download size"), format_size (total_dsize)));
|
||||||
|
} else {
|
||||||
|
transaction.progress_box.action_label.label = "";
|
||||||
|
}
|
||||||
// fix an possible visibility issue
|
// fix an possible visibility issue
|
||||||
transaction_infobox.show_all ();
|
transaction_infobox.show_all ();
|
||||||
}
|
}
|
||||||
@ -261,12 +271,10 @@ namespace Pamac {
|
|||||||
repos_scrolledwindow.visible = true;
|
repos_scrolledwindow.visible = true;
|
||||||
aur_updates_list.clear ();
|
aur_updates_list.clear ();
|
||||||
aur_scrolledwindow.visible = false;
|
aur_scrolledwindow.visible = false;
|
||||||
uint64 dsize = 0;
|
|
||||||
uint repos_updates_nb = 0;
|
uint repos_updates_nb = 0;
|
||||||
uint aur_updates_nb = 0;
|
uint aur_updates_nb = 0;
|
||||||
foreach (unowned UpdateInfos infos in updates.repos_updates) {
|
foreach (unowned UpdateInfos infos in updates.repos_updates) {
|
||||||
string size = infos.download_size != 0 ? format_size (infos.download_size) : "";
|
string size = infos.download_size != 0 ? format_size (infos.download_size) : "";
|
||||||
dsize += infos.download_size;
|
|
||||||
repos_updates_nb++;
|
repos_updates_nb++;
|
||||||
repos_updates_list.insert_with_values (null, -1,
|
repos_updates_list.insert_with_values (null, -1,
|
||||||
0, !transaction.temporary_ignorepkgs.contains (infos.name),
|
0, !transaction.temporary_ignorepkgs.contains (infos.name),
|
||||||
@ -274,7 +282,8 @@ namespace Pamac {
|
|||||||
2, infos.new_version,
|
2, infos.new_version,
|
||||||
3, "(%s)".printf (infos.old_version),
|
3, "(%s)".printf (infos.old_version),
|
||||||
4, infos.repo,
|
4, infos.repo,
|
||||||
5, size);
|
5, size,
|
||||||
|
6, infos.download_size);
|
||||||
}
|
}
|
||||||
foreach (unowned UpdateInfos infos in updates.aur_updates) {
|
foreach (unowned UpdateInfos infos in updates.aur_updates) {
|
||||||
aur_updates_nb++;
|
aur_updates_nb++;
|
||||||
@ -291,11 +300,6 @@ namespace Pamac {
|
|||||||
headerbar.title = dngettext (null, "%u available update", "%u available updates", updates_nb).printf (updates_nb);
|
headerbar.title = dngettext (null, "%u available update", "%u available updates", updates_nb).printf (updates_nb);
|
||||||
}
|
}
|
||||||
set_transaction_infobox_visible ();
|
set_transaction_infobox_visible ();
|
||||||
if (dsize != 0) {
|
|
||||||
transaction.progress_box.action_label.set_markup("<b>%s: %s</b>".printf (dgettext (null, "Total download size"), format_size(dsize)));
|
|
||||||
} else {
|
|
||||||
transaction.progress_box.action_label.label = "";
|
|
||||||
}
|
|
||||||
if (aur_updates_nb != 0) {
|
if (aur_updates_nb != 0) {
|
||||||
aur_scrolledwindow.visible = true;
|
aur_scrolledwindow.visible = true;
|
||||||
if (repos_updates_nb == 0) {
|
if (repos_updates_nb == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user