forked from cromer/pamac-classic
little code improvements
This commit is contained in:
parent
16453a214d
commit
db57dfe8e5
@ -38,10 +38,10 @@ namespace Pamac {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public struct ErrorInfos {
|
public struct ErrorInfos {
|
||||||
public string str;
|
public string message;
|
||||||
public string[] details;
|
public string[] details;
|
||||||
public ErrorInfos () {
|
public ErrorInfos () {
|
||||||
str = "";
|
message = "";
|
||||||
details = {};
|
details = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,8 +68,8 @@ namespace Pamac {
|
|||||||
private void refresh_handle () {
|
private void refresh_handle () {
|
||||||
alpm_config.get_handle ();
|
alpm_config.get_handle ();
|
||||||
if (alpm_config.handle == null) {
|
if (alpm_config.handle == null) {
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
err.str = _("Failed to initialize alpm library");
|
err.message = _("Failed to initialize alpm library");
|
||||||
trans_commit_finished (err);
|
trans_commit_finished (err);
|
||||||
} else {
|
} else {
|
||||||
alpm_config.handle.eventcb = (EventCallBack) cb_event;
|
alpm_config.handle.eventcb = (EventCallBack) cb_event;
|
||||||
@ -256,7 +256,7 @@ namespace Pamac {
|
|||||||
|
|
||||||
private async ErrorInfos refresh (int force) {
|
private async ErrorInfos refresh (int force) {
|
||||||
SourceFunc callback = refresh.callback;
|
SourceFunc callback = refresh.callback;
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
try {
|
try {
|
||||||
new Thread<int>.try ("refresh thread", () => {
|
new Thread<int>.try ("refresh thread", () => {
|
||||||
databases_lock_mutex.lock ();
|
databases_lock_mutex.lock ();
|
||||||
@ -272,7 +272,7 @@ namespace Pamac {
|
|||||||
// We should always succeed if at least one DB was upgraded - we may possibly
|
// We should always succeed if at least one DB was upgraded - we may possibly
|
||||||
// fail later with unresolved deps, but that should be rare, and would be expected
|
// fail later with unresolved deps, but that should be rare, and would be expected
|
||||||
if (success == 0) {
|
if (success == 0) {
|
||||||
err.str = _("Failed to synchronize any databases");
|
err.message = _("Failed to synchronize any databases");
|
||||||
details += Alpm.strerror (alpm_config.handle.errno ());
|
details += Alpm.strerror (alpm_config.handle.errno ());
|
||||||
err.details = details;
|
err.details = details;
|
||||||
}
|
}
|
||||||
@ -387,7 +387,7 @@ namespace Pamac {
|
|||||||
return Pamac.Package (get_syncpkg (pkgname), null);
|
return Pamac.Package (get_syncpkg (pkgname), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Pamac.Package[] search_pkgs (string search_string, bool search_aur) {
|
public async Pamac.Package[] search_pkgs (string search_string, bool search_from_aur) {
|
||||||
Pamac.Package[] result = {};
|
Pamac.Package[] result = {};
|
||||||
var needles = new Alpm.List<string> ();
|
var needles = new Alpm.List<string> ();
|
||||||
string[] splitted = search_string.split (" ");
|
string[] splitted = search_string.split (" ");
|
||||||
@ -398,7 +398,7 @@ namespace Pamac {
|
|||||||
foreach (var alpm_pkg in alpm_pkgs) {
|
foreach (var alpm_pkg in alpm_pkgs) {
|
||||||
result += Pamac.Package (alpm_pkg, null);
|
result += Pamac.Package (alpm_pkg, null);
|
||||||
}
|
}
|
||||||
if (search_aur) {
|
if (search_from_aur) {
|
||||||
Json.Array aur_pkgs;
|
Json.Array aur_pkgs;
|
||||||
if (aur_results.contains (search_string)) {
|
if (aur_results.contains (search_string)) {
|
||||||
aur_pkgs = aur_results.get (search_string);
|
aur_pkgs = aur_results.get (search_string);
|
||||||
@ -462,9 +462,9 @@ namespace Pamac {
|
|||||||
return groups_names;
|
return groups_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Pamac.Package[] get_group_pkgs (string group_name) {
|
public async Pamac.Package[] get_group_pkgs (string groupname) {
|
||||||
Pamac.Package[] pkgs = {};
|
Pamac.Package[] pkgs = {};
|
||||||
var alpm_pkgs = group_pkgs (alpm_config.handle, group_name);
|
var alpm_pkgs = group_pkgs (alpm_config.handle, groupname);
|
||||||
foreach (var alpm_pkg in alpm_pkgs) {
|
foreach (var alpm_pkg in alpm_pkgs) {
|
||||||
pkgs += Pamac.Package (alpm_pkg, null);
|
pkgs += Pamac.Package (alpm_pkg, null);
|
||||||
}
|
}
|
||||||
@ -585,8 +585,7 @@ namespace Pamac {
|
|||||||
return deps;
|
return deps;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Updates get_updates () {
|
public async Updates get_updates (bool enable_aur) {
|
||||||
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
|
|
||||||
var infos = UpdateInfos ();
|
var infos = UpdateInfos ();
|
||||||
UpdateInfos[] updates_infos = {};
|
UpdateInfos[] updates_infos = {};
|
||||||
var updates = Updates ();
|
var updates = Updates ();
|
||||||
@ -625,7 +624,7 @@ namespace Pamac {
|
|||||||
infos.download_size = candidate.download_size;
|
infos.download_size = candidate.download_size;
|
||||||
updates_infos += infos;
|
updates_infos += infos;
|
||||||
} else {
|
} else {
|
||||||
if (pamac_config.enable_aur) {
|
if (enable_aur) {
|
||||||
// check if it is a local pkg
|
// check if it is a local pkg
|
||||||
foreach (var db in alpm_config.handle.syncdbs) {
|
foreach (var db in alpm_config.handle.syncdbs) {
|
||||||
pkg = Alpm.find_satisfier (db.pkgcache, local_pkg.name);
|
pkg = Alpm.find_satisfier (db.pkgcache, local_pkg.name);
|
||||||
@ -642,7 +641,7 @@ namespace Pamac {
|
|||||||
}
|
}
|
||||||
updates.is_syncfirst = false;
|
updates.is_syncfirst = false;
|
||||||
updates.repos_updates = updates_infos;
|
updates.repos_updates = updates_infos;
|
||||||
if (pamac_config.enable_aur) {
|
if (enable_aur) {
|
||||||
if (aur_updates_checked == false) {
|
if (aur_updates_checked == false) {
|
||||||
// get aur updates
|
// get aur updates
|
||||||
updates_infos = {};
|
updates_infos = {};
|
||||||
@ -675,11 +674,11 @@ namespace Pamac {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ErrorInfos trans_init (TransFlag transflags) {
|
public ErrorInfos trans_init (TransFlag transflags) {
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
string[] details = {};
|
string[] details = {};
|
||||||
int ret = alpm_config.handle.trans_init (transflags);
|
int ret = alpm_config.handle.trans_init (transflags);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
err.str = _("Failed to init transaction");
|
err.message = _("Failed to init transaction");
|
||||||
details += Alpm.strerror (alpm_config.handle.errno ());
|
details += Alpm.strerror (alpm_config.handle.errno ());
|
||||||
err.details = details;
|
err.details = details;
|
||||||
}
|
}
|
||||||
@ -687,11 +686,11 @@ namespace Pamac {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ErrorInfos trans_sysupgrade (int enable_downgrade) {
|
public ErrorInfos trans_sysupgrade (int enable_downgrade) {
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
string[] details = {};
|
string[] details = {};
|
||||||
int ret = alpm_config.handle.trans_sysupgrade (enable_downgrade);
|
int ret = alpm_config.handle.trans_sysupgrade (enable_downgrade);
|
||||||
if (ret == -1) {;
|
if (ret == -1) {;
|
||||||
err.str = _("Failed to prepare transaction");
|
err.message = _("Failed to prepare transaction");
|
||||||
details += Alpm.strerror (alpm_config.handle.errno ());
|
details += Alpm.strerror (alpm_config.handle.errno ());
|
||||||
err.details = details;
|
err.details = details;
|
||||||
}
|
}
|
||||||
@ -699,7 +698,7 @@ namespace Pamac {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ErrorInfos trans_add_pkg_real (Alpm.Package pkg) {
|
private ErrorInfos trans_add_pkg_real (Alpm.Package pkg) {
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
string[] details = {};
|
string[] details = {};
|
||||||
int ret = alpm_config.handle.trans_add_pkg (pkg);
|
int ret = alpm_config.handle.trans_add_pkg (pkg);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
@ -708,7 +707,7 @@ namespace Pamac {
|
|||||||
// just skip duplicate or ignored targets
|
// just skip duplicate or ignored targets
|
||||||
return err;
|
return err;
|
||||||
} else {
|
} else {
|
||||||
err.str = _("Failed to prepare transaction");
|
err.message = _("Failed to prepare transaction");
|
||||||
details += "%s: %s".printf (pkg.name, Alpm.strerror (errno));
|
details += "%s: %s".printf (pkg.name, Alpm.strerror (errno));
|
||||||
err.details = details;
|
err.details = details;
|
||||||
return err;
|
return err;
|
||||||
@ -718,17 +717,17 @@ namespace Pamac {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ErrorInfos trans_add_pkg (string pkgname) {
|
public ErrorInfos trans_add_pkg (string pkgname) {
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
string[] details = {};
|
string[] details = {};
|
||||||
unowned Alpm.Package? pkg = get_syncpkg (pkgname);
|
unowned Alpm.Package? pkg = get_syncpkg (pkgname);
|
||||||
if (pkg == null) {
|
if (pkg == null) {
|
||||||
err.str = _("Failed to prepare transaction");
|
err.message = _("Failed to prepare transaction");
|
||||||
details += _("target not found: %s").printf (pkgname);
|
details += _("target not found: %s").printf (pkgname);
|
||||||
err.details = details;
|
err.details = details;
|
||||||
return err;
|
return err;
|
||||||
} else {
|
} else {
|
||||||
err = trans_add_pkg_real (pkg);
|
err = trans_add_pkg_real (pkg);
|
||||||
if (err.str == "") {
|
if (err.message == "") {
|
||||||
if ("linux31" in pkg.name) {
|
if ("linux31" in pkg.name) {
|
||||||
string[] installed_kernels = {};
|
string[] installed_kernels = {};
|
||||||
string[] installed_modules = {};
|
string[] installed_modules = {};
|
||||||
@ -774,11 +773,11 @@ namespace Pamac {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ErrorInfos trans_load_pkg (string pkgpath) {
|
public ErrorInfos trans_load_pkg (string pkgpath) {
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
string[] details = {};
|
string[] details = {};
|
||||||
Alpm.Package* pkg = alpm_config.handle.load_file (pkgpath, 1, alpm_config.handle.localfilesiglevel);
|
Alpm.Package* pkg = alpm_config.handle.load_file (pkgpath, 1, alpm_config.handle.localfilesiglevel);
|
||||||
if (pkg == null) {
|
if (pkg == null) {
|
||||||
err.str = _("Failed to prepare transaction");
|
err.message = _("Failed to prepare transaction");
|
||||||
details += "%s: %s".printf (pkgpath, Alpm.strerror (alpm_config.handle.errno ()));
|
details += "%s: %s".printf (pkgpath, Alpm.strerror (alpm_config.handle.errno ()));
|
||||||
err.details = details;
|
err.details = details;
|
||||||
return err;
|
return err;
|
||||||
@ -790,7 +789,7 @@ namespace Pamac {
|
|||||||
// just skip duplicate or ignored targets
|
// just skip duplicate or ignored targets
|
||||||
return err;
|
return err;
|
||||||
} else {
|
} else {
|
||||||
err.str = _("Failed to prepare transaction");
|
err.message = _("Failed to prepare transaction");
|
||||||
details += "%s: %s".printf (pkg->name, Alpm.strerror (errno));
|
details += "%s: %s".printf (pkg->name, Alpm.strerror (errno));
|
||||||
err.details = details;
|
err.details = details;
|
||||||
// free the package because it will not be used
|
// free the package because it will not be used
|
||||||
@ -803,18 +802,18 @@ namespace Pamac {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ErrorInfos trans_remove_pkg (string pkgname) {
|
public ErrorInfos trans_remove_pkg (string pkgname) {
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
string[] details = {};
|
string[] details = {};
|
||||||
unowned Alpm.Package? pkg = alpm_config.handle.localdb.get_pkg (pkgname);
|
unowned Alpm.Package? pkg = alpm_config.handle.localdb.get_pkg (pkgname);
|
||||||
if (pkg == null) {
|
if (pkg == null) {
|
||||||
err.str = _("Failed to prepare transaction");
|
err.message = _("Failed to prepare transaction");
|
||||||
details += _("target not found: %s").printf (pkgname);
|
details += _("target not found: %s").printf (pkgname);
|
||||||
err.details = details;
|
err.details = details;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
int ret = alpm_config.handle.trans_remove_pkg (pkg);
|
int ret = alpm_config.handle.trans_remove_pkg (pkg);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
err.str = _("Failed to prepare transaction");
|
err.message = _("Failed to prepare transaction");
|
||||||
details += "%s: %s".printf (pkg.name, Alpm.strerror (alpm_config.handle.errno ()));
|
details += "%s: %s".printf (pkg.name, Alpm.strerror (alpm_config.handle.errno ()));
|
||||||
err.details = details;
|
err.details = details;
|
||||||
}
|
}
|
||||||
@ -823,7 +822,7 @@ namespace Pamac {
|
|||||||
|
|
||||||
private async ErrorInfos trans_prepare () {
|
private async ErrorInfos trans_prepare () {
|
||||||
SourceFunc callback = trans_prepare.callback;
|
SourceFunc callback = trans_prepare.callback;
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
try {
|
try {
|
||||||
new Thread<int>.try ("prepare thread", () => {
|
new Thread<int>.try ("prepare thread", () => {
|
||||||
databases_lock_mutex.lock ();
|
databases_lock_mutex.lock ();
|
||||||
@ -832,7 +831,7 @@ namespace Pamac {
|
|||||||
int ret = alpm_config.handle.trans_prepare (out err_data);
|
int ret = alpm_config.handle.trans_prepare (out err_data);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
Alpm.Errno errno = alpm_config.handle.errno ();
|
Alpm.Errno errno = alpm_config.handle.errno ();
|
||||||
err.str = _("Failed to prepare transaction");
|
err.message = _("Failed to prepare transaction");
|
||||||
string detail = Alpm.strerror (errno);
|
string detail = Alpm.strerror (errno);
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case Errno.PKG_INVALID_ARCH:
|
case Errno.PKG_INVALID_ARCH:
|
||||||
@ -885,7 +884,7 @@ namespace Pamac {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found_locked_pkg) {
|
if (found_locked_pkg) {
|
||||||
err.str = _("Failed to prepare transaction");
|
err.message = _("Failed to prepare transaction");
|
||||||
err.details = details;
|
err.details = details;
|
||||||
trans_release ();
|
trans_release ();
|
||||||
}
|
}
|
||||||
@ -950,7 +949,7 @@ namespace Pamac {
|
|||||||
|
|
||||||
private async ErrorInfos trans_commit (GLib.BusName sender) {
|
private async ErrorInfos trans_commit (GLib.BusName sender) {
|
||||||
SourceFunc callback = trans_commit.callback;
|
SourceFunc callback = trans_commit.callback;
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
try {
|
try {
|
||||||
Polkit.Authority authority = Polkit.Authority.get_sync (null);
|
Polkit.Authority authority = Polkit.Authority.get_sync (null);
|
||||||
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
|
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
|
||||||
@ -971,7 +970,7 @@ namespace Pamac {
|
|||||||
int ret = alpm_config.handle.trans_commit (out err_data);
|
int ret = alpm_config.handle.trans_commit (out err_data);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
Alpm.Errno errno = alpm_config.handle.errno ();
|
Alpm.Errno errno = alpm_config.handle.errno ();
|
||||||
err.str = _("Failed to commit transaction");
|
err.message = _("Failed to commit transaction");
|
||||||
string detail = Alpm.strerror (errno);
|
string detail = Alpm.strerror (errno);
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case Alpm.Errno.FILE_CONFLICTS:
|
case Alpm.Errno.FILE_CONFLICTS:
|
||||||
@ -1018,7 +1017,7 @@ namespace Pamac {
|
|||||||
return ret;
|
return ret;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
err.str = _("Authentication failed");
|
err.message = _("Authentication failed");
|
||||||
trans_release ();
|
trans_release ();
|
||||||
}
|
}
|
||||||
} catch (GLib.Error e) {
|
} catch (GLib.Error e) {
|
||||||
|
@ -35,7 +35,7 @@ namespace Pamac {
|
|||||||
public abstract async Pamac.Package[] get_orphans () throws IOError;
|
public abstract async Pamac.Package[] get_orphans () throws IOError;
|
||||||
public abstract Pamac.Package find_local_pkg (string pkgname) throws IOError;
|
public abstract Pamac.Package find_local_pkg (string pkgname) throws IOError;
|
||||||
public abstract Pamac.Package find_sync_pkg (string pkgname) throws IOError;
|
public abstract Pamac.Package find_sync_pkg (string pkgname) throws IOError;
|
||||||
public abstract async Pamac.Package[] search_pkgs (string search_string, bool search_aur) throws IOError;
|
public abstract async Pamac.Package[] search_pkgs (string search_string, bool search_from_aur) throws IOError;
|
||||||
public abstract string[] get_repos_names () throws IOError;
|
public abstract string[] get_repos_names () throws IOError;
|
||||||
public abstract async Pamac.Package[] get_repo_pkgs (string repo) throws IOError;
|
public abstract async Pamac.Package[] get_repo_pkgs (string repo) throws IOError;
|
||||||
public abstract string[] get_groups_names () throws IOError;
|
public abstract string[] get_groups_names () throws IOError;
|
||||||
@ -44,7 +44,7 @@ namespace Pamac {
|
|||||||
public abstract string[] get_pkg_uninstalled_optdeps (string pkgname) throws IOError;
|
public abstract string[] get_pkg_uninstalled_optdeps (string pkgname) throws IOError;
|
||||||
public abstract PackageDeps get_pkg_deps (string pkgname) throws IOError;
|
public abstract PackageDeps get_pkg_deps (string pkgname) throws IOError;
|
||||||
public abstract PackageDetails get_pkg_details (string pkgname) throws IOError;
|
public abstract PackageDetails get_pkg_details (string pkgname) throws IOError;
|
||||||
public abstract async Updates get_updates () throws IOError;
|
public abstract async Updates get_updates (bool enable_aur) throws IOError;
|
||||||
public abstract ErrorInfos trans_init (Alpm.TransFlag transflags) throws IOError;
|
public abstract ErrorInfos trans_init (Alpm.TransFlag transflags) throws IOError;
|
||||||
public abstract ErrorInfos trans_sysupgrade (int enable_downgrade) throws IOError;
|
public abstract ErrorInfos trans_sysupgrade (int enable_downgrade) throws IOError;
|
||||||
public abstract ErrorInfos trans_add_pkg (string pkgname) throws IOError;
|
public abstract ErrorInfos trans_add_pkg (string pkgname) throws IOError;
|
||||||
@ -414,8 +414,9 @@ namespace Pamac {
|
|||||||
|
|
||||||
public async Updates get_updates () {
|
public async Updates get_updates () {
|
||||||
var updates = Updates ();
|
var updates = Updates ();
|
||||||
|
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
|
||||||
try {
|
try {
|
||||||
updates = yield daemon.get_updates ();
|
updates = yield daemon.get_updates (pamac_config.enable_aur);
|
||||||
} catch (IOError e) {
|
} catch (IOError e) {
|
||||||
stderr.printf ("IOError: %s\n", e.message);
|
stderr.printf ("IOError: %s\n", e.message);
|
||||||
}
|
}
|
||||||
@ -425,13 +426,13 @@ namespace Pamac {
|
|||||||
public void sysupgrade_simple (int enable_downgrade) {
|
public void sysupgrade_simple (int enable_downgrade) {
|
||||||
progress_dialog.progressbar.set_fraction (0);
|
progress_dialog.progressbar.set_fraction (0);
|
||||||
progress_dialog.cancel_button.set_visible (true);
|
progress_dialog.cancel_button.set_visible (true);
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
try {
|
try {
|
||||||
err = daemon.trans_init (0);
|
err = daemon.trans_init (0);
|
||||||
} catch (IOError e) {
|
} catch (IOError e) {
|
||||||
stderr.printf ("IOError: %s\n", e.message);
|
stderr.printf ("IOError: %s\n", e.message);
|
||||||
}
|
}
|
||||||
if (err.str != "") {
|
if (err.message != "") {
|
||||||
finished (true);
|
finished (true);
|
||||||
handle_error (err);
|
handle_error (err);
|
||||||
} else {
|
} else {
|
||||||
@ -440,7 +441,7 @@ namespace Pamac {
|
|||||||
} catch (IOError e) {
|
} catch (IOError e) {
|
||||||
stderr.printf ("IOError: %s\n", e.message);
|
stderr.printf ("IOError: %s\n", e.message);
|
||||||
}
|
}
|
||||||
if (err.str == "") {
|
if (err.message == "") {
|
||||||
progress_dialog.show ();
|
progress_dialog.show ();
|
||||||
while (Gtk.events_pending ())
|
while (Gtk.events_pending ())
|
||||||
Gtk.main_iteration ();
|
Gtk.main_iteration ();
|
||||||
@ -500,7 +501,7 @@ namespace Pamac {
|
|||||||
while (Gtk.events_pending ()) {
|
while (Gtk.events_pending ()) {
|
||||||
Gtk.main_iteration ();
|
Gtk.main_iteration ();
|
||||||
}
|
}
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
on_trans_prepare_finished (err);
|
on_trans_prepare_finished (err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -525,7 +526,7 @@ namespace Pamac {
|
|||||||
while (Gtk.events_pending ())
|
while (Gtk.events_pending ())
|
||||||
Gtk.main_iteration ();
|
Gtk.main_iteration ();
|
||||||
// run
|
// run
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
if (to_add.size () == 0
|
if (to_add.size () == 0
|
||||||
&& to_remove.size () == 0
|
&& to_remove.size () == 0
|
||||||
&& to_load.size () == 0
|
&& to_load.size () == 0
|
||||||
@ -538,7 +539,7 @@ namespace Pamac {
|
|||||||
} catch (IOError e) {
|
} catch (IOError e) {
|
||||||
stderr.printf ("IOError: %s\n", e.message);
|
stderr.printf ("IOError: %s\n", e.message);
|
||||||
}
|
}
|
||||||
if (err.str != "") {
|
if (err.message != "") {
|
||||||
finished (true);
|
finished (true);
|
||||||
handle_error (err);
|
handle_error (err);
|
||||||
} else {
|
} else {
|
||||||
@ -548,7 +549,7 @@ namespace Pamac {
|
|||||||
} catch (IOError e) {
|
} catch (IOError e) {
|
||||||
stderr.printf ("IOError: %s\n", e.message);
|
stderr.printf ("IOError: %s\n", e.message);
|
||||||
}
|
}
|
||||||
if (err.str != "")
|
if (err.message != "")
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
foreach (string name in to_remove.get_keys ()) {
|
foreach (string name in to_remove.get_keys ()) {
|
||||||
@ -557,7 +558,7 @@ namespace Pamac {
|
|||||||
} catch (IOError e) {
|
} catch (IOError e) {
|
||||||
stderr.printf ("IOError: %s\n", e.message);
|
stderr.printf ("IOError: %s\n", e.message);
|
||||||
}
|
}
|
||||||
if (err.str != "")
|
if (err.message != "")
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
foreach (string path in to_load.get_keys ()) {
|
foreach (string path in to_load.get_keys ()) {
|
||||||
@ -566,10 +567,10 @@ namespace Pamac {
|
|||||||
} catch (IOError e) {
|
} catch (IOError e) {
|
||||||
stderr.printf ("IOError: %s\n", e.message);
|
stderr.printf ("IOError: %s\n", e.message);
|
||||||
}
|
}
|
||||||
if (err.str != "")
|
if (err.message != "")
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (err.str == "") {
|
if (err.message == "") {
|
||||||
try {
|
try {
|
||||||
daemon.start_trans_prepare ();
|
daemon.start_trans_prepare ();
|
||||||
} catch (IOError e) {
|
} catch (IOError e) {
|
||||||
@ -1198,12 +1199,12 @@ namespace Pamac {
|
|||||||
|
|
||||||
public void handle_error (ErrorInfos error) {
|
public void handle_error (ErrorInfos error) {
|
||||||
progress_dialog.expander.set_expanded (true);
|
progress_dialog.expander.set_expanded (true);
|
||||||
spawn_in_term ({"echo", "-n", error.str});
|
spawn_in_term ({"echo", "-n", error.message});
|
||||||
Gtk.TextIter start_iter;
|
Gtk.TextIter start_iter;
|
||||||
Gtk.TextIter end_iter;
|
Gtk.TextIter end_iter;
|
||||||
transaction_info_dialog.set_title (dgettext (null, "Error"));
|
transaction_info_dialog.set_title (dgettext (null, "Error"));
|
||||||
transaction_info_dialog.label.set_visible (true);
|
transaction_info_dialog.label.set_visible (true);
|
||||||
transaction_info_dialog.label.set_markup (error.str);
|
transaction_info_dialog.label.set_markup (error.message);
|
||||||
if (error.details.length != 0) {
|
if (error.details.length != 0) {
|
||||||
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);
|
||||||
@ -1231,7 +1232,7 @@ namespace Pamac {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void on_refresh_finished (ErrorInfos error) {
|
public void on_refresh_finished (ErrorInfos error) {
|
||||||
if (error.str == "") {
|
if (error.message == "") {
|
||||||
if (mode == Mode.UPDATER) {
|
if (mode == Mode.UPDATER) {
|
||||||
progress_dialog.hide ();
|
progress_dialog.hide ();
|
||||||
while (Gtk.events_pending ()) {
|
while (Gtk.events_pending ()) {
|
||||||
@ -1250,7 +1251,7 @@ namespace Pamac {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void on_trans_prepare_finished (ErrorInfos error) {
|
public void on_trans_prepare_finished (ErrorInfos error) {
|
||||||
if (error.str == "") {
|
if (error.message == "") {
|
||||||
show_warnings ();
|
show_warnings ();
|
||||||
TransactionType type = set_transaction_sum ();
|
TransactionType type = set_transaction_sum ();
|
||||||
if (type == TransactionType.UPDATE && mode == Mode.UPDATER) {
|
if (type == TransactionType.UPDATE && mode == Mode.UPDATER) {
|
||||||
@ -1264,7 +1265,7 @@ namespace Pamac {
|
|||||||
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
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
on_trans_commit_finished (err);
|
on_trans_commit_finished (err);
|
||||||
} else
|
} else
|
||||||
start_commit ();
|
start_commit ();
|
||||||
@ -1281,8 +1282,8 @@ namespace Pamac {
|
|||||||
finished (true);
|
finished (true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//ErrorInfos err = ErrorInfos ();
|
//var err = ErrorInfos ();
|
||||||
//err.str = 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 ())
|
||||||
@ -1299,7 +1300,7 @@ namespace Pamac {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void on_trans_commit_finished (ErrorInfos error) {
|
public void on_trans_commit_finished (ErrorInfos error) {
|
||||||
if (error.str == "") {
|
if (error.message == "") {
|
||||||
if (to_build.size () != 0) {
|
if (to_build.size () != 0) {
|
||||||
if (to_add.size () != 0
|
if (to_add.size () != 0
|
||||||
|| to_remove.size () != 0
|
|| to_remove.size () != 0
|
||||||
@ -1342,7 +1343,7 @@ namespace Pamac {
|
|||||||
Source.remove (pulse_timeout_id);
|
Source.remove (pulse_timeout_id);
|
||||||
to_build.steal_all ();
|
to_build.steal_all ();
|
||||||
build_status = status;
|
build_status = status;
|
||||||
ErrorInfos err = ErrorInfos ();
|
var err = ErrorInfos ();
|
||||||
on_trans_commit_finished (err);
|
on_trans_commit_finished (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user