[gnome-software/1688-reloading-view-upon-install] gs-category-page: Ignore result of cancelled operation
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1688-reloading-view-upon-install] gs-category-page: Ignore result of cancelled operation
- Date: Mon, 22 Aug 2022 15:20:26 +0000 (UTC)
commit 0e5ef083f92c6c3fb3660e583f53935673e01b5c
Author: Milan Crha <mcrha redhat com>
Date: Mon Aug 22 16:57:31 2022 +0200
gs-category-page: Ignore result of cancelled operation
The result is not valid when the operation had been cancelled, thus
do not modify the GUI in such case.
src/gs-category-page.c | 10 ++++++++++
1 file changed, 10 insertions(+)
---
diff --git a/src/gs-category-page.c b/src/gs-category-page.c
index 70364c763..0df2efcef 100644
--- a/src/gs-category-page.c
+++ b/src/gs-category-page.c
@@ -109,6 +109,7 @@ typedef struct {
gboolean get_featured_apps_finished;
GsAppList *apps; /* (owned) (nullable) */
gboolean get_main_apps_finished;
+ gboolean cancelled;
} LoadCategoryData;
static void
@@ -140,6 +141,8 @@ gs_category_page_get_featured_apps_cb (GObject *source_object,
if (!g_error_matches (local_error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED) &&
!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_warning ("failed to get featured apps for category apps: %s", local_error->message);
+ else
+ data->cancelled = TRUE;
data->get_featured_apps_finished = TRUE;
load_category_finish (data);
return;
@@ -175,6 +178,8 @@ gs_category_page_get_apps_cb (GObject *source_object,
if (!g_error_matches (local_error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED) &&
!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_warning ("failed to get apps for category apps: %s", local_error->message);
+ else
+ data->cancelled = TRUE;
data->get_main_apps_finished = TRUE;
load_category_finish (data);
return;
@@ -287,6 +292,11 @@ load_category_finish (LoadCategoryData *data)
!data->get_main_apps_finished)
return;
+ if (data->cancelled) {
+ load_category_data_free (data);
+ return;
+ }
+
/* Remove the loading tiles. */
gs_widget_remove_all (self->featured_flow_box, (GsRemoveFunc) gtk_flow_box_remove);
gs_widget_remove_all (self->recently_updated_flow_box, (GsRemoveFunc) gtk_flow_box_remove);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]