update
This commit is contained in:
@@ -5,6 +5,7 @@ import Pango from 'gi://Pango';
|
||||
import St from 'gi://St';
|
||||
|
||||
import * as D from './dates.js';
|
||||
import {readJson, writeJson} from './store.js';
|
||||
import {editTodo, todoClick, todoRow, todoTitle} from './todos.js';
|
||||
import {button, contextMenu, dropdown, openDatePicker, openTimePicker, Popover, scrollBox, textButton} from './widgets.js';
|
||||
|
||||
@@ -160,7 +161,9 @@ class CalendarPanel extends St.BoxLayout {
|
||||
_init(store) {
|
||||
super._init({vertical: true, style_class: 'desktop-panel calendar', reactive: true, x_expand: true, y_expand: false});
|
||||
this._store = store;
|
||||
this._view = 'month';
|
||||
// Die zuletzt gewählte Ansicht bleibt über Neustarts erhalten
|
||||
this._settingsPath = GLib.build_filenamev([store.dir, 'settings.json']);
|
||||
this._view = readJson(this._settingsPath, {}).calendarView ?? 'month';
|
||||
this._cursor = D.today();
|
||||
this._drag = null;
|
||||
this._slots = [];
|
||||
@@ -185,7 +188,7 @@ class CalendarPanel extends St.BoxLayout {
|
||||
header.add_child(new Clutter.Actor({x_expand: true}));
|
||||
|
||||
this._viewButtons = {};
|
||||
for (const [view, text] of [['month', 'Monat'], ['week', 'Woche'], ['day', 'Tag']]) {
|
||||
for (const [view, text] of [['day', 'Tag'], ['week', 'Woche'], ['month', 'Monat']]) {
|
||||
const b = button(text, () => this._go(this._cursor, view), 'desktop-button view-button');
|
||||
this._viewButtons[view] = b;
|
||||
header.add_child(b);
|
||||
@@ -195,6 +198,8 @@ class CalendarPanel extends St.BoxLayout {
|
||||
|
||||
_go(date, view = this._view) {
|
||||
this._cursor = date;
|
||||
if (view !== this._view)
|
||||
writeJson(this._settingsPath, {...readJson(this._settingsPath, {}), calendarView: view});
|
||||
this._view = view;
|
||||
this._render();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user