[gtk/prop-list: 24/27] Update existing scrollable implementations



commit 6f3520f654830526e04b5a8f596da92e91282c2b
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Dec 16 18:54:12 2019 -0500

    Update existing scrollable implementations
    
    Make all existing scrollable implemenations just
    warn if they see the new policy. We can maybe
    implement it later.

 gtk/gtkiconview.c        | 10 ++++++++++
 gtk/gtkiconviewprivate.h |  4 ++--
 gtk/gtktextview.c        | 14 ++++++++++++--
 gtk/gtktreeview.c        | 14 ++++++++++++--
 gtk/gtkviewport.c        | 14 ++++++++++++--
 5 files changed, 48 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 8c5962d1fa..f9035b854d 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1127,6 +1127,11 @@ gtk_icon_view_set_property (GObject      *object,
       if (icon_view->priv->hscroll_policy != g_value_get_enum (value))
         {
           icon_view->priv->hscroll_policy = g_value_get_enum (value);
+          if (icon_view->priv->hscroll_policy == GTK_SCROLL_FIT)
+            {
+              g_warning ("GTK_SCROLL_FIT not implemented for %s", G_OBJECT_TYPE_NAME (object));
+              icon_view->priv->hscroll_policy = GTK_SCROLL_NATURAL;
+            }
           gtk_widget_queue_resize (GTK_WIDGET (icon_view));
           g_object_notify_by_pspec (object, pspec);
         }
@@ -1135,6 +1140,11 @@ gtk_icon_view_set_property (GObject      *object,
       if (icon_view->priv->vscroll_policy != g_value_get_enum (value))
         {
           icon_view->priv->vscroll_policy = g_value_get_enum (value);
+          if (icon_view->priv->vscroll_policy == GTK_SCROLL_FIT)
+            {
+              g_warning ("GTK_SCROLL_FIT not implemented for %s", G_OBJECT_TYPE_NAME (object));
+              icon_view->priv->vscroll_policy = GTK_SCROLL_NATURAL;
+            }
           gtk_widget_queue_resize (GTK_WIDGET (icon_view));
           g_object_notify_by_pspec (object, pspec);
         }
diff --git a/gtk/gtkiconviewprivate.h b/gtk/gtkiconviewprivate.h
index e507cb55bc..a0dfd0edaa 100644
--- a/gtk/gtkiconviewprivate.h
+++ b/gtk/gtkiconviewprivate.h
@@ -157,8 +157,8 @@ struct _GtkIconViewPrivate
 
   /* GtkScrollablePolicy needs to be checked when
    * driving the scrollable adjustment values */
-  guint hscroll_policy : 1;
-  guint vscroll_policy : 1;
+  guint hscroll_policy : 2;
+  guint vscroll_policy : 2;
 
   guint doing_rubberband : 1;
 
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index d4c43d164d..498318535e 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -274,8 +274,8 @@ struct _GtkTextViewPrivate
 
   /* GtkScrollablePolicy needs to be checked when
    * driving the scrollable adjustment values */
-  guint hscroll_policy : 1;
-  guint vscroll_policy : 1;
+  guint hscroll_policy : 2;
+  guint vscroll_policy : 2;
   guint cursor_handle_dragged : 1;
   guint selection_handle_dragged : 1;
 };
@@ -3734,6 +3734,11 @@ gtk_text_view_set_property (GObject         *object,
       if (priv->hscroll_policy != g_value_get_enum (value))
         {
           priv->hscroll_policy = g_value_get_enum (value);
+          if (priv->hscroll_policy == GTK_SCROLL_FIT)
+            {
+              g_warning ("GTK_SCROLL_FIT not implemented for %s", G_OBJECT_TYPE_NAME (object));
+              priv->hscroll_policy = GTK_SCROLL_NATURAL;
+            }
           gtk_widget_queue_resize (GTK_WIDGET (text_view));
           g_object_notify_by_pspec (object, pspec);
         }
@@ -3743,6 +3748,11 @@ gtk_text_view_set_property (GObject         *object,
       if (priv->vscroll_policy != g_value_get_enum (value))
         {
           priv->vscroll_policy = g_value_get_enum (value);
+          if (priv->vscroll_policy == GTK_SCROLL_FIT)
+            {
+              g_warning ("GTK_SCROLL_FIT not implemented for %s", G_OBJECT_TYPE_NAME (object));
+              priv->vscroll_policy = GTK_SCROLL_NATURAL;
+            }
           gtk_widget_queue_resize (GTK_WIDGET (text_view));
           g_object_notify_by_pspec (object, pspec);
         }
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 76b24c08b4..286dcedf9f 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -558,8 +558,8 @@ struct _GtkTreeViewPrivate
 
   /* GtkScrollablePolicy needs to be checked when
    * driving the scrollable adjustment values */
-  guint hscroll_policy : 1;
-  guint vscroll_policy : 1;
+  guint hscroll_policy : 2;
+  guint vscroll_policy : 2;
 
   /* GtkTreeView flags */
   guint is_list : 1;
@@ -1886,6 +1886,11 @@ gtk_tree_view_set_property (GObject         *object,
       if (tree_view->priv->hscroll_policy != g_value_get_enum (value))
         {
           tree_view->priv->hscroll_policy = g_value_get_enum (value);
+          if (tree_view->priv->hscroll_policy == GTK_SCROLL_FIT)
+            {
+              g_warning ("GTK_SCROLL_FIT not implemented for %s", G_OBJECT_TYPE_NAME (object));
+              tree_view->priv->hscroll_policy = GTK_SCROLL_NATURAL;
+            }
           gtk_widget_queue_resize (GTK_WIDGET (tree_view));
           g_object_notify_by_pspec (object, pspec);
         }
@@ -1894,6 +1899,11 @@ gtk_tree_view_set_property (GObject         *object,
       if (tree_view->priv->vscroll_policy != g_value_get_enum (value))
         {
           tree_view->priv->vscroll_policy = g_value_get_enum (value);
+          if (tree_view->priv->vscroll_policy == GTK_SCROLL_FIT)
+            {
+              g_warning ("GTK_SCROLL_FIT not implemented for %s", G_OBJECT_TYPE_NAME (object));
+              tree_view->priv->vscroll_policy = GTK_SCROLL_NATURAL;
+            }
           gtk_widget_queue_resize (GTK_WIDGET (tree_view));
           g_object_notify_by_pspec (object, pspec);
         }
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 1a6d17deb4..671ed2966e 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -79,8 +79,8 @@ struct _GtkViewportPrivate
 
   /* GtkScrollablePolicy needs to be checked when
    * driving the scrollable adjustment values */
-  guint hscroll_policy : 1;
-  guint vscroll_policy : 1;
+  guint hscroll_policy : 2;
+  guint vscroll_policy : 2;
 };
 
 struct _GtkViewportClass
@@ -287,6 +287,11 @@ gtk_viewport_set_property (GObject         *object,
       if (priv->hscroll_policy != g_value_get_enum (value))
         {
           priv->hscroll_policy = g_value_get_enum (value);
+          if (priv->hscroll_policy == GTK_SCROLL_FIT)
+            {
+              g_warning ("GTK_SCROLL_FIT not implemented for %s", G_OBJECT_TYPE_NAME (object));
+              priv->hscroll_policy = GTK_SCROLL_NATURAL;
+            }
           gtk_widget_queue_resize (GTK_WIDGET (viewport));
           g_object_notify_by_pspec (object, pspec);
         }
@@ -295,6 +300,11 @@ gtk_viewport_set_property (GObject         *object,
       if (priv->vscroll_policy != g_value_get_enum (value))
         {
           priv->vscroll_policy = g_value_get_enum (value);
+          if (priv->vscroll_policy == GTK_SCROLL_FIT)
+            {
+              g_warning ("GTK_SCROLL_FIT not implemented for %s", G_OBJECT_TYPE_NAME (object));
+              priv->hscroll_policy = GTK_SCROLL_NATURAL;
+            }
           gtk_widget_queue_resize (GTK_WIDGET (viewport));
           g_object_notify_by_pspec (object, pspec);
         }


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