From a2d248bc2da9870f81d2fbdb3c3ff1fb47b6752d Mon Sep 17 00:00:00 2001 From: guinux Date: Sun, 26 Oct 2014 12:30:04 +0100 Subject: [PATCH] update displayed strings --- data/polkit/org.manjaro.pamac.policy | 8 - files_to_translate | 48 ++-- pamac.pot | 299 +++++++++++++++++++++--- pot_head | 2 +- resources/manager_window.ui | 8 +- resources/preferences_dialog.ui | 2 +- resources/progress_window.ui | 2 +- resources/transaction_info_dialog.ui | 2 +- src/daemon.vala | 327 +++++++++++++-------------- src/manager_window.vala | 5 +- src/progress_window.vala | 3 +- src/transaction.vala | 276 +++++++++++++--------- src/tray.vala | 4 +- src/updater_window.vala | 26 ++- update_po_files.sh | 2 +- 15 files changed, 661 insertions(+), 353 deletions(-) diff --git a/data/polkit/org.manjaro.pamac.policy b/data/polkit/org.manjaro.pamac.policy index 65c0a53..e753b1d 100644 --- a/data/polkit/org.manjaro.pamac.policy +++ b/data/polkit/org.manjaro.pamac.policy @@ -14,12 +14,4 @@ auth_admin_keep - - Authentication is required - - no - no - auth_admin_keep - - diff --git a/files_to_translate b/files_to_translate index 95e7f1f..eb75160 100644 --- a/files_to_translate +++ b/files_to_translate @@ -1,24 +1,26 @@ -./resources/choose_provider_dialog.ui -./resources/packages_chooser_dialog.ui -./resources/progress_window.ui -./resources/history_dialog.ui -./resources/transaction_info_dialog.ui -./resources/transaction_sum_dialog.ui -./resources/manager_window.ui -./resources/updater_window.ui -./resources/preferences_dialog.ui +resources/choose_provider_dialog.ui +resources/packages_chooser_dialog.ui +resources/progress_window.ui +resources/history_dialog.ui +resources/transaction_info_dialog.ui +resources/transaction_sum_dialog.ui +resources/manager_window.ui +resources/updater_window.ui +resources/preferences_dialog.ui -./src/packages_chooser_dialog.vala -./src/transaction_info_dialog.vala -./src/history_dialog.vala -./src/transaction_sum_dialog.vala -./src/installer.vala -./src/tray.vala -./src/manager.vala -./src/preferences_dialog.vala -./src/updater.vala -./src/choose_provider_dialog.vala -./src/manager_window.vala -./src/progress_window.vala -./src/updater_window.vala -./src/common.vala +src/packages_chooser_dialog.vala +src/transaction_info_dialog.vala +src/history_dialog.vala +src/transaction_sum_dialog.vala +src/daemon.vala +src/transaction.vala +src/installer.vala +src/tray.vala +src/manager.vala +src/preferences_dialog.vala +src/updater.vala +src/choose_provider_dialog.vala +src/manager_window.vala +src/progress_window.vala +src/updater_window.vala +src/common.vala diff --git a/pamac.pot b/pamac.pot index 134f1ae..f4243ad 100644 --- a/pamac.pot +++ b/pamac.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: pamac 2.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-13-10 15:09+0100\n" +"POT-Creation-Date: 2014-10-23 15:09+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -33,13 +33,18 @@ msgid "Progress" msgstr "" #: resources/progress_window.ui:63 resources/transaction_info_dialog.ui:84 -msgid "details" +#: resources/manager_window.ui:707 +msgid "Details" msgstr "" #: resources/history_dialog.ui:7 msgid "Pamac History" msgstr "" +#: resources/transaction_sum_dialog.ui:6 src/transaction.vala:356 +msgid "Transaction Summary" +msgstr "" + #: resources/manager_window.ui:14 src/tray.vala:76 msgid "Package Manager" msgstr "" @@ -73,7 +78,7 @@ msgid "State" msgstr "" #: resources/manager_window.ui:371 -msgid "Repos" +msgid "Repositories" msgstr "" #: resources/manager_window.ui:433 @@ -84,8 +89,8 @@ msgstr "" msgid "Version" msgstr "" -#: resources/manager_window.ui:463 -msgid "Repo" +#: resources/manager_window.ui:463 src/manager_window.vala:328 +msgid "Repository" msgstr "" #: resources/manager_window.ui:478 @@ -93,15 +98,11 @@ msgid "Size" msgstr "" #: resources/manager_window.ui:582 -msgid "Infos" +msgid "Description" msgstr "" #: resources/manager_window.ui:642 -msgid "Deps" -msgstr "" - -#: resources/manager_window.ui:707 -msgid "Details" +msgid "Dependencies" msgstr "" #: resources/manager_window.ui:740 @@ -135,8 +136,8 @@ msgstr "" #: resources/preferences_dialog.ui:118 msgid "" -"When removing a package, also remove those dependencies that are not " -"required by other packages" +"When removing a package, also remove its dependencies that are not required " +"by other packages" msgstr "" #: resources/preferences_dialog.ui:152 src/preferences_dialog.vala:37 @@ -151,15 +152,261 @@ msgstr "" msgid "Packages" msgstr "" -#: src/tray.vala:24 src/updater_window.vala:167 -msgid "{number} available updates" +#: src/daemon.vala:113 src/daemon.vala:120 +msgid "Failed to synchronize any databases" msgstr "" -#: src/tray.vala:25 src/updater_window.vala:164 +#: src/daemon.vala:162 +msgid "Failed to init transaction" +msgstr "" + +#: src/daemon.vala:174 src/daemon.vala:192 src/daemon.vala:204 +#: src/daemon.vala:218 src/daemon.vala:230 src/daemon.vala:245 +#: src/daemon.vala:252 src/daemon.vala:266 src/daemon.vala:316 +msgid "Failed to prepare transaction" +msgstr "" + +#: src/daemon.vala:193 src/daemon.vala:246 +#, c-format +msgid "target not found: %s" +msgstr "" + +#: src/daemon.vala:274 +#, c-format +msgid "package %s does not have a valid architecture" +msgstr "" + +#: src/daemon.vala:283 +#, c-format +msgid "%s: requires %s" +msgstr "" + +#: src/daemon.vala:291 +#, c-format +msgid "%s and %s are in conflict" +msgstr "" + +#: src/daemon.vala:310 +#, c-format +msgid "%s needs to be removed but it is a locked package" +msgstr "" + +#: src/daemon.vala:378 +msgid "Failed to commit transaction" +msgstr "" + +#: src/daemon.vala:392 +#, c-format +msgid "%s exists in both %s and %s" +msgstr "" + +#: src/daemon.vala:395 +#, c-format +msgid "%s: %s already exists in filesystem" +msgstr "" + +#: src/daemon.vala:408 +#, c-format +msgid "%s is invalid or corrupted" +msgstr "" + +#: src/daemon.vala:436 +msgid "Authentication failed" +msgstr "" + +#: src/transaction.vala:154 +msgid "Synchronizing package databases" +msgstr "" + +#: src/transaction.vala:210 +msgid "Starting full system upgrade" +msgstr "" + +#: src/transaction.vala:254 +msgid "Preparing" +msgstr "" + +#: src/transaction.vala:328 +#, c-format +msgid "Choose a provider for %s" +msgstr "" + +#: src/transaction.vala:386 src/manager_window.vala:187 +#: src/manager_window.vala:731 +msgid "To remove" +msgstr "" + +#: src/transaction.vala:399 +msgid "To downgrade" +msgstr "" + +#: src/transaction.vala:412 +msgid "To build" +msgstr "" + +#: src/transaction.vala:425 src/manager_window.vala:186 +#: src/manager_window.vala:720 +msgid "To install" +msgstr "" + +#: src/transaction.vala:438 +msgid "To reinstall" +msgstr "" + +#: src/transaction.vala:452 +msgid "To update" +msgstr "" + +#: src/transaction.vala:465 src/updater_window.vala:180 +msgid "Total download size" +msgstr "" + +#: src/transaction.vala:483 +msgid "Building packages" +msgstr "" + +#: src/transaction.vala:540 +msgid "Checking dependencies" +msgstr "" + +#: src/transaction.vala:545 +msgid "Checking file conflicts" +msgstr "" + +#: src/transaction.vala:550 +msgid "Resolving dependencies" +msgstr "" + +#: src/transaction.vala:555 +msgid "Checking inter-conflicts" +msgstr "" + +#: src/transaction.vala:562 src/transaction.vala:564 +#, c-format +msgid "Installing %s" +msgstr "" + +#: src/transaction.vala:570 src/transaction.vala:572 +#, c-format +msgid "Reinstalling %s" +msgstr "" + +#: src/transaction.vala:578 src/transaction.vala:580 +#, c-format +msgid "Removing %s" +msgstr "" + +#: src/transaction.vala:586 src/transaction.vala:588 +#, c-format +msgid "Upgrading %s" +msgstr "" + +#: src/transaction.vala:594 src/transaction.vala:596 +#, c-format +msgid "Downgrading %s" +msgstr "" + +#: src/transaction.vala:600 +msgid "Checking integrity" +msgstr "" + +#: src/transaction.vala:605 +msgid "Checking keyring" +msgstr "" + +#: src/transaction.vala:610 +msgid "Downloading required keys" +msgstr "" + +#: src/transaction.vala:615 +msgid "Loading packages files" +msgstr "" + +#: src/transaction.vala:620 +msgid "Checking delta integrity" +msgstr "" + +#: src/transaction.vala:625 +msgid "Applying deltas" +msgstr "" + +#: src/transaction.vala:630 +#, c-format +msgid "Generating %s with %s" +msgstr "" + +#: src/transaction.vala:635 +msgid "Generation succeeded" +msgstr "" + +#: src/transaction.vala:640 +msgid "Generation failed" +msgstr "" + +#: src/transaction.vala:645 +#, c-format +msgid "Configuring %s" +msgstr "" + +#: src/transaction.vala:650 +msgid "Downloading" +msgstr "" + +#: src/transaction.vala:655 +msgid "Checking available disk space" +msgstr "" + +#: src/transaction.vala:660 +#, c-format +msgid "%s optionally requires %s" +msgstr "" + +#: src/transaction.vala:663 +#, c-format +msgid "Database file for %s does not exist" +msgstr "" + +#: src/transaction.vala:715 +#, c-format +msgid "Refreshing %s" +msgstr "" + +#: src/transaction.vala:717 +#, c-format +msgid "Downloading %s" +msgstr "" + +#: src/transaction.vala:754 src/transaction.vala:768 +msgid "Warning" +msgstr "" + +#: src/transaction.vala:758 src/transaction.vala:787 +msgid "Error" +msgstr "" + +#: src/transaction.vala:851 src/transaction.vala:866 +#: src/progress_window.vala:55 +msgid "Transaction cancelled" +msgstr "" + +#: src/transaction.vala:877 +msgid "Nothing to do" +msgstr "" + +#: src/transaction.vala:897 src/transaction.vala:913 +msgid "Transaction successfully finished" +msgstr "" + +#: src/tray.vala:24 src/updater_window.vala:176 +#, c-format +msgid "%u available updates" +msgstr "" + +#: src/tray.vala:25 src/updater_window.vala:173 msgid "1 available update" msgstr "" -#: src/tray.vala:27 src/updater_window.vala:56 src/updater_window.vala:161 +#: src/tray.vala:27 src/updater_window.vala:56 src/updater_window.vala:170 msgid "Your system is up-to-date" msgstr "" @@ -184,14 +431,6 @@ msgstr "" msgid "Orphans" msgstr "" -#: src/manager_window.vala:186 src/manager_window.vala:720 -msgid "To install" -msgstr "" - -#: src/manager_window.vala:187 src/manager_window.vala:731 -msgid "To remove" -msgstr "" - #: src/manager_window.vala:210 msgid "Licenses" msgstr "" @@ -201,7 +440,7 @@ msgid "Depends On" msgstr "" #: src/manager_window.vala:252 -msgid "Optional Deps" +msgid "Optional Dependencies" msgstr "" #: src/manager_window.vala:272 @@ -220,10 +459,6 @@ msgstr "" msgid "Conflicts With" msgstr "" -#: src/manager_window.vala:328 -msgid "Repository" -msgstr "" - #: src/manager_window.vala:346 msgid "Packager" msgstr "" @@ -264,8 +499,8 @@ msgstr "" msgid "Uninstalled" msgstr "" -#: src/updater_window.vala:173 -msgid "Total download size:" +#: src/manager_window.vala:888 +msgid "A Gtk3 frontend for libalpm" msgstr "" #: src/common.vala:62 diff --git a/pot_head b/pot_head index 8580c26..4f73384 100644 --- a/pot_head +++ b/pot_head @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: pamac 2.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-03-30 15:09+0100\n" +"POT-Creation-Date: 2014-10-23 15:09+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/resources/manager_window.ui b/resources/manager_window.ui index e31655f..f567783 100644 --- a/resources/manager_window.ui +++ b/resources/manager_window.ui @@ -368,7 +368,7 @@ True False - Repos + Repositories 3 @@ -460,7 +460,7 @@ True autosize - Repo + Repository True @@ -579,7 +579,7 @@ True False - Infos + Description False @@ -639,7 +639,7 @@ True False - Deps + Dependencies 1 diff --git a/resources/preferences_dialog.ui b/resources/preferences_dialog.ui index a7d44da..a688dd8 100644 --- a/resources/preferences_dialog.ui +++ b/resources/preferences_dialog.ui @@ -115,7 +115,7 @@ True - When removing a package, also remove those dependencies that are not required by other packages + When removing a package, also remove its dependencies that are not required by other packages 2 3 diff --git a/resources/progress_window.ui b/resources/progress_window.ui index 25f56e1..f49227e 100644 --- a/resources/progress_window.ui +++ b/resources/progress_window.ui @@ -60,7 +60,7 @@ True False - details + Details diff --git a/resources/transaction_info_dialog.ui b/resources/transaction_info_dialog.ui index 3bb6ac7..5998a8d 100644 --- a/resources/transaction_info_dialog.ui +++ b/resources/transaction_info_dialog.ui @@ -81,7 +81,7 @@ True False - details + Details diff --git a/src/daemon.vala b/src/daemon.vala index ae83ab0..977e176 100644 --- a/src/daemon.vala +++ b/src/daemon.vala @@ -22,7 +22,7 @@ using Pamac; using Polkit; // i18n -const string GETTEXT_PACKAGE = "pacman"; +const string GETTEXT_PACKAGE = "pamac"; PamacServer server; MainLoop loop; @@ -41,9 +41,9 @@ public class PamacServer : Object { public Mutex provider_mutex; public int? choosen_provider; - public signal void emit_event (uint event, string msg); + public signal void emit_event (uint event, string[] details); public signal void emit_providers (string depend, string[] providers); - public signal void emit_progress (uint progress, string action, string pkgname, int percent, uint n_targets, uint current_target); + public signal void emit_progress (uint progress, string pkgname, int percent, uint n_targets, uint current_target); public signal void emit_download (string filename, uint64 xfered, uint64 total); public signal void emit_totaldownload (uint64 total); public signal void emit_log (uint level, string msg); @@ -91,6 +91,10 @@ public class PamacServer : Object { } } + public void refresh_alpm_config () { + get_handle (); + } + private void refresh_real () { ErrorInfos err = ErrorInfos (); string[] details = {}; @@ -106,17 +110,21 @@ public class PamacServer : Object { // 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 if (success == 0) { - err.str = _("failed to synchronize any databases\n"); - details += Alpm.strerror (alpm_config.handle.errno ()) + "\n"; + err.str = _("Failed to synchronize any databases"); + details += Alpm.strerror (alpm_config.handle.errno ()); err.details = details; } trans_release (); get_handle (); - if (emit_refreshed_signal) - emit_refreshed (err); - else - emit_refreshed_signal = true; + } else { + err.str = _("Failed to synchronize any databases"); + details += Alpm.strerror (alpm_config.handle.errno ()); + err.details = details; } + if (emit_refreshed_signal) + emit_refreshed (err); + else + emit_refreshed_signal = true; } public async void refresh (int force, bool emit_signal) { @@ -148,25 +156,31 @@ public class PamacServer : Object { public ErrorInfos trans_init (TransFlag transflags) { ErrorInfos err = ErrorInfos (); + string[] details = {}; int ret = alpm_config.handle.trans_init (transflags); if (ret == -1) { - //err = _("failed to init transaction (%s)\n").printf (Alpm.strerror (errno)); - err.str = Alpm.strerror (alpm_config.handle.errno ()) + "\n"; + err.str = _("Failed to init transaction"); + details += Alpm.strerror (alpm_config.handle.errno ()); + err.details = details; } return err; } public ErrorInfos trans_sysupgrade (int enable_downgrade) { ErrorInfos err = ErrorInfos (); + string[] details = {}; int ret = alpm_config.handle.trans_sysupgrade (enable_downgrade); if (ret == -1) {; - err.str = Alpm.strerror (alpm_config.handle.errno ()) + "\n"; + err.str = _("Failed to prepare transaction"); + details += Alpm.strerror (alpm_config.handle.errno ()); + err.details = details; } return err; } public ErrorInfos trans_add_pkg (string pkgname) { ErrorInfos err = ErrorInfos (); + string[] details = {}; unowned Package? pkg = null; //pkg = alpm_config.handle.find_dbs_satisfier (syncdbs, pkgname); foreach (var db in syncdbs) { @@ -175,7 +189,9 @@ public class PamacServer : Object { break; } if (pkg == null) { - err.str = _("target not found: %s\n").printf (pkgname); + err.str = _("Failed to prepare transaction"); + details += _("target not found: %s").printf (pkgname); + err.details = details; return err; } int ret = alpm_config.handle.trans_add_pkg (pkg); @@ -185,7 +201,9 @@ public class PamacServer : Object { // just skip duplicate or ignored targets return err; else { - err.str = "'%s': %s\n".printf (pkg.name, Alpm.strerror (errno)); + err.str = _("Failed to prepare transaction"); + details += "%s: %s".printf (pkg.name, Alpm.strerror (errno)); + err.details = details; return err; } } @@ -194,19 +212,24 @@ public class PamacServer : Object { public ErrorInfos trans_load_pkg (string pkgpath) { ErrorInfos err = ErrorInfos (); + string[] details = {}; unowned Package? pkg = alpm_config.handle.load_file (pkgpath, 1, alpm_config.handle.localfilesiglevel); if (pkg == null) { - err.str = "'%s': %s\n".printf (pkgpath, Alpm.strerror (alpm_config.handle.errno ())); + err.str = _("Failed to prepare transaction"); + details += "%s: %s".printf (pkgpath, Alpm.strerror (alpm_config.handle.errno ())); + err.details = details; return err; } else { int ret = alpm_config.handle.trans_add_pkg (pkg); if (ret == -1) { Alpm.Errno errno = alpm_config.handle.errno (); - if (errno == Errno.TRANS_DUP_TARGET || errno == Errno.PKG_IGNORED) { + if (errno == Errno.TRANS_DUP_TARGET || errno == Errno.PKG_IGNORED) // just skip duplicate or ignored targets return err; - } else { - err.str = "'%s': %s\n".printf (pkg.name, Alpm.strerror (errno)); + else { + err.str = _("Failed to prepare transaction"); + details += "%s: %s".printf (pkg.name, Alpm.strerror (errno)); + err.details = details; return err; } } @@ -216,14 +239,19 @@ public class PamacServer : Object { public ErrorInfos trans_remove_pkg (string pkgname) { ErrorInfos err = ErrorInfos (); + string[] details = {}; unowned Package? pkg = localdb.get_pkg (pkgname); if (pkg == null) { - err.str = _("target not found: %s\n").printf (pkgname); + err.str = _("Failed to prepare transaction"); + details += _("target not found: %s").printf (pkgname); + err.details = details; return err; } int ret = alpm_config.handle.trans_remove_pkg (pkg); if (ret == -1) { - err.str = "'%s': %s\n".printf (pkg.name, Alpm.strerror (alpm_config.handle.errno ())); + err.str = _("Failed to prepare transaction"); + details += "%s: %s".printf (pkg.name, Alpm.strerror (alpm_config.handle.errno ())); + err.details = details; } return err; } @@ -235,39 +263,60 @@ public class PamacServer : Object { int ret = alpm_config.handle.trans_prepare (out err_data); if (ret == -1) { Alpm.Errno errno = alpm_config.handle.errno (); - //err = _("failed to prepare transaction (%s)\n").printf (); - err.str = Alpm.strerror (errno) + "\n"; + err.str = _("Failed to prepare transaction"); + string detail = Alpm.strerror (errno); switch (errno) { case Errno.PKG_INVALID_ARCH: + detail += ":"; + details += detail; foreach (void *i in err_data) { char *pkgname = i; - details += _("package %s does not have a valid architecture\n").printf (pkgname); + details += _("package %s does not have a valid architecture").printf (pkgname); } break; case Errno.UNSATISFIED_DEPS: + detail += ":"; + details += detail; foreach (void *i in err_data) { DepMissing *miss = i; string depstring = miss->depend.compute_string (); - details += _("%s: requires %s\n").printf (miss->target, depstring); + details += _("%s: requires %s").printf (miss->target, depstring); } break; case Errno.CONFLICTING_DEPS: + detail += ":"; + details += detail; foreach (void *i in err_data) { Conflict *conflict = i; + detail = _("%s and %s are in conflict").printf (conflict->package1, conflict->package2); // only print reason if it contains new information - if (conflict->reason.mod == DepMod.ANY) - details += _("%s and %s are in conflict\n").printf (conflict->package1, conflict->package2); - else { - string reason = conflict->reason.compute_string (); - details += _("%s and %s are in conflict (%s)\n").printf (conflict->package1, conflict->package2, reason); + if (conflict->reason.mod != DepMod.ANY) { + detail += " (%s)".printf (conflict->reason.compute_string ()); } + details += detail; } break; default: + details += detail; break; } err.details = details; trans_release (); + } else { + // Search for holdpkg in target list + bool found_locked_pkg = false; + foreach (unowned Package pkg in alpm_config.handle.trans_to_remove ()) { + if (pkg.name in alpm_config.holdpkg) { + details += _("%s needs to be removed but it is a locked package").printf (pkg.name); + found_locked_pkg = true; + break; + } + } + if (found_locked_pkg) { + err.str = _("Failed to prepare transaction"); + err.details = details; + trans_release (); + } } emit_trans_prepared (err); } @@ -326,22 +375,24 @@ public class PamacServer : Object { int ret = alpm_config.handle.trans_commit (out err_data); if (ret == -1) { Alpm.Errno errno = alpm_config.handle.errno (); - //err = _("failed to commit transaction (%s)\n").printf (Alpm.strerror (errno)); - err.str = Alpm.strerror (errno) + "\n"; + err.str = _("Failed to commit transaction"); + string detail = Alpm.strerror (errno); switch (errno) { case Alpm.Errno.FILE_CONFLICTS: - TransFlag flags = alpm_config.handle.trans_get_flags (); - if ((flags & TransFlag.FORCE) != 0) { - details += _("unable to %s directory-file conflicts\n").printf ("--force"); - } + detail += ":"; + details += detail; + //TransFlag flags = alpm_config.handle.trans_get_flags (); + //if ((flags & TransFlag.FORCE) != 0) { + //details += _("unable to %s directory-file conflicts").printf ("--force"); + //} foreach (void *i in err_data) { FileConflict *conflict = i; switch (conflict->type) { case FileConflictType.TARGET: - details += _("%s exists in both '%s' and '%s'\n").printf (conflict->file, conflict->target, conflict->ctarget); + details += _("%s exists in both %s and %s").printf (conflict->file, conflict->target, conflict->ctarget); break; case FileConflictType.FILESYSTEM: - details += _("%s: %s exists in filesystem\n").printf (conflict->target, conflict->file); + details += _("%s: %s already exists in filesystem").printf (conflict->target, conflict->file); break; } } @@ -350,12 +401,15 @@ public class PamacServer : Object { case Alpm.Errno.PKG_INVALID_CHECKSUM: case Alpm.Errno.PKG_INVALID_SIG: case Alpm.Errno.DLT_INVALID: + detail += ":"; + details += detail; foreach (void *i in err_data) { char *filename = i; - details += _("%s is invalid or corrupted\n").printf (filename); + details += _("%s is invalid or corrupted").printf (filename); } break; default: + details += detail; break; } err.details = details; @@ -379,7 +433,7 @@ public class PamacServer : Object { new Thread.try ("commit thread", (ThreadFunc) trans_commit_real); } else { ErrorInfos err = ErrorInfos (); - err.str = "Not Authorized\n"; + err.str = dgettext ("pamac", "Authentication failed"); emit_trans_committed (err); trans_release (); } @@ -416,143 +470,105 @@ private void write_log_file (string event) { // writing a short string to the stream dos.put_string (log); } catch (GLib.Error e) { - GLib.stderr.printf("%s\n", e.message); + stderr.printf("%s\n", e.message); } } private void cb_event (Event event, void *data1, void *data2) { - string event_str = null; + string[] details = {}; switch (event) { - case Event.CHECKDEPS_START: - event_str = _("checking dependencies...\n"); - break; - case Event.FILECONFLICTS_START: - event_str = _("checking for file conflicts...\n"); - break; - case Event.RESOLVEDEPS_START: - event_str = _("resolving dependencies...\n"); - break; - case Event.INTERCONFLICTS_START: - event_str = _("looking for inter-conflicts...\n"); - break; case Event.ADD_START: + case Event.REMOVE_START: + case Event.REINSTALL_START: unowned Package pkg = (Package) data1; - event_str = _("installing %s...\n").printf ("%s (%s)".printf (pkg.name, pkg.version)); + details += pkg.name; + details += pkg.version; break; case Event.ADD_DONE: unowned Package pkg = (Package) data1; - string log = "installed %s (%s)\n".printf (pkg.name, pkg.version); + string log = "Installed %s (%s)\n".printf (pkg.name, pkg.version); write_log_file (log); break; - case Event.REMOVE_START: - unowned Package pkg = (Package) data1; - event_str = _("removing %s...\n").printf ("%s (%s)".printf (pkg.name, pkg.version)); - break; case Event.REMOVE_DONE: unowned Package pkg = (Package) data1; - string log = "removed %s (%s)\n".printf (pkg.name, pkg.version); + string log = "Removed %s (%s)\n".printf (pkg.name, pkg.version); + write_log_file (log); + break; + case Event.REINSTALL_DONE: + unowned Package pkg = (Package) data1; + string log = "Reinstalled %s (%s)\n".printf (pkg.name, pkg.version); write_log_file (log); break; case Event.UPGRADE_START: + case Event.DOWNGRADE_START: unowned Package new_pkg = (Package) data1; unowned Package old_pkg = (Package) data2; - event_str = _("upgrading %s...\n").printf ("%s (%s -> %s)".printf (old_pkg.name, old_pkg.version, new_pkg.version)); + details += old_pkg.name; + details += old_pkg.version; + details += new_pkg.version; break; case Event.UPGRADE_DONE: unowned Package new_pkg = (Package) data1; unowned Package old_pkg = (Package) data2; - string log = _("upgraded %s (%s -> %s)\n").printf (old_pkg.name, old_pkg.version, new_pkg.version); + string log = "Upgraded %s (%s -> %s)\n".printf (old_pkg.name, old_pkg.version, new_pkg.version); write_log_file (log); break; - case Event.DOWNGRADE_START: - unowned Package new_pkg = (Package) data1; - unowned Package old_pkg = (Package) data2; - event_str = _("downgrading %s...\n").printf ("%s (%s -> %s)".printf (old_pkg.name, old_pkg.version, new_pkg.version)); - break; case Event.DOWNGRADE_DONE: unowned Package new_pkg = (Package) data1; unowned Package old_pkg = (Package) data2; - string log = _("downgraded %s (%s -> %s)\n").printf (old_pkg.name, old_pkg.version, new_pkg.version); + string log = "Downgraded %s (%s -> %s)\n".printf (old_pkg.name, old_pkg.version, new_pkg.version); write_log_file (log); break; - case Event.REINSTALL_START: - unowned Package pkg = (Package) data1; - event_str = _("reinstalling %s...\n").printf ("%s (%s)".printf (pkg.name, pkg.version)); - break; - case Event.REINSTALL_DONE: - unowned Package pkg = (Package) data1; - string log = "reinstalled %s (%s)\n".printf (pkg.name, pkg.version); - write_log_file (log); - break; - case Event.INTEGRITY_START: - event_str = _("checking package integrity...\n"); - break; - case Event.KEYRING_START: - event_str = _("checking keyring...\n"); - break; - case Event.KEY_DOWNLOAD_START: - event_str = _("downloading required keys...\n"); - break; - case Event.LOAD_START: - event_str = _("loading package files...\n"); - break; - case Event.DELTA_INTEGRITY_START: - event_str = _("checking delta integrity...\n"); - break; - case Event.DELTA_PATCHES_START: - event_str = _("applying deltas...\n"); - break; case Event.DELTA_PATCH_START: unowned string string1 = (string) data1; unowned string string2 = (string) data2; - event_str = _("generating %s with %s... ").printf (string1, string2); - break; - case Event.DELTA_PATCH_DONE: - event_str = _("success!\n"); - break; - case Event.DELTA_PATCH_FAILED: - event_str = _("failed.\n"); + details += string1; + details += string2; break; case Event.SCRIPTLET_INFO: unowned string info = (string) data1; - event_str = info; - write_log_file (event_str); - break; - case Event.RETRIEVE_START: - event_str = _("Retrieving packages ...\n"); - break; - case Event.DISKSPACE_START: - event_str = _("checking available disk space...\n"); + details += info; + write_log_file (info); break; case Event.OPTDEP_REQUIRED: unowned Package pkg = (Package) data1; Depend *depend = data2; - event_str = _("%s optionally requires %s\n").printf (pkg.name, depend->compute_string ()); + details += pkg.name; + details += depend->compute_string (); break; case Event.DATABASE_MISSING: - event_str = _("database file for '%s' does not exist\n").printf ((char *) data1); - break; - /* all the simple done events, with fallthrough for each */ - - case Event.FILECONFLICTS_DONE: - case Event.CHECKDEPS_DONE: - case Event.RESOLVEDEPS_DONE: - case Event.INTERCONFLICTS_DONE: - case Event.INTEGRITY_DONE: - case Event.KEYRING_DONE: - case Event.KEY_DOWNLOAD_DONE: - case Event.LOAD_DONE: - case Event.DELTA_INTEGRITY_DONE: - case Event.DELTA_PATCHES_DONE: - case Event.DISKSPACE_DONE: - /* nothing */ + unowned string db_name = (string) data1; + details += db_name; break; +//~ case Event.CHECKDEPS_START: +//~ case Event.CHECKDEPS_DONE: +//~ case Event.FILECONFLICTS_START: +//~ case Event.FILECONFLICTS_DONE: +//~ case Event.RESOLVEDEPS_START: +//~ case Event.RESOLVEDEPS_DONE: +//~ case Event.INTERCONFLICTS_START: +//~ case Event.INTERCONFLICTS_DONE: +//~ case Event.INTEGRITY_START: +//~ case Event.INTEGRITY_DONE: +//~ case Event.KEYRING_START: +//~ case Event.KEYRING_DONE: +//~ case Event.KEY_DOWNLOAD_START: +//~ case Event.KEY_DOWNLOAD_DONE: +//~ case Event.LOAD_START: +//~ case Event.LOAD_DONE: +//~ case Event.DELTA_INTEGRITY_START: +//~ case Event.DELTA_INTEGRITY_DONE: +//~ case Event.DELTA_PATCHES_START: +//~ case Event.DELTA_PATCHES_DONE: +//~ case Event.DELTA_PATCH_DONE: +//~ case Event.DELTA_PATCH_FAILED: +//~ case Event.RETRIEVE_START: +//~ case Event.DISKSPACE_START: +//~ case Event.DISKSPACE_DONE: default: - event_str = "unknown event"; break; } - if (event_str != null) - server.emit_event ((uint) event, event_str); + server.emit_event ((uint) event, details); } private void cb_question (Question question, void *data1, void *data2, void *data3, out int response) { @@ -610,44 +626,23 @@ private void cb_question (Question question, void *data1, void *data2, void *dat } private void cb_progress (Progress progress, string pkgname, int percent, uint n_targets, uint current_target) { - string action = ""; - switch (progress) { - case Progress.ADD_START: - action = _("installing"); - break; - case Progress.UPGRADE_START: - action = _("upgrading"); - break; - case Progress.DOWNGRADE_START: - action = _("downgrading"); - break; - case Progress.REINSTALL_START: - action = _("reinstalling"); - break; - case Progress.REMOVE_START: - action = _("removing"); - break; - case Progress.CONFLICTS_START: - action = _("checking for file conflicts"); - break; - case Progress.DISKSPACE_START: - action = _("checking available disk space"); - break; - case Progress.INTEGRITY_START: - action = _("checking package integrity"); - break; - case Progress.KEYRING_START: - action = _("checking keys in keyring"); - break; - case Progress.LOAD_START: - action = _("loading package files"); - break; - default: - break; - } +//~ switch (progress) { +//~ case Progress.ADD_START: +//~ case Progress.UPGRADE_START: +//~ case Progress.DOWNGRADE_START: +//~ case Progress.REINSTALL_START: +//~ case Progress.REMOVE_START: +//~ case Progress.CONFLICTS_START: +//~ case Progress.DISKSPACE_START: +//~ case Progress.INTEGRITY_START: +//~ case Progress.KEYRING_START: +//~ case Progress.LOAD_START: +//~ default: +//~ break; +//~ } if ((uint64) percent != server.previous_percent) { server.previous_percent = (uint64) percent; - server.emit_progress ((uint) progress, action, pkgname, percent, n_targets, current_target); + server.emit_progress ((uint) progress, pkgname, percent, n_targets, current_target); } } diff --git a/src/manager_window.vala b/src/manager_window.vala index 9dee1f5..e4fe2af 100644 --- a/src/manager_window.vala +++ b/src/manager_window.vala @@ -249,7 +249,7 @@ namespace Pamac { if (satisfier != null) optdep_str = optdep_str + " [" + dgettext (null, "Installed") + "]"; deps_list.insert_with_values (out iter, -1, - 0, dgettext (null, "Optional Deps") + ":", + 0, dgettext (null, "Optional Dependencies") + ":", 1, optdep_str); i = 1; while (i < len) { @@ -885,7 +885,7 @@ namespace Pamac { this, "program_name", "Pamac", "logo_icon_name", "system-software-install", - "comments", "A GTK3 frontend of libalpm", + "comments", dgettext (null, "A Gtk3 frontend for libalpm"), "copyright", "Copyright © 2014 Guillaume Benoit", "version", VERSION, "license_type", License.GPL_3_0, @@ -916,6 +916,7 @@ namespace Pamac { } public void on_emit_trans_finished (bool error) { + print ("transaction finished\n"); if (error == false) { set_buttons_sensitive (false); refresh_packages_list (); diff --git a/src/progress_window.vala b/src/progress_window.vala index 6068737..4c48496 100644 --- a/src/progress_window.vala +++ b/src/progress_window.vala @@ -52,8 +52,9 @@ namespace Pamac { public void on_cancel_button_clicked () { transaction.cancel (); transaction.clear_lists (); - transaction.finished (false); + transaction.spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction cancelled") + ".\n"}); this.hide (); + transaction.finished (false); while (Gtk.events_pending ()) Gtk.main_iteration (); } diff --git a/src/transaction.vala b/src/transaction.vala index 13e0af1..b07bbc5 100644 --- a/src/transaction.vala +++ b/src/transaction.vala @@ -25,6 +25,7 @@ namespace Pamac { [DBus (name = "org.manjaro.pamac")] public interface Daemon : Object { public abstract void write_config (HashTable new_conf) throws IOError; + public abstract void refresh_alpm_config () throws IOError; public abstract async void refresh (int force, bool emit_signal) throws IOError; public abstract ErrorInfos trans_init (TransFlag transflags) throws IOError; public abstract ErrorInfos trans_sysupgrade (int enable_downgrade) throws IOError; @@ -37,12 +38,13 @@ namespace Pamac { public abstract UpdatesInfos[] trans_to_remove () throws IOError; public abstract async void trans_commit () throws IOError; public abstract void trans_release () throws IOError; + [DBus (no_reply = true)] public abstract void trans_cancel () throws IOError; [DBus (no_reply = true)] public abstract void quit () throws IOError; - public signal void emit_event (uint event, string msg); + public signal void emit_event (uint event, string[] details); public signal void emit_providers (string depend, string[] providers); - public signal void emit_progress (uint progress, string action, string pkgname, int percent, uint n_targets, uint current_target); + public signal void emit_progress (uint progress, string pkgname, int percent, uint n_targets, uint current_target); public signal void emit_download (string filename, uint64 xfered, uint64 total); public signal void emit_totaldownload (uint64 total); public signal void emit_log (uint level, string msg); @@ -69,6 +71,7 @@ namespace Pamac { uint build_timeout_id; bool sysupgrade_after_trans; bool sysupgrade_after_build; + int build_status; Terminal term; Pty pty; @@ -132,6 +135,7 @@ namespace Pamac { previous_filename = ""; sysupgrade_after_trans = false; sysupgrade_after_build = false; + build_status = 0; } public void write_config (HashTable new_conf) { @@ -147,13 +151,13 @@ namespace Pamac { } public void refresh (int force) { - string action = dgettext ("pacman", "Synchronizing package databases...\n").replace ("\n", ""); - spawn_in_term ({"/usr/bin/echo", action}, null); + string action = dgettext (null, "Synchronizing package databases") + "..."; + spawn_in_term ({"/usr/bin/echo", action}); progress_window.action_label.set_text (action); progress_window.progressbar.set_fraction (0); progress_window.progressbar.set_text (""); - progress_window.cancel_button.visible = true; - progress_window.close_button.visible = false; + progress_window.cancel_button.set_visible (true); + progress_window.close_button.set_visible (false); progress_window.show (); daemon.refresh.begin (force, true, (obj, res) => { try { @@ -165,9 +169,9 @@ namespace Pamac { } public void sysupgrade_simple (int enable_downgrade) { - print("simple sysupgrade\n"); + print ("simple sysupgrade\n"); progress_window.progressbar.set_fraction (0); - progress_window.cancel_button.visible = true; + progress_window.cancel_button.set_visible (true); ErrorInfos err = ErrorInfos (); try { err = daemon.trans_init (0); @@ -203,17 +207,17 @@ namespace Pamac { } public void sysupgrade (int enable_downgrade) { - string action = dgettext ("pacman", "Starting full system upgrade...\n").replace ("\n", ""); - spawn_in_term ({"/usr/bin/echo", action}, null); + string action = dgettext (null, "Starting full system upgrade") + "..."; + spawn_in_term ({"/usr/bin/echo", action}); progress_window.action_label.set_text (action); progress_window.progressbar.set_fraction (0); progress_window.progressbar.set_text (""); - progress_window.cancel_button.visible = true; - progress_window.close_button.visible = false; + progress_window.cancel_button.set_visible (true); + progress_window.close_button.set_visible (false); while (Gtk.events_pending ()) Gtk.main_iteration (); // sysupgrade - print("get syncfirst\n"); + print ("get syncfirst\n"); // get syncfirst updates UpdatesInfos[] syncfirst_updates = get_syncfirst_updates (alpm_config); if (syncfirst_updates.length != 0) { @@ -226,7 +230,7 @@ namespace Pamac { run (); } else { if (pamac_config.enable_aur) { - print("get aur updates\n"); + print ("get aur updates\n"); string[] ignore_pkgs = get_ignore_pkgs (alpm_config); UpdatesInfos[] aur_updates = get_aur_updates (alpm_config, ignore_pkgs); if (aur_updates.length != 0) { @@ -248,12 +252,12 @@ namespace Pamac { public void run () { string action = dgettext (null,"Preparing") + "..."; - spawn_in_term ({"/usr/bin/echo", action}, null); + spawn_in_term ({"/usr/bin/echo", action}); progress_window.action_label.set_text (action); progress_window.progressbar.set_fraction (0); progress_window.progressbar.set_text (""); - progress_window.cancel_button.visible = true; - progress_window.close_button.visible = false; + progress_window.cancel_button.set_visible (true); + progress_window.close_button.set_visible (false); progress_window.show (); while (Gtk.events_pending ()) Gtk.main_iteration (); @@ -321,7 +325,7 @@ namespace Pamac { public void choose_provider (string depend, string[] providers) { int len = providers.length; - choose_provider_dialog.label.set_markup ("%s".printf (dgettext (null, "Choose a provider for %s:").printf (depend, len))); + choose_provider_dialog.label.set_markup ("%s".printf (dgettext (null, "Choose a provider for %s").printf (depend, len))); choose_provider_dialog.comboboxtext.remove_all (); foreach (string provider in providers) choose_provider_dialog.comboboxtext.append_text (provider); @@ -458,14 +462,13 @@ namespace Pamac { if (dsize == 0) transaction_sum_dialog.bottom_label.set_visible (false); else { - transaction_sum_dialog.bottom_label.set_markup ("%s %s".printf (dgettext (null, "Total download size:"), format_size (dsize))); + transaction_sum_dialog.bottom_label.set_markup ("%s: %s".printf (dgettext (null, "Total download size"), format_size (dsize))); transaction_sum_dialog.bottom_label.set_visible (true); } return ret; } public void commit () { - progress_window.cancel_button.visible = false; daemon.trans_commit.begin ((obj, res) => { try { daemon.trans_commit.end (res); @@ -478,12 +481,12 @@ namespace Pamac { public void build_aur_packages () { print ("building packages\n"); string action = dgettext (null,"Building packages") + "..."; - spawn_in_term ({"/usr/bin/echo", "-n", action}, null); + spawn_in_term ({"/usr/bin/echo", "-n", action}); progress_window.action_label.set_text (action); progress_window.progressbar.set_fraction (0); progress_window.progressbar.set_text (""); - progress_window.cancel_button.visible = false; - progress_window.close_button.visible = false; + progress_window.cancel_button.set_visible (false); + progress_window.close_button.set_visible (false); progress_window.expander.set_expanded (true); progress_window.width_request = 700; term.grab_focus (); @@ -521,7 +524,7 @@ namespace Pamac { } } - void spawn_in_term (string[] args, out int pid) { + public void spawn_in_term (string[] args, out int pid = null) { try { Process.spawn_async (null, args, null, SpawnFlags.DO_NOT_REAP_CHILD, pty.child_setup, out pid); } catch (SpawnError e) { @@ -530,91 +533,147 @@ namespace Pamac { term.set_pty (pty); } - void on_emit_event (uint event, string msg) { + void on_emit_event (uint event, string[] details) { + string msg; switch (event) { case Event.CHECKDEPS_START: + msg = dgettext (null, "Checking dependencies") + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); break; case Event.FILECONFLICTS_START: + msg = dgettext (null, "Checking file conflicts") + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); break; case Event.RESOLVEDEPS_START: + msg = dgettext (null, "Resolving dependencies") + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); break; case Event.INTERCONFLICTS_START: + msg = dgettext (null, "Checking inter-conflicts") + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); break; case Event.ADD_START: - progress_window.cancel_button.visible = false; - break; - case Event.ADD_DONE: - break; - case Event.REMOVE_START: - progress_window.cancel_button.visible = false; - break; - case Event.REMOVE_DONE: - break; - case Event.UPGRADE_START: - break; - case Event.UPGRADE_DONE: - break; - case Event.DOWNGRADE_START: - break; - case Event.DOWNGRADE_DONE: + progress_window.cancel_button.set_visible (false); + previous_filename = details[0]; + msg = dgettext (null, "Installing %s").printf (details[0]) + "..."; + progress_window.action_label.set_text (msg); + msg = dgettext (null, "Installing %s").printf ("%s (%s)".printf (details[0], details[1]))+ "..."; + spawn_in_term ({"/usr/bin/echo", msg}); break; case Event.REINSTALL_START: + progress_window.cancel_button.set_visible (false); + previous_filename = details[0]; + msg = dgettext (null, "Reinstalling %s").printf (details[0]) + "..."; + progress_window.action_label.set_text (msg); + msg = dgettext (null, "Reinstalling %s").printf ("%s (%s)".printf (details[0], details[1]))+ "..."; + spawn_in_term ({"/usr/bin/echo", msg}); break; - case Event.REINSTALL_DONE: + case Event.REMOVE_START: + progress_window.cancel_button.set_visible (false); + previous_filename = details[0]; + msg = dgettext (null, "Removing %s").printf (details[0]) + "..."; + progress_window.action_label.set_text (msg); + msg = dgettext (null, "Removing %s").printf ("%s (%s)".printf (details[0], details[1]))+ "..."; + spawn_in_term ({"/usr/bin/echo", msg}); + break; + case Event.UPGRADE_START: + progress_window.cancel_button.set_visible (false); + previous_filename = details[0]; + msg = dgettext (null, "Upgrading %s").printf (details[0]) + "..."; + progress_window.action_label.set_text (msg); + msg = dgettext (null, "Upgrading %s").printf ("%s (%s -> %s)".printf (details[0], details[1], details[2]))+ "..."; + spawn_in_term ({"/usr/bin/echo", msg}); + break; + case Event.DOWNGRADE_START: + progress_window.cancel_button.set_visible (false); + previous_filename = details[0]; + msg = dgettext (null, "Downgrading %s").printf (details[0]) + "..."; + progress_window.action_label.set_text (msg); + msg = dgettext (null, "Downgrading %s").printf ("%s (%s -> %s)".printf (details[0], details[1], details[2]))+ "..."; + spawn_in_term ({"/usr/bin/echo", msg}); break; case Event.INTEGRITY_START: + msg = dgettext (null, "Checking integrity") + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); break; case Event.KEYRING_START: + msg = dgettext (null, "Checking keyring") + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); + break; + case Event.KEY_DOWNLOAD_START: + msg = dgettext (null, "Downloading required keys") + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); break; - //~ case Event.KEY_DOWNLOAD_START: - //~ break; case Event.LOAD_START: + msg = dgettext (null, "Loading packages files") + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); + break; + case Event.DELTA_INTEGRITY_START: + msg = dgettext (null, "Checking delta integrity") + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); + break; + case Event.DELTA_PATCHES_START: + msg = dgettext (null, "Applying deltas") + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); + break; + case Event.DELTA_PATCH_START: + msg = dgettext (null, "Generating %s with %s").printf (details[0], details[1]) + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); + break; + case Event.DELTA_PATCH_DONE: + msg = dgettext (null, "Generation succeeded") + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); + break; + case Event.DELTA_PATCH_FAILED: + msg = dgettext (null, "Generation failed") + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); break; - //~ case Event.DELTA_INTEGRITY_START: - //~ break; - //~ case Event.DELTA_PATCHES_START: - //~ break; - //~ case Event.DELTA_PATCH_START: - //~ break; - //~ case Event.DELTA_PATCH_DONE: - //~ break; - //~ case Event.DELTA_PATCH_FAILED: - //~ break; case Event.SCRIPTLET_INFO: + progress_window.action_label.set_text (dgettext (null, "Configuring %s").printf (previous_filename) + "..."); progress_window.expander.set_expanded (true); + spawn_in_term ({"/usr/bin/echo", details[0]}); break; case Event.RETRIEVE_START: - progress_window.action_label.set_text (msg.replace ("\n", "")); + msg = dgettext (null, "Downloading") + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); break; case Event.DISKSPACE_START: + msg = dgettext (null, "Checking available disk space") + "..."; + progress_window.action_label.set_text (msg); + spawn_in_term ({"/usr/bin/echo", msg}); break; - //~ case Event.OPTDEP_REQUIRED: - //~ break; - //~ case Event.DATABASE_MISSING: - //~ break; - case Event.FILECONFLICTS_DONE: - case Event.CHECKDEPS_DONE: - case Event.RESOLVEDEPS_DONE: - case Event.INTERCONFLICTS_DONE: - case Event.INTEGRITY_DONE: - case Event.KEYRING_DONE: - case Event.KEY_DOWNLOAD_DONE: - case Event.LOAD_DONE: - case Event.DELTA_INTEGRITY_DONE: - case Event.DELTA_PATCHES_DONE: - case Event.DISKSPACE_DONE: + case Event.OPTDEP_REQUIRED: + spawn_in_term ({"/usr/bin/echo", dgettext (null, "%s optionally requires %s").printf (details[0], details[1])}); + break; + case Event.DATABASE_MISSING: + spawn_in_term ({"/usr/bin/echo", dgettext (null, "Database file for %s does not exist").printf (details[0])}); break; default: break; } - spawn_in_term ({"/usr/bin/echo", "-n", msg}, null); + while (Gtk.events_pending ()) + Gtk.main_iteration (); } void on_emit_providers (string depend, string[] providers) { choose_provider (depend, providers); } - void on_emit_progress (uint progress, string action, string pkgname, int percent, uint n_targets, uint current_target) { + void on_emit_progress (uint progress, string pkgname, int percent, uint n_targets, uint current_target) { double fraction; switch (progress) { case Progress.ADD_START: @@ -633,15 +692,6 @@ namespace Pamac { fraction = (float) percent/100; break; } - string label; - if (pkgname != "") - label = "%s %s...".printf (action, pkgname); - else - label = "%s...".printf (action); - if (label != previous_label) { - previous_label = label; - progress_window.action_label.set_text (label); - } string textbar = "%lu/%lu".printf (current_target, n_targets); if (textbar != previous_textbar) { previous_textbar = textbar; @@ -662,14 +712,14 @@ namespace Pamac { if (filename != previous_filename) { previous_filename = filename; if (filename.has_suffix (".db")) { - label = dgettext (null, "Refreshing {repo}").replace ("{repo}", filename.replace (".db", "")) + "..."; + label = dgettext (null, "Refreshing %s").printf (filename.replace (".db", "")) + "..."; } else { - label = dgettext (null, "Downloading {pkgname}").replace ("{pkgname}", filename.replace (".pkg.tar.xz", "")) + "..."; + label = dgettext (null, "Downloading %s").printf (filename.replace (".pkg.tar.xz", "")) + "..."; } if (label != previous_label) { previous_label = label; progress_window.action_label.set_text (label); - spawn_in_term ({"/usr/bin/echo", label}, null); + spawn_in_term ({"/usr/bin/echo", label}); } } if (total_download > 0) { @@ -709,11 +759,11 @@ namespace Pamac { } if (line != null) { progress_window.expander.set_expanded (true); - spawn_in_term ({"/usr/bin/echo", "-n", line}, null); + spawn_in_term ({"/usr/bin/echo", "-n", line}); } } - public void handle_warning () { + public void show_warnings () { if (transaction_info_dialog.textbuffer.text != "") { transaction_info_dialog.set_title (dgettext (null, "Warning")); transaction_info_dialog.label.set_visible (false); @@ -730,31 +780,41 @@ namespace Pamac { } public void handle_error (ErrorInfos error) { + progress_window.expander.set_expanded (true); + spawn_in_term ({"/usr/bin/echo", "-n", error.str}); TextIter start_iter; TextIter end_iter; transaction_info_dialog.set_title (dgettext (null, "Error")); transaction_info_dialog.label.set_visible (true); - transaction_info_dialog.label.set_markup (error.str.replace ("\n", "")); - 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); + transaction_info_dialog.label.set_markup (error.str); if (error.details.length != 0) { - foreach (string detail in error.details) { - transaction_info_dialog.textbuffer.get_end_iter (out end_iter); - transaction_info_dialog.textbuffer.insert (ref end_iter, detail, detail.length); - } + 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); transaction_info_dialog.expander.set_visible (true); + transaction_info_dialog.expander.set_expanded (true); + spawn_in_term ({"/usr/bin/echo", ":"}); + foreach (string detail in error.details) { + spawn_in_term ({"/usr/bin/echo", detail}); + string str = detail + "\n"; + transaction_info_dialog.textbuffer.get_end_iter (out end_iter); + transaction_info_dialog.textbuffer.insert (ref end_iter, str, str.length); + } } else transaction_info_dialog.expander.set_visible (false); + spawn_in_term ({"/usr/bin/echo"}); transaction_info_dialog.run (); transaction_info_dialog.hide (); progress_window.hide (); + 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 ()) Gtk.main_iteration (); } public void on_emit_refreshed (ErrorInfos error) { - print("transaction refreshed\n"); + print ("transaction refreshed\n"); refresh_alpm_config (); if (error.str == "") { if (mode == Mode.UPDATER) { @@ -772,7 +832,7 @@ namespace Pamac { public void on_emit_trans_prepared (ErrorInfos error) { print ("transaction prepared\n"); if (error.str == "") { - handle_warning (); + show_warnings (); int ret = set_transaction_sum (); if (ret == 0) { if (data.to_add.size () == 0 @@ -788,12 +848,13 @@ namespace Pamac { ErrorInfos err = ErrorInfos (); on_emit_trans_committed (err); } else { + spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction cancelled") + ".\n"}); progress_window.hide (); transaction_sum_dialog.hide (); finished (true); } } else if (sysupgrade_after_build) { - print("sysupgrade_after_build\n"); + print ("sysupgrade_after_build\n"); sysupgrade_after_build = false; commit (); } else if (transaction_sum_dialog.run () == ResponseType.OK) { @@ -802,6 +863,7 @@ namespace Pamac { Gtk.main_iteration (); commit (); } else { + spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction cancelled") + ".\n"}); progress_window.hide (); transaction_sum_dialog.hide (); release (); @@ -812,6 +874,7 @@ namespace Pamac { } else { //ErrorInfos err = ErrorInfos (); //err.str = dgettext (null, "Nothing to do") + "\n"; + spawn_in_term ({"/usr/bin/echo", dgettext (null, "Nothing to do") + ".\n"}); progress_window.hide (); release (); clear_lists (); @@ -825,20 +888,20 @@ namespace Pamac { } public void on_emit_trans_committed (ErrorInfos error) { - print("transaction committed\n"); + print ("transaction committed\n"); if (error.str == "") { if (data.to_build.size () != 0) { if (data.to_add.size () != 0 || data.to_remove.size () != 0 || data.to_load.size () != 0) { - spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction successfully finished") + "\n"}, null); + spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction successfully finished") + ".\n"}); } build_aur_packages (); } else { //progress_window.action_label.set_text (dgettext (null, "Transaction successfully finished")); //progress_window.close_button.set_visible (true); clear_lists (); - handle_warning (); + show_warnings (); refresh_alpm_config (); if (sysupgrade_after_trans) { sysupgrade_after_trans = false; @@ -846,22 +909,33 @@ namespace Pamac { } else if (sysupgrade_after_build) { sysupgrade_simple (0); } else { + if (build_status == 0) + spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction successfully finished") + ".\n"}); + else + spawn_in_term ({"/usr/bin/echo"}); progress_window.hide (); - spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction successfully finished") + "\n"}, null); finished (false); } } } else { + refresh_alpm_config (); finished (true); handle_error (error); } total_download = 0; already_downloaded = 0; + build_status = 0; } void on_term_child_exited (int status) { Source.remove (build_timeout_id); data.to_build.steal_all (); + build_status = status; + try { + daemon.refresh_alpm_config (); + } catch (IOError e) { + stderr.printf ("IOError: %s\n", e.message); + } ErrorInfos err = ErrorInfos (); on_emit_trans_committed (err); } diff --git a/src/tray.vala b/src/tray.vala index 0dc489d..0122e75 100644 --- a/src/tray.vala +++ b/src/tray.vala @@ -21,7 +21,7 @@ const string GETTEXT_PACKAGE = "pamac"; const string update_icon_name = "pamac-tray-update"; -const string update_info = _("{number} available updates"); +const string update_info = _("%u available updates"); const string one_update_info = _("1 available update"); const string noupdate_icon_name = "pamac-tray-no-update"; const string noupdate_info = _("Your system is up-to-date"); @@ -142,7 +142,7 @@ namespace Pamac { show_notification (one_update_info); } else { // workaround to use python format string - string info = update_info.replace ("{number}", updates_nb.to_string ()); + string info = update_info.printf (updates_nb); this.update_icon (update_icon_name, info); if (pamac_run == false) show_notification (info); diff --git a/src/updater_window.vala b/src/updater_window.vala index a703fac..dbafbe0 100644 --- a/src/updater_window.vala +++ b/src/updater_window.vala @@ -132,7 +132,10 @@ namespace Pamac { updates_nb = syncfirst_updates.length; foreach (UpdatesInfos infos in syncfirst_updates) { name = infos.name + " " + infos.version; - size = format_size (infos.download_size); + if (infos.download_size != 0) + size = format_size (infos.download_size); + else + size = ""; dsize += infos.download_size; updates_list.insert_with_values (out iter, -1, 0, name, 1, size); } @@ -141,7 +144,10 @@ namespace Pamac { UpdatesInfos[] updates = get_repos_updates (transaction.alpm_config, ignore_pkgs); foreach (UpdatesInfos infos in updates) { name = infos.name + " " + infos.version; - size = format_size (infos.download_size); + if (infos.download_size != 0) + size = format_size (infos.download_size); + else + size = ""; dsize += infos.download_size; updates_list.insert_with_values (out iter, -1, 0, name, 1, size); } @@ -151,7 +157,10 @@ namespace Pamac { updates_nb += aur_updates.length; foreach (UpdatesInfos infos in aur_updates) { name = infos.name + " " + infos.version; - size = format_size (infos.download_size); + if (infos.download_size != 0) + size = format_size (infos.download_size); + else + size = ""; dsize += infos.download_size; updates_list.insert_with_values (out iter, -1, 0, name, 1, size); } @@ -164,15 +173,14 @@ namespace Pamac { top_label.set_markup("%s".printf (dgettext (null, "1 available update"))); apply_button.set_sensitive (true); } else { - top_label.set_markup("%s".printf (dgettext (null, "{number} available updates").replace ("{number}", updates_nb.to_string ()))); + top_label.set_markup("%s".printf (dgettext (null, "%u available updates").printf (updates_nb))); apply_button.set_sensitive (true); } - if (dsize == 0) - bottom_label.set_visible (false); - else { - bottom_label.set_markup("%s %s".printf (dgettext (null, "Total download size:"), format_size(dsize))); + if (dsize != 0) { + bottom_label.set_markup("%s: %s".printf (dgettext (null, "Total download size"), format_size(dsize))); bottom_label.set_visible (true); - } + } else + bottom_label.set_visible (false); } } } diff --git a/update_po_files.sh b/update_po_files.sh index 3647da1..0ce20b2 100755 --- a/update_po_files.sh +++ b/update_po_files.sh @@ -1,5 +1,5 @@ #! /bin/sh for i in `ls po | sed s'|.po||'` ; do - msgmerge --update --no-fuzzy-matching po/$i.po pamac.pot + msgmerge --update po/$i.po pamac.pot done