[california/wip/725767-week] Standardize GtkStack transition durations



commit fe2bddd477745b7446ea2f56ae15227f95b9703f
Author: Jim Nelson <jim yorba org>
Date:   Tue May 6 15:17:37 2014 -0700

    Standardize GtkStack transition durations

 src/host/host-main-window.vala       |    2 +-
 src/toolkit/toolkit-deck.vala        |    7 +------
 src/toolkit/toolkit.vala             |   12 ++++++++++++
 src/view/month/month-controller.vala |    5 +----
 src/view/week/week-controller.vala   |    2 +-
 5 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/src/host/host-main-window.vala b/src/host/host-main-window.vala
index 2c3e3eb..dce6443 100644
--- a/src/host/host-main-window.vala
+++ b/src/host/host-main-window.vala
@@ -62,7 +62,7 @@ public class MainWindow : Gtk.ApplicationWindow {
         
         // view stack settings
         view_stack.homogeneous = true;
-        view_stack.transition_duration = 300;
+        view_stack.transition_duration = Toolkit.DEFAULT_STACK_TRANSITION_DURATION_MSEC;
         view_stack.transition_type = Gtk.StackTransitionType.SLIDE_UP_DOWN;
         
         // subscribe before adding so first add to initialize UI
diff --git a/src/toolkit/toolkit-deck.vala b/src/toolkit/toolkit-deck.vala
index c8b6803..e5f8acc 100644
--- a/src/toolkit/toolkit-deck.vala
+++ b/src/toolkit/toolkit-deck.vala
@@ -15,11 +15,6 @@ namespace California.Toolkit {
 
 public class Deck : Gtk.Stack {
     /**
-     * A slightly slower transition duration than default.
-     */
-    public const int DEFAULT_TRANSITION_MSEC = 300;
-    
-    /**
      * @inheritedDoc
      */
     public Gtk.Widget? default_widget { get { return null; } }
@@ -72,7 +67,7 @@ public class Deck : Gtk.Stack {
      */
     public Deck() {
         transition_type = Gtk.StackTransitionType.SLIDE_LEFT_RIGHT;
-        transition_duration = DEFAULT_TRANSITION_MSEC;
+        transition_duration = DEFAULT_STACK_TRANSITION_DURATION_MSEC;
         
         notify["visible-child"].connect(on_child_to_top);
     }
diff --git a/src/toolkit/toolkit.vala b/src/toolkit/toolkit.vala
index c8afc0a..ec84471 100644
--- a/src/toolkit/toolkit.vala
+++ b/src/toolkit/toolkit.vala
@@ -10,6 +10,18 @@
 
 namespace California.Toolkit {
 
+/**
+ * Gtk.Stack transition duration is a little quick for my tastes; this default value seems a bit
+ * smoother to me.
+ */
+public const int DEFAULT_STACK_TRANSITION_DURATION_MSEC = 300;
+
+/**
+ * Gtk.Stack transition duration for slower transitions (where it really needs to be obvious to
+ * user what's going on).
+ */
+public const int SLOW_STACK_TRANSITION_DURATION_MSEC = 500;
+
 private int init_count = 0;
 
 public void init() throws Error {
diff --git a/src/view/month/month-controller.vala b/src/view/month/month-controller.vala
index 2d957bf..c01c24c 100644
--- a/src/view/month/month-controller.vala
+++ b/src/view/month/month-controller.vala
@@ -17,9 +17,6 @@ public class Controller : BaseObject, View.Controllable {
     public const string PROP_MONTH_OF_YEAR = "month-of-year";
     public const string PROP_SHOW_OUTSIDE_MONTH = "show-outside-month";
     
-    // Slower than default to make more apparent to user what's occurring
-    private const int TRANSITION_DURATION_MSEC = 500;
-    
     // number of Grids to keep in GtkStack and cache (in terms of months) ... this should be an
     // even number, as it is halved to determine neighboring months depths
     private const int CACHE_NEIGHBORS_COUNT = 4;
@@ -84,7 +81,7 @@ public class Controller : BaseObject, View.Controllable {
         master_grid.row_spacing = 0;
         master_grid.expand = true;
         
-        stack.transition_duration = TRANSITION_DURATION_MSEC;
+        stack.transition_duration = Toolkit.SLOW_STACK_TRANSITION_DURATION_MSEC;
         
         stack_model = new Toolkit.StackModel<Calendar.MonthOfYear>(stack,
             Toolkit.StackModel.OrderedTransitionType.SLIDE_LEFT_RIGHT, model_presentation,
diff --git a/src/view/week/week-controller.vala b/src/view/week/week-controller.vala
index ae1666b..aed2748 100644
--- a/src/view/week/week-controller.vala
+++ b/src/view/week/week-controller.vala
@@ -56,7 +56,7 @@ public class Controller : BaseObject, View.Controllable {
     public Controller() {
         stack = new MasterStack(this);
         stack.homogeneous = true;
-        stack.transition_duration = 300;
+        stack.transition_duration = Toolkit.SLOW_STACK_TRANSITION_DURATION_MSEC;
         
         stack_model = new Toolkit.StackModel<Calendar.Week>(stack,
             Toolkit.StackModel.OrderedTransitionType.SLIDE_LEFT_RIGHT, model_presentation,


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