diff --git a/src/main.py b/src/main.py
index c8cb83d..59001be 100644
--- a/src/main.py
+++ b/src/main.py
@@ -100,8 +100,10 @@ class JnotesApplication(Adw.Application):
def on_calendar_selected(self, container, row):
notes_list = self.props.active_window.notes_list
+ cal_row = self.calendar_set[row.get_index()]
+ self.props.active_window.notes_list_page.set_title(cal_row.displayname)
Sync.get_calenndar_notes(
- self.calendar_set[row.get_index()],
+ cal_row,
lambda calendar: notes_list.set_calendar(calendar)
)
diff --git a/src/note_edit.py b/src/note_edit.py
index 46a3e0a..227b20f 100644
--- a/src/note_edit.py
+++ b/src/note_edit.py
@@ -37,14 +37,12 @@ class NoteEdit(Gtk.ScrolledWindow):
@Gtk.Template.Callback()
def on_summary_changed(self, s):
- pass
summary = s.get_text(s.get_start_iter(), s.get_end_iter(), False)
if self.note.summary != summary:
self.note.set_property("summary", summary)
@Gtk.Template.Callback()
def on_description_changed(self, d):
- pass
description = d.get_text(d.get_start_iter(), d.get_end_iter(), False)
if self.note.description != description:
- self.note.description = description
+ self.note.set_property("description", description)
diff --git a/src/sync.py b/src/sync.py
index d25a940..3fc8146 100644
--- a/src/sync.py
+++ b/src/sync.py
@@ -104,6 +104,10 @@ class Sync():
callback(calendar)
class CalendarSet(Gio.ListStore):
+
+ def __init__(self):
+ super().__init__(item_type=Calendar)
+
def add_calendar(self, calendar):
self.append(calendar)
@@ -111,22 +115,32 @@ class CalendarSet(Gio.ListStore):
self.remove(calendar)
class Calendar(Gio.ListStore):
+ __gtype_name__ = "Calendar"
displayname = None
cal_id = None
def __init__(self, displayname, cal_id):
- super().__init__()
+ super().__init__(item_type=Note)
self.displayname = displayname
self.cal_id = cal_id
def add_note(self, note):
+ # Listen for changes in note to update the list UI
+ note.connect("notify::summary", self.on_notify_note_changed)
+ note.connect("notify::description", self.on_notify_note_changed)
self.append(note)
+ def on_notify_note_changed(self, note, gparamstring):
+ (found, position) = self.find(note)
+ if found:
+ self.items_changed(position, 1, 1)
+
class Note(GObject.GObject):
+ __gtype_name__ = "Note"
uid = None
calendar = None
- summary = None
- description = None
+ summary = GObject.property(type=str)
+ description = GObject.property(type=str)
def __init__(self, calendar, summary, description):
super().__init__()
diff --git a/src/ui/note_edit.ui b/src/ui/note_edit.ui
index 2d40b2f..5dce0b4 100644
--- a/src/ui/note_edit.ui
+++ b/src/ui/note_edit.ui
@@ -5,7 +5,7 @@
"
@@ -38,7 +42,11 @@
12
3
card
-
+
+
+ "
+
+
diff --git a/src/ui/window.ui b/src/ui/window.ui
index 9859356..216d972 100644
--- a/src/ui/window.ui
+++ b/src/ui/window.ui
@@ -35,16 +35,16 @@
-
- Note
+
+ Notes
-
+
1
-
@@ -55,7 +55,7 @@
-
diff --git a/src/window.py b/src/window.py
index edffeff..c4315fe 100644
--- a/src/window.py
+++ b/src/window.py
@@ -26,10 +26,12 @@ class JnotesWindow(Adw.ApplicationWindow):
__gtype_name__ = 'JnotesWindow'
sidebar = Gtk.Template.Child()
+ notes_list_page = Gtk.Template.Child()
notes_list = Gtk.Template.Child()
note_edit = Gtk.Template.Child()
spinner = Gtk.Template.Child()
+
def __init__(self, **kwargs):
super().__init__(**kwargs)