[gnome-software: 4/9] updates-section: Make the constructor return the proper type




commit 22c523c125985780cd6093953216cc2b819ccd0d
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue Jun 15 13:51:40 2021 +0200

    updates-section: Make the constructor return the proper type
    
    This avoids downcasts in GsUpdatesPage and will allow changing the how
    sections are internally handled.

 src/gs-updates-section.c |  4 ++--
 src/gs-updates-section.h | 34 +++++++++++++++++-----------------
 2 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/src/gs-updates-section.c b/src/gs-updates-section.c
index d32180e05..fe95710fe 100644
--- a/src/gs-updates-section.c
+++ b/src/gs-updates-section.c
@@ -773,7 +773,7 @@ gs_updates_section_set_is_narrow (GsUpdatesSection *self, gboolean is_narrow)
        g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_IS_NARROW]);
 }
 
-GtkListBox *
+GsUpdatesSection *
 gs_updates_section_new (GsUpdatesSectionKind kind,
                        GsPluginLoader *plugin_loader,
                        GsPage *page)
@@ -791,5 +791,5 @@ gs_updates_section_new (GsUpdatesSectionKind kind,
                                         self, 0);
        }
 
-       return GTK_LIST_BOX (self);
+       return self;
 }
diff --git a/src/gs-updates-section.h b/src/gs-updates-section.h
index d67c4ff53..683b49b20 100644
--- a/src/gs-updates-section.h
+++ b/src/gs-updates-section.h
@@ -29,22 +29,22 @@ typedef enum {
        GS_UPDATES_SECTION_KIND_LAST
 } GsUpdatesSectionKind;
 
-GtkListBox     *gs_updates_section_new                 (GsUpdatesSectionKind    kind,
-                                                        GsPluginLoader         *plugin_loader,
-                                                        GsPage                 *page);
-GsAppList      *gs_updates_section_get_list            (GsUpdatesSection       *self);
-void            gs_updates_section_add_app             (GsUpdatesSection       *self,
-                                                        GsApp                  *app);
-void            gs_updates_section_remove_all          (GsUpdatesSection       *self);
-void            gs_updates_section_set_size_groups     (GsUpdatesSection       *self,
-                                                        GtkSizeGroup           *image,
-                                                        GtkSizeGroup           *name,
-                                                        GtkSizeGroup           *desc,
-                                                        GtkSizeGroup           *button_label,
-                                                        GtkSizeGroup           *button_image,
-                                                        GtkSizeGroup           *header);
-gboolean        gs_updates_section_get_is_narrow       (GsUpdatesSection       *self);
-void            gs_updates_section_set_is_narrow       (GsUpdatesSection       *self,
-                                                        gboolean                is_narrow);
+GsUpdatesSection       *gs_updates_section_new                 (GsUpdatesSectionKind    kind,
+                                                                GsPluginLoader         *plugin_loader,
+                                                                GsPage                 *page);
+GsAppList              *gs_updates_section_get_list            (GsUpdatesSection       *self);
+void                    gs_updates_section_add_app             (GsUpdatesSection       *self,
+                                                                GsApp                  *app);
+void                    gs_updates_section_remove_all          (GsUpdatesSection       *self);
+void                    gs_updates_section_set_size_groups     (GsUpdatesSection       *self,
+                                                                GtkSizeGroup           *image,
+                                                                GtkSizeGroup           *name,
+                                                                GtkSizeGroup           *desc,
+                                                                GtkSizeGroup           *button_label,
+                                                                GtkSizeGroup           *button_image,
+                                                                GtkSizeGroup           *header);
+gboolean                gs_updates_section_get_is_narrow       (GsUpdatesSection       *self);
+void                    gs_updates_section_set_is_narrow       (GsUpdatesSection       *self,
+                                                                gboolean                is_narrow);
 
 G_END_DECLS


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