// File: /workspace/github_cpp_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rsi, %rbx
leaq 0xc8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x19c21(%rip), %rsi     # 0x2919b
leaq 0x19c28(%rip), %rdx     # 0x291a9
leaq 0xb8(%rsp), %rdi
callq 0xd588
leaq 0xa8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x19c09(%rip), %rsi     # 0x291aa
leaq 0x19c37(%rip), %rdx     # 0x291df
leaq 0x98(%rsp), %rdi
callq 0xd588
movq (%rbx), %rcx
leaq 0x100(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
leaq 0x98(%rsp), %rdx
callq 0x288c8
movq 0x98(%rsp), %rdi
cmpq %r15, %rdi
je 0xf5f2
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x8170
movq 0xb8(%rsp), %rdi
cmpq %r14, %rdi
je 0xf60f
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x8170
leaq 0x88(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x19b79(%rip), %rsi     # 0x2919b
leaq 0x19b80(%rip), %rdx     # 0x291a9
leaq 0x78(%rsp), %rdi
callq 0xd588
leaq 0x68(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x19b9d(%rip), %rsi     # 0x291e0
leaq 0x19b9c(%rip), %rdx     # 0x291e6
leaq 0x58(%rsp), %rdi
callq 0xd588
leaq 0x100(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x28c5e
movl %eax, %ebp
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0xf684
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x8170
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0xf69e
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x8170
testl %ebp, %ebp
jne 0xf8a7
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
xorl %eax, %eax
movq %rax, 0x8(%rsp)
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movq 0x40(%rbx), %rdi
leaq 0xd8(%rsp), %rdx
callq 0x8d90
testl %eax, %eax
je 0xf79c
movq 0x10(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x8(%rsp), %rcx
xorl %edx, %edx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %eax, %eax
callq 0x8850
movq 0x8(%rsp), %rsi
leaq 0x150(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0xd42c
movq 0x150(%rsp), %r12
callq 0x8cf0
movq %rax, %r15
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0xf8(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movl $0xa, %edx
callq 0x8b70
cmpq %r12, (%r13)
je 0xf8c6
movq %rax, %r14
movslq %r14d, %rax
cmpq %r14, %rax
jne 0xf8d2
movl (%r15), %eax
cmpl $0x22, %eax
je 0xf8d2
testl %eax, %eax
jne 0xf76a
movl %ebp, (%r15)
movl %r14d, 0x4(%rsp)
leaq 0x160(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf790
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x8170
movq 0x8(%rsp), %rdi
callq 0x90c8
jmp 0xf7a2
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq 0x40(%rbx), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x8d90
testl %eax, %eax
je 0xf803
cmpl $-0x1, %r14d
je 0xf803
leaq 0x150(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x2681c
leaq 0x150(%rsp), %rdi
callq 0x16d88
leaq 0xd8(%rsp), %rsi
movq %rbx, %rdi
callq 0xfa12
leaq 0x150(%rsp), %rdi
callq 0x26d92
jmp 0xf8a7
leaq 0x48(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x199d4(%rip), %rsi     # 0x291e7
leaq 0x199e0(%rip), %rdx     # 0x291fa
leaq 0x38(%rsp), %rdi
callq 0xd588
leaq 0x28(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x199c7(%rip), %rsi     # 0x291fb
leaq 0x199e2(%rip), %rdx     # 0x2921d
leaq 0x18(%rsp), %rdi
callq 0xd588
movq (%rbx), %rcx
leaq 0x150(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x288c8
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0xf876
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x8170
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0xf88d
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x8170
leaq 0x150(%rsp), %rdi
callq 0x28b44
leaq 0x150(%rsp), %rdi
callq 0x28b0c
leaq 0x100(%rsp), %rdi
callq 0x28b0c
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x19a61(%rip), %rdi     # 0x2932e
callq 0x81d0
leaq 0x19a55(%rip), %rdi     # 0x2932e
callq 0x8770
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0x28b0c
jmp 0xf9fd
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0xf912
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x8170
jmp 0xf912
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0xf9fd
movq 0x48(%rsp), %rsi
jmp 0xf9aa
jmp 0xf9fa
jmp 0xf9fa
jmp 0xf9fa
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0x26d92
jmp 0xf9fd
movq %rax, %rbx
cmpl $0x0, (%r15)
jne 0xf95a
movl %ebp, (%r15)
leaq 0x160(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf9fd
movq 0x160(%rsp), %rsi
jmp 0xf9aa
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0xf998
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x8170
jmp 0xf998
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0xf9fd
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x8170
jmp 0xf9fd
jmp 0xf9fa
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r15, %rdi
je 0xf9db
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x8170
jmp 0xf9db
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r14, %rdi
je 0xfa0a
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x8170
jmp 0xfa0a
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x28b0c
movq %rbx, %rdi
callq 0x87b0