[gnome-software/1111-app-details-addons: 3/3] details: Don't refresh on addon state change
- From: Phaedrus Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1111-app-details-addons: 3/3] details: Don't refresh on addon state change
- Date: Fri, 29 Jan 2021 00:36:34 +0000 (UTC)
commit 562554f6d7278e860b139212977028f5d3d6337a
Author: Phaedrus Leeds <mwleeds endlessos org>
Date: Thu Jan 28 16:21:44 2021 -0800
details: Don't refresh on addon state change
When an add-on is installed or removed, the whole app details page
refreshes, which causes it to flicker. Avoid this since the
GsAppAddonRow implementation already correctly updates the UI for an
add-on when its state changes, so no refresh is required.
src/gs-app-addon-row.c | 1 +
src/gs-details-page.c | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-app-addon-row.c b/src/gs-app-addon-row.c
index 82bce703..e9bd5e75 100644
--- a/src/gs-app-addon-row.c
+++ b/src/gs-app-addon-row.c
@@ -124,6 +124,7 @@ gs_app_addon_row_refresh (GsAppAddonRow *row)
break;
case GS_APP_STATE_AVAILABLE:
case GS_APP_STATE_AVAILABLE_LOCAL:
+ gtk_widget_set_visible (row->checkbox, TRUE);
gtk_widget_set_sensitive (row->checkbox, TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (row->checkbox), FALSE);
gtk_widget_set_visible (row->button_remove, FALSE);
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 1b550382..379bb1bd 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -2349,13 +2349,26 @@ gs_details_page_write_review_cb (GtkButton *button,
static void
gs_details_page_app_installed (GsPage *page, GsApp *app)
{
+ GsDetailsPage *self = GS_DETAILS_PAGE (page);
+ GsAppList *addons;
+ guint i;
+
+ /* if the app is just an addon, no need for a full refresh */
+ addons = gs_app_get_addons (self->app);
+ for (i = 0; i < gs_app_list_length (addons); i++) {
+ GsApp *addon;
+ addon = gs_app_list_index (addons, i);
+ if (addon == app)
+ return;
+ }
+
gs_details_page_reload (page);
}
static void
gs_details_page_app_removed (GsPage *page, GsApp *app)
{
- gs_details_page_reload (page);
+ gs_details_page_app_installed (page, app);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]