Skip to content

Commit

Permalink
Fix sync
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvladus committed Oct 18, 2023
1 parent cd0f8c1 commit df9f0c1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion po/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions src/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit df9f0c1

Please sign in to comment.