mirror of
https://github.com/flatpak/flatpak.git
synced 2026-05-18 21:55:22 -04:00
app: Use bold_on/bold_off variables for consistency/clarity
This commit is contained in:
@@ -162,14 +162,14 @@ confirm_runtime_removal (gboolean yes_opt,
|
||||
g_autoptr(GError) local_error = NULL;
|
||||
g_autofree char *ref_name = NULL;
|
||||
const char *ref_branch;
|
||||
const char *on = "";
|
||||
const char *off = "";
|
||||
const char *bold_on = "";
|
||||
const char *bold_off = "";
|
||||
gboolean is_extension;
|
||||
|
||||
if (flatpak_fancy_output ())
|
||||
{
|
||||
on = FLATPAK_ANSI_BOLD_ON;
|
||||
off = FLATPAK_ANSI_BOLD_OFF;
|
||||
bold_on = FLATPAK_ANSI_BOLD_ON;
|
||||
bold_off = FLATPAK_ANSI_BOLD_OFF;
|
||||
}
|
||||
|
||||
is_extension = flatpak_dir_is_runtime_extension (udir->dir, ref);
|
||||
@@ -218,10 +218,10 @@ confirm_runtime_removal (gboolean yes_opt,
|
||||
|
||||
if (is_extension)
|
||||
g_print (_("Info: applications using the extension %s%s%s branch %s%s%s:\n"),
|
||||
on, ref_name, off, on, ref_branch, off);
|
||||
bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off);
|
||||
else
|
||||
g_print (_("Info: applications using the runtime %s%s%s branch %s%s%s:\n"),
|
||||
on, ref_name, off, on, ref_branch, off);
|
||||
bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off);
|
||||
|
||||
g_print (" ");
|
||||
for (guint i = 0; i < apps->len; i++)
|
||||
|
||||
@@ -1194,16 +1194,16 @@ flatpak_dir_load_appstream_store (FlatpakDir *self,
|
||||
void
|
||||
print_aligned (int len, const char *title, const char *value)
|
||||
{
|
||||
const char *on = "";
|
||||
const char *off = "";
|
||||
const char *bold_on = "";
|
||||
const char *bold_off = "";
|
||||
|
||||
if (flatpak_fancy_output ())
|
||||
{
|
||||
on = FLATPAK_ANSI_BOLD_ON;
|
||||
off = FLATPAK_ANSI_BOLD_OFF;
|
||||
bold_on = FLATPAK_ANSI_BOLD_ON;
|
||||
bold_off = FLATPAK_ANSI_BOLD_OFF;
|
||||
}
|
||||
|
||||
g_print ("%s%*s%s%s %s\n", on, len - (int) cell_width (title), "", title, off, value);
|
||||
g_print ("%s%*s%s%s %s\n", bold_on, len - (int) cell_width (title), "", title, bold_off, value);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -474,13 +474,13 @@ operation_error (FlatpakTransaction *transaction,
|
||||
g_autoptr(FlatpakRef) rref = flatpak_ref_parse (ref, NULL);
|
||||
gboolean non_fatal = (detail & FLATPAK_TRANSACTION_ERROR_DETAILS_NON_FATAL) != 0;
|
||||
g_autofree char *text = NULL;
|
||||
const char *on = "";
|
||||
const char *off = "";
|
||||
const char *bold_on = "";
|
||||
const char *bold_off = "";
|
||||
|
||||
if (flatpak_fancy_output ())
|
||||
{
|
||||
on = FLATPAK_ANSI_BOLD_ON;
|
||||
off = FLATPAK_ANSI_BOLD_OFF;
|
||||
bold_on = FLATPAK_ANSI_BOLD_ON;
|
||||
bold_off = FLATPAK_ANSI_BOLD_OFF;
|
||||
}
|
||||
|
||||
if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_SKIPPED))
|
||||
@@ -510,28 +510,28 @@ operation_error (FlatpakTransaction *transaction,
|
||||
{
|
||||
if (non_fatal)
|
||||
text = g_strdup_printf (_("Warning: %s%s%s already installed"),
|
||||
on, flatpak_ref_get_name (rref), off);
|
||||
bold_on, flatpak_ref_get_name (rref), bold_off);
|
||||
else
|
||||
text = g_strdup_printf (_("Error: %s%s%s already installed"),
|
||||
on, flatpak_ref_get_name (rref), off);
|
||||
bold_on, flatpak_ref_get_name (rref), bold_off);
|
||||
}
|
||||
else if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED))
|
||||
{
|
||||
if (non_fatal)
|
||||
text = g_strdup_printf (_("Warning: %s%s%s not installed"),
|
||||
on, flatpak_ref_get_name (rref), off);
|
||||
bold_on, flatpak_ref_get_name (rref), bold_off);
|
||||
else
|
||||
text = g_strdup_printf (_("Error: %s%s%s not installed"),
|
||||
on, flatpak_ref_get_name (rref), off);
|
||||
bold_on, flatpak_ref_get_name (rref), bold_off);
|
||||
}
|
||||
else if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_NEED_NEW_FLATPAK))
|
||||
{
|
||||
if (non_fatal)
|
||||
text = g_strdup_printf (_("Warning: %s%s%s needs a later flatpak version"),
|
||||
on, flatpak_ref_get_name (rref), off);
|
||||
bold_on, flatpak_ref_get_name (rref), bold_off);
|
||||
else
|
||||
text = g_strdup_printf (_("Error: %s%s%s needs a later flatpak version"),
|
||||
on, flatpak_ref_get_name (rref), off);
|
||||
bold_on, flatpak_ref_get_name (rref), bold_off);
|
||||
}
|
||||
else if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_OUT_OF_SPACE))
|
||||
{
|
||||
@@ -561,28 +561,28 @@ operation_error (FlatpakTransaction *transaction,
|
||||
g_propagate_prefixed_error (&self->first_operation_error,
|
||||
g_error_copy (error),
|
||||
_("Failed to install %s%s%s: "),
|
||||
on, flatpak_ref_get_name (rref), off);
|
||||
bold_on, flatpak_ref_get_name (rref), bold_off);
|
||||
break;
|
||||
|
||||
case FLATPAK_TRANSACTION_OPERATION_UPDATE:
|
||||
g_propagate_prefixed_error (&self->first_operation_error,
|
||||
g_error_copy (error),
|
||||
_("Failed to update %s%s%s: "),
|
||||
on, flatpak_ref_get_name (rref), off);
|
||||
bold_on, flatpak_ref_get_name (rref), bold_off);
|
||||
break;
|
||||
|
||||
case FLATPAK_TRANSACTION_OPERATION_INSTALL_BUNDLE:
|
||||
g_propagate_prefixed_error (&self->first_operation_error,
|
||||
g_error_copy (error),
|
||||
_("Failed to install bundle %s%s%s: "),
|
||||
on, flatpak_ref_get_name (rref), off);
|
||||
bold_on, flatpak_ref_get_name (rref), bold_off);
|
||||
break;
|
||||
|
||||
case FLATPAK_TRANSACTION_OPERATION_UNINSTALL:
|
||||
g_propagate_prefixed_error (&self->first_operation_error,
|
||||
g_error_copy (error),
|
||||
_("Failed to uninstall %s%s%s: "),
|
||||
on, flatpak_ref_get_name (rref), off);
|
||||
bold_on, flatpak_ref_get_name (rref), bold_off);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -710,13 +710,13 @@ print_eol_info_message (FlatpakDir *dir,
|
||||
{
|
||||
gboolean is_pinned = flatpak_dir_ref_is_pinned (dir, flatpak_decomposed_get_ref (ref));
|
||||
g_autofree char *ref_branch = flatpak_decomposed_dup_branch (ref);
|
||||
const char *on = "";
|
||||
const char *off = "";
|
||||
const char *bold_on = "";
|
||||
const char *bold_off = "";
|
||||
|
||||
if (flatpak_fancy_output ())
|
||||
{
|
||||
on = FLATPAK_ANSI_BOLD_ON;
|
||||
off = FLATPAK_ANSI_BOLD_OFF;
|
||||
bold_on = FLATPAK_ANSI_BOLD_ON;
|
||||
bold_off = FLATPAK_ANSI_BOLD_OFF;
|
||||
}
|
||||
|
||||
/* Here we go to great lengths not to split the sentences. See
|
||||
@@ -741,16 +741,19 @@ print_eol_info_message (FlatpakDir *dir,
|
||||
{
|
||||
/* Only runtimes can be pinned */
|
||||
g_print (_("\nInfo: (pinned) runtime %s%s%s branch %s%s%s is end-of-life, in favor of %s%s%s branch %s%s%s\n"),
|
||||
on, ref_name, off, on, ref_branch, off, on, eolr_name, off, on, eolr_branch, off);
|
||||
bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off,
|
||||
bold_on, eolr_name, bold_off, bold_on, eolr_branch, bold_off);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (flatpak_decomposed_is_runtime (ref))
|
||||
g_print (_("\nInfo: runtime %s%s%s branch %s%s%s is end-of-life, in favor of %s%s%s branch %s%s%s\n"),
|
||||
on, ref_name, off, on, ref_branch, off, on, eolr_name, off, on, eolr_branch, off);
|
||||
bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off,
|
||||
bold_on, eolr_name, bold_off, bold_on, eolr_branch, bold_off);
|
||||
else
|
||||
g_print (_("\nInfo: app %s%s%s branch %s%s%s is end-of-life, in favor of %s%s%s branch %s%s%s\n"),
|
||||
on, ref_name, off, on, ref_branch, off, on, eolr_name, off, on, eolr_branch, off);
|
||||
bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off,
|
||||
bold_on, eolr_name, bold_off, bold_on, eolr_branch, bold_off);
|
||||
}
|
||||
}
|
||||
else if (reason)
|
||||
@@ -759,16 +762,16 @@ print_eol_info_message (FlatpakDir *dir,
|
||||
{
|
||||
/* Only runtimes can be pinned */
|
||||
g_print (_("\nInfo: (pinned) runtime %s%s%s branch %s%s%s is end-of-life, with reason:\n"),
|
||||
on, ref_name, off, on, ref_branch, off);
|
||||
bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (flatpak_decomposed_is_runtime (ref))
|
||||
g_print (_("\nInfo: runtime %s%s%s branch %s%s%s is end-of-life, with reason:\n"),
|
||||
on, ref_name, off, on, ref_branch, off);
|
||||
bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off);
|
||||
else
|
||||
g_print (_("\nInfo: app %s%s%s branch %s%s%s is end-of-life, with reason:\n"),
|
||||
on, ref_name, off, on, ref_branch, off);
|
||||
bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off);
|
||||
}
|
||||
g_print (" %s\n", reason);
|
||||
}
|
||||
@@ -1164,13 +1167,13 @@ print_permissions (FlatpakCliTransaction *self,
|
||||
int i, j;
|
||||
int rows, cols;
|
||||
int table_rows, table_cols;
|
||||
const char *on = "";
|
||||
const char *off = "";
|
||||
const char *bold_on = "";
|
||||
const char *bold_off = "";
|
||||
|
||||
if (flatpak_fancy_output ())
|
||||
{
|
||||
on = FLATPAK_ANSI_BOLD_ON;
|
||||
off = FLATPAK_ANSI_BOLD_OFF;
|
||||
bold_on = FLATPAK_ANSI_BOLD_ON;
|
||||
bold_off = FLATPAK_ANSI_BOLD_OFF;
|
||||
}
|
||||
|
||||
if (metadata == NULL)
|
||||
@@ -1212,9 +1215,9 @@ print_permissions (FlatpakCliTransaction *self,
|
||||
g_print ("\n");
|
||||
|
||||
if (old_metadata)
|
||||
g_print (_("New %s%s%s permissions:"), on, flatpak_ref_get_name (rref), off);
|
||||
g_print (_("New %s%s%s permissions:"), bold_on, flatpak_ref_get_name (rref), bold_off);
|
||||
else
|
||||
g_print (_("%s%s%s permissions:"), on, flatpak_ref_get_name (rref), off);
|
||||
g_print (_("%s%s%s permissions:"), bold_on, flatpak_ref_get_name (rref), bold_off);
|
||||
|
||||
g_print ("\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user