Skip to content

Commit

Permalink
Only add new page on empty notebooks when creating the notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip-Scott committed Dec 4, 2018
1 parent c895e50 commit 05244d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/Services/Notebook.vala
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ public class ENotes.NotebookTable : DatabaseTable {

var last = last_insert_row ();
var notebook = load_notebook_data (last);
PageTable.get_instance ().new_page (notebook.id);

notebook_added (notebook);

return last;
Expand All @@ -198,12 +200,12 @@ public class ENotes.NotebookTable : DatabaseTable {

return stmt.column_text (0);
}

public void move_notebook (Notebook notebook, Notebook? parent_notebook) {
var stmt = create_stmt ("UPDATE Notebook SET parent_id = ? WHERE id = ?");
bind_int (stmt, 1, parent_notebook != null ? parent_notebook.id : 0);
bind_int (stmt, 2, notebook.id);

stmt.step ();
}

Expand Down
6 changes: 0 additions & 6 deletions src/Widgets/PagesList.vala
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,6 @@ public class ENotes.PagesList : Gtk.Box {
new_page (page);
}

bool has_pages = added_pages.size > 0;

if (!has_pages) {
new_blank_page ();
}

toolbar.set_sensitive (true);
minus_button.set_sensitive (false);

Expand Down

0 comments on commit 05244d4

Please sign in to comment.