1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # Variation adding a button to manually check in and out
16 module manual_checkins
20 redef class HomeWindow
28 private var checkin_button
= new Button(parent
=layout_user
, align
=0.0)
30 redef fun on_event
(event
)
34 if event
isa ButtonPressEvent then
35 var sender
= event
.sender
36 if sender
== checkin_button
then
37 if app
.currently_on_location
then
44 private fun update_checkin_text
46 if app
.user
!= null then
47 if app
.currently_on_location
then
48 checkin_button
.text
= "Leaving? Check out".t
50 checkin_button
.text
= "On location? Check in".t
52 checkin_button
.enabled
= true
54 checkin_button
.text
= "Login to check in".t
55 checkin_button
.enabled
= false
65 if window
isa HomeWindow then window
.update_checkin_text
68 redef fun on_check_out
72 if window
isa HomeWindow then window
.update_checkin_text