all braces
This commit is contained in:
parent
12da5c01db
commit
dcbb6b07cd
@ -595,9 +595,10 @@ namespace Pamac {
|
||||
transaction.to_add.insert (pkg.name, pkg.name);
|
||||
}
|
||||
}
|
||||
if (transaction.to_add.size () != 0)
|
||||
if (transaction.to_add.size () != 0) {
|
||||
set_buttons_sensitive (true);
|
||||
}
|
||||
}
|
||||
|
||||
void on_remove_item_activate () {
|
||||
foreach (Pamac.Package pkg in selected_pkgs) {
|
||||
@ -1025,9 +1026,9 @@ namespace Pamac {
|
||||
[GtkCallback]
|
||||
public void on_history_item_activate () {
|
||||
var file = GLib.File.new_for_path ("/var/log/pamac.log");
|
||||
if (!file.query_exists ())
|
||||
if (!file.query_exists ()) {
|
||||
GLib.stderr.printf ("File '%s' doesn't exist.\n", file.get_path ());
|
||||
else {
|
||||
} else {
|
||||
StringBuilder text = new StringBuilder ();
|
||||
try {
|
||||
// Open file for reading and wrap returned FileInputStream into a
|
||||
@ -1045,10 +1046,11 @@ namespace Pamac {
|
||||
history_dialog.textview.buffer.set_text (text.str, (int) text.len);
|
||||
history_dialog.run ();
|
||||
history_dialog.hide ();
|
||||
while (Gtk.events_pending ())
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
public void on_local_item_activate () {
|
||||
@ -1061,8 +1063,9 @@ namespace Pamac {
|
||||
}
|
||||
this.get_window ().set_cursor (new Gdk.Cursor (Gdk.CursorType.WATCH));
|
||||
packages_chooser_dialog.hide ();
|
||||
while (Gtk.events_pending ())
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
transaction.run ();
|
||||
}
|
||||
} else {
|
||||
|
@ -443,8 +443,9 @@ namespace Pamac {
|
||||
}
|
||||
if (err.message == "") {
|
||||
progress_dialog.show ();
|
||||
while (Gtk.events_pending ())
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
try {
|
||||
daemon.start_trans_prepare ();
|
||||
} catch (IOError e) {
|
||||
@ -523,8 +524,9 @@ namespace Pamac {
|
||||
progress_dialog.cancel_button.set_visible (true);
|
||||
progress_dialog.close_button.set_visible (false);
|
||||
progress_dialog.show ();
|
||||
while (Gtk.events_pending ())
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
// run
|
||||
var err = ErrorInfos ();
|
||||
if (to_add.size () == 0
|
||||
@ -549,27 +551,30 @@ namespace Pamac {
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
}
|
||||
if (err.message != "")
|
||||
if (err.message != "") {
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (string name in to_remove.get_keys ()) {
|
||||
try {
|
||||
err = daemon.trans_remove_pkg (name);
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
}
|
||||
if (err.message != "")
|
||||
if (err.message != "") {
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (string path in to_load.get_keys ()) {
|
||||
try {
|
||||
err = daemon.trans_load_pkg (path);
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
}
|
||||
if (err.message != "")
|
||||
if (err.message != "") {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (err.message == "") {
|
||||
try {
|
||||
daemon.start_trans_prepare ();
|
||||
@ -595,8 +600,9 @@ namespace Pamac {
|
||||
choose_provider_dialog.comboboxtext.active = 0;
|
||||
choose_provider_dialog.run ();
|
||||
choose_provider_dialog.hide ();
|
||||
while (Gtk.events_pending ())
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
try {
|
||||
daemon.choose_provider (choose_provider_dialog.comboboxtext.active);
|
||||
} catch (IOError e) {
|
||||
@ -1065,9 +1071,10 @@ namespace Pamac {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
while (Gtk.events_pending ())
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
}
|
||||
|
||||
void on_emit_providers (string depend, string[] providers) {
|
||||
choose_provider (depend, providers);
|
||||
@ -1101,9 +1108,10 @@ namespace Pamac {
|
||||
previous_percent = fraction;
|
||||
progress_dialog.progressbar.set_fraction (fraction);
|
||||
}
|
||||
while (Gtk.events_pending ())
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
}
|
||||
|
||||
void on_emit_download (string filename, uint64 xfered, uint64 total) {
|
||||
string label;
|
||||
@ -1124,24 +1132,27 @@ namespace Pamac {
|
||||
}
|
||||
if (total_download > 0) {
|
||||
fraction = (float) (xfered + already_downloaded) / total_download;
|
||||
if (fraction <= 1)
|
||||
if (fraction <= 1) {
|
||||
textbar = "%s/%s".printf (format_size (xfered + already_downloaded), format_size (total_download));
|
||||
else
|
||||
} else {
|
||||
textbar = "%s".printf (format_size (xfered + already_downloaded));
|
||||
}
|
||||
} else {
|
||||
fraction = (float) xfered / total;
|
||||
if (fraction <= 1)
|
||||
if (fraction <= 1) {
|
||||
textbar = "%s/%s".printf (format_size (xfered), format_size (total));
|
||||
else
|
||||
} else {
|
||||
textbar = "%s".printf (format_size (xfered));
|
||||
}
|
||||
}
|
||||
if (fraction > 0) {
|
||||
if (fraction != previous_percent) {
|
||||
previous_percent = fraction;
|
||||
progress_dialog.progressbar.set_fraction (fraction);
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
progress_dialog.progressbar.set_fraction (0);
|
||||
}
|
||||
if (textbar != previous_textbar) {
|
||||
previous_textbar = textbar;
|
||||
progress_dialog.progressbar.set_text (textbar);
|
||||
@ -1161,18 +1172,20 @@ namespace Pamac {
|
||||
string? line = null;
|
||||
Gtk.TextIter end_iter;
|
||||
if ((Alpm.LogLevel) level == Alpm.LogLevel.WARNING) {
|
||||
if (previous_filename != "")
|
||||
if (previous_filename != "") {
|
||||
line = dgettext (null, "Warning") + ": " + previous_filename + ": " + msg;
|
||||
else
|
||||
} else {
|
||||
line = dgettext (null, "Warning") + ": " + msg;
|
||||
}
|
||||
transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
|
||||
transaction_info_dialog.textbuffer.insert (ref end_iter, msg, msg.length);
|
||||
} else if ((Alpm.LogLevel) level == Alpm.LogLevel.ERROR) {
|
||||
if (previous_filename != "")
|
||||
if (previous_filename != "") {
|
||||
line = dgettext (null, "Error") + ": " + previous_filename + ": " + msg;
|
||||
else
|
||||
} else {
|
||||
line = dgettext (null, "Error") + ": " + msg;
|
||||
}
|
||||
}
|
||||
if (line != null) {
|
||||
progress_dialog.expander.set_expanded (true);
|
||||
spawn_in_term ({"echo", "-n", line});
|
||||
@ -1187,8 +1200,9 @@ namespace Pamac {
|
||||
transaction_info_dialog.expander.set_expanded (true);
|
||||
transaction_info_dialog.run ();
|
||||
transaction_info_dialog.hide ();
|
||||
while (Gtk.events_pending ())
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
Gtk.TextIter start_iter;
|
||||
Gtk.TextIter end_iter;
|
||||
transaction_info_dialog.textbuffer.get_start_iter (out start_iter);
|
||||
@ -1218,8 +1232,9 @@ namespace Pamac {
|
||||
transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
|
||||
transaction_info_dialog.textbuffer.insert (ref end_iter, str, str.length);
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
transaction_info_dialog.expander.set_visible (false);
|
||||
}
|
||||
spawn_in_term ({"echo"});
|
||||
transaction_info_dialog.run ();
|
||||
transaction_info_dialog.hide ();
|
||||
@ -1227,9 +1242,10 @@ namespace Pamac {
|
||||
transaction_info_dialog.textbuffer.get_start_iter (out start_iter);
|
||||
transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
|
||||
transaction_info_dialog.textbuffer.delete (ref start_iter, ref end_iter);
|
||||
while (Gtk.events_pending ())
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
}
|
||||
|
||||
public void on_refresh_finished (ErrorInfos error) {
|
||||
if (error.message == "") {
|
||||
@ -1261,20 +1277,23 @@ namespace Pamac {
|
||||
} else if (type != 0) {
|
||||
if (transaction_sum_dialog.run () == Gtk.ResponseType.OK) {
|
||||
transaction_sum_dialog.hide ();
|
||||
while (Gtk.events_pending ())
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
if (type == TransactionType.BUILD) {
|
||||
// there only AUR packages to build
|
||||
var err = ErrorInfos ();
|
||||
on_trans_commit_finished (err);
|
||||
} else
|
||||
} else {
|
||||
start_commit ();
|
||||
}
|
||||
} else {
|
||||
spawn_in_term ({"echo", dgettext (null, "Transaction cancelled") + ".\n"});
|
||||
progress_dialog.hide ();
|
||||
transaction_sum_dialog.hide ();
|
||||
while (Gtk.events_pending ())
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
release ();
|
||||
to_build.steal_all ();
|
||||
sysupgrade_after_trans = false;
|
||||
@ -1286,8 +1305,9 @@ namespace Pamac {
|
||||
//err.message = dgettext (null, "Nothing to do") + "\n";
|
||||
spawn_in_term ({"echo", dgettext (null, "Nothing to do") + ".\n"});
|
||||
progress_dialog.hide ();
|
||||
while (Gtk.events_pending ())
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
release ();
|
||||
clear_lists ();
|
||||
finished (false);
|
||||
|
Loading…
Reference in New Issue
Block a user