[gnome-software: 2/29] src: Implement GtkScrollable on several GsPages




commit 3580679621619fa45f8f3652451e050703601c77
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Jan 20 22:46:05 2021 +0000

    src: Implement GtkScrollable on several GsPages
    
    This is one step towards separating `scroll_up` out from
    `gs_page_switch_to()`, so that page state can be made more
    property-based.
    
    All the `GsPage`s which currently handle the `scroll_up` argument now
    implement `GtkScrollable`, which exposes the `GtkAdjustment` used by
    their internal widgetry.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 src/gs-extras-page.c    | 81 ++++++++++++++++++++++++++++++++++++++++++++++++-
 src/gs-installed-page.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++-
 src/gs-overview-page.c  | 81 ++++++++++++++++++++++++++++++++++++++++++++++++-
 src/gs-search-page.c    | 81 ++++++++++++++++++++++++++++++++++++++++++++++++-
 src/gs-updates-page.c   | 81 ++++++++++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 400 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-extras-page.c b/src/gs-extras-page.c
index d5fc9c918..e0b1d827c 100644
--- a/src/gs-extras-page.c
+++ b/src/gs-extras-page.c
@@ -66,7 +66,17 @@ struct _GsExtrasPage
        GtkWidget                *stack;
 };
 
-G_DEFINE_TYPE (GsExtrasPage, gs_extras_page, GS_TYPE_PAGE)
+static void gs_extras_page_scrollable_init (GtkScrollable *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GsExtrasPage, gs_extras_page, GS_TYPE_PAGE,
+                        G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, gs_extras_page_scrollable_init))
+
+typedef enum {
+       PROP_HADJUSTMENT = 1,
+       PROP_VADJUSTMENT,
+       PROP_HSCROLL_POLICY,
+       PROP_VSCROLL_POLICY,
+} GsExtrasPageProperty;
 
 static void
 search_data_free (SearchData *search_data)
@@ -1210,6 +1220,61 @@ gs_extras_page_setup (GsPage *page,
        return TRUE;
 }
 
+static void
+gs_extras_page_get_property (GObject    *object,
+                             guint       prop_id,
+                             GValue     *value,
+                             GParamSpec *pspec)
+{
+       GsExtrasPage *self = GS_EXTRAS_PAGE (object);
+
+       switch ((GsExtrasPageProperty) prop_id) {
+       case PROP_HADJUSTMENT:
+               g_value_set_object (value, gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW 
(self->scrolledwindow)));
+               break;
+       case PROP_VADJUSTMENT:
+               g_value_set_object (value, gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW 
(self->scrolledwindow)));
+               break;
+       case PROP_HSCROLL_POLICY:
+               g_value_set_enum (value, GTK_SCROLL_MINIMUM);
+               break;
+       case PROP_VSCROLL_POLICY:
+               g_value_set_enum (value, GTK_SCROLL_MINIMUM);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+gs_extras_page_set_property (GObject      *object,
+                             guint         prop_id,
+                             const GValue *value,
+                             GParamSpec   *pspec)
+{
+       GsExtrasPage *self = GS_EXTRAS_PAGE (object);
+
+       switch ((GsExtrasPageProperty) prop_id) {
+       case PROP_HADJUSTMENT:
+               gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow),
+                                                    g_value_get_object (value));
+               break;
+       case PROP_VADJUSTMENT:
+               gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow),
+                                                    g_value_get_object (value));
+               break;
+       case PROP_HSCROLL_POLICY:
+       case PROP_VSCROLL_POLICY:
+               /* Not supported yet */
+               g_assert_not_reached ();
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
 static void
 gs_extras_page_dispose (GObject *object)
 {
@@ -1262,11 +1327,19 @@ gs_extras_page_class_init (GsExtrasPageClass *klass)
        GsPageClass *page_class = GS_PAGE_CLASS (klass);
        GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
+       object_class->get_property = gs_extras_page_get_property;
+       object_class->set_property = gs_extras_page_set_property;
        object_class->dispose = gs_extras_page_dispose;
+
        page_class->switch_to = gs_extras_page_switch_to;
        page_class->reload = gs_extras_page_reload;
        page_class->setup = gs_extras_page_setup;
 
+       g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment");
+       g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment");
+       g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy");
+       g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy");
+
        gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Software/gs-extras-page.ui");
 
        gtk_widget_class_bind_template_child (widget_class, GsExtrasPage, label_failed);
@@ -1277,6 +1350,12 @@ gs_extras_page_class_init (GsExtrasPageClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsExtrasPage, stack);
 }
 
+static void
+gs_extras_page_scrollable_init (GtkScrollable *iface)
+{
+       /* Nothing to do here; all defined in properties */
+}
+
 GsExtrasPage *
 gs_extras_page_new (void)
 {
diff --git a/src/gs-installed-page.c b/src/gs-installed-page.c
index 6083da9d0..103da87a4 100644
--- a/src/gs-installed-page.c
+++ b/src/gs-installed-page.c
@@ -41,7 +41,17 @@ struct _GsInstalledPage
        GtkWidget               *stack_install;
 };
 
-G_DEFINE_TYPE (GsInstalledPage, gs_installed_page, GS_TYPE_PAGE)
+static void gs_installed_page_scrollable_init (GtkScrollable *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GsInstalledPage, gs_installed_page, GS_TYPE_PAGE,
+                        G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, gs_installed_page_scrollable_init))
+
+typedef enum {
+       PROP_HADJUSTMENT = 1,
+       PROP_VADJUSTMENT,
+       PROP_HSCROLL_POLICY,
+       PROP_VSCROLL_POLICY,
+} GsInstalledPageProperty;
 
 static void gs_installed_page_pending_apps_changed_cb (GsPluginLoader *plugin_loader,
                                                        GsInstalledPage *self);
@@ -604,6 +614,61 @@ gs_installed_page_setup (GsPage *page,
        return TRUE;
 }
 
+static void
+gs_installed_page_get_property (GObject    *object,
+                                guint       prop_id,
+                                GValue     *value,
+                                GParamSpec *pspec)
+{
+       GsInstalledPage *self = GS_INSTALLED_PAGE (object);
+
+       switch ((GsInstalledPageProperty) prop_id) {
+       case PROP_HADJUSTMENT:
+               g_value_set_object (value, gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW 
(self->scrolledwindow_install)));
+               break;
+       case PROP_VADJUSTMENT:
+               g_value_set_object (value, gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW 
(self->scrolledwindow_install)));
+               break;
+       case PROP_HSCROLL_POLICY:
+               g_value_set_enum (value, GTK_SCROLL_MINIMUM);
+               break;
+       case PROP_VSCROLL_POLICY:
+               g_value_set_enum (value, GTK_SCROLL_MINIMUM);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+gs_installed_page_set_property (GObject      *object,
+                                guint         prop_id,
+                                const GValue *value,
+                                GParamSpec   *pspec)
+{
+       GsInstalledPage *self = GS_INSTALLED_PAGE (object);
+
+       switch ((GsInstalledPageProperty) prop_id) {
+       case PROP_HADJUSTMENT:
+               gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow_install),
+                                                    g_value_get_object (value));
+               break;
+       case PROP_VADJUSTMENT:
+               gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow_install),
+                                                    g_value_get_object (value));
+               break;
+       case PROP_HSCROLL_POLICY:
+       case PROP_VSCROLL_POLICY:
+               /* Not supported yet */
+               g_assert_not_reached ();
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
 static void
 gs_installed_page_dispose (GObject *object)
 {
@@ -629,12 +694,20 @@ gs_installed_page_class_init (GsInstalledPageClass *klass)
        GsPageClass *page_class = GS_PAGE_CLASS (klass);
        GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
+       object_class->get_property = gs_installed_page_get_property;
+       object_class->set_property = gs_installed_page_set_property;
        object_class->dispose = gs_installed_page_dispose;
+
        page_class->app_removed = gs_installed_page_app_removed;
        page_class->switch_to = gs_installed_page_switch_to;
        page_class->reload = gs_installed_page_reload;
        page_class->setup = gs_installed_page_setup;
 
+       g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment");
+       g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment");
+       g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy");
+       g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy");
+
        gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/Software/gs-installed-page.ui");
 
        gtk_widget_class_bind_template_child (widget_class, GsInstalledPage, list_box_install);
@@ -643,6 +716,12 @@ gs_installed_page_class_init (GsInstalledPageClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsInstalledPage, stack_install);
 }
 
+static void
+gs_installed_page_scrollable_init (GtkScrollable *iface)
+{
+       /* Nothing to do here; all defined in properties */
+}
+
 static void
 gs_installed_page_init (GsInstalledPage *self)
 {
diff --git a/src/gs-overview-page.c b/src/gs-overview-page.c
index 0a9500cb2..64d11ad42 100644
--- a/src/gs-overview-page.c
+++ b/src/gs-overview-page.c
@@ -60,7 +60,17 @@ struct _GsOverviewPage
        GtkWidget               *stack_overview;
 };
 
-G_DEFINE_TYPE (GsOverviewPage, gs_overview_page, GS_TYPE_PAGE)
+static void gs_overview_page_scrollable_init (GtkScrollable *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GsOverviewPage, gs_overview_page, GS_TYPE_PAGE,
+                        G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, gs_overview_page_scrollable_init))
+
+typedef enum {
+       PROP_HADJUSTMENT = 1,
+       PROP_VADJUSTMENT,
+       PROP_HSCROLL_POLICY,
+       PROP_VSCROLL_POLICY,
+} GsOverviewPageProperty;
 
 enum {
        SIGNAL_REFRESHED,
@@ -882,6 +892,61 @@ gs_overview_page_init (GsOverviewPage *self)
        self->settings = g_settings_new ("org.gnome.software");
 }
 
+static void
+gs_overview_page_get_property (GObject    *object,
+                               guint       prop_id,
+                               GValue     *value,
+                               GParamSpec *pspec)
+{
+       GsOverviewPage *self = GS_OVERVIEW_PAGE (object);
+
+       switch ((GsOverviewPageProperty) prop_id) {
+       case PROP_HADJUSTMENT:
+               g_value_set_object (value, gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW 
(self->scrolledwindow_overview)));
+               break;
+       case PROP_VADJUSTMENT:
+               g_value_set_object (value, gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW 
(self->scrolledwindow_overview)));
+               break;
+       case PROP_HSCROLL_POLICY:
+               g_value_set_enum (value, GTK_SCROLL_MINIMUM);
+               break;
+       case PROP_VSCROLL_POLICY:
+               g_value_set_enum (value, GTK_SCROLL_MINIMUM);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+gs_overview_page_set_property (GObject      *object,
+                               guint         prop_id,
+                               const GValue *value,
+                               GParamSpec   *pspec)
+{
+       GsOverviewPage *self = GS_OVERVIEW_PAGE (object);
+
+       switch ((GsOverviewPageProperty) prop_id) {
+       case PROP_HADJUSTMENT:
+               gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow_overview),
+                                                    g_value_get_object (value));
+               break;
+       case PROP_VADJUSTMENT:
+               gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow_overview),
+                                                    g_value_get_object (value));
+               break;
+       case PROP_HSCROLL_POLICY:
+       case PROP_VSCROLL_POLICY:
+               /* Not supported yet */
+               g_assert_not_reached ();
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
 static void
 gs_overview_page_dispose (GObject *object)
 {
@@ -905,11 +970,19 @@ gs_overview_page_class_init (GsOverviewPageClass *klass)
        GsPageClass *page_class = GS_PAGE_CLASS (klass);
        GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
+       object_class->get_property = gs_overview_page_get_property;
+       object_class->set_property = gs_overview_page_set_property;
        object_class->dispose = gs_overview_page_dispose;
+
        page_class->switch_to = gs_overview_page_switch_to;
        page_class->reload = gs_overview_page_reload;
        page_class->setup = gs_overview_page_setup;
 
+       g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment");
+       g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment");
+       g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy");
+       g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy");
+
        signals [SIGNAL_REFRESHED] =
                g_signal_new ("refreshed",
                              G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
@@ -934,6 +1007,12 @@ gs_overview_page_class_init (GsOverviewPageClass *klass)
        gtk_widget_class_bind_template_callback (widget_class, featured_carousel_app_clicked_cb);
 }
 
+static void
+gs_overview_page_scrollable_init (GtkScrollable *iface)
+{
+       /* Nothing to do here; all defined in properties */
+}
+
 GsOverviewPage *
 gs_overview_page_new (void)
 {
diff --git a/src/gs-search-page.c b/src/gs-search-page.c
index bcb28e140..c60f3121e 100644
--- a/src/gs-search-page.c
+++ b/src/gs-search-page.c
@@ -44,7 +44,17 @@ struct _GsSearchPage
        GtkWidget               *stack_search;
 };
 
-G_DEFINE_TYPE (GsSearchPage, gs_search_page, GS_TYPE_PAGE)
+static void gs_search_page_scrollable_init (GtkScrollable *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GsSearchPage, gs_search_page, GS_TYPE_PAGE,
+                        G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, gs_search_page_scrollable_init))
+
+typedef enum {
+       PROP_HADJUSTMENT = 1,
+       PROP_VADJUSTMENT,
+       PROP_HSCROLL_POLICY,
+       PROP_VSCROLL_POLICY,
+} GsSearchPageProperty;
 
 static void
 gs_search_page_app_row_clicked_cb (GsAppRow *app_row,
@@ -452,6 +462,61 @@ gs_search_page_setup (GsPage *page,
        return TRUE;
 }
 
+static void
+gs_search_page_get_property (GObject    *object,
+                             guint       prop_id,
+                             GValue     *value,
+                             GParamSpec *pspec)
+{
+       GsSearchPage *self = GS_SEARCH_PAGE (object);
+
+       switch ((GsSearchPageProperty) prop_id) {
+       case PROP_HADJUSTMENT:
+               g_value_set_object (value, gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW 
(self->scrolledwindow_search)));
+               break;
+       case PROP_VADJUSTMENT:
+               g_value_set_object (value, gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW 
(self->scrolledwindow_search)));
+               break;
+       case PROP_HSCROLL_POLICY:
+               g_value_set_enum (value, GTK_SCROLL_MINIMUM);
+               break;
+       case PROP_VSCROLL_POLICY:
+               g_value_set_enum (value, GTK_SCROLL_MINIMUM);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+gs_search_page_set_property (GObject      *object,
+                             guint         prop_id,
+                             const GValue *value,
+                             GParamSpec   *pspec)
+{
+       GsSearchPage *self = GS_SEARCH_PAGE (object);
+
+       switch ((GsSearchPageProperty) prop_id) {
+       case PROP_HADJUSTMENT:
+               gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow_search),
+                                                    g_value_get_object (value));
+               break;
+       case PROP_VADJUSTMENT:
+               gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow_search),
+                                                    g_value_get_object (value));
+               break;
+       case PROP_HSCROLL_POLICY:
+       case PROP_VSCROLL_POLICY:
+               /* Not supported yet */
+               g_assert_not_reached ();
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
 static void
 gs_search_page_dispose (GObject *object)
 {
@@ -488,8 +553,11 @@ gs_search_page_class_init (GsSearchPageClass *klass)
        GsPageClass *page_class = GS_PAGE_CLASS (klass);
        GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
+       object_class->get_property = gs_search_page_get_property;
+       object_class->set_property = gs_search_page_set_property;
        object_class->dispose = gs_search_page_dispose;
        object_class->finalize = gs_search_page_finalize;
+
        page_class->app_installed = gs_search_page_app_installed;
        page_class->app_removed = gs_search_page_app_removed;
        page_class->switch_to = gs_search_page_switch_to;
@@ -497,6 +565,11 @@ gs_search_page_class_init (GsSearchPageClass *klass)
        page_class->reload = gs_search_page_reload;
        page_class->setup = gs_search_page_setup;
 
+       g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment");
+       g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment");
+       g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy");
+       g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy");
+
        gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Software/gs-search-page.ui");
 
        gtk_widget_class_bind_template_child (widget_class, GsSearchPage, list_box_search);
@@ -505,6 +578,12 @@ gs_search_page_class_init (GsSearchPageClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsSearchPage, stack_search);
 }
 
+static void
+gs_search_page_scrollable_init (GtkScrollable *iface)
+{
+       /* Nothing to do here; all defined in properties */
+}
+
 static void
 gs_search_page_init (GsSearchPage *self)
 {
diff --git a/src/gs-updates-page.c b/src/gs-updates-page.c
index 01399820b..6a16852c2 100644
--- a/src/gs-updates-page.c
+++ b/src/gs-updates-page.c
@@ -93,7 +93,17 @@ enum {
        COLUMN_UPDATE_LAST
 };
 
-G_DEFINE_TYPE (GsUpdatesPage, gs_updates_page, GS_TYPE_PAGE)
+static void gs_updates_page_scrollable_init (GtkScrollable *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GsUpdatesPage, gs_updates_page, GS_TYPE_PAGE,
+                        G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, gs_updates_page_scrollable_init))
+
+typedef enum {
+       PROP_HADJUSTMENT = 1,
+       PROP_VADJUSTMENT,
+       PROP_HSCROLL_POLICY,
+       PROP_VSCROLL_POLICY,
+} GsUpdatesPageProperty;
 
 static void
 gs_updates_page_set_flag (GsUpdatesPage *self, GsUpdatesPageFlags flag)
@@ -1294,6 +1304,61 @@ gs_updates_page_setup (GsPage *page,
        return TRUE;
 }
 
+static void
+gs_updates_page_get_property (GObject    *object,
+                              guint       prop_id,
+                              GValue     *value,
+                              GParamSpec *pspec)
+{
+       GsUpdatesPage *self = GS_UPDATES_PAGE (object);
+
+       switch ((GsUpdatesPageProperty) prop_id) {
+       case PROP_HADJUSTMENT:
+               g_value_set_object (value, gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW 
(self->scrolledwindow_updates)));
+               break;
+       case PROP_VADJUSTMENT:
+               g_value_set_object (value, gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW 
(self->scrolledwindow_updates)));
+               break;
+       case PROP_HSCROLL_POLICY:
+               g_value_set_enum (value, GTK_SCROLL_MINIMUM);
+               break;
+       case PROP_VSCROLL_POLICY:
+               g_value_set_enum (value, GTK_SCROLL_MINIMUM);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+gs_updates_page_set_property (GObject      *object,
+                              guint         prop_id,
+                              const GValue *value,
+                              GParamSpec   *pspec)
+{
+       GsUpdatesPage *self = GS_UPDATES_PAGE (object);
+
+       switch ((GsUpdatesPageProperty) prop_id) {
+       case PROP_HADJUSTMENT:
+               gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow_updates),
+                                                    g_value_get_object (value));
+               break;
+       case PROP_VADJUSTMENT:
+               gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow_updates),
+                                                    g_value_get_object (value));
+               break;
+       case PROP_HSCROLL_POLICY:
+       case PROP_VSCROLL_POLICY:
+               /* Not supported yet */
+               g_assert_not_reached ();
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
 static void
 gs_updates_page_dispose (GObject *object)
 {
@@ -1333,11 +1398,19 @@ gs_updates_page_class_init (GsUpdatesPageClass *klass)
        GsPageClass *page_class = GS_PAGE_CLASS (klass);
        GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
+       object_class->get_property = gs_updates_page_get_property;
+       object_class->set_property = gs_updates_page_set_property;
        object_class->dispose = gs_updates_page_dispose;
+
        page_class->switch_to = gs_updates_page_switch_to;
        page_class->reload = gs_updates_page_reload;
        page_class->setup = gs_updates_page_setup;
 
+       g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment");
+       g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment");
+       g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy");
+       g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy");
+
        gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Software/gs-updates-page.ui");
 
        gtk_widget_class_bind_template_child (widget_class, GsUpdatesPage, updates_box);
@@ -1354,6 +1427,12 @@ gs_updates_page_class_init (GsUpdatesPageClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsUpdatesPage, label_end_of_life);
 }
 
+static void
+gs_updates_page_scrollable_init (GtkScrollable *iface)
+{
+       /* Nothing to do here; all defined in properties */
+}
+
 static void
 gs_updates_page_init (GsUpdatesPage *self)
 {


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