From 3d9f7d5150fc4a1c6db5ef5df454a7a977ac711c Mon Sep 17 00:00:00 2001 From: Automeris naranja Date: Fri, 14 Jun 2024 17:46:20 -0300 Subject: [PATCH 1/2] apps: Turn dialogs into subpages Turn the "Storage", "Required Permissions" and "File and Link Associations" into subpages. Doing so, the navigation in Settings will be more consistent. See https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/3020 --- panels/applications/cc-applications-panel.c | 34 ++- panels/applications/cc-applications-panel.ui | 238 ++++++++++--------- 2 files changed, 135 insertions(+), 137 deletions(-) diff --git a/panels/applications/cc-applications-panel.c b/panels/applications/cc-applications-panel.c index f0ffacb3fd..1f18354a58 100644 --- a/panels/applications/cc-applications-panel.c +++ b/panels/applications/cc-applications-panel.c @@ -117,13 +117,11 @@ struct _CcApplicationsPanel CcListRow *no_microphone; AdwPreferencesGroup *other_permissions_section; CcListRow *builtin; - AdwDialog *builtin_dialog; AdwPreferencesPage *builtin_page; GtkListBox *builtin_list; GList *snap_permission_rows; AdwButtonRow *handler_reset; - AdwDialog *handler_dialog; AdwPreferencesPage *handler_page; CcListRow *handler_row; AdwPreferencesGroup *handler_file_group; @@ -133,11 +131,10 @@ struct _CcApplicationsPanel GtkWidget *usage_section; CcListRow *storage; - AdwDialog *storage_dialog; - AdwActionRow *storage_dialog_app_row; - AdwActionRow *storage_dialog_data_row; - AdwActionRow *storage_dialog_cache_row; - AdwActionRow *storage_dialog_total_row; + AdwActionRow *storage_page_app_row; + AdwActionRow *storage_page_data_row; + AdwActionRow *storage_page_cache_row; + AdwActionRow *storage_page_total_row; AdwButtonRow *clear_cache_button_row; guint64 app_size; @@ -1236,7 +1233,7 @@ update_total_size (CcApplicationsPanel *self) total = self->app_size + self->data_size + self->cache_size; formatted_size = g_format_size (total); - adw_action_row_set_subtitle (self->storage_dialog_total_row, formatted_size); + adw_action_row_set_subtitle (self->storage_page_total_row, formatted_size); cc_list_row_set_secondary_label (self->storage, formatted_size); } @@ -1260,7 +1257,7 @@ set_cache_size (GObject *source, self->cache_size = size; formatted_size = g_format_size (self->cache_size); - adw_action_row_set_subtitle (self->storage_dialog_cache_row, formatted_size); + adw_action_row_set_subtitle (self->storage_page_cache_row, formatted_size); gtk_widget_set_sensitive (GTK_WIDGET (self->clear_cache_button_row), self->cache_size > 0); @@ -1273,7 +1270,7 @@ update_cache_row (CcApplicationsPanel *self, { g_autoptr(GFile) dir = get_flatpak_app_dir (app_id, "cache"); - adw_action_row_set_subtitle (self->storage_dialog_cache_row, "…"); + adw_action_row_set_subtitle (self->storage_page_cache_row, "…"); file_size_async (dir, cc_panel_get_cancellable (CC_PANEL (self)), set_cache_size, self); } @@ -1297,7 +1294,7 @@ set_data_size (GObject *source, self->data_size = size; formatted_size = g_format_size (self->data_size); - adw_action_row_set_subtitle (self->storage_dialog_data_row, formatted_size); + adw_action_row_set_subtitle (self->storage_page_data_row, formatted_size); update_total_size (self); } @@ -1308,7 +1305,7 @@ update_data_row (CcApplicationsPanel *self, { g_autoptr(GFile) dir = get_flatpak_app_dir (app_id, "data"); - adw_action_row_set_subtitle (self->storage_dialog_data_row, "…"); + adw_action_row_set_subtitle (self->storage_page_data_row, "…"); file_size_async (dir, cc_panel_get_cancellable (CC_PANEL (self)), set_data_size, self); } @@ -1355,7 +1352,7 @@ update_app_row (CcApplicationsPanel *self, self->app_size = get_flatpak_app_size (app_id); formatted_size = g_format_size (self->app_size); - adw_action_row_set_subtitle (self->storage_dialog_app_row, formatted_size); + adw_action_row_set_subtitle (self->storage_page_app_row, formatted_size); update_total_size (self); } @@ -1749,7 +1746,7 @@ cc_applications_panel_class_init (CcApplicationsPanelClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/applications/cc-applications-panel.ui"); - gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_dialog_app_row); + gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_page_app_row); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, app_icon_image); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, app_listbox); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, app_name_label); @@ -1758,15 +1755,13 @@ cc_applications_panel_class_init (CcApplicationsPanelClass *klass) gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, other_permissions_section); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, autorun_never_row); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, builtin); - gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, builtin_dialog); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, builtin_page); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, builtin_list); - gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_dialog_cache_row); + gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_page_cache_row); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, camera); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, clear_cache_button_row); - gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_dialog_data_row); + gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_page_data_row); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, default_apps_page); - gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_dialog); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_page); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_file_group); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_link_group); @@ -1794,8 +1789,7 @@ cc_applications_panel_class_init (CcApplicationsPanelClass *klass) gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, search); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, sound); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage); - gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_dialog); - gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_dialog_total_row); + gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_page_total_row); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, usage_section); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, view_details_button); diff --git a/panels/applications/cc-applications-panel.ui b/panels/applications/cc-applications-panel.ui index ea497bc45f..34693f4053 100644 --- a/panels/applications/cc-applications-panel.ui +++ b/panels/applications/cc-applications-panel.ui @@ -388,7 +388,8 @@ Re_quired Permissions System permissions that the app requires True - + navigation.push + 'builtin-page' @@ -402,7 +403,8 @@ _Files & Links File and link types that are opened by the app True - + navigation.push + 'handler-page' @@ -410,7 +412,8 @@ S_torage Disk space being used True - + navigation.push + 'storage-page' @@ -423,148 +426,149 @@ - - - - - Required Permissions - 500 - 400 - - - - - - - - - - - - none - - - - - - - - - - - - - File & Link Associations - 500 - 400 - - - - - - - - - - - File Types - - - - - - Link Types - + + + + Required Permissions + builtin-page + + + + - - - + + - - _Reset - True - - + + + + none + + + - - + - - + - - - Storage - 420 - - - - - - - - How much disk space this app is occupying with app data and caches - - - - - App - - - + + + + File & Link Associations + handler-page + + + + + + + - - Data - + + File Types - - Cache - + + Link Types - - Total - + + + + _Reset + True + + + + + + + + + + + + + + Storage + storage-page + + + + - - + + + How much disk space this app is occupying with app data and caches + + + + + App + + + + + + Data + + + + + + Cache + + + + + + Total + + + + + - - _Clear Cache - True - + + + + _Clear Cache + True + + + - + - - + + + horizontal -- GitLab From 1055c4b5c5b4c7545986e5b5f56b57f3368ff102 Mon Sep 17 00:00:00 2001 From: Felipe Borges Date: Wed, 19 Jun 2024 15:01:56 -0300 Subject: [PATCH 2/2] apps: Mention app page on the "Storage" page Reference: https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/2665#note_2146336 Closes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2912 Co-authored-by: Automeris naranja --- panels/applications/cc-applications-panel.c | 16 ++++++++++++++++ panels/applications/cc-applications-panel.ui | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/panels/applications/cc-applications-panel.c b/panels/applications/cc-applications-panel.c index 1f18354a58..a08c5ed9c7 100644 --- a/panels/applications/cc-applications-panel.c +++ b/panels/applications/cc-applications-panel.c @@ -131,6 +131,7 @@ struct _CcApplicationsPanel GtkWidget *usage_section; CcListRow *storage; + AdwPreferencesPage *storage_page; AdwActionRow *storage_page_app_row; AdwActionRow *storage_page_data_row; AdwActionRow *storage_page_cache_row; @@ -1225,6 +1226,18 @@ on_items_changed_cb (GListModel *list, } } +static void +update_storage_page (CcApplicationsPanel *self, + GAppInfo *info) +{ + g_autofree gchar *storage_page_description = NULL; + + /* TRANSLATORS: %s is an app name. */ + storage_page_description = g_strdup_printf (_("How much disk space %s is occupying with app data and caches"), + g_app_info_get_display_name (info)); + adw_preferences_page_set_description (self->storage_page, storage_page_description); +} + static void update_total_size (CcApplicationsPanel *self) { @@ -1385,6 +1398,8 @@ update_usage_section (CcApplicationsPanel *self, gtk_widget_set_visible (GTK_WIDGET (self->other_permissions_section), has_builtin); gtk_widget_set_visible (GTK_WIDGET (self->usage_section), portal_app_id || has_builtin); + + update_storage_page (self, info); } /* --- panel setup --- */ @@ -1789,6 +1804,7 @@ cc_applications_panel_class_init (CcApplicationsPanelClass *klass) gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, search); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, sound); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage); + gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_page); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_page_total_row); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, usage_section); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, view_details_button); diff --git a/panels/applications/cc-applications-panel.ui b/panels/applications/cc-applications-panel.ui index 34693f4053..2ff5e96eac 100644 --- a/panels/applications/cc-applications-panel.ui +++ b/panels/applications/cc-applications-panel.ui @@ -512,7 +512,7 @@ - + How much disk space this app is occupying with app data and caches -- GitLab