[gnome-software/1364-implement-other-apps-by-author-section-in-app-details-page: 70/73] gs-details-page: Better limit shown other apps
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1364-implement-other-apps-by-author-section-in-app-details-page: 70/73] gs-details-page: Better limit shown other apps
- Date: Mon, 28 Mar 2022 09:23:40 +0000 (UTC)
commit ef323c41c7aa5571295ae8e6675f06ae4668ecf6
Author: Milan Crha <mcrha redhat com>
Date: Tue Mar 15 18:21:59 2022 +0100
gs-details-page: Better limit shown other apps
Ask for more apps than will be shown, because some of them can be dropped
due to being same as the shown application.
src/gs-details-page.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index d23229492..f9b7d4657 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -40,6 +40,10 @@
/* the number of reviews to show before clicking the 'More Reviews' button */
#define SHOW_NR_REVIEWS_INITIAL 4
+/* How many other developer apps can be shown; should be divisible by 3 and 2,
+ to catch full width and smaller width without bottom gap */
+#define N_OTHER_APPS 18
+
#define GS_DETAILS_PAGE_REFINE_FLAGS GS_PLUGIN_REFINE_FLAGS_REQUIRE_ADDONS | \
GS_PLUGIN_REFINE_FLAGS_REQUIRE_CATEGORIES | \
GS_PLUGIN_REFINE_FLAGS_REQUIRE_CONTENT_RATING | \
@@ -970,7 +974,7 @@ gs_details_page_search_other_apps_cb (GObject *source_object,
GsDetailsPage *self = GS_DETAILS_PAGE (user_data);
g_autoptr(GsAppList) list = NULL;
g_autoptr(GError) local_error = NULL;
- gboolean any_added = FALSE;
+ guint n_added = 0;
list = gs_plugin_loader_job_process_finish (GS_PLUGIN_LOADER (source_object), result, &local_error);
if (list == NULL) {
@@ -993,11 +997,13 @@ gs_details_page_search_other_apps_cb (GObject *source_object,
g_signal_connect (tile, "clicked", G_CALLBACK (gs_details_page_app_tile_clicked),
self);
gtk_flow_box_insert (GTK_FLOW_BOX (self->box_other_apps), tile, -1);
- any_added = TRUE;
+ n_added++;
+ if (n_added == N_OTHER_APPS)
+ break;
}
}
- gtk_widget_set_visible (self->box_other_apps, any_added);
+ gtk_widget_set_visible (self->box_other_apps, n_added > 0);
}
static void
@@ -1100,7 +1106,7 @@ gs_details_page_refresh_all (GsDetailsPage *self)
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_SEARCH_OTHER_APPS,
"search", self->last_developer_name,
- "max-results", 18,
+ "max-results", N_OTHER_APPS * 3, /* Ask for more,
some can be skipped */
"refine-flags", GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_VERSION |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_HISTORY |
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]