[gnome-shell] [StScrollView] Fix incorrect assertion, defaults, and test case



commit fb9fd6925a34d2cd7f5f899457ec7d38a780f077
Author: Colin Walters <walters verbum org>
Date:   Mon Feb 22 11:51:54 2010 -0500

    [StScrollView] Fix incorrect assertion, defaults, and test case
    
    The type we don't currently handle is _ALWAYS, my original use
    of g_return_if_fail was wrong.
    
    Also the default should be AUTOMATIC in the properties, not ALWAYS.
    
    Finally the test case was still using the incorrect St.ScrollPolicy.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=609015

 src/st/st-scroll-view.c        |    6 +++---
 tests/interactive/scrolling.js |    7 ++++---
 2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c
index 1394784..bf46347 100644
--- a/src/st/st-scroll-view.c
+++ b/src/st/st-scroll-view.c
@@ -504,7 +504,7 @@ st_scroll_view_class_init (StScrollViewClass *klass)
                              "Vertical Scrollbar Policy",
                              "When the vertical scrollbar is displayed",
                              GTK_TYPE_POLICY_TYPE,
-                             GTK_POLICY_ALWAYS,
+                             GTK_POLICY_AUTOMATIC,
                              G_PARAM_READWRITE);
   g_object_class_install_property (object_class, PROP_VSCROLLBAR_POLICY, pspec);
 
@@ -512,7 +512,7 @@ st_scroll_view_class_init (StScrollViewClass *klass)
                              "Horizontal Scrollbar Policy",
                              "When the horizontal scrollbar is displayed",
                              GTK_TYPE_POLICY_TYPE,
-                             GTK_POLICY_ALWAYS,
+                             GTK_POLICY_AUTOMATIC,
                              G_PARAM_READWRITE);
   g_object_class_install_property (object_class, PROP_HSCROLLBAR_POLICY, pspec);
 
@@ -918,7 +918,7 @@ st_scroll_view_set_policy (StScrollView   *scroll,
   StAdjustment *hadjust, *vadjust;
 
   g_return_if_fail (ST_IS_SCROLL_VIEW (scroll));
-  g_return_if_fail (hscroll == GTK_POLICY_ALWAYS || vscroll == GTK_POLICY_ALWAYS);
+  g_return_if_fail (hscroll != GTK_POLICY_ALWAYS && vscroll != GTK_POLICY_ALWAYS);
 
   priv = ST_SCROLL_VIEW (scroll)->priv;
 
diff --git a/tests/interactive/scrolling.js b/tests/interactive/scrolling.js
index 8867ed0..fe28b9e 100644
--- a/tests/interactive/scrolling.js
+++ b/tests/interactive/scrolling.js
@@ -1,6 +1,7 @@
 /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
 
 const Clutter = imports.gi.Clutter;
+const Gtk = imports.gi.Gtk;
 const St = imports.gi.St;
 
 const UI = imports.testcommon.ui;
@@ -22,9 +23,9 @@ let v = new St.ScrollView();
 vbox.add(v, { expand: true });
 
 toggle.connect('notify::checked', function () {
-    v.set_policy(toggle.checked ? St.ScrollPolicy.AUTOMATIC
-                                : St.ScrollPolicy.NEVER,
-                 St.ScrollPolicy.AUTOMATIC);
+    v.set_policy(toggle.checked ? Gtk.PolicyType.AUTOMATIC
+                                : Gtk.PolicyType.NEVER,
+                 Gtk.PolicyType.AUTOMATIC);
 });
 
 let b = new St.BoxLayout({ vertical: true,



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