// File: eiskalteschatten[P]developersnotebook/src/views/ProjectsView.cpp
// Function: delete_project(_GtkWidget*, ProjectsView*)
void delete_project(GtkWidget *widget, ProjectsView *pv) {
    Modal modal("Delete Project", "Are you sure you want to delete the selected project?", pv->main_window);
    int result = modal.show_confirm_modal("Delete Project", "Cancel");

    switch(result) {
        case MODAL_RESPONSE_ACCEPT: {
            int id              = -1;
            gchar *id_char      = nullptr;
            GtkTreeModel *model = nullptr;
            GtkTreeIter tree_iter;

            if (gtk_tree_selection_get_selected(pv->select, &model, &tree_iter)) {
                gtk_tree_model_get(model, &tree_iter, ID_COLUMN, &id_char, -1);
                id = std::stoi(id_char);
                g_free(id_char);
            }

            if (!gtk_tree_selection_get_selected(pv->select, &model, &tree_iter) || id == -1) {
                Modal modal("No Project Selected", "No project was selected to delete.", pv->main_window);
                modal.show_error_modal();
                break;
            }

            ProjectsModel projects_model(id);
            projects_model.delete_single();

            pv->remove_from_list_store(&tree_iter);
        } break;
        default:
        break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3a0, %rsp            # imm = 0x3A0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x81(%rbp), %rdi
movq %rdi, -0x358(%rbp)
callq 0xaf80
movq -0x358(%rbp), %rdx
leaq 0x3d59a(%rip), %rsi     # 0x533ce
leaq -0x80(%rbp), %rdi
callq 0x10f00
jmp 0x15e3f
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x360(%rbp)
callq 0xaf80
movq -0x360(%rbp), %rdx
leaq 0x3d57d(%rip), %rsi     # 0x533dd
leaq -0xb8(%rbp), %rdi
callq 0x10f00
jmp 0x15e6e
movq -0x10(%rbp), %rax
movq (%rax), %rcx
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
callq 0x52050
jmp 0x15e8b
leaq -0xb8(%rbp), %rdi
callq 0xb430
leaq -0xb9(%rbp), %rdi
callq 0xb410
leaq -0x80(%rbp), %rdi
callq 0xb430
leaq -0x81(%rbp), %rdi
callq 0xb410
leaq -0xe1(%rbp), %rdi
movq %rdi, -0x368(%rbp)
callq 0xaf80
movq -0x368(%rbp), %rdx
leaq 0x3d4f5(%rip), %rsi     # 0x533ce
leaq -0xe0(%rbp), %rdi
callq 0x10f00
jmp 0x15ee7
leaq -0x109(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0xaf80
movq -0x370(%rbp), %rdx
leaq 0x3d50b(%rip), %rsi     # 0x53413
leaq -0x108(%rbp), %rdi
callq 0x10f00
jmp 0x15f16
leaq -0x60(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
leaq -0x108(%rbp), %rdx
callq 0x52610
movl %eax, -0x374(%rbp)
jmp 0x15f35
leaq -0x108(%rbp), %rdi
callq 0xb430
leaq -0x109(%rbp), %rdi
callq 0xb410
leaq -0xe0(%rbp), %rdi
callq 0xb430
leaq -0xe1(%rbp), %rdi
callq 0xb410
movl -0x374(%rbp), %eax
movl %eax, -0xc0(%rbp)
movl -0xc0(%rbp), %eax
testl %eax, %eax
je 0x1605f
jmp 0x163bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x15fdf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x15fca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0xb430
leaq -0xb9(%rbp), %rdi
callq 0xb410
leaq -0x80(%rbp), %rdi
callq 0xb430
leaq -0x81(%rbp), %rdi
callq 0xb410
jmp 0x163d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x1604e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x16036
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x108(%rbp), %rdi
callq 0xb430
leaq -0x109(%rbp), %rdi
callq 0xb410
leaq -0xe0(%rbp), %rdi
callq 0xb430
leaq -0xe1(%rbp), %rdi
callq 0xb410
jmp 0x163d0
movl $0xffffffff, -0x110(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x118(%rbp)
movq $0x0, -0x120(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
leaq -0x120(%rbp), %rsi
leaq -0x140(%rbp), %rdx
callq 0xb080
movl %eax, -0x378(%rbp)
jmp 0x160a2
movl -0x378(%rbp), %eax
cmpl $0x0, %eax
je 0x161bf
movq -0x120(%rbp), %rdi
xorl %edx, %edx
movb %dl, %al
leaq -0x140(%rbp), %rsi
leaq -0x118(%rbp), %rcx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0xaab0
jmp 0x160d7
movq -0x118(%rbp), %rax
movq %rax, -0x388(%rbp)
leaq -0x161(%rbp), %rdi
movq %rdi, -0x380(%rbp)
callq 0xaf80
movq -0x388(%rbp), %rsi
movq -0x380(%rbp), %rdx
leaq -0x160(%rbp), %rdi
callq 0x10f00
jmp 0x16114
xorl %eax, %eax
movl %eax, %esi
leaq -0x160(%rbp), %rdi
movl $0xa, %edx
callq 0x18f10
movl %eax, -0x38c(%rbp)
jmp 0x16131
movl -0x38c(%rbp), %eax
movl %eax, -0x110(%rbp)
leaq -0x160(%rbp), %rdi
callq 0xb430
leaq -0x161(%rbp), %rdi
callq 0xb410
movq -0x118(%rbp), %rdi
callq 0xb428
jmp 0x16163
jmp 0x161bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x163d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x161ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x160(%rbp), %rdi
callq 0xb430
leaq -0x161(%rbp), %rdi
callq 0xb410
jmp 0x163d0
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
leaq -0x120(%rbp), %rsi
leaq -0x140(%rbp), %rdx
callq 0xb080
movl %eax, -0x390(%rbp)
jmp 0x161e2
movl -0x390(%rbp), %eax
cmpl $0x0, %eax
je 0x161fa
cmpl $-0x1, -0x110(%rbp)
jne 0x16359
leaq -0x1d9(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0xaf80
movq -0x398(%rbp), %rdx
leaq 0x3d1ff(%rip), %rsi     # 0x5341a
leaq -0x1d8(%rbp), %rdi
callq 0x10f00
jmp 0x16229
leaq -0x201(%rbp), %rdi
movq %rdi, -0x3a0(%rbp)
callq 0xaf80
movq -0x3a0(%rbp), %rdx
leaq 0x3d1e4(%rip), %rsi     # 0x5342e
leaq -0x200(%rbp), %rdi
callq 0x10f00
jmp 0x16258
movq -0x10(%rbp), %rax
movq (%rax), %rcx
leaq -0x1b8(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
leaq -0x200(%rbp), %rdx
callq 0x52050
jmp 0x1627b
leaq -0x200(%rbp), %rdi
callq 0xb430
leaq -0x201(%rbp), %rdi
callq 0xb410
leaq -0x1d8(%rbp), %rdi
callq 0xb430
leaq -0x1d9(%rbp), %rdi
callq 0xb410
leaq -0x1b8(%rbp), %rdi
callq 0x524a0
jmp 0x162b9
leaq -0x1b8(%rbp), %rdi
callq 0x52470
jmp 0x163be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x16328
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x16310
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x200(%rbp), %rdi
callq 0xb430
leaq -0x201(%rbp), %rdi
callq 0xb410
leaq -0x1d8(%rbp), %rdi
callq 0xb430
leaq -0x1d9(%rbp), %rdi
callq 0xb410
jmp 0x163d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x52470
jmp 0x163d0
leaq -0x350(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x4f250
jmp 0x1636e
leaq -0x350(%rbp), %rdi
callq 0x22170
jmp 0x1637c
movq -0x10(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x163f0
jmp 0x1638e
leaq -0x350(%rbp), %rdi
callq 0x4f8a0
jmp 0x163be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x350(%rbp), %rdi
callq 0x4f8a0
jmp 0x163d0
jmp 0x163be
leaq -0x60(%rbp), %rdi
callq 0x52470
addq $0x3a0, %rsp            # imm = 0x3A0
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x52470
movq -0x90(%rbp), %rdi
callq 0xaa00
nopw %cs:(%rax,%rax)