Skip to content

Commit c895e50

Browse files
committed
Refresh headerbar title on page save
1 parent 03c3023 commit c895e50

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/Widgets/Editor.vala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ public class ENotes.Editor : Gtk.Box {
269269
current_page.data = this.get_text ();
270270
current_page.html_cache = "";
271271
PageTable.get_instance ().save_page (current_page);
272+
ViewEditStack.get_instance ().refresh_headerbar_title ();
272273
}
273274
}
274275
}

src/Widgets/ViewEditStack.vala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class ENotes.ViewEditStack : Gtk.Overlay {
4444
private Gtk.Stack stack;
4545

4646
public ENotes.Page? current_page {get; private set; default = null;}
47+
public ENotes.Notebook? current_notebook {get; private set; default = null;}
4748

4849
public static ViewEditStack get_instance () {
4950
if (instance == null) {
@@ -76,14 +77,13 @@ public class ENotes.ViewEditStack : Gtk.Overlay {
7677
return;
7778
}
7879
}
79-
80+
8081
editor.save_file ();
8182
current_page = PageTable.get_instance ().get_page (page.id);
83+
current_notebook = ENotes.NotebookTable.get_instance().load_notebook_data (current_page.notebook_id);
84+
8285
editor.current_page = current_page;
8386
viewer.load_page (current_page);
84-
85-
var ntbook = ENotes.NotebookTable.get_instance().load_notebook_data(current_page.notebook_id);
86-
ENotes.Headerbar.get_instance ().set_title (page.name, ntbook.name);
8787

8888
bookmark_button.set_page (current_page);
8989
page_set (current_page);
@@ -93,6 +93,11 @@ public class ENotes.ViewEditStack : Gtk.Overlay {
9393
}
9494

9595
editor.set_sensitive (!Trash.get_instance ().is_page_trashed (page));
96+
refresh_headerbar_title ();
97+
}
98+
99+
public void refresh_headerbar_title () {
100+
ENotes.Headerbar.get_instance ().set_title (current_page.name, current_notebook.name);
96101
}
97102

98103
public void show_edit () {

0 commit comments

Comments
 (0)