Skip to content

Commit

Permalink
Add subject deletion that doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 committed Nov 29, 2023
1 parent 8367087 commit ac32b73
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/edit-subject-dialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ public class EditSubjectDialog : Adw.Window {
case "0":
break;
case "1":
subject = null;
accept = true;
this.close ();
subject.deleted = true;
close ();
break;
}
});
Expand Down
1 change: 1 addition & 0 deletions src/subject.vala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ public class Subject : Object{
public string name { get; set; }
public ListStore grades_model { get; construct; }
public HashTable<string, Category> categories_by_name { get; construct; }
public bool deleted { get; set; default = false; }

public Subject (string name) {
Object (name: name);
Expand Down
6 changes: 6 additions & 0 deletions src/window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ public class Window : Adw.ApplicationWindow {
subject_manager.read_data ();

foreach (var subject in subject_manager.subjects.get_values ()) {
subject.notify["deleted"].connect (() => {
if (subject.deleted) {
//TODO: Remove without crash
}
warning ("removed");
});
stack.add_titled (new SubjectPage (subject), subject.name, subject.name);
}

Expand Down

0 comments on commit ac32b73

Please sign in to comment.