Fix #253: Reset indicator time on NewUser, NewSeat and NewSession events
Fix #253
I don't think this fixes #253 as the TimeManager class is not used for the calendar widget.
I don't think this fixes #253 as the
TimeManagerclass is not used for the calendar widget.
Got it. Will look further to fix a bug
DateTime.Widgets.Grid:
public void set_focus_to_today () { if (grid_range == null) { return; } Gee.List<GLib.DateTime> dates = grid_range.to_list (); for (int i = 0; i < dates.size; i++) { var date = dates[i]; GridDay? day = data[day_hash (date)]; if (day != null && day.name == "today") { day.grab_focus_force (); return; } } }
Think about it, it looks like that's where the problem is. I haven't checked yet, but it seems that you need to abandon the reference to "name=today", and directly access the desired day (via day_hash), and so that the old day is not lost, write it to a variable.
Perhaps tomorrow in my fork I will fix this error, you can do it by analogy.
The problem turned out to be a little wider than I originally thought. There are two ways to solve it, in my opinion:
- the simple way is to reset the carousel when opening the widget. the carousel will be built again and correctly determine the current day
- a difficult way (in my opinion, more correct), to determine the current day at the level of the CalendarView (now you have at the level of CalendarGrid's). This will take much more time, unfortunately, I am not ready to transfer my conjectures to the main branch, but you can take this commit as a vector: https://github.com/Dirli/wingpanel-indicator-datetime/commit/93f5a144dde28e2f9639e81bc61a4a3d03be00ff