// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rsi, %rbx
leaq 0xd0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x19c4d(%rip), %rsi     # 0x2919b
leaq 0x19c54(%rip), %rdx     # 0x291a9
leaq 0xc0(%rsp), %rdi
callq 0xd5b4
leaq 0xb0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x19c35(%rip), %rsi     # 0x291aa
leaq 0x19c63(%rip), %rdx     # 0x291df
leaq 0xa0(%rsp), %rdi
callq 0xd5b4
movq (%rbx), %rcx
leaq 0x108(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0x288f0
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0xf5c6
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x8170
movq 0xc0(%rsp), %rdi
cmpq %r14, %rdi
je 0xf5e3
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x8170
leaq 0x90(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x19ba5(%rip), %rsi     # 0x2919b
leaq 0x19bac(%rip), %rdx     # 0x291a9
leaq 0x80(%rsp), %rdi
callq 0xd5b4
leaq 0x70(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x19bc6(%rip), %rsi     # 0x291e0
leaq 0x19bc5(%rip), %rdx     # 0x291e6
leaq 0x60(%rsp), %rdi
callq 0xd5b4
leaq 0x108(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x28c86
movl %eax, %ebp
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0xf65e
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8170
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0xf67b
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x8170
testl %ebp, %ebp
jne 0xf879
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
xorl %eax, %eax
movq %rax, 0x10(%rsp)
leaq 0x18(%rsp), %rsi
movq %rax, (%rsi)
movq 0x40(%rbx), %rdi
leaq 0xe0(%rsp), %rdx
callq 0x8d90
testl %eax, %eax
je 0xf773
movq 0x18(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
leaq 0x10(%rsp), %rcx
xorl %edx, %edx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %eax, %eax
callq 0x8850
movq 0x10(%rsp), %rsi
leaq 0x158(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xd45e
movq 0x158(%rsp), %r15
callq 0x8cf0
movq %rax, %r14
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x100(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x8b70
cmpq %r15, (%r12)
je 0xf896
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0xf8a2
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0xf8a2
testl %ecx, %ecx
jne 0xf744
movl %ebp, (%r14)
movl %eax, 0x8(%rsp)
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf769
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x8170
movq 0x10(%rsp), %rdi
callq 0x90c8
movq 0x40(%rbx), %rdi
leaq 0x18(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x8d90
testl %eax, %eax
je 0xf7d5
cmpl $-0x1, 0x8(%rsp)
je 0xf7d5
leaq 0x158(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x26864
leaq 0x158(%rsp), %rdi
callq 0x16db0
leaq 0xe0(%rsp), %rsi
movq %rbx, %rdi
callq 0xf9e6
leaq 0x158(%rsp), %rdi
callq 0x26dba
jmp 0xf879
leaq 0x50(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x19a02(%rip), %rsi     # 0x291e7
leaq 0x19a0e(%rip), %rdx     # 0x291fa
leaq 0x40(%rsp), %rdi
callq 0xd5b4
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x199f5(%rip), %rsi     # 0x291fb
leaq 0x19a10(%rip), %rdx     # 0x2921d
leaq 0x20(%rsp), %rdi
callq 0xd5b4
movq (%rbx), %rcx
leaq 0x158(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x288f0
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0xf848
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8170
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0xf85f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8170
leaq 0x158(%rsp), %rdi
callq 0x28b6c
leaq 0x158(%rsp), %rdi
callq 0x28b34
leaq 0x108(%rsp), %rdi
callq 0x28b34
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x19a91(%rip), %rdi     # 0x2932e
callq 0x81d0
leaq 0x19a85(%rip), %rdi     # 0x2932e
callq 0x8770
movq %rax, %rbx
leaq 0x158(%rsp), %rdi
callq 0x28b34
jmp 0xf9d0
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0xf8e2
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8170
jmp 0xf8e2
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0xf9d0
movq 0x50(%rsp), %rsi
jmp 0xf97d
jmp 0xf9cd
jmp 0xf9cd
jmp 0xf9cd
movq %rax, %rbx
leaq 0x158(%rsp), %rdi
callq 0x26dba
jmp 0xf9d0
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0xf92a
movl %ebp, (%r14)
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf9d0
movq 0x168(%rsp), %rsi
jmp 0xf97d
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0xf968
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8170
jmp 0xf968
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0xf9d0
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x8170
jmp 0xf9d0
jmp 0xf9cd
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0xf9ae
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x8170
jmp 0xf9ae
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
cmpq %r14, %rdi
je 0xf9dd
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x8170
jmp 0xf9dd
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x28b34
movq %rbx, %rdi
callq 0x87b0
nop