list/remote-ls/search: Split description field

Instead of combining name and comment we split them into two columns.
We also disable the comment column by default for list and remote-ls
as it is very poor in long tables. However, it is still there for search
where it seems more useful.

Also, the Application column title changed to Application ID to make
it clearer what it is compared to the "Name" column.

Closes: #2852
Approved by: alexlarsson
This commit is contained in:
Alexander Larsson
2019-04-23 15:45:06 +02:00
committed by Atomic Bot
parent bd18eab6ce
commit c84db7714e
4 changed files with 35 additions and 24 deletions

View File

@@ -54,8 +54,9 @@ static GOptionEntry options[] = {
};
static Column all_columns[] = {
{ "description", N_("Description"), N_("Show the description"), 1, FLATPAK_ELLIPSIZE_MODE_END, 1, 1 },
{ "application", N_("Application"), N_("Show the application ID"), 1, FLATPAK_ELLIPSIZE_MODE_START, 0, 1 },
{ "name", N_("Name"), N_("Show the name"), 1, FLATPAK_ELLIPSIZE_MODE_END, 1, 1 },
{ "description", N_("Description"), N_("Show the description"), 1, FLATPAK_ELLIPSIZE_MODE_END, 1, 0 },
{ "application", N_("Application ID"), N_("Show the application ID"), 1, FLATPAK_ELLIPSIZE_MODE_START, 0, 1 },
{ "version", N_("Version"), N_("Show the version"), 1, FLATPAK_ELLIPSIZE_MODE_NONE, 1, 1 },
{ "branch", N_("Branch"), N_("Show the branch"), 1, FLATPAK_ELLIPSIZE_MODE_NONE, 0, 1 },
{ "arch", N_("Arch"), N_("Show the architecture"), 1, FLATPAK_ELLIPSIZE_MODE_NONE, 0, 1, 1 },
@@ -284,15 +285,15 @@ print_table_for_refs (gboolean print_apps,
for (k = 0; columns[k].name; k++)
{
if (strcmp (columns[k].name, "description") == 0)
if (strcmp (columns[k].name, "name") == 0)
{
g_autofree char *description = NULL;
const char *name = appdata_name ? appdata_name : strrchr (parts[1], '.') + 1;
if (appdata_summary)
description = g_strconcat (name, " - ", appdata_summary, NULL);
else
description = g_strdup (name);
flatpak_table_printer_add_column (printer, name);
}
else if (strcmp (columns[k].name, "description") == 0)
{
const char *description = appdata_summary ? appdata_summary : "";
flatpak_table_printer_add_column (printer, description);
}
else if (strcmp (columns[k].name, "version") == 0)

View File

@@ -56,8 +56,9 @@ static GOptionEntry options[] = {
};
static Column all_columns[] = {
{ "description", N_("Description"), N_("Show the description"), 1, FLATPAK_ELLIPSIZE_MODE_END, 1, 1 },
{ "application", N_("Application"), N_("Show the application ID"), 1, FLATPAK_ELLIPSIZE_MODE_START, 0, 1 },
{ "name", N_("Name"), N_("Show the name"), 1, FLATPAK_ELLIPSIZE_MODE_END, 1, 1 },
{ "description", N_("Description"), N_("Show the description"), 1, FLATPAK_ELLIPSIZE_MODE_END, 1, 0 },
{ "application", N_("Application ID"), N_("Show the application ID"), 1, FLATPAK_ELLIPSIZE_MODE_START, 0, 1 },
{ "version", N_("Version"), N_("Show the version"), 1, FLATPAK_ELLIPSIZE_MODE_NONE, 1, 1 },
{ "branch", N_("Branch"), N_("Show the branch"), 1, FLATPAK_ELLIPSIZE_MODE_NONE, 0, 1 },
{ "arch", N_("Arch"), N_("Show the architecture"), 1, FLATPAK_ELLIPSIZE_MODE_NONE, 0, 0 },
@@ -137,7 +138,8 @@ ls_remote (GHashTable *refs_hash, const char **arches, const char *app_runtime,
strcmp (columns[j].name, "installed-size") == 0 ||
strcmp (columns[j].name, "runtime") == 0)
need_cache_data = TRUE;
if (strcmp (columns[j].name, "description") == 0 ||
if (strcmp (columns[j].name, "name") == 0 ||
strcmp (columns[j].name, "description") == 0 ||
strcmp (columns[j].name, "version") == 0)
need_appstream_data = TRUE;
}
@@ -303,18 +305,22 @@ ls_remote (GHashTable *refs_hash, const char **arches, const char *app_runtime,
for (j = 0; columns[j].name; j++)
{
if (strcmp (columns[j].name, "description") == 0)
if (strcmp (columns[j].name, "name") == 0)
{
const char *name = NULL;
if (app)
{
g_autofree char *description = NULL;
const char *name = as_app_get_localized_name (app);
const char *comment = as_app_get_localized_comment (app);
description = g_strconcat (name, " - ", comment, NULL);
flatpak_table_printer_add_column (printer, description);
}
else
flatpak_table_printer_add_column (printer, parts[1]);
name = as_app_get_localized_name (app);
flatpak_table_printer_add_column (printer, name ? name : strrchr (parts[1], '.') + 1);
}
else if (strcmp (columns[j].name, "description") == 0)
{
const char *comment = NULL;
if (app)
comment = as_app_get_localized_comment (app);
flatpak_table_printer_add_column (printer, comment);
}
else if (strcmp (columns[j].name, "version") == 0)
flatpak_table_printer_add_column (printer, app ? as_app_get_version (app) : "");

View File

@@ -39,8 +39,9 @@ static GOptionEntry options[] = {
};
static Column all_columns[] = {
{ "name", N_("Name"), N_("Show the name"), 1, FLATPAK_ELLIPSIZE_MODE_END, 1, 1 },
{ "description", N_("Description"), N_("Show the description"), 1, FLATPAK_ELLIPSIZE_MODE_END, 1, 1 },
{ "application", N_("Application"), N_("Show the application ID"), 1, FLATPAK_ELLIPSIZE_MODE_START, 1, 1 },
{ "application", N_("Application ID"), N_("Show the application ID"), 1, FLATPAK_ELLIPSIZE_MODE_START, 1, 1 },
{ "version", N_("Version"), N_("Show the version"), 1, FLATPAK_ELLIPSIZE_MODE_NONE, 1, 1 },
#if AS_CHECK_VERSION (0, 6, 1)
{ "branch", N_("Branch"), N_("Show the application branch"), 1, FLATPAK_ELLIPSIZE_MODE_NONE, 1, 1 },
@@ -214,13 +215,14 @@ print_app (Column *columns, MatchResult *res, FlatpakTablePrinter *printer)
const char *id = as_app_get_id_filename (res->app);
const char *name = as_app_get_localized_name (res->app);
const char *comment = as_app_get_localized_comment (res->app);
g_autofree char *description = g_strconcat (name, " - ", comment, NULL);
guint i;
for (i = 0; columns[i].name; i++)
{
if (strcmp (columns[i].name, "name") == 0)
flatpak_table_printer_add_column (printer, name);
if (strcmp (columns[i].name, "description") == 0)
flatpak_table_printer_add_column (printer, description);
flatpak_table_printer_add_column (printer, comment);
else if (strcmp (columns[i].name, "application") == 0)
flatpak_table_printer_add_column (printer, id);
else if (strcmp (columns[i].name, "version") == 0)

View File

@@ -185,6 +185,7 @@ description
help
installation
latest
name
options
origin
ref
@@ -215,6 +216,7 @@ arch,branch
arch,description
arch,installation
arch,latest
arch,name
arch,options
arch,origin
arch,ref