From 3728e9b630437bb8804f4b420a4a959a9e05d8e3 Mon Sep 17 00:00:00 2001 From: guinux Date: Thu, 20 Aug 2015 18:23:43 +0200 Subject: [PATCH 1/2] show optional_for in deps list and show a warning on optdeps removal --- src/daemon.vala | 11 +++++++++++ src/manager_window.vala | 13 +++++++++++++ src/package.vala | 1 + src/transaction.vala | 7 ++++++- 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/daemon.vala b/src/daemon.vala index 4f34f88..19cae47 100644 --- a/src/daemon.vala +++ b/src/daemon.vala @@ -637,6 +637,7 @@ namespace Pamac { string[] depends = {}; string[] optdepends = {}; string[] requiredby = {}; + string[] optionalfor = {}; string[] provides = {}; string[] replaces = {}; string[] conflicts = {}; @@ -671,11 +672,21 @@ namespace Pamac { } Alpm.List.free_all (list); } + if (alpm_pkg.db.name == "local") { + Alpm.List *list = alpm_pkg.compute_optionalfor (); + int i = 0; + while (i < list->length) { + optionalfor += list->nth_data (i); + i++; + } + Alpm.List.free_all (list); + } } deps.repo = repo; deps.depends = depends; deps.optdepends = optdepends; deps.requiredby = requiredby; + deps.optionalfor = optionalfor; deps.provides = provides; deps.replaces = replaces; deps.conflicts = conflicts; diff --git a/src/manager_window.vala b/src/manager_window.vala index ca62f98..933e012 100644 --- a/src/manager_window.vala +++ b/src/manager_window.vala @@ -308,6 +308,19 @@ namespace Pamac { } } } + if (deps.repo == "local") { + if (deps.optionalfor.length != 0) { + deps_list.insert_with_values (out iter, -1, + 0, dgettext (null, "Optional For") + ":", + 1, deps.optionalfor[0]); + i = 1; + while (i < deps.optionalfor.length) { + deps_list.insert_with_values (out iter, -1, + 1, deps.optionalfor[i]); + i++; + } + } + } if (deps.provides.length != 0) { deps_list.insert_with_values (out iter, -1, 0, dgettext (null, "Provides") + ":", diff --git a/src/package.vala b/src/package.vala index 0e77191..0c36423 100644 --- a/src/package.vala +++ b/src/package.vala @@ -87,6 +87,7 @@ namespace Pamac { string[] depends; string[] optdepends; string[] requiredby; + string[] optionalfor; string[] provides; string[] replaces; string[] conflicts; diff --git a/src/transaction.vala b/src/transaction.vala index 650adb8..cc58eac 100644 --- a/src/transaction.vala +++ b/src/transaction.vala @@ -948,7 +948,12 @@ namespace Pamac { progress_dialog.spawn_in_term ({"echo", msg}); break; case Alpm.Event.Type.OPTDEP_REMOVAL: - progress_dialog.spawn_in_term ({"echo", dgettext (null, "%s optionally requires %s").printf (details[0], details[1])}); + msg = dgettext (null, "%s optionally requires %s").printf (details[0], details[1]); + progress_dialog.spawn_in_term ({"echo", msg}); + Gtk.TextIter end_iter; + msg += "\n"; + transaction_info_dialog.textbuffer.get_end_iter (out end_iter); + transaction_info_dialog.textbuffer.insert (ref end_iter, msg, msg.length); break; case Alpm.Event.Type.DATABASE_MISSING: progress_dialog.spawn_in_term ({"echo", dgettext (null, "Database file for %s does not exist").printf (details[0])}); From cad52d23e1d2f43d87daa04bef17159c9c7b442a Mon Sep 17 00:00:00 2001 From: guinux Date: Thu, 20 Aug 2015 18:54:28 +0200 Subject: [PATCH 2/2] add missing translations of optional_for --- po/fr.po | 4 ++++ po/pamac.pot | 4 ++++ po/update_po_files.sh | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/po/fr.po b/po/fr.po index 6ed47c9..041466e 100644 --- a/po/fr.po +++ b/po/fr.po @@ -412,6 +412,10 @@ msgstr "Dépendances optionnelles" msgid "Required By" msgstr "Requis par" +#: ../src/manager_window.vala +msgid "Optional For" +msgstr "Optionnel pour" + #: ../src/manager_window.vala msgid "Provides" msgstr "Fournit" diff --git a/po/pamac.pot b/po/pamac.pot index 466fd4c..2b885e9 100644 --- a/po/pamac.pot +++ b/po/pamac.pot @@ -401,6 +401,10 @@ msgstr "" msgid "Required By" msgstr "" +#: ../src/manager_window.vala +msgid "Optional For" +msgstr "" + #: ../src/manager_window.vala msgid "Provides" msgstr "" diff --git a/po/update_po_files.sh b/po/update_po_files.sh index d0c3023..03462fe 100755 --- a/po/update_po_files.sh +++ b/po/update_po_files.sh @@ -1,5 +1,5 @@ #! /bin/sh for i in `ls ./ | sed s'|.po||'` ; do - msgmerge --update --no-fuzzy-matching --add-location=file --backup=none ./$i.po pamac.pot + msgmerge --update --no-fuzzy-matching --no-wrap --add-location=file --backup=none ./$i.po pamac.pot done