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