update displayed strings

This commit is contained in:
guinux 2014-10-26 12:30:04 +01:00
parent 03638f6375
commit a2d248bc2d
15 changed files with 661 additions and 353 deletions

View File

@ -14,12 +14,4 @@
<allow_active>auth_admin_keep</allow_active> <allow_active>auth_admin_keep</allow_active>
</defaults> </defaults>
</action> </action>
<action id="org.manjaro.pamac.write_config">
<message>Authentication is required</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
</policyconfig> </policyconfig>

View File

@ -1,24 +1,26 @@
./resources/choose_provider_dialog.ui resources/choose_provider_dialog.ui
./resources/packages_chooser_dialog.ui resources/packages_chooser_dialog.ui
./resources/progress_window.ui resources/progress_window.ui
./resources/history_dialog.ui resources/history_dialog.ui
./resources/transaction_info_dialog.ui resources/transaction_info_dialog.ui
./resources/transaction_sum_dialog.ui resources/transaction_sum_dialog.ui
./resources/manager_window.ui resources/manager_window.ui
./resources/updater_window.ui resources/updater_window.ui
./resources/preferences_dialog.ui resources/preferences_dialog.ui
./src/packages_chooser_dialog.vala src/packages_chooser_dialog.vala
./src/transaction_info_dialog.vala src/transaction_info_dialog.vala
./src/history_dialog.vala src/history_dialog.vala
./src/transaction_sum_dialog.vala src/transaction_sum_dialog.vala
./src/installer.vala src/daemon.vala
./src/tray.vala src/transaction.vala
./src/manager.vala src/installer.vala
./src/preferences_dialog.vala src/tray.vala
./src/updater.vala src/manager.vala
./src/choose_provider_dialog.vala src/preferences_dialog.vala
./src/manager_window.vala src/updater.vala
./src/progress_window.vala src/choose_provider_dialog.vala
./src/updater_window.vala src/manager_window.vala
./src/common.vala src/progress_window.vala
src/updater_window.vala
src/common.vala

299
pamac.pot
View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: pamac 2.0\n" "Project-Id-Version: pamac 2.0\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -33,13 +33,18 @@ msgid "Progress"
msgstr "" msgstr ""
#: resources/progress_window.ui:63 resources/transaction_info_dialog.ui:84 #: resources/progress_window.ui:63 resources/transaction_info_dialog.ui:84
msgid "details" #: resources/manager_window.ui:707
msgid "Details"
msgstr "" msgstr ""
#: resources/history_dialog.ui:7 #: resources/history_dialog.ui:7
msgid "Pamac History" msgid "Pamac History"
msgstr "" msgstr ""
#: resources/transaction_sum_dialog.ui:6 src/transaction.vala:356
msgid "Transaction Summary"
msgstr ""
#: resources/manager_window.ui:14 src/tray.vala:76 #: resources/manager_window.ui:14 src/tray.vala:76
msgid "Package Manager" msgid "Package Manager"
msgstr "" msgstr ""
@ -73,7 +78,7 @@ msgid "State"
msgstr "" msgstr ""
#: resources/manager_window.ui:371 #: resources/manager_window.ui:371
msgid "Repos" msgid "Repositories"
msgstr "" msgstr ""
#: resources/manager_window.ui:433 #: resources/manager_window.ui:433
@ -84,8 +89,8 @@ msgstr ""
msgid "Version" msgid "Version"
msgstr "" msgstr ""
#: resources/manager_window.ui:463 #: resources/manager_window.ui:463 src/manager_window.vala:328
msgid "Repo" msgid "Repository"
msgstr "" msgstr ""
#: resources/manager_window.ui:478 #: resources/manager_window.ui:478
@ -93,15 +98,11 @@ msgid "Size"
msgstr "" msgstr ""
#: resources/manager_window.ui:582 #: resources/manager_window.ui:582
msgid "Infos" msgid "Description"
msgstr "" msgstr ""
#: resources/manager_window.ui:642 #: resources/manager_window.ui:642
msgid "Deps" msgid "Dependencies"
msgstr ""
#: resources/manager_window.ui:707
msgid "Details"
msgstr "" msgstr ""
#: resources/manager_window.ui:740 #: resources/manager_window.ui:740
@ -135,8 +136,8 @@ msgstr ""
#: resources/preferences_dialog.ui:118 #: resources/preferences_dialog.ui:118
msgid "" msgid ""
"When removing a package, also remove those dependencies that are not " "When removing a package, also remove its dependencies that are not required "
"required by other packages" "by other packages"
msgstr "" msgstr ""
#: resources/preferences_dialog.ui:152 src/preferences_dialog.vala:37 #: resources/preferences_dialog.ui:152 src/preferences_dialog.vala:37
@ -151,15 +152,261 @@ msgstr ""
msgid "Packages" msgid "Packages"
msgstr "" msgstr ""
#: src/tray.vala:24 src/updater_window.vala:167 #: src/daemon.vala:113 src/daemon.vala:120
msgid "{number} available updates" msgid "Failed to synchronize any databases"
msgstr "" 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" msgid "1 available update"
msgstr "" 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" msgid "Your system is up-to-date"
msgstr "" msgstr ""
@ -184,14 +431,6 @@ msgstr ""
msgid "Orphans" msgid "Orphans"
msgstr "" 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 #: src/manager_window.vala:210
msgid "Licenses" msgid "Licenses"
msgstr "" msgstr ""
@ -201,7 +440,7 @@ msgid "Depends On"
msgstr "" msgstr ""
#: src/manager_window.vala:252 #: src/manager_window.vala:252
msgid "Optional Deps" msgid "Optional Dependencies"
msgstr "" msgstr ""
#: src/manager_window.vala:272 #: src/manager_window.vala:272
@ -220,10 +459,6 @@ msgstr ""
msgid "Conflicts With" msgid "Conflicts With"
msgstr "" msgstr ""
#: src/manager_window.vala:328
msgid "Repository"
msgstr ""
#: src/manager_window.vala:346 #: src/manager_window.vala:346
msgid "Packager" msgid "Packager"
msgstr "" msgstr ""
@ -264,8 +499,8 @@ msgstr ""
msgid "Uninstalled" msgid "Uninstalled"
msgstr "" msgstr ""
#: src/updater_window.vala:173 #: src/manager_window.vala:888
msgid "Total download size:" msgid "A Gtk3 frontend for libalpm"
msgstr "" msgstr ""
#: src/common.vala:62 #: src/common.vala:62

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: pamac 2.0\n" "Project-Id-Version: pamac 2.0\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -368,7 +368,7 @@
<object class="GtkLabel" id="tab4"> <object class="GtkLabel" id="tab4">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Repos</property> <property name="label" translatable="yes">Repositories</property>
</object> </object>
<packing> <packing>
<property name="position">3</property> <property name="position">3</property>
@ -460,7 +460,7 @@
<object class="GtkTreeViewColumn" id="repo_column"> <object class="GtkTreeViewColumn" id="repo_column">
<property name="resizable">True</property> <property name="resizable">True</property>
<property name="sizing">autosize</property> <property name="sizing">autosize</property>
<property name="title" translatable="yes">Repo</property> <property name="title" translatable="yes">Repository</property>
<property name="clickable">True</property> <property name="clickable">True</property>
<signal name="clicked" handler="on_repo_column_clicked" swapped="no"/> <signal name="clicked" handler="on_repo_column_clicked" swapped="no"/>
<child> <child>
@ -579,7 +579,7 @@
<object class="GtkLabel" id="label1"> <object class="GtkLabel" id="label1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Infos</property> <property name="label" translatable="yes">Description</property>
</object> </object>
<packing> <packing>
<property name="tab_fill">False</property> <property name="tab_fill">False</property>
@ -639,7 +639,7 @@
<object class="GtkLabel" id="label2"> <object class="GtkLabel" id="label2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Deps</property> <property name="label" translatable="yes">Dependencies</property>
</object> </object>
<packing> <packing>
<property name="position">1</property> <property name="position">1</property>

View File

@ -115,7 +115,7 @@
<child> <child>
<object class="GtkSwitch" id="remove_unrequired_deps_button"> <object class="GtkSwitch" id="remove_unrequired_deps_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip_text" translatable="yes">When removing a package, also remove those dependencies that are not required by other packages</property> <property name="tooltip_text" translatable="yes">When removing a package, also remove its dependencies that are not required by other packages</property>
<property name="halign">2</property> <property name="halign">2</property>
<property name="margin">3</property> <property name="margin">3</property>
</object> </object>

View File

@ -60,7 +60,7 @@
<object class="GtkLabel" id="expander_label"> <object class="GtkLabel" id="expander_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">details</property> <property name="label" translatable="yes">Details</property>
</object> </object>
</child> </child>
</object> </object>

View File

@ -81,7 +81,7 @@
<object class="GtkLabel" id="expander_label"> <object class="GtkLabel" id="expander_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">details</property> <property name="label" translatable="yes">Details</property>
</object> </object>
</child> </child>
</object> </object>

View File

@ -22,7 +22,7 @@ using Pamac;
using Polkit; using Polkit;
// i18n // i18n
const string GETTEXT_PACKAGE = "pacman"; const string GETTEXT_PACKAGE = "pamac";
PamacServer server; PamacServer server;
MainLoop loop; MainLoop loop;
@ -41,9 +41,9 @@ public class PamacServer : Object {
public Mutex provider_mutex; public Mutex provider_mutex;
public int? choosen_provider; 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_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_download (string filename, uint64 xfered, uint64 total);
public signal void emit_totaldownload (uint64 total); public signal void emit_totaldownload (uint64 total);
public signal void emit_log (uint level, string msg); 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 () { private void refresh_real () {
ErrorInfos err = ErrorInfos (); ErrorInfos err = ErrorInfos ();
string[] details = {}; string[] details = {};
@ -106,18 +110,22 @@ public class PamacServer : Object {
// 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\n"); err.str = _("Failed to synchronize any databases");
details += Alpm.strerror (alpm_config.handle.errno ()) + "\n"; details += Alpm.strerror (alpm_config.handle.errno ());
err.details = details; err.details = details;
} }
trans_release (); trans_release ();
get_handle (); get_handle ();
} else {
err.str = _("Failed to synchronize any databases");
details += Alpm.strerror (alpm_config.handle.errno ());
err.details = details;
}
if (emit_refreshed_signal) if (emit_refreshed_signal)
emit_refreshed (err); emit_refreshed (err);
else else
emit_refreshed_signal = true; emit_refreshed_signal = true;
} }
}
public async void refresh (int force, bool emit_signal) { public async void refresh (int force, bool emit_signal) {
force_refresh = force; force_refresh = force;
@ -148,25 +156,31 @@ public class PamacServer : Object {
public ErrorInfos trans_init (TransFlag transflags) { public ErrorInfos trans_init (TransFlag transflags) {
ErrorInfos err = ErrorInfos (); ErrorInfos err = ErrorInfos ();
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 = _("failed to init transaction (%s)\n").printf (Alpm.strerror (errno)); err.str = _("Failed to init transaction");
err.str = Alpm.strerror (alpm_config.handle.errno ()) + "\n"; details += Alpm.strerror (alpm_config.handle.errno ());
err.details = details;
} }
return err; return err;
} }
public ErrorInfos trans_sysupgrade (int enable_downgrade) { public ErrorInfos trans_sysupgrade (int enable_downgrade) {
ErrorInfos err = ErrorInfos (); ErrorInfos err = ErrorInfos ();
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 = 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; return err;
} }
public ErrorInfos trans_add_pkg (string pkgname) { public ErrorInfos trans_add_pkg (string pkgname) {
ErrorInfos err = ErrorInfos (); ErrorInfos err = ErrorInfos ();
string[] details = {};
unowned Package? pkg = null; unowned Package? pkg = null;
//pkg = alpm_config.handle.find_dbs_satisfier (syncdbs, pkgname); //pkg = alpm_config.handle.find_dbs_satisfier (syncdbs, pkgname);
foreach (var db in syncdbs) { foreach (var db in syncdbs) {
@ -175,7 +189,9 @@ public class PamacServer : Object {
break; break;
} }
if (pkg == null) { 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; return err;
} }
int ret = alpm_config.handle.trans_add_pkg (pkg); int ret = alpm_config.handle.trans_add_pkg (pkg);
@ -185,7 +201,9 @@ public class PamacServer : Object {
// just skip duplicate or ignored targets // just skip duplicate or ignored targets
return err; return err;
else { 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; return err;
} }
} }
@ -194,19 +212,24 @@ public class PamacServer : Object {
public ErrorInfos trans_load_pkg (string pkgpath) { public ErrorInfos trans_load_pkg (string pkgpath) {
ErrorInfos err = ErrorInfos (); ErrorInfos err = ErrorInfos ();
string[] details = {};
unowned Package? pkg = alpm_config.handle.load_file (pkgpath, 1, alpm_config.handle.localfilesiglevel); unowned Package? pkg = alpm_config.handle.load_file (pkgpath, 1, alpm_config.handle.localfilesiglevel);
if (pkg == null) { 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; return err;
} else { } else {
int ret = alpm_config.handle.trans_add_pkg (pkg); int ret = alpm_config.handle.trans_add_pkg (pkg);
if (ret == -1) { if (ret == -1) {
Alpm.Errno errno = alpm_config.handle.errno (); 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 // just skip duplicate or ignored targets
return err; return err;
} else { 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; return err;
} }
} }
@ -216,14 +239,19 @@ public class PamacServer : Object {
public ErrorInfos trans_remove_pkg (string pkgname) { public ErrorInfos trans_remove_pkg (string pkgname) {
ErrorInfos err = ErrorInfos (); ErrorInfos err = ErrorInfos ();
string[] details = {};
unowned Package? pkg = localdb.get_pkg (pkgname); unowned Package? pkg = localdb.get_pkg (pkgname);
if (pkg == null) { 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; 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 = "'%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; return err;
} }
@ -235,39 +263,60 @@ public class PamacServer : Object {
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 = _("failed to prepare transaction (%s)\n").printf (); err.str = _("Failed to prepare transaction");
err.str = Alpm.strerror (errno) + "\n"; string detail = Alpm.strerror (errno);
switch (errno) { switch (errno) {
case Errno.PKG_INVALID_ARCH: case Errno.PKG_INVALID_ARCH:
detail += ":";
details += detail;
foreach (void *i in err_data) { foreach (void *i in err_data) {
char *pkgname = i; 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; break;
case Errno.UNSATISFIED_DEPS: case Errno.UNSATISFIED_DEPS:
detail += ":";
details += detail;
foreach (void *i in err_data) { foreach (void *i in err_data) {
DepMissing *miss = i; DepMissing *miss = i;
string depstring = miss->depend.compute_string (); string depstring = miss->depend.compute_string ();
details += _("%s: requires %s\n").printf (miss->target, depstring); details += _("%s: requires %s").printf (miss->target, depstring);
} }
break; break;
case Errno.CONFLICTING_DEPS: case Errno.CONFLICTING_DEPS:
detail += ":";
details += detail;
foreach (void *i in err_data) { foreach (void *i in err_data) {
Conflict *conflict = i; Conflict *conflict = i;
detail = _("%s and %s are in conflict").printf (conflict->package1, conflict->package2);
// only print reason if it contains new information // only print reason if it contains new information
if (conflict->reason.mod == DepMod.ANY) if (conflict->reason.mod != DepMod.ANY) {
details += _("%s and %s are in conflict\n").printf (conflict->package1, conflict->package2); detail += " (%s)".printf (conflict->reason.compute_string ());
else {
string reason = conflict->reason.compute_string ();
details += _("%s and %s are in conflict (%s)\n").printf (conflict->package1, conflict->package2, reason);
} }
details += detail;
} }
break; break;
default: default:
details += detail;
break; break;
} }
err.details = details; err.details = details;
trans_release (); 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); emit_trans_prepared (err);
} }
@ -326,22 +375,24 @@ public class PamacServer : Object {
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 = _("failed to commit transaction (%s)\n").printf (Alpm.strerror (errno)); err.str = _("Failed to commit transaction");
err.str = Alpm.strerror (errno) + "\n"; string detail = Alpm.strerror (errno);
switch (errno) { switch (errno) {
case Alpm.Errno.FILE_CONFLICTS: case Alpm.Errno.FILE_CONFLICTS:
TransFlag flags = alpm_config.handle.trans_get_flags (); detail += ":";
if ((flags & TransFlag.FORCE) != 0) { details += detail;
details += _("unable to %s directory-file conflicts\n").printf ("--force"); //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) { foreach (void *i in err_data) {
FileConflict *conflict = i; FileConflict *conflict = i;
switch (conflict->type) { switch (conflict->type) {
case FileConflictType.TARGET: 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; break;
case FileConflictType.FILESYSTEM: 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; break;
} }
} }
@ -350,12 +401,15 @@ public class PamacServer : Object {
case Alpm.Errno.PKG_INVALID_CHECKSUM: case Alpm.Errno.PKG_INVALID_CHECKSUM:
case Alpm.Errno.PKG_INVALID_SIG: case Alpm.Errno.PKG_INVALID_SIG:
case Alpm.Errno.DLT_INVALID: case Alpm.Errno.DLT_INVALID:
detail += ":";
details += detail;
foreach (void *i in err_data) { foreach (void *i in err_data) {
char *filename = i; char *filename = i;
details += _("%s is invalid or corrupted\n").printf (filename); details += _("%s is invalid or corrupted").printf (filename);
} }
break; break;
default: default:
details += detail;
break; break;
} }
err.details = details; err.details = details;
@ -379,7 +433,7 @@ public class PamacServer : Object {
new Thread<void*>.try ("commit thread", (ThreadFunc) trans_commit_real); new Thread<void*>.try ("commit thread", (ThreadFunc) trans_commit_real);
} else { } else {
ErrorInfos err = ErrorInfos (); ErrorInfos err = ErrorInfos ();
err.str = "Not Authorized\n"; err.str = dgettext ("pamac", "Authentication failed");
emit_trans_committed (err); emit_trans_committed (err);
trans_release (); trans_release ();
} }
@ -416,143 +470,105 @@ private void write_log_file (string event) {
// writing a short string to the stream // writing a short string to the stream
dos.put_string (log); dos.put_string (log);
} catch (GLib.Error e) { } 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) { private void cb_event (Event event, void *data1, void *data2) {
string event_str = null; string[] details = {};
switch (event) { 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.ADD_START:
case Event.REMOVE_START:
case Event.REINSTALL_START:
unowned Package pkg = (Package) data1; 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; break;
case Event.ADD_DONE: case Event.ADD_DONE:
unowned Package pkg = (Package) data1; 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); write_log_file (log);
break; 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: case Event.REMOVE_DONE:
unowned Package pkg = (Package) data1; 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); write_log_file (log);
break; break;
case Event.UPGRADE_START: case Event.UPGRADE_START:
case Event.DOWNGRADE_START:
unowned Package new_pkg = (Package) data1; unowned Package new_pkg = (Package) data1;
unowned Package old_pkg = (Package) data2; 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; break;
case Event.UPGRADE_DONE: case Event.UPGRADE_DONE:
unowned Package new_pkg = (Package) data1; unowned Package new_pkg = (Package) data1;
unowned Package old_pkg = (Package) data2; 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); write_log_file (log);
break; 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: case Event.DOWNGRADE_DONE:
unowned Package new_pkg = (Package) data1; unowned Package new_pkg = (Package) data1;
unowned Package old_pkg = (Package) data2; 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); write_log_file (log);
break; 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: case Event.DELTA_PATCH_START:
unowned string string1 = (string) data1; unowned string string1 = (string) data1;
unowned string string2 = (string) data2; unowned string string2 = (string) data2;
event_str = _("generating %s with %s... ").printf (string1, string2); details += string1;
break; details += string2;
case Event.DELTA_PATCH_DONE:
event_str = _("success!\n");
break;
case Event.DELTA_PATCH_FAILED:
event_str = _("failed.\n");
break; break;
case Event.SCRIPTLET_INFO: case Event.SCRIPTLET_INFO:
unowned string info = (string) data1; unowned string info = (string) data1;
event_str = info; details += info;
write_log_file (event_str); write_log_file (info);
break;
case Event.RETRIEVE_START:
event_str = _("Retrieving packages ...\n");
break;
case Event.DISKSPACE_START:
event_str = _("checking available disk space...\n");
break; break;
case Event.OPTDEP_REQUIRED: case Event.OPTDEP_REQUIRED:
unowned Package pkg = (Package) data1; unowned Package pkg = (Package) data1;
Depend *depend = data2; Depend *depend = data2;
event_str = _("%s optionally requires %s\n").printf (pkg.name, depend->compute_string ()); details += pkg.name;
details += depend->compute_string ();
break; break;
case Event.DATABASE_MISSING: case Event.DATABASE_MISSING:
event_str = _("database file for '%s' does not exist\n").printf ((char *) data1); unowned string db_name = (string) data1;
break; details += db_name;
/* 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 */
break; 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: default:
event_str = "unknown event";
break; break;
} }
if (event_str != null) server.emit_event ((uint) event, details);
server.emit_event ((uint) event, event_str);
} }
private void cb_question (Question question, void *data1, void *data2, void *data3, out int response) { 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) { private void cb_progress (Progress progress, string pkgname, int percent, uint n_targets, uint current_target) {
string action = ""; //~ switch (progress) {
switch (progress) { //~ case Progress.ADD_START:
case Progress.ADD_START: //~ case Progress.UPGRADE_START:
action = _("installing"); //~ case Progress.DOWNGRADE_START:
break; //~ case Progress.REINSTALL_START:
case Progress.UPGRADE_START: //~ case Progress.REMOVE_START:
action = _("upgrading"); //~ case Progress.CONFLICTS_START:
break; //~ case Progress.DISKSPACE_START:
case Progress.DOWNGRADE_START: //~ case Progress.INTEGRITY_START:
action = _("downgrading"); //~ case Progress.KEYRING_START:
break; //~ case Progress.LOAD_START:
case Progress.REINSTALL_START: //~ default:
action = _("reinstalling"); //~ break;
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;
}
if ((uint64) percent != server.previous_percent) { if ((uint64) percent != server.previous_percent) {
server.previous_percent = (uint64) 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);
} }
} }

View File

@ -249,7 +249,7 @@ namespace Pamac {
if (satisfier != null) if (satisfier != null)
optdep_str = optdep_str + " [" + dgettext (null, "Installed") + "]"; optdep_str = optdep_str + " [" + dgettext (null, "Installed") + "]";
deps_list.insert_with_values (out iter, -1, deps_list.insert_with_values (out iter, -1,
0, dgettext (null, "Optional Deps") + ":", 0, dgettext (null, "Optional Dependencies") + ":",
1, optdep_str); 1, optdep_str);
i = 1; i = 1;
while (i < len) { while (i < len) {
@ -885,7 +885,7 @@ namespace Pamac {
this, this,
"program_name", "Pamac", "program_name", "Pamac",
"logo_icon_name", "system-software-install", "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", "copyright", "Copyright © 2014 Guillaume Benoit",
"version", VERSION, "version", VERSION,
"license_type", License.GPL_3_0, "license_type", License.GPL_3_0,
@ -916,6 +916,7 @@ namespace Pamac {
} }
public void on_emit_trans_finished (bool error) { public void on_emit_trans_finished (bool error) {
print ("transaction finished\n");
if (error == false) { if (error == false) {
set_buttons_sensitive (false); set_buttons_sensitive (false);
refresh_packages_list (); refresh_packages_list ();

View File

@ -52,8 +52,9 @@ namespace Pamac {
public void on_cancel_button_clicked () { public void on_cancel_button_clicked () {
transaction.cancel (); transaction.cancel ();
transaction.clear_lists (); transaction.clear_lists ();
transaction.finished (false); transaction.spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction cancelled") + ".\n"});
this.hide (); this.hide ();
transaction.finished (false);
while (Gtk.events_pending ()) while (Gtk.events_pending ())
Gtk.main_iteration (); Gtk.main_iteration ();
} }

View File

@ -25,6 +25,7 @@ namespace Pamac {
[DBus (name = "org.manjaro.pamac")] [DBus (name = "org.manjaro.pamac")]
public interface Daemon : Object { public interface Daemon : Object {
public abstract void write_config (HashTable<string,string> new_conf) throws IOError; public abstract void write_config (HashTable<string,string> 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 async void refresh (int force, bool emit_signal) throws IOError;
public abstract ErrorInfos trans_init (TransFlag transflags) throws IOError; public abstract ErrorInfos trans_init (TransFlag transflags) throws IOError;
public abstract ErrorInfos trans_sysupgrade (int enable_downgrade) 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 UpdatesInfos[] trans_to_remove () throws IOError;
public abstract async void trans_commit () throws IOError; public abstract async void trans_commit () throws IOError;
public abstract void trans_release () throws IOError; public abstract void trans_release () throws IOError;
[DBus (no_reply = true)]
public abstract void trans_cancel () throws IOError; public abstract void trans_cancel () throws IOError;
[DBus (no_reply = true)] [DBus (no_reply = true)]
public abstract void quit () throws IOError; 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_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_download (string filename, uint64 xfered, uint64 total);
public signal void emit_totaldownload (uint64 total); public signal void emit_totaldownload (uint64 total);
public signal void emit_log (uint level, string msg); public signal void emit_log (uint level, string msg);
@ -69,6 +71,7 @@ namespace Pamac {
uint build_timeout_id; uint build_timeout_id;
bool sysupgrade_after_trans; bool sysupgrade_after_trans;
bool sysupgrade_after_build; bool sysupgrade_after_build;
int build_status;
Terminal term; Terminal term;
Pty pty; Pty pty;
@ -132,6 +135,7 @@ namespace Pamac {
previous_filename = ""; previous_filename = "";
sysupgrade_after_trans = false; sysupgrade_after_trans = false;
sysupgrade_after_build = false; sysupgrade_after_build = false;
build_status = 0;
} }
public void write_config (HashTable<string,string> new_conf) { public void write_config (HashTable<string,string> new_conf) {
@ -147,13 +151,13 @@ namespace Pamac {
} }
public void refresh (int force) { public void refresh (int force) {
string action = dgettext ("pacman", "Synchronizing package databases...\n").replace ("\n", ""); string action = dgettext (null, "Synchronizing package databases") + "...";
spawn_in_term ({"/usr/bin/echo", action}, null); spawn_in_term ({"/usr/bin/echo", action});
progress_window.action_label.set_text (action); progress_window.action_label.set_text (action);
progress_window.progressbar.set_fraction (0); progress_window.progressbar.set_fraction (0);
progress_window.progressbar.set_text (""); progress_window.progressbar.set_text ("");
progress_window.cancel_button.visible = true; progress_window.cancel_button.set_visible (true);
progress_window.close_button.visible = false; progress_window.close_button.set_visible (false);
progress_window.show (); progress_window.show ();
daemon.refresh.begin (force, true, (obj, res) => { daemon.refresh.begin (force, true, (obj, res) => {
try { try {
@ -165,9 +169,9 @@ namespace Pamac {
} }
public void sysupgrade_simple (int enable_downgrade) { public void sysupgrade_simple (int enable_downgrade) {
print("simple sysupgrade\n"); print ("simple sysupgrade\n");
progress_window.progressbar.set_fraction (0); progress_window.progressbar.set_fraction (0);
progress_window.cancel_button.visible = true; progress_window.cancel_button.set_visible (true);
ErrorInfos err = ErrorInfos (); ErrorInfos err = ErrorInfos ();
try { try {
err = daemon.trans_init (0); err = daemon.trans_init (0);
@ -203,17 +207,17 @@ namespace Pamac {
} }
public void sysupgrade (int enable_downgrade) { public void sysupgrade (int enable_downgrade) {
string action = dgettext ("pacman", "Starting full system upgrade...\n").replace ("\n", ""); string action = dgettext (null, "Starting full system upgrade") + "...";
spawn_in_term ({"/usr/bin/echo", action}, null); spawn_in_term ({"/usr/bin/echo", action});
progress_window.action_label.set_text (action); progress_window.action_label.set_text (action);
progress_window.progressbar.set_fraction (0); progress_window.progressbar.set_fraction (0);
progress_window.progressbar.set_text (""); progress_window.progressbar.set_text ("");
progress_window.cancel_button.visible = true; progress_window.cancel_button.set_visible (true);
progress_window.close_button.visible = false; progress_window.close_button.set_visible (false);
while (Gtk.events_pending ()) while (Gtk.events_pending ())
Gtk.main_iteration (); Gtk.main_iteration ();
// sysupgrade // sysupgrade
print("get syncfirst\n"); print ("get syncfirst\n");
// get syncfirst updates // get syncfirst updates
UpdatesInfos[] syncfirst_updates = get_syncfirst_updates (alpm_config); UpdatesInfos[] syncfirst_updates = get_syncfirst_updates (alpm_config);
if (syncfirst_updates.length != 0) { if (syncfirst_updates.length != 0) {
@ -226,7 +230,7 @@ namespace Pamac {
run (); run ();
} else { } else {
if (pamac_config.enable_aur) { if (pamac_config.enable_aur) {
print("get aur updates\n"); print ("get aur updates\n");
string[] ignore_pkgs = get_ignore_pkgs (alpm_config); string[] ignore_pkgs = get_ignore_pkgs (alpm_config);
UpdatesInfos[] aur_updates = get_aur_updates (alpm_config, ignore_pkgs); UpdatesInfos[] aur_updates = get_aur_updates (alpm_config, ignore_pkgs);
if (aur_updates.length != 0) { if (aur_updates.length != 0) {
@ -248,12 +252,12 @@ namespace Pamac {
public void run () { public void run () {
string action = dgettext (null,"Preparing") + "..."; 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.action_label.set_text (action);
progress_window.progressbar.set_fraction (0); progress_window.progressbar.set_fraction (0);
progress_window.progressbar.set_text (""); progress_window.progressbar.set_text ("");
progress_window.cancel_button.visible = true; progress_window.cancel_button.set_visible (true);
progress_window.close_button.visible = false; progress_window.close_button.set_visible (false);
progress_window.show (); progress_window.show ();
while (Gtk.events_pending ()) while (Gtk.events_pending ())
Gtk.main_iteration (); Gtk.main_iteration ();
@ -321,7 +325,7 @@ namespace Pamac {
public void choose_provider (string depend, string[] providers) { public void choose_provider (string depend, string[] providers) {
int len = providers.length; int len = providers.length;
choose_provider_dialog.label.set_markup ("<b>%s</b>".printf (dgettext (null, "Choose a provider for %s:").printf (depend, len))); choose_provider_dialog.label.set_markup ("<b>%s</b>".printf (dgettext (null, "Choose a provider for %s").printf (depend, len)));
choose_provider_dialog.comboboxtext.remove_all (); choose_provider_dialog.comboboxtext.remove_all ();
foreach (string provider in providers) foreach (string provider in providers)
choose_provider_dialog.comboboxtext.append_text (provider); choose_provider_dialog.comboboxtext.append_text (provider);
@ -458,14 +462,13 @@ namespace Pamac {
if (dsize == 0) if (dsize == 0)
transaction_sum_dialog.bottom_label.set_visible (false); transaction_sum_dialog.bottom_label.set_visible (false);
else { else {
transaction_sum_dialog.bottom_label.set_markup ("<b>%s %s</b>".printf (dgettext (null, "Total download size:"), format_size (dsize))); transaction_sum_dialog.bottom_label.set_markup ("<b>%s: %s</b>".printf (dgettext (null, "Total download size"), format_size (dsize)));
transaction_sum_dialog.bottom_label.set_visible (true); transaction_sum_dialog.bottom_label.set_visible (true);
} }
return ret; return ret;
} }
public void commit () { public void commit () {
progress_window.cancel_button.visible = false;
daemon.trans_commit.begin ((obj, res) => { daemon.trans_commit.begin ((obj, res) => {
try { try {
daemon.trans_commit.end (res); daemon.trans_commit.end (res);
@ -478,12 +481,12 @@ namespace Pamac {
public void build_aur_packages () { public void build_aur_packages () {
print ("building packages\n"); print ("building packages\n");
string action = dgettext (null,"Building packages") + "..."; 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.action_label.set_text (action);
progress_window.progressbar.set_fraction (0); progress_window.progressbar.set_fraction (0);
progress_window.progressbar.set_text (""); progress_window.progressbar.set_text ("");
progress_window.cancel_button.visible = false; progress_window.cancel_button.set_visible (false);
progress_window.close_button.visible = false; progress_window.close_button.set_visible (false);
progress_window.expander.set_expanded (true); progress_window.expander.set_expanded (true);
progress_window.width_request = 700; progress_window.width_request = 700;
term.grab_focus (); 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 { try {
Process.spawn_async (null, args, null, SpawnFlags.DO_NOT_REAP_CHILD, pty.child_setup, out pid); Process.spawn_async (null, args, null, SpawnFlags.DO_NOT_REAP_CHILD, pty.child_setup, out pid);
} catch (SpawnError e) { } catch (SpawnError e) {
@ -530,91 +533,147 @@ namespace Pamac {
term.set_pty (pty); term.set_pty (pty);
} }
void on_emit_event (uint event, string msg) { void on_emit_event (uint event, string[] details) {
string msg;
switch (event) { switch (event) {
case Event.CHECKDEPS_START: case Event.CHECKDEPS_START:
msg = dgettext (null, "Checking dependencies") + "...";
progress_window.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break; break;
case Event.FILECONFLICTS_START: 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; break;
case Event.RESOLVEDEPS_START: case Event.RESOLVEDEPS_START:
msg = dgettext (null, "Resolving dependencies") + "...";
progress_window.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break; break;
case Event.INTERCONFLICTS_START: 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; break;
case Event.ADD_START: case Event.ADD_START:
progress_window.cancel_button.visible = false; progress_window.cancel_button.set_visible (false);
break; previous_filename = details[0];
case Event.ADD_DONE: msg = dgettext (null, "Installing %s").printf (details[0]) + "...";
break; progress_window.action_label.set_text (msg);
case Event.REMOVE_START: msg = dgettext (null, "Installing %s").printf ("%s (%s)".printf (details[0], details[1]))+ "...";
progress_window.cancel_button.visible = false; spawn_in_term ({"/usr/bin/echo", msg});
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:
break; break;
case Event.REINSTALL_START: 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; 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; break;
case Event.INTEGRITY_START: case Event.INTEGRITY_START:
msg = dgettext (null, "Checking integrity") + "...";
progress_window.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break; break;
case Event.KEYRING_START: 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; break;
//~ case Event.KEY_DOWNLOAD_START:
//~ break;
case Event.LOAD_START: 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; 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: case Event.SCRIPTLET_INFO:
progress_window.action_label.set_text (dgettext (null, "Configuring %s").printf (previous_filename) + "...");
progress_window.expander.set_expanded (true); progress_window.expander.set_expanded (true);
spawn_in_term ({"/usr/bin/echo", details[0]});
break; break;
case Event.RETRIEVE_START: 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; break;
case Event.DISKSPACE_START: 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; break;
//~ case Event.OPTDEP_REQUIRED: case Event.OPTDEP_REQUIRED:
//~ break; spawn_in_term ({"/usr/bin/echo", dgettext (null, "%s optionally requires %s").printf (details[0], details[1])});
//~ case Event.DATABASE_MISSING: break;
//~ break; case Event.DATABASE_MISSING:
case Event.FILECONFLICTS_DONE: spawn_in_term ({"/usr/bin/echo", dgettext (null, "Database file for %s does not exist").printf (details[0])});
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:
break; break;
default: default:
break; 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) { void on_emit_providers (string depend, string[] providers) {
choose_provider (depend, 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; double fraction;
switch (progress) { switch (progress) {
case Progress.ADD_START: case Progress.ADD_START:
@ -633,15 +692,6 @@ namespace Pamac {
fraction = (float) percent/100; fraction = (float) percent/100;
break; 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); string textbar = "%lu/%lu".printf (current_target, n_targets);
if (textbar != previous_textbar) { if (textbar != previous_textbar) {
previous_textbar = textbar; previous_textbar = textbar;
@ -662,14 +712,14 @@ namespace Pamac {
if (filename != previous_filename) { if (filename != previous_filename) {
previous_filename = filename; previous_filename = filename;
if (filename.has_suffix (".db")) { 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 { } 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) { if (label != previous_label) {
previous_label = label; previous_label = label;
progress_window.action_label.set_text (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) { if (total_download > 0) {
@ -709,11 +759,11 @@ namespace Pamac {
} }
if (line != null) { if (line != null) {
progress_window.expander.set_expanded (true); 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 != "") { if (transaction_info_dialog.textbuffer.text != "") {
transaction_info_dialog.set_title (dgettext (null, "Warning")); transaction_info_dialog.set_title (dgettext (null, "Warning"));
transaction_info_dialog.label.set_visible (false); transaction_info_dialog.label.set_visible (false);
@ -730,31 +780,41 @@ namespace Pamac {
} }
public void handle_error (ErrorInfos error) { 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 start_iter;
TextIter end_iter; 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.replace ("\n", "")); transaction_info_dialog.label.set_markup (error.str);
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);
transaction_info_dialog.textbuffer.delete (ref start_iter, ref end_iter); transaction_info_dialog.textbuffer.delete (ref start_iter, ref end_iter);
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.expander.set_visible (true); 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 } else
transaction_info_dialog.expander.set_visible (false); transaction_info_dialog.expander.set_visible (false);
spawn_in_term ({"/usr/bin/echo"});
transaction_info_dialog.run (); transaction_info_dialog.run ();
transaction_info_dialog.hide (); transaction_info_dialog.hide ();
progress_window.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 ()) while (Gtk.events_pending ())
Gtk.main_iteration (); Gtk.main_iteration ();
} }
public void on_emit_refreshed (ErrorInfos error) { public void on_emit_refreshed (ErrorInfos error) {
print("transaction refreshed\n"); print ("transaction refreshed\n");
refresh_alpm_config (); refresh_alpm_config ();
if (error.str == "") { if (error.str == "") {
if (mode == Mode.UPDATER) { if (mode == Mode.UPDATER) {
@ -772,7 +832,7 @@ namespace Pamac {
public void on_emit_trans_prepared (ErrorInfos error) { public void on_emit_trans_prepared (ErrorInfos error) {
print ("transaction prepared\n"); print ("transaction prepared\n");
if (error.str == "") { if (error.str == "") {
handle_warning (); show_warnings ();
int ret = set_transaction_sum (); int ret = set_transaction_sum ();
if (ret == 0) { if (ret == 0) {
if (data.to_add.size () == 0 if (data.to_add.size () == 0
@ -788,12 +848,13 @@ namespace Pamac {
ErrorInfos err = ErrorInfos (); ErrorInfos err = ErrorInfos ();
on_emit_trans_committed (err); on_emit_trans_committed (err);
} else { } else {
spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction cancelled") + ".\n"});
progress_window.hide (); progress_window.hide ();
transaction_sum_dialog.hide (); transaction_sum_dialog.hide ();
finished (true); finished (true);
} }
} else if (sysupgrade_after_build) { } else if (sysupgrade_after_build) {
print("sysupgrade_after_build\n"); print ("sysupgrade_after_build\n");
sysupgrade_after_build = false; sysupgrade_after_build = false;
commit (); commit ();
} else if (transaction_sum_dialog.run () == ResponseType.OK) { } else if (transaction_sum_dialog.run () == ResponseType.OK) {
@ -802,6 +863,7 @@ namespace Pamac {
Gtk.main_iteration (); Gtk.main_iteration ();
commit (); commit ();
} else { } else {
spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction cancelled") + ".\n"});
progress_window.hide (); progress_window.hide ();
transaction_sum_dialog.hide (); transaction_sum_dialog.hide ();
release (); release ();
@ -812,6 +874,7 @@ namespace Pamac {
} else { } else {
//ErrorInfos err = ErrorInfos (); //ErrorInfos err = ErrorInfos ();
//err.str = dgettext (null, "Nothing to do") + "\n"; //err.str = dgettext (null, "Nothing to do") + "\n";
spawn_in_term ({"/usr/bin/echo", dgettext (null, "Nothing to do") + ".\n"});
progress_window.hide (); progress_window.hide ();
release (); release ();
clear_lists (); clear_lists ();
@ -825,20 +888,20 @@ namespace Pamac {
} }
public void on_emit_trans_committed (ErrorInfos error) { public void on_emit_trans_committed (ErrorInfos error) {
print("transaction committed\n"); print ("transaction committed\n");
if (error.str == "") { if (error.str == "") {
if (data.to_build.size () != 0) { if (data.to_build.size () != 0) {
if (data.to_add.size () != 0 if (data.to_add.size () != 0
|| data.to_remove.size () != 0 || data.to_remove.size () != 0
|| data.to_load.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 (); build_aur_packages ();
} else { } else {
//progress_window.action_label.set_text (dgettext (null, "Transaction successfully finished")); //progress_window.action_label.set_text (dgettext (null, "Transaction successfully finished"));
//progress_window.close_button.set_visible (true); //progress_window.close_button.set_visible (true);
clear_lists (); clear_lists ();
handle_warning (); show_warnings ();
refresh_alpm_config (); refresh_alpm_config ();
if (sysupgrade_after_trans) { if (sysupgrade_after_trans) {
sysupgrade_after_trans = false; sysupgrade_after_trans = false;
@ -846,22 +909,33 @@ namespace Pamac {
} else if (sysupgrade_after_build) { } else if (sysupgrade_after_build) {
sysupgrade_simple (0); sysupgrade_simple (0);
} else { } 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 (); progress_window.hide ();
spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction successfully finished") + "\n"}, null);
finished (false); finished (false);
} }
} }
} else { } else {
refresh_alpm_config ();
finished (true); finished (true);
handle_error (error); handle_error (error);
} }
total_download = 0; total_download = 0;
already_downloaded = 0; already_downloaded = 0;
build_status = 0;
} }
void on_term_child_exited (int status) { void on_term_child_exited (int status) {
Source.remove (build_timeout_id); Source.remove (build_timeout_id);
data.to_build.steal_all (); 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 (); ErrorInfos err = ErrorInfos ();
on_emit_trans_committed (err); on_emit_trans_committed (err);
} }

View File

@ -21,7 +21,7 @@
const string GETTEXT_PACKAGE = "pamac"; const string GETTEXT_PACKAGE = "pamac";
const string update_icon_name = "pamac-tray-update"; 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 one_update_info = _("1 available update");
const string noupdate_icon_name = "pamac-tray-no-update"; const string noupdate_icon_name = "pamac-tray-no-update";
const string noupdate_info = _("Your system is up-to-date"); const string noupdate_info = _("Your system is up-to-date");
@ -142,7 +142,7 @@ namespace Pamac {
show_notification (one_update_info); show_notification (one_update_info);
} else { } else {
// workaround to use python format string // 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); this.update_icon (update_icon_name, info);
if (pamac_run == false) if (pamac_run == false)
show_notification (info); show_notification (info);

View File

@ -132,7 +132,10 @@ namespace Pamac {
updates_nb = syncfirst_updates.length; updates_nb = syncfirst_updates.length;
foreach (UpdatesInfos infos in syncfirst_updates) { foreach (UpdatesInfos infos in syncfirst_updates) {
name = infos.name + " " + infos.version; name = infos.name + " " + infos.version;
if (infos.download_size != 0)
size = format_size (infos.download_size); size = format_size (infos.download_size);
else
size = "";
dsize += infos.download_size; dsize += infos.download_size;
updates_list.insert_with_values (out iter, -1, 0, name, 1, 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); UpdatesInfos[] updates = get_repos_updates (transaction.alpm_config, ignore_pkgs);
foreach (UpdatesInfos infos in updates) { foreach (UpdatesInfos infos in updates) {
name = infos.name + " " + infos.version; name = infos.name + " " + infos.version;
if (infos.download_size != 0)
size = format_size (infos.download_size); size = format_size (infos.download_size);
else
size = "";
dsize += infos.download_size; dsize += infos.download_size;
updates_list.insert_with_values (out iter, -1, 0, name, 1, size); updates_list.insert_with_values (out iter, -1, 0, name, 1, size);
} }
@ -151,7 +157,10 @@ namespace Pamac {
updates_nb += aur_updates.length; updates_nb += aur_updates.length;
foreach (UpdatesInfos infos in aur_updates) { foreach (UpdatesInfos infos in aur_updates) {
name = infos.name + " " + infos.version; name = infos.name + " " + infos.version;
if (infos.download_size != 0)
size = format_size (infos.download_size); size = format_size (infos.download_size);
else
size = "";
dsize += infos.download_size; dsize += infos.download_size;
updates_list.insert_with_values (out iter, -1, 0, name, 1, size); updates_list.insert_with_values (out iter, -1, 0, name, 1, size);
} }
@ -164,15 +173,14 @@ namespace Pamac {
top_label.set_markup("<b>%s</b>".printf (dgettext (null, "1 available update"))); top_label.set_markup("<b>%s</b>".printf (dgettext (null, "1 available update")));
apply_button.set_sensitive (true); apply_button.set_sensitive (true);
} else { } else {
top_label.set_markup("<b>%s</b>".printf (dgettext (null, "{number} available updates").replace ("{number}", updates_nb.to_string ()))); top_label.set_markup("<b>%s</b>".printf (dgettext (null, "%u available updates").printf (updates_nb)));
apply_button.set_sensitive (true); apply_button.set_sensitive (true);
} }
if (dsize == 0) if (dsize != 0) {
bottom_label.set_visible (false); bottom_label.set_markup("<b>%s: %s</b>".printf (dgettext (null, "Total download size"), format_size(dsize)));
else {
bottom_label.set_markup("<b>%s %s</b>".printf (dgettext (null, "Total download size:"), format_size(dsize)));
bottom_label.set_visible (true); bottom_label.set_visible (true);
} } else
bottom_label.set_visible (false);
} }
} }
} }

View File

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
for i in `ls po | sed s'|.po||'` ; do 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 done