[gnome-software/1268-appstream-urls-not-properly-supported: 2/5] gs-details-page: Make sure an alternative is always selected
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1268-appstream-urls-not-properly-supported: 2/5] gs-details-page: Make sure an alternative is always selected
- Date: Thu, 29 Jul 2021 12:31:31 +0000 (UTC)
commit 7aa568e4ac3edebcd41ba4617c6a19dd3f74426b
Author: Milan Crha <mcrha redhat com>
Date: Thu Jul 29 14:28:41 2021 +0200
gs-details-page: Make sure an alternative is always selected
In case none of the found alternatives is not matched with the page's
app, make sure the first row is selected. Observed this with a Snap
application found by url-to-app.
src/gs-details-page.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index bf9e5acb9..135c4965f 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -693,6 +693,7 @@ gs_details_page_get_alternates_cb (GObject *source_object,
g_autofree gchar *origin_ui = NULL;
gboolean instance_changed = FALSE;
gboolean origin_by_packaging_format = self->origin_by_packaging_format;
+ GtkWidget *first_row = NULL;
GtkWidget *select_row = NULL;
GtkWidget *origin_row_by_packaging_format = NULL;
gint origin_row_by_packaging_format_index = 0;
@@ -772,6 +773,8 @@ gs_details_page_get_alternates_cb (GObject *source_object,
GsApp *app = gs_app_list_index (list, i);
GtkWidget *row = gs_origin_popover_row_new (app);
gtk_widget_show (row);
+ if (first_row == NULL)
+ first_row = row;
if (app == self->app || (
(gs_app_get_bundle_kind (app) == AS_BUNDLE_KIND_UNKNOWN ||
gs_app_get_bundle_kind (app) == gs_app_get_bundle_kind (self->app)) &&
@@ -813,6 +816,17 @@ gs_details_page_get_alternates_cb (GObject *source_object,
}
}
+ if (select_row == NULL && first_row != NULL) {
+ GsOriginPopoverRow *row = GS_ORIGIN_POPOVER_ROW (first_row);
+ GsApp *app = gs_origin_popover_row_get_app (row);
+ select_row = first_row;
+ if (app != self->app) {
+ g_clear_object (&self->app);
+ self->app = g_object_ref (app);
+ instance_changed = TRUE;
+ }
+ }
+
if (select_row)
gs_origin_popover_row_set_selected (GS_ORIGIN_POPOVER_ROW (select_row), TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]