From ecd065b22d929c2d35a6323637ccf4e8ead6315e Mon Sep 17 00:00:00 2001 From: pesader Date: Sat, 1 Apr 2023 14:33:26 -0300 Subject: [PATCH] applications: show handler row when resetting is possible If the user removes all file and link types associated with an application, the handler row does not show up anymore. This makes it impossible for the user to reset the default file and link types. To fix this, make sure the handler row is visible whenever the "Reset" button is sensitive. Also add descriptive labels for the case that handler row appears without any file or link associations. --- panels/applications/cc-applications-panel.c | 30 ++++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/panels/applications/cc-applications-panel.c b/panels/applications/cc-applications-panel.c index a277f3c3e5..37b543a98e 100644 --- a/panels/applications/cc-applications-panel.c +++ b/panels/applications/cc-applications-panel.c @@ -1175,6 +1175,7 @@ update_handler_dialog (CcApplicationsPanel *self, if (!app_info_recommended_for (info, ctype)) { gtk_widget_set_sensitive (GTK_WIDGET (self->handler_reset), TRUE); + gtk_widget_set_visible (GTK_WIDGET (self->handler_row), TRUE); continue; } @@ -1184,20 +1185,29 @@ update_handler_dialog (CcApplicationsPanel *self, n_associations++; } + g_autofree gchar *subtitle = NULL; if (n_associations > 0) { - g_autofree gchar *subtitle = NULL; - subtitle = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, - "%u file and link type that is opened by the app", - "%u file and link types that are opened by the app", - n_associations), - n_associations); - adw_action_row_set_subtitle (ADW_ACTION_ROW (self->handler_row), subtitle); + "%u file and link type that is opened by the app", + "%u file and link types that are opened by the app", + n_associations), + n_associations); + header_title = g_strdup_printf + ( + _("%s is used to open the following types of files and links."), + g_app_info_get_display_name (info) + ); } - - header_title = g_strdup_printf (_("%s is used to open the following types of files and links."), - g_app_info_get_display_name (info)); + else + { + subtitle = g_strdup (_("No file or link types are opened by this app")); + header_title = g_strdup_printf + ( + _("%s is not used to open any types of files and links.\nClicking the button below will associate all recommended types with it."), + g_app_info_get_display_name (info)); + } + adw_action_row_set_subtitle (ADW_ACTION_ROW (self->handler_row), subtitle); gtk_label_set_markup (self->handler_title_label, header_title); } -- GitLab