[gnome-software: 1/4] gs-extras-page: Ignore separators when iterating over app rows




commit 33719a0f65ee1c76973694d6cdb866d5706c7abe
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Oct 13 12:24:11 2021 +0100

    gs-extras-page: Ignore separators when iterating over app rows
    
    Not all rows in the list are `GsAppRow`s.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1473

 src/gs-extras-page.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/src/gs-extras-page.c b/src/gs-extras-page.c
index df084eba9..dc74171a4 100644
--- a/src/gs-extras-page.c
+++ b/src/gs-extras-page.c
@@ -300,6 +300,10 @@ gs_extras_page_add_app (GsExtrasPage *self, GsApp *app, GsAppList *list, SearchD
             child = gtk_widget_get_next_sibling (child)) {
                GsApp *existing_app;
 
+               /* Might be a separator from list_header_func(). */
+               if (!GS_IS_APP_ROW (child))
+                       continue;
+
                existing_app = gs_app_row_get_app (GS_APP_ROW (child));
                if (app == existing_app)
                        gtk_list_box_remove (GTK_LIST_BOX (self->list_box_results), child);
@@ -461,6 +465,10 @@ build_no_results_label (GsExtrasPage *self)
        for (child = gtk_widget_get_first_child (self->list_box_results);
             child != NULL;
             child = gtk_widget_get_next_sibling (child)) {
+               /* Might be a separator from list_header_func(). */
+               if (!GS_IS_APP_ROW (child))
+                       continue;
+
                app = gs_app_row_get_app (GS_APP_ROW (child));
                g_ptr_array_add (array,
                                 g_object_get_data (G_OBJECT (child), "missing-title"));
@@ -507,6 +515,10 @@ show_search_results (GsExtrasPage *self)
        for (child = first_child;
             child != NULL;
             child = gtk_widget_get_next_sibling (child)) {
+               /* Might be a separator from list_header_func(). */
+               if (!GS_IS_APP_ROW (child))
+                       continue;
+
                app = gs_app_row_get_app (GS_APP_ROW (child));
                if (g_strcmp0 (gs_app_get_id (app), "missing-codec") == 0) {
                        n_missing++;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]