← Back to team overview

elementaryart team mailing list archive

[Merge] lp:~niels-avonds/granite/timepicker into lp:granite

 

Niels Avonds has proposed merging lp:~niels-avonds/granite/timepicker into lp:granite.

Requested reviews:
  elementary Pantheon team (elementary-pantheon)
Related bugs:
  Bug #944451 in Granite: "Build error using timepicker"
  https://bugs.launchpad.net/granite/+bug/944451

For more details, see:
https://code.launchpad.net/~niels-avonds/granite/timepicker/+merge/99226

Fixed bug #944451
-- 
https://code.launchpad.net/~niels-avonds/granite/timepicker/+merge/99226
Your team elementaryart (old) is subscribed to branch lp:granite.
=== modified file 'lib/Widgets/TimePicker.vala'
--- lib/Widgets/TimePicker.vala	2011-11-08 21:45:07 +0000
+++ lib/Widgets/TimePicker.vala	2012-03-25 21:59:17 +0000
@@ -24,7 +24,7 @@
     
         public string format { get; construct; default = _("%l:%M %p"); }
         
-        public DateTime time { get; protected set; }
+        public DateTime time { get; set; }
         
         construct {
             
@@ -34,19 +34,28 @@
         
             // SpinButton properties
             can_focus = false;
-            editable = false; // user can't edit the entry directly
             adjustment = new Adjustment (starting_time, 0, 1440, 30, 300, 0);
             climb_rate = 0;
             digits = 0;
             numeric = false; // so the text can be set
             wrap = true;
+            notify["time"].connect (on_time_changed);
         }
 
         public TimePicker.with_format (string format) {
             Object (format: format);
         }
+
+        void on_time_changed () {
+            text = time.format (format);
+        }
         
-        protected override bool output () {        
+        protected override int input (out double new_value) {
+            new_value = this.value;
+            return 1;
+        }
+
+        protected override bool output () {    
             set_minutes ((int) this.value);
             return true;           
         }
@@ -55,7 +64,6 @@
         
             time = time.add_full (0, 0, 0, minutes / 60 - time.get_hour (),
                     minutes % 60 - time.get_minute (), 0);
-            text = time.format (format);
         }
         
     }


Follow ups