diff --git a/po/it.po b/po/it.po index 5a813647..f80013bd 100644 --- a/po/it.po +++ b/po/it.po @@ -242,7 +242,7 @@ msgstr "Password" #: src/res/ui/preferences.ui:132 msgid "Calendar Name (\"Errands\" by Default)" -msgstr "Nome del calendario (\""Errands\" per impostazione predefinita)" +msgstr "Nome del calendario (\"Errands\" per impostazione predefinita)" #: src/res/ui/preferences.ui:141 msgid "Token" diff --git a/src/preferences.py b/src/preferences.py index 3022886c..36995769 100644 --- a/src/preferences.py +++ b/src/preferences.py @@ -3,7 +3,7 @@ from gi.repository import Adw, Gtk from .sync import Sync -from .utils import GSettings, UserData +from .utils import GSettings, UserData, UserDataTask @Gtk.Template(resource_path="/io/github/mrvladus/Errands/preferences.ui") @@ -59,9 +59,9 @@ def setup_sync(self): @Gtk.Template.Callback() def on_cal_name_changed(self, *args): data: dict = UserData.get() - for task in data["tasks"]: - task["synced_caldav"] = False + data["tasks"] = [task for task in data["tasks"] if not task["synced_caldav"]] UserData.set(data) + Sync.sync(True) @Gtk.Template.Callback() def on_sync_provider_selected(self, *_) -> None: diff --git a/src/window.py b/src/window.py index 27dd3d46..36318379 100644 --- a/src/window.py +++ b/src/window.py @@ -279,6 +279,12 @@ def update_ui(self) -> None: t.add_task(task) tasks_ids = [task.task["id"] for task in self.get_all_tasks()] + # Remove tasks + ids = [t["id"] for t in UserData.get()["tasks"]] + for task in self.get_all_tasks(): + if task.task["id"] not in ids: + task.purge() + def trash_add(self, task: dict) -> None: """ Add item to trash