fix incorrect cases in switch for libalpm 5.2

This commit is contained in:
Chris Cromer 2019-10-23 15:04:48 -03:00
parent b6144a7164
commit 6a6175478a
Signed by untrusted user: cromer
GPG Key ID: 39CC813FF3C8708A

View File

@ -1487,46 +1487,46 @@ namespace Pamac {
string? action = null; string? action = null;
string? detailed_action = null; string? detailed_action = null;
switch (primary_event) { switch (primary_event) {
case 1: //Alpm.Event.Type.CHECKDEPS_START case Alpm.Event.Type.CHECKDEPS_START:
action = dgettext (null, "Checking dependencies") + "..."; action = dgettext (null, "Checking dependencies") + "...";
break; break;
case 3: //Alpm.Event.Type.FILECONFLICTS_START case Alpm.Event.Type.FILECONFLICTS_START:
action = dgettext (null, "Checking file conflicts") + "..."; action = dgettext (null, "Checking file conflicts") + "...";
break; break;
case 5: //Alpm.Event.Type.RESOLVEDEPS_START case Alpm.Event.Type.RESOLVEDEPS_START:
action = dgettext (null, "Resolving dependencies") + "..."; action = dgettext (null, "Resolving dependencies") + "...";
break; break;
case 7: //Alpm.Event.Type.INTERCONFLICTS_START case Alpm.Event.Type.INTERCONFLICTS_START:
action = dgettext (null, "Checking inter-conflicts") + "..."; action = dgettext (null, "Checking inter-conflicts") + "...";
break; break;
case 11: //Alpm.Event.Type.PACKAGE_OPERATION_START case Alpm.Event.Type.PACKAGE_OPERATION_START:
switch (secondary_event) { switch (secondary_event) {
// special case handle differently // special case handle differently
case 1: //Alpm.Package.Operation.INSTALL case Alpm.Package.Operation.INSTALL:
previous_filename = details[0]; previous_filename = details[0];
string msg = dgettext (null, "Installing %s").printf (details[0]) + "..."; string msg = dgettext (null, "Installing %s").printf (details[0]) + "...";
progress_box.action_label.label = msg; progress_box.action_label.label = msg;
show_in_term (dgettext (null, "Installing %s").printf ("%s (%s)".printf (details[0], details[1])) + "..."); show_in_term (dgettext (null, "Installing %s").printf ("%s (%s)".printf (details[0], details[1])) + "...");
break; break;
case 2: //Alpm.Package.Operation.UPGRADE case Alpm.Package.Operation.UPGRADE:
previous_filename = details[0]; previous_filename = details[0];
string msg = dgettext (null, "Upgrading %s").printf (details[0]) + "..."; string msg = dgettext (null, "Upgrading %s").printf (details[0]) + "...";
progress_box.action_label.label = msg; progress_box.action_label.label = msg;
show_in_term (dgettext (null, "Upgrading %s").printf ("%s (%s -> %s)".printf (details[0], details[1], details[2])) + "..."); show_in_term (dgettext (null, "Upgrading %s").printf ("%s (%s -> %s)".printf (details[0], details[1], details[2])) + "...");
break; break;
case 3: //Alpm.Package.Operation.REINSTALL case Alpm.Package.Operation.REINSTALL:
previous_filename = details[0]; previous_filename = details[0];
string msg = dgettext (null, "Reinstalling %s").printf (details[0]) + "..."; string msg = dgettext (null, "Reinstalling %s").printf (details[0]) + "...";
progress_box.action_label.label = msg; progress_box.action_label.label = msg;
show_in_term (dgettext (null, "Reinstalling %s").printf ("%s (%s)".printf (details[0], details[1])) + "..."); show_in_term (dgettext (null, "Reinstalling %s").printf ("%s (%s)".printf (details[0], details[1])) + "...");
break; break;
case 4: //Alpm.Package.Operation.DOWNGRADE case Alpm.Package.Operation.DOWNGRADE:
previous_filename = details[0]; previous_filename = details[0];
string msg = dgettext (null, "Downgrading %s").printf (details[0]) + "..."; string msg = dgettext (null, "Downgrading %s").printf (details[0]) + "...";
progress_box.action_label.label = msg; progress_box.action_label.label = msg;
show_in_term (dgettext (null, "Downgrading %s").printf ("%s (%s -> %s)".printf (details[0], details[1], details[2])) + "..."); show_in_term (dgettext (null, "Downgrading %s").printf ("%s (%s -> %s)".printf (details[0], details[1], details[2])) + "...");
break; break;
case 5: //Alpm.Package.Operation.REMOVE case Alpm.Package.Operation.REMOVE:
previous_filename = details[0]; previous_filename = details[0];
string msg = dgettext (null, "Removing %s").printf (details[0]) + "..."; string msg = dgettext (null, "Removing %s").printf (details[0]) + "...";
progress_box.action_label.label = msg; progress_box.action_label.label = msg;
@ -1534,28 +1534,13 @@ namespace Pamac {
break; break;
} }
break; break;
case 13: //Alpm.Event.Type.INTEGRITY_START case Alpm.Event.Type.INTEGRITY_START:
action = dgettext (null, "Checking integrity") + "..."; action = dgettext (null, "Checking integrity") + "...";
break; break;
case 15: //Alpm.Event.Type.LOAD_START case Alpm.Event.Type.LOAD_START:
action = dgettext (null, "Loading packages files") + "..."; action = dgettext (null, "Loading packages files") + "...";
break; break;
case 17: //Alpm.Event.Type.DELTA_INTEGRITY_START case Alpm.Event.Type.SCRIPTLET_INFO:
action = dgettext (null, "Checking delta integrity") + "...";
break;
case 19: //Alpm.Event.Type.DELTA_PATCHES_START
action = dgettext (null, "Applying deltas") + "...";
break;
case 21: //Alpm.Event.Type.DELTA_PATCH_START
detailed_action = dgettext (null, "Generating %s with %s").printf (details[0], details[1]) + "...";
break;
case 22: //Alpm.Event.Type.DELTA_PATCH_DONE
detailed_action = dgettext (null, "Generation succeeded") + "...";
break;
case 23: //Alpm.Event.Type.DELTA_PATCH_FAILED
detailed_action = dgettext (null, "Generation failed") + "...";
break;
case 24: //Alpm.Event.Type.SCRIPTLET_INFO
// hooks output are also emitted as SCRIPTLET_INFO // hooks output are also emitted as SCRIPTLET_INFO
if (previous_filename != "") { if (previous_filename != "") {
progress_box.action_label.label = dgettext (null, "Configuring %s").printf (previous_filename) + "..."; progress_box.action_label.label = dgettext (null, "Configuring %s").printf (previous_filename) + "...";
@ -1563,15 +1548,15 @@ namespace Pamac {
detailed_action = details[0].replace ("\n", ""); detailed_action = details[0].replace ("\n", "");
important_details_outpout (false); important_details_outpout (false);
break; break;
case 25: //Alpm.Event.Type.RETRIEVE_START case Alpm.Event.Type.RETRIEVE_START:
start_downloading (); start_downloading ();
action = dgettext (null, "Downloading") + "..."; action = dgettext (null, "Downloading") + "...";
break; break;
case 26: //Alpm.Event.Type.RETRIEVE_DONE case Alpm.Event.Type.RETRIEVE_DONE:
case 27: //Alpm.Event.Type.RETRIEVE_FAILED case Alpm.Event.Type.RETRIEVE_FAILED:
stop_downloading (); stop_downloading ();
break; break;
case 28: //Alpm.Event.Type.PKGDOWNLOAD_START case Alpm.Event.Type.PKGDOWNLOAD_START:
// special case handle differently // special case handle differently
show_in_term (dgettext (null, "Downloading %s").printf (details[0]) + "..."); show_in_term (dgettext (null, "Downloading %s").printf (details[0]) + "...");
string name_version_release = details[0].slice (0, details[0].last_index_of_char ('-')); string name_version_release = details[0].slice (0, details[0].last_index_of_char ('-'));
@ -1579,34 +1564,34 @@ namespace Pamac {
string name = name_version.slice (0, name_version.last_index_of_char ('-')); string name = name_version.slice (0, name_version.last_index_of_char ('-'));
progress_box.action_label.label = dgettext (null, "Downloading %s").printf (name) + "..."; progress_box.action_label.label = dgettext (null, "Downloading %s").printf (name) + "...";
break; break;
case 31: //Alpm.Event.Type.DISKSPACE_START case Alpm.Event.Type.DISKSPACE_START:
action = dgettext (null, "Checking available disk space") + "..."; action = dgettext (null, "Checking available disk space") + "...";
break; break;
case 33: //Alpm.Event.Type.OPTDEP_REMOVAL case Alpm.Event.Type.OPTDEP_REMOVAL:
detailed_action = dgettext (null, "%s optionally requires %s").printf (details[0], details[1]); detailed_action = dgettext (null, "%s optionally requires %s").printf (details[0], details[1]);
warning_textbuffer.append (detailed_action + "\n"); warning_textbuffer.append (detailed_action + "\n");
break; break;
case 34: //Alpm.Event.Type.DATABASE_MISSING case Alpm.Event.Type.DATABASE_MISSING:
detailed_action = dgettext (null, "Database file for %s does not exist").printf (details[0]); detailed_action = dgettext (null, "Database file for %s does not exist").printf (details[0]);
break; break;
case 35: //Alpm.Event.Type.KEYRING_START case Alpm.Event.Type.KEYRING_START:
action = dgettext (null, "Checking keyring") + "..."; action = dgettext (null, "Checking keyring") + "...";
break; break;
case 37: //Alpm.Event.Type.KEY_DOWNLOAD_START case Alpm.Event.Type.KEY_DOWNLOAD_START:
action = dgettext (null, "Downloading required keys") + "..."; action = dgettext (null, "Downloading required keys") + "...";
break; break;
case 39: //Alpm.Event.Type.PACNEW_CREATED case Alpm.Event.Type.PACNEW_CREATED:
detailed_action = dgettext (null, "%s installed as %s.pacnew").printf (details[0], details[0]); detailed_action = dgettext (null, "%s installed as %s.pacnew").printf (details[0], details[0]);
break; break;
case 40: //Alpm.Event.Type.PACSAVE_CREATED case Alpm.Event.Type.PACSAVE_CREATED:
detailed_action = dgettext (null, "%s installed as %s.pacsave").printf (details[0], details[0]); detailed_action = dgettext (null, "%s installed as %s.pacsave").printf (details[0], details[0]);
break; break;
case 41: //Alpm.Event.Type.HOOK_START case Alpm.Event.Type.HOOK_START:
switch (secondary_event) { switch (secondary_event) {
case 1: //Alpm.HookWhen.PRE_TRANSACTION case Alpm.HookWhen.PRE_TRANSACTION:
action = dgettext (null, "Running pre-transaction hooks") + "..."; action = dgettext (null, "Running pre-transaction hooks") + "...";
break; break;
case 2: //Alpm.HookWhen.POST_TRANSACTION case Alpm.HookWhen.POST_TRANSACTION:
previous_filename = ""; previous_filename = "";
action = dgettext (null, "Running post-transaction hooks") + "..."; action = dgettext (null, "Running post-transaction hooks") + "...";
break; break;
@ -1614,7 +1599,7 @@ namespace Pamac {
break; break;
} }
break; break;
case 43: // Alpm.Event.Type.HOOK_RUN_START case Alpm.Event.Type.HOOK_RUN_START:
float fraction = (float) int.parse (details[2]) / int.parse (details[3]); float fraction = (float) int.parse (details[2]) / int.parse (details[3]);
if (fraction != previous_percent) { if (fraction != previous_percent) {
previous_percent = fraction; previous_percent = fraction;
@ -1650,18 +1635,18 @@ namespace Pamac {
void on_emit_progress (uint progress, string pkgname, uint percent, uint n_targets, uint current_target) { void on_emit_progress (uint progress, string pkgname, uint percent, uint n_targets, uint current_target) {
float fraction; float fraction;
switch (progress) { switch (progress) {
case 0: //Alpm.Progress.ADD_START case Alpm.Progress.ADD_START:
case 1: //Alpm.Progress.UPGRADE_START case Alpm.Progress.UPGRADE_START:
case 2: //Alpm.Progress.DOWNGRADE_START case Alpm.Progress.DOWNGRADE_START:
case 3: //Alpm.Progress.REINSTALL_START case Alpm.Progress.REINSTALL_START:
case 4: //Alpm.Progress.REMOVE_START case Alpm.Progress.REMOVE_START:
fraction = ((float) (current_target - 1) / n_targets) + ((float) percent / (100 * n_targets)); fraction = ((float) (current_target - 1) / n_targets) + ((float) percent / (100 * n_targets));
break; break;
case 5: //Alpm.Progress.CONFLICTS_START case Alpm.Progress.CONFLICTS_START:
case 6: //Alpm.Progress.DISKSPACE_START case Alpm.Progress.DISKSPACE_START:
case 7: //Alpm.Progress.INTEGRITY_START case Alpm.Progress.INTEGRITY_START:
case 8: //Alpm.Progress.LOAD_START case Alpm.Progress.LOAD_START:
case 9: //Alpm.Progress.KEYRING_START case Alpm.Progress.KEYRING_START:
default: default:
fraction = (float) percent / 100; fraction = (float) percent / 100;
break; break;