[gtk/wip/otte/listview: 71/71] columnview: Implement GtkScrollable
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/listview: 71/71] columnview: Implement GtkScrollable
- Date: Thu, 31 Oct 2019 03:49:59 +0000 (UTC)
commit 23fcb02ef4ba0a4bf2ac799195f91d0128a67114
Author: Benjamin Otte <otte redhat com>
Date: Thu Oct 31 03:16:45 2019 +0100
columnview: Implement GtkScrollable
Just forward it to the listview for now.
gtk/gtkcolumnview.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 55 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkcolumnview.c b/gtk/gtkcolumnview.c
index d6a06096aa..46952397bf 100644
--- a/gtk/gtkcolumnview.c
+++ b/gtk/gtkcolumnview.c
@@ -29,6 +29,7 @@
#include "gtklistview.h"
#include "gtkmain.h"
#include "gtkprivate.h"
+#include "gtkscrollable.h"
#include "gtkwidgetprivate.h"
/**
@@ -60,8 +61,12 @@ enum
{
PROP_0,
PROP_COLUMNS,
+ PROP_HADJUSTMENT,
+ PROP_HSCROLL_POLICY,
PROP_MODEL,
PROP_SHOW_SEPARATORS,
+ PROP_VADJUSTMENT,
+ PROP_VSCROLL_POLICY,
N_PROPS
};
@@ -106,7 +111,8 @@ gtk_column_view_buildable_interface_init (GtkBuildableIface *iface)
}
G_DEFINE_TYPE_WITH_CODE (GtkColumnView, gtk_column_view, GTK_TYPE_WIDGET,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_column_view_buildable_interface_init))
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, gtk_column_view_buildable_interface_init)
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
static GParamSpec *properties[N_PROPS] = { NULL, };
static guint signals[LAST_SIGNAL] = { 0 };
@@ -185,6 +191,14 @@ gtk_column_view_get_property (GObject *object,
g_value_set_object (value, self->columns);
break;
+ case PROP_HADJUSTMENT:
+ g_value_set_object (value, gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (self->listview)));
+ break;
+
+ case PROP_HSCROLL_POLICY:
+ g_value_set_enum (value, gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (self->listview)));
+ break;
+
case PROP_MODEL:
g_value_set_object (value, gtk_list_view_get_model (self->listview));
break;
@@ -193,6 +207,14 @@ gtk_column_view_get_property (GObject *object,
g_value_set_boolean (value, gtk_list_view_get_show_separators (self->listview));
break;
+ case PROP_VADJUSTMENT:
+ g_value_set_object (value, gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (self->listview)));
+ break;
+
+ case PROP_VSCROLL_POLICY:
+ g_value_set_enum (value, gtk_scrollable_get_vscroll_policy (GTK_SCROLLABLE (self->listview)));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -209,6 +231,14 @@ gtk_column_view_set_property (GObject *object,
switch (property_id)
{
+ case PROP_HADJUSTMENT:
+ gtk_scrollable_set_hadjustment (GTK_SCROLLABLE (self->listview), g_value_get_object (value));
+ break;
+
+ case PROP_HSCROLL_POLICY:
+ gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (self->listview), g_value_get_enum (value));
+ break;
+
case PROP_MODEL:
gtk_column_view_set_model (self, g_value_get_object (value));
break;
@@ -217,6 +247,14 @@ gtk_column_view_set_property (GObject *object,
gtk_column_view_set_show_separators (self, g_value_get_boolean (value));
break;
+ case PROP_VADJUSTMENT:
+ gtk_scrollable_set_vadjustment (GTK_SCROLLABLE (self->listview), g_value_get_object (value));
+ break;
+
+ case PROP_VSCROLL_POLICY:
+ gtk_scrollable_set_vscroll_policy (GTK_SCROLLABLE (self->listview), g_value_get_enum (value));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -228,12 +266,28 @@ gtk_column_view_class_init (GtkColumnViewClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ gpointer iface;
gobject_class->dispose = gtk_column_view_dispose;
gobject_class->finalize = gtk_column_view_finalize;
gobject_class->get_property = gtk_column_view_get_property;
gobject_class->set_property = gtk_column_view_set_property;
+ /* GtkScrollable implementation */
+ iface = g_type_default_interface_peek (GTK_TYPE_SCROLLABLE);
+ properties[PROP_HADJUSTMENT] =
+ g_param_spec_override ("hadjustment",
+ g_object_interface_find_property (iface, "hadjustment"));
+ properties[PROP_HSCROLL_POLICY] =
+ g_param_spec_override ("hscroll-policy",
+ g_object_interface_find_property (iface, "hscroll-policy"));
+ properties[PROP_VADJUSTMENT] =
+ g_param_spec_override ("vadjustment",
+ g_object_interface_find_property (iface, "vadjustment"));
+ properties[PROP_VSCROLL_POLICY] =
+ g_param_spec_override ("vscroll-policy",
+ g_object_interface_find_property (iface, "vscroll-policy"));
+
/**
* GtkColumnView:columns:
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]