appchooserdialog: Don't show broken subtitles

Commit 07beb6dba2 made GtkAppChooserWidget useful with no content-type,
however when used in a GtkAppChooserDialog, this will lead to a confusing
"Opening (null) files" subtitle.

Fix this by omitting the subtitle altogether in that case.
This commit is contained in:
Florian Müllner 2020-05-01 17:01:34 +02:00
parent 4822e02be3
commit 3f1bd3722d

View File

@ -200,16 +200,18 @@ set_dialog_properties (GtkAppChooserDialog *self)
unknown = g_content_type_is_unknown (self->content_type); unknown = g_content_type_is_unknown (self->content_type);
} }
title = g_strdup (_("Select Application"));
subtitle = NULL;
string = NULL;
if (name != NULL) if (name != NULL)
{ {
title = g_strdup (_("Select Application"));
/* Translators: %s is a filename */ /* Translators: %s is a filename */
subtitle = g_strdup_printf (_("Opening “%s”."), name); subtitle = g_strdup_printf (_("Opening “%s”."), name);
string = g_strdup_printf (_("No applications found for “%s”"), name); string = g_strdup_printf (_("No applications found for “%s”"), name);
} }
else else if (self->content_type)
{ {
title = g_strdup (_("Select Application"));
/* Translators: %s is a file type description */ /* Translators: %s is a file type description */
subtitle = g_strdup_printf (_("Opening “%s” files."), subtitle = g_strdup_printf (_("Opening “%s” files."),
unknown ? self->content_type : description); unknown ? self->content_type : description);