From a123c858a5da670e370d540f0ebb0dbd39c334f2 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 11 Jun 2018 10:55:36 +0200 Subject: [PATCH] uninstall --unused: Don't prompt if no unused refs found If there was no refs found to delete, we don't want to print the "ok?" prompt. Instead we just say that nothing was found. Closes: #1776 Approved by: alexlarsson --- app/flatpak-builtins-uninstall.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/flatpak-builtins-uninstall.c b/app/flatpak-builtins-uninstall.c index 0aa0aeb3..7fc6b6a1 100644 --- a/app/flatpak-builtins-uninstall.c +++ b/app/flatpak-builtins-uninstall.c @@ -197,6 +197,8 @@ flatpak_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GEr } else if (opt_unused) { + gboolean found_something_to_uninstall = FALSE; + for (j = 0; j < dirs->len; j++) { FlatpakDir *dir = g_ptr_array_index (dirs, j); @@ -287,9 +289,16 @@ flatpak_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GEr g_ptr_array_sort (udir->refs, flatpak_strcmp0_ptr); for (i = 0; i < udir->refs->len; i++) g_print (" %s\n", (char *)udir->refs->pdata[i]); + found_something_to_uninstall = TRUE; } } + if (!found_something_to_uninstall) + { + g_print (_("Nothing unused to uninstall\n")); + return TRUE; + } + if (!opt_yes && !flatpak_yes_no_prompt (_("Is this ok?"))) return TRUE;