[gnome-shell/wip/carlosg/cleanup-gtk-usage: 7/12] st: Add StPolicyType enum



commit dac9e46bec30de5cbe54dccb980d4e98f60e6b62
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 27 13:45:36 2018 +0100

    st: Add StPolicyType enum
    
    In order to replace GTK+'s GtkPolicyType. It's bit-compatible with it, too.
    All callers have been updated to use it.
    
    This is a purely accessory change in terms of X11 Display usage cleanup,
    but helps see better what is left.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/317

 js/gdm/loginDialog.js               |  8 ++--
 js/ui/appDisplay.js                 |  6 +--
 js/ui/calendar.js                   |  3 +-
 js/ui/components/telepathyClient.js |  5 +--
 js/ui/dateMenu.js                   |  3 +-
 js/ui/endSessionDialog.js           |  3 +-
 js/ui/popupMenu.js                  |  6 +--
 js/ui/screenShield.js               |  6 +--
 js/ui/search.js                     |  2 +-
 js/ui/shellMountOperation.js        |  5 +--
 js/ui/status/network.js             |  5 +--
 js/ui/switcherPopup.js              |  3 +-
 src/st/st-scroll-view.c             | 89 +++++++++++++++++++------------------
 src/st/st-scroll-view.h             | 12 ++++-
 14 files changed, 79 insertions(+), 77 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index a22f55e59..db4d2069a 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -161,8 +161,8 @@ Signals.addSignalMethods(UserListItem.prototype);
 var UserList = class {
     constructor() {
         this.actor = new St.ScrollView({ style_class: 'login-dialog-user-list-view'});
-        this.actor.set_policy(Gtk.PolicyType.NEVER,
-                              Gtk.PolicyType.AUTOMATIC);
+        this.actor.set_policy(St.PolicyType.NEVER,
+                              St.PolicyType.AUTOMATIC);
 
         this._box = new St.BoxLayout({ vertical: true,
                                        style_class: 'login-dialog-user-list',
@@ -473,8 +473,8 @@ var LoginDialog = GObject.registerClass({
 
         this._bannerView = new St.ScrollView({ style_class: 'login-dialog-banner-view',
                                                opacity: 0,
-                                               vscrollbar_policy: Gtk.PolicyType.AUTOMATIC,
-                                               hscrollbar_policy: Gtk.PolicyType.NEVER });
+                                               vscrollbar_policy: St.PolicyType.AUTOMATIC,
+                                               hscrollbar_policy: St.PolicyType.NEVER });
         this.add_child(this._bannerView);
 
         let bannerBox = new St.BoxLayout({ vertical: true });
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index b8865cf2c..d888ec305 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -370,8 +370,8 @@ var AllView = class AllView extends BaseAppView {
                                      x_expand:true, y_expand:true });
         this.actor.add_actor(this._scrollView);
 
-        this._scrollView.set_policy(Gtk.PolicyType.NEVER,
-                                    Gtk.PolicyType.EXTERNAL);
+        this._scrollView.set_policy(St.PolicyType.NEVER,
+                                    St.PolicyType.EXTERNAL);
         this._adjustment = this._scrollView.vscroll.adjustment;
 
         this._pageIndicators = new PageIndicators();
@@ -1124,7 +1124,7 @@ var FolderView = class FolderView extends BaseAppView {
         this._grid.x_expand = true;
 
         this.actor = new St.ScrollView({ overlay_scrollbars: true });
-        this.actor.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
+        this.actor.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
         let scrollableContainer = new St.BoxLayout({ vertical: true, reactive: true });
         scrollableContainer.add_actor(this._grid);
         this.actor.add_actor(scrollableContainer);
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index bbe44d022..32a99344c 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -3,7 +3,6 @@
 const Clutter = imports.gi.Clutter;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
-const Gtk = imports.gi.Gtk;
 const St = imports.gi.St;
 const Signals = imports.signals;
 const Shell = imports.gi.Shell;
@@ -1083,7 +1082,7 @@ var CalendarMessageList = class CalendarMessageList {
                                                overlay_scrollbars: true,
                                                x_expand: true, y_expand: true,
                                                x_fill: true, y_fill: true });
-        this._scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
+        this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
         box.add_actor(this._scrollView);
 
         this._clearButton = new St.Button({ style_class: 'message-list-clear-button button',
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index 41b4985f4..86e40b4e7 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -4,7 +4,6 @@ const Clutter = imports.gi.Clutter;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const Signals = imports.signals;
@@ -821,8 +820,8 @@ var ChatNotificationBanner = class extends MessageTray.NotificationBanner {
         });
 
         this._scrollArea = new St.ScrollView({ style_class: 'chat-scrollview vfade',
-                                               vscrollbar_policy: Gtk.PolicyType.AUTOMATIC,
-                                               hscrollbar_policy: Gtk.PolicyType.NEVER,
+                                               vscrollbar_policy: St.PolicyType.AUTOMATIC,
+                                               hscrollbar_policy: St.PolicyType.NEVER,
                                                visible: this.expanded });
         this._contentArea = new St.BoxLayout({ style_class: 'chat-body',
                                                vertical: true });
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index b2e2f0cd8..5d6938960 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -4,7 +4,6 @@ const GLib = imports.gi.GLib;
 const Gio = imports.gi.Gio;
 const GnomeDesktop = imports.gi.GnomeDesktop;
 const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
 const GWeather = imports.gi.GWeather;
 const Mainloop = imports.mainloop;
 const Pango = imports.gi.Pango;
@@ -515,7 +514,7 @@ class DateMenuButton extends PanelMenu.Button {
         this._displaysSection = new St.ScrollView({ style_class: 'datemenu-displays-section vfade',
                                                     x_expand: true, x_fill: true,
                                                     overlay_scrollbars: true });
-        this._displaysSection.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
+        this._displaysSection.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
         vbox.add_actor(this._displaysSection);
 
         let displaysBox = new St.BoxLayout({ vertical: true,
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
index 7c3a02256..1d6efc5ec 100644
--- a/js/ui/endSessionDialog.js
+++ b/js/ui/endSessionDialog.js
@@ -22,7 +22,6 @@ const AccountsService = imports.gi.AccountsService;
 const Clutter = imports.gi.Clutter;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
-const Gtk = imports.gi.Gtk;
 const Pango = imports.gi.Pango;
 const Polkit = imports.gi.Polkit;
 const St = imports.gi.St;
@@ -320,7 +319,7 @@ var EndSessionDialog = class EndSessionDialog extends ModalDialog.ModalDialog {
         messageLayout.add(this._batteryWarning);
 
         this._scrollView = new St.ScrollView({ style_class: 'end-session-dialog-list' });
-        this._scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
+        this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
         this.contentLayout.add(this._scrollView,
                                { x_fill: true,
                                  y_fill: true });
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 02ab885d4..81508bac3 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -914,8 +914,8 @@ var PopupSubMenu = class extends PopupMenuBase {
         // with long content, we make it scrollable - the scrollbar will only take
         // effect if a CSS max-height is set on the top menu.
         this.actor = new St.ScrollView({ style_class: 'popup-sub-menu',
-                                         hscrollbar_policy: Gtk.PolicyType.NEVER,
-                                         vscrollbar_policy: Gtk.PolicyType.NEVER });
+                                         hscrollbar_policy: St.PolicyType.NEVER,
+                                         vscrollbar_policy: St.PolicyType.NEVER });
 
         this.actor.add_actor(this.box);
         this.actor._delegate = this;
@@ -957,7 +957,7 @@ var PopupSubMenu = class extends PopupMenuBase {
         // when we *don't* need it, so turn off the scrollbar when that's true.
         // Dynamic changes in whether we need it aren't handled properly.
         this.actor.vscrollbar_policy =
-            needsScrollbar ? Gtk.PolicyType.AUTOMATIC : Gtk.PolicyType.NEVER;
+            needsScrollbar ? St.PolicyType.AUTOMATIC : St.PolicyType.NEVER;
 
         if (needsScrollbar)
             this.actor.add_style_pseudo_class('scrolled');
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index 5e9eae2e2..829ca51db 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -101,7 +101,7 @@ var NotificationsBox = class {
                                         style_class: 'screen-shield-notifications-container' });
 
         this._scrollView = new St.ScrollView({ x_fill: false, x_align: St.Align.START,
-                                               hscrollbar_policy: Gtk.PolicyType.NEVER });
+                                               hscrollbar_policy: St.PolicyType.NEVER });
         this._notificationBox = new St.BoxLayout({ vertical: true,
                                                    style_class: 'screen-shield-notifications-container' });
         this._scrollView.add_actor(this._notificationBox);
@@ -253,7 +253,7 @@ var NotificationsBox = class {
             // block scrollbars while animating, if they're not needed now
             let boxHeight = this._notificationBox.height;
             if (this._scrollView.height >= boxHeight)
-                this._scrollView.vscrollbar_policy = Gtk.PolicyType.NEVER;
+                this._scrollView.vscrollbar_policy = St.PolicyType.NEVER;
 
             let widget = obj.sourceBox;
             let [, natHeight] = widget.get_preferred_height(-1);
@@ -263,7 +263,7 @@ var NotificationsBox = class {
                                transition: 'easeOutQuad',
                                time: 0.25,
                                onComplete() {
-                                   this._scrollView.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
+                                   this._scrollView.vscrollbar_policy = St.PolicyType.AUTOMATIC;
                                    widget.set_height(-1);
                                },
                                onCompleteScope: this
diff --git a/js/ui/search.js b/js/ui/search.js
index df359ae70..cf1e5d325 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -402,7 +402,7 @@ var SearchResults = class {
                                                y_fill: false,
                                                overlay_scrollbars: true,
                                                style_class: 'search-display vfade' });
-        this._scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
+        this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
         this._scrollView.add_actor(scrollChild);
         let action = new Clutter.PanAction({ interpolate: true });
         action.connect('pan', this._onPan.bind(this));
diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js
index a49e75a8d..4445ae12d 100644
--- a/js/ui/shellMountOperation.js
+++ b/js/ui/shellMountOperation.js
@@ -4,7 +4,6 @@ const Clutter = imports.gi.Clutter;
 const Signals = imports.signals;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
-const Gtk = imports.gi.Gtk;
 const Pango = imports.gi.Pango;
 const St = imports.gi.St;
 const Shell = imports.gi.Shell;
@@ -371,8 +370,8 @@ var ShellProcessesDialog = class extends ModalDialog.ModalDialog {
         this.contentLayout.add(this._content, { x_fill: true, y_fill: false });
 
         let scrollView = new St.ScrollView({ style_class: 'mount-dialog-app-list'});
-        scrollView.set_policy(Gtk.PolicyType.NEVER,
-                              Gtk.PolicyType.AUTOMATIC);
+        scrollView.set_policy(St.PolicyType.NEVER,
+                              St.PolicyType.AUTOMATIC);
         this.contentLayout.add(scrollView,
                                { x_fill: true,
                                  y_fill: true });
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index a2388bd8b..46fc51c09 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -3,7 +3,6 @@ const Clutter = imports.gi.Clutter;
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
 const Gio = imports.gi.Gio;
-const Gtk = imports.gi.Gtk;
 const Mainloop = imports.mainloop;
 const NM = imports.gi.NM;
 const Signals = imports.signals;
@@ -846,8 +845,8 @@ var NMWirelessDialog = class extends ModalDialog.ModalDialog {
         this._scrollView = new St.ScrollView({ style_class: 'nm-dialog-scroll-view' });
         this._scrollView.set_x_expand(true);
         this._scrollView.set_y_expand(true);
-        this._scrollView.set_policy(Gtk.PolicyType.NEVER,
-                                    Gtk.PolicyType.AUTOMATIC);
+        this._scrollView.set_policy(St.PolicyType.NEVER,
+                                    St.PolicyType.AUTOMATIC);
         this._scrollView.add_actor(this._itemBox);
         this._stack.add_child(this._scrollView);
 
diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js
index d941acf22..8e30e892f 100644
--- a/js/ui/switcherPopup.js
+++ b/js/ui/switcherPopup.js
@@ -3,7 +3,6 @@
 const Clutter = imports.gi.Clutter;
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
 const Mainloop = imports.mainloop;
 const Meta = imports.gi.Meta;
 const Shell = imports.gi.Shell;
@@ -365,7 +364,7 @@ var SwitcherList = GObject.registerClass({
 
         this._scrollView = new St.ScrollView({ style_class: 'hfade',
                                                enable_mouse_scrolling: false });
-        this._scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER);
+        this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.NEVER);
 
         this._scrollView.add_actor(this._list);
         this.add_actor(this._scrollView);
diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c
index fc0db1c99..1a83ad445 100644
--- a/src/st/st-scroll-view.c
+++ b/src/st/st-scroll-view.c
@@ -58,6 +58,7 @@
  * detailed description of the considerations involved.
  */
 
+#include "st-enum-types.h"
 #include "st-scroll-view.h"
 #include "st-scroll-bar.h"
 #include "st-scrollable.h"
@@ -82,8 +83,8 @@ struct _StScrollViewPrivate
   StAdjustment *vadjustment;
   ClutterActor *vscroll;
 
-  GtkPolicyType hscrollbar_policy;
-  GtkPolicyType vscrollbar_policy;
+  StPolicyType hscrollbar_policy;
+  StPolicyType vscrollbar_policy;
 
   gfloat        row_size;
   gfloat        column_size;
@@ -372,12 +373,12 @@ st_scroll_view_get_preferred_width (ClutterActor *actor,
 
   switch (priv->hscrollbar_policy)
     {
-    case GTK_POLICY_NEVER:
+    case ST_POLICY_NEVER:
       min_width = child_min_width;
       break;
-    case GTK_POLICY_ALWAYS:
-    case GTK_POLICY_AUTOMATIC:
-    case GTK_POLICY_EXTERNAL:
+    case ST_POLICY_ALWAYS:
+    case ST_POLICY_AUTOMATIC:
+    case ST_POLICY_EXTERNAL:
       /* Should theoretically use the min width of the hscrollbar,
        * but that's not cleanly defined at the moment */
       min_width = 0;
@@ -389,14 +390,14 @@ st_scroll_view_get_preferred_width (ClutterActor *actor,
 
   switch (priv->vscrollbar_policy)
     {
-    case GTK_POLICY_NEVER:
-    case GTK_POLICY_EXTERNAL:
+    case ST_POLICY_NEVER:
+    case ST_POLICY_EXTERNAL:
       account_for_vscrollbar = FALSE;
       break;
-    case GTK_POLICY_ALWAYS:
+    case ST_POLICY_ALWAYS:
       account_for_vscrollbar = !priv->overlay_scrollbars;
       break;
-    case GTK_POLICY_AUTOMATIC:
+    case ST_POLICY_AUTOMATIC:
       /* For automatic scrollbars, we always request space for the vertical
        * scrollbar; we won't know whether we actually need one until our
        * height is assigned in allocate().
@@ -454,11 +455,11 @@ st_scroll_view_get_preferred_height (ClutterActor *actor,
 
   switch (priv->vscrollbar_policy)
     {
-    case GTK_POLICY_NEVER:
-    case GTK_POLICY_EXTERNAL:
+    case ST_POLICY_NEVER:
+    case ST_POLICY_EXTERNAL:
       break;
-    case GTK_POLICY_ALWAYS:
-    case GTK_POLICY_AUTOMATIC:
+    case ST_POLICY_ALWAYS:
+    case ST_POLICY_AUTOMATIC:
       /* We've requested space for the scrollbar, subtract it back out */
       for_width -= sb_width;
       break;
@@ -469,14 +470,14 @@ st_scroll_view_get_preferred_height (ClutterActor *actor,
 
   switch (priv->hscrollbar_policy)
     {
-    case GTK_POLICY_NEVER:
-    case GTK_POLICY_EXTERNAL:
+    case ST_POLICY_NEVER:
+    case ST_POLICY_EXTERNAL:
       account_for_hscrollbar = FALSE;
       break;
-    case GTK_POLICY_ALWAYS:
+    case ST_POLICY_ALWAYS:
       account_for_hscrollbar = !priv->overlay_scrollbars;
       break;
-    case GTK_POLICY_AUTOMATIC:
+    case ST_POLICY_AUTOMATIC:
       /* For automatic scrollbars, we always request space for the horizontal
        * scrollbar; we won't know whether we actually need one until our
        * width is assigned in allocate().
@@ -495,12 +496,12 @@ st_scroll_view_get_preferred_height (ClutterActor *actor,
 
   switch (priv->vscrollbar_policy)
     {
-    case GTK_POLICY_NEVER:
+    case ST_POLICY_NEVER:
       min_height = child_min_height;
       break;
-    case GTK_POLICY_ALWAYS:
-    case GTK_POLICY_AUTOMATIC:
-    case GTK_POLICY_EXTERNAL:
+    case ST_POLICY_ALWAYS:
+    case ST_POLICY_AUTOMATIC:
+    case ST_POLICY_EXTERNAL:
       /* Should theoretically use the min height of the vscrollbar,
        * but that's not cleanly defined at the moment */
       min_height = 0;
@@ -571,9 +572,9 @@ st_scroll_view_allocate (ClutterActor          *actor,
       clutter_actor_get_preferred_width (priv->child, -1,
                                          &child_min_width, NULL);
 
-      if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
+      if (priv->vscrollbar_policy == ST_POLICY_AUTOMATIC)
         {
-          if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
+          if (priv->hscrollbar_policy == ST_POLICY_AUTOMATIC)
             {
               /* Pass one, try without a vertical scrollbar */
               clutter_actor_get_preferred_height (priv->child, avail_width, &child_min_height, NULL);
@@ -591,7 +592,7 @@ st_scroll_view_allocate (ClutterActor          *actor,
             }
           else
             {
-              hscrollbar_visible = priv->hscrollbar_policy == GTK_POLICY_ALWAYS;
+              hscrollbar_visible = priv->hscrollbar_policy == ST_POLICY_ALWAYS;
 
               /* try without a vertical scrollbar */
               clutter_actor_get_preferred_height (priv->child, avail_width, &child_min_height, NULL);
@@ -600,20 +601,20 @@ st_scroll_view_allocate (ClutterActor          *actor,
         }
       else
         {
-          vscrollbar_visible = priv->vscrollbar_policy == GTK_POLICY_ALWAYS;
+          vscrollbar_visible = priv->vscrollbar_policy == ST_POLICY_ALWAYS;
 
-          if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
+          if (priv->hscrollbar_policy == ST_POLICY_AUTOMATIC)
             hscrollbar_visible = child_min_width > avail_height - (vscrollbar_visible ? 0 : sb_width);
           else
-            hscrollbar_visible = priv->hscrollbar_policy == GTK_POLICY_ALWAYS;
+            hscrollbar_visible = priv->hscrollbar_policy == ST_POLICY_ALWAYS;
         }
     }
   else
     {
-      hscrollbar_visible = priv->hscrollbar_policy != GTK_POLICY_NEVER &&
-                           priv->hscrollbar_policy != GTK_POLICY_EXTERNAL;
-      vscrollbar_visible = priv->vscrollbar_policy != GTK_POLICY_NEVER &&
-                           priv->vscrollbar_policy != GTK_POLICY_EXTERNAL;
+      hscrollbar_visible = priv->hscrollbar_policy != ST_POLICY_NEVER &&
+                           priv->hscrollbar_policy != ST_POLICY_EXTERNAL;
+      vscrollbar_visible = priv->vscrollbar_policy != ST_POLICY_NEVER &&
+                           priv->vscrollbar_policy != ST_POLICY_EXTERNAL;
     }
 
   /* Whether or not we show the scrollbars, if the scrollbars are visible
@@ -661,12 +662,12 @@ st_scroll_view_allocate (ClutterActor          *actor,
    * Fold this into the scrollbar sizes to simplify the rest of the
    * computations.
    */
-  if (priv->hscrollbar_policy == GTK_POLICY_NEVER ||
-      priv->hscrollbar_policy == GTK_POLICY_EXTERNAL ||
+  if (priv->hscrollbar_policy == ST_POLICY_NEVER ||
+      priv->hscrollbar_policy == ST_POLICY_EXTERNAL ||
       priv->overlay_scrollbars)
     sb_height = 0;
-  if (priv->vscrollbar_policy == GTK_POLICY_NEVER ||
-      priv->vscrollbar_policy == GTK_POLICY_EXTERNAL ||
+  if (priv->vscrollbar_policy == ST_POLICY_NEVER ||
+      priv->vscrollbar_policy == ST_POLICY_EXTERNAL ||
       priv->overlay_scrollbars)
     sb_width = 0;
 
@@ -828,16 +829,16 @@ st_scroll_view_class_init (StScrollViewClass *klass)
   pspec = g_param_spec_enum ("vscrollbar-policy",
                              "Vertical Scrollbar Policy",
                              "When the vertical scrollbar is displayed",
-                             GTK_TYPE_POLICY_TYPE,
-                             GTK_POLICY_AUTOMATIC,
+                             ST_TYPE_POLICY_TYPE,
+                             ST_POLICY_AUTOMATIC,
                              G_PARAM_READWRITE);
   g_object_class_install_property (object_class, PROP_VSCROLLBAR_POLICY, pspec);
 
   pspec = g_param_spec_enum ("hscrollbar-policy",
                              "Horizontal Scrollbar Policy",
                              "When the horizontal scrollbar is displayed",
-                             GTK_TYPE_POLICY_TYPE,
-                             GTK_POLICY_AUTOMATIC,
+                             ST_TYPE_POLICY_TYPE,
+                             ST_POLICY_AUTOMATIC,
                              G_PARAM_READWRITE);
   g_object_class_install_property (object_class, PROP_HSCROLLBAR_POLICY, pspec);
 
@@ -879,8 +880,8 @@ st_scroll_view_init (StScrollView *self)
 {
   StScrollViewPrivate *priv = self->priv = st_scroll_view_get_instance_private (self);
 
-  priv->hscrollbar_policy = GTK_POLICY_AUTOMATIC;
-  priv->vscrollbar_policy = GTK_POLICY_AUTOMATIC;
+  priv->hscrollbar_policy = ST_POLICY_AUTOMATIC;
+  priv->vscrollbar_policy = ST_POLICY_AUTOMATIC;
 
   priv->hadjustment = g_object_new (ST_TYPE_ADJUSTMENT, NULL);
   priv->hscroll = g_object_new (ST_TYPE_SCROLL_BAR,
@@ -1187,8 +1188,8 @@ st_scroll_view_get_overlay_scrollbars (StScrollView *scroll)
  */
 void
 st_scroll_view_set_policy (StScrollView   *scroll,
-                           GtkPolicyType   hscroll,
-                           GtkPolicyType   vscroll)
+                           StPolicyType    hscroll,
+                           StPolicyType    vscroll)
 {
   StScrollViewPrivate *priv;
 
diff --git a/src/st/st-scroll-view.h b/src/st/st-scroll-view.h
index 35a27a652..2f2c31d6c 100644
--- a/src/st/st-scroll-view.h
+++ b/src/st/st-scroll-view.h
@@ -34,6 +34,14 @@ G_BEGIN_DECLS
 #define ST_TYPE_SCROLL_VIEW            (st_scroll_view_get_type())
 G_DECLARE_FINAL_TYPE (StScrollView, st_scroll_view, ST, SCROLL_VIEW, StBin)
 
+typedef enum
+{
+  ST_POLICY_ALWAYS,
+  ST_POLICY_AUTOMATIC,
+  ST_POLICY_NEVER,
+  ST_POLICY_EXTERNAL,
+} StPolicyType;
+
 typedef struct _StScrollViewPrivate   StScrollViewPrivate;
 
 /**
@@ -72,8 +80,8 @@ void          st_scroll_view_set_overlay_scrollbars (StScrollView *scroll,
 gboolean      st_scroll_view_get_overlay_scrollbars (StScrollView *scroll);
 
 void          st_scroll_view_set_policy          (StScrollView   *scroll,
-                                                  GtkPolicyType   hscroll,
-                                                  GtkPolicyType   vscroll);
+                                                  StPolicyType    hscroll,
+                                                  StPolicyType    vscroll);
 void          st_scroll_view_update_fade_effect  (StScrollView *scroll,
                                                   float vfade_offset,
                                                   float hfade_offset);


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