// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/classes/gui/dialogs/file/filedlg_gtk.cpp
// Function: smooth::GUI::Dialogs::FileSelection::ShowDialog()
const Error &S::GUI::Dialogs::FileSelection::ShowDialog()
{
	/* Create file chooser dialog.
	 */
	GtkWidget	*dialog = NULL;

	if (mode == SFM_OPEN)
	{
		dialog = gtk_file_chooser_dialog_new(caption, NULL, GTK_FILE_CHOOSER_ACTION_OPEN,
						     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
						     GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
						     NULL);

		if (flags & SFD_ALLOWMULTISELECT) gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), True);
	}
	else if (mode == SFM_SAVE)
	{
		dialog = gtk_file_chooser_dialog_new(caption, NULL, GTK_FILE_CHOOSER_ACTION_SAVE,
						     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
						     GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
						     NULL);

		if (flags & SFD_CONFIRMOVERWRITE) gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), True);
	}

	if (defPath != NIL) gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), defPath);
	if (defFile != NIL) gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), defFile);

	/* Add file filters.
	 */
	for (int i = 0; i < filters.Length(); i++)
	{
		GtkFileFilter		*filter = gtk_file_filter_new();
		const Array<String>	&patterns = filters.GetNth(i).Explode(";");

		foreach (const String &pattern, patterns)
		{
			/* Make patterns case insensitive.
			 */
			String	 converted = pattern.Head(		     pattern.FindLast(".") + 1);
			String	 extension = pattern.Tail(pattern.Length() - pattern.FindLast(".") - 1).ToLower();

			for (Int i = 0; i < extension.Length(); i++)
			{
				if (extension[i] >= 'a' && extension[i] <= 'z') converted.Append("[").Append(extension.SubString(i, 1)).Append(extension.SubString(i, 1).ToUpper()).Append("]");
				else						converted.Append(extension.SubString(i, 1));
			}

			gtk_file_filter_add_pattern(filter, converted.Trim());
		}

		gtk_file_filter_set_name(filter, filterNames.GetNth(i));

		gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
	}

	/* Run dialog and check result.
	 */
	if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
	{
		GSList	*list = gtk_file_chooser_get_uris(GTK_FILE_CHOOSER(dialog));
		GSList	*current = list;

		while (current != NULL)
		{
			String	 file = String((char *) current->data).Replace("file://", NIL);

			for (Int i = 0; i < file.Length() - 2; i++)
			{
				if (file[i] == '%')
				{
					file[i] = (Int64) Number::FromHexString(file.SubString(i + 1, 2));
					file = file.Head(i + 1).Append(file.Tail(file.Length() - i - 3));
				}
			}

			file.ImportFrom("UTF-8", file.ConvertTo("ISO-8859-1"));
			files.Add(file);

			g_free(current->data);

			current = current->next;
		}

		g_slist_free(list);
	}
	else
	{
		error = Error();
	}

	gtk_widget_destroy(dialog);

	/* Wait for GTK to finish pending actions.
	 */
	while (gtk_events_pending()) gtk_main_iteration();

	return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdi, 0x10(%rsp)
movzwl 0x6f2(%rdi), %eax
cmpl $0x1, %eax
je 0xb5781
testl %eax, %eax
jne 0xb57e9
movq 0x10(%rsp), %rbx
leaq 0x5b8(%rbx), %rdi
callq 0x598d0
andq $0x0, 0x8(%rsp)
movl $0xfffffffd, (%rsp)     # imm = 0xFFFFFFFD
leaq 0x4d58b(%rip), %rcx     # 0x102cc6
leaq 0x4d596(%rip), %r9      # 0x102cd8
pushq $-0x6
popq %r8
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x59c90
movq %rax, %r15
testb $0x2, 0x6f1(%rbx)
je 0xb57ec
callq 0x58a30
movq %r15, %rdi
movq %rax, %rsi
callq 0x56450
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x57200
jmp 0xb57ec
movq 0x10(%rsp), %rbx
leaq 0x5b8(%rbx), %rdi
callq 0x598d0
andq $0x0, 0x8(%rsp)
movl $0xfffffffd, (%rsp)     # imm = 0xFFFFFFFD
leaq 0x4d520(%rip), %rcx     # 0x102cc6
leaq 0x4d534(%rip), %r9      # 0x102ce1
pushq $0x1
popq %rdx
pushq $-0x6
popq %r8
movq %rax, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x59c90
movq %rax, %r15
testb $0x2, 0x6f0(%rbx)
je 0xb57ec
callq 0x58a30
movq %r15, %rdi
movq %rax, %rsi
callq 0x56450
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x56030
jmp 0xb57ec
xorl %r15d, %r15d
movq 0x10(%rsp), %rax
leaq 0x710(%rax), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x57d40
testb %al, %al
je 0xb582c
callq 0x58a30
movq %r15, %rdi
movq %rax, %rsi
callq 0x56450
movq %rax, %r14
movq %rbx, %rdi
callq 0x598d0
movq %r14, %rdi
movq %rax, %rsi
callq 0x57270
movq 0x10(%rsp), %rax
leaq 0x728(%rax), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x57d40
testb %al, %al
je 0xb586c
callq 0x58a30
movq %r15, %rdi
movq %rax, %rsi
callq 0x56450
movq %rax, %r14
movq %rbx, %rdi
callq 0x598d0
movq %r14, %rdi
movq %rax, %rsi
callq 0x56370
movq %r15, 0x28(%rsp)
movq 0x10(%rsp), %rax
leaq 0x640(%rax), %rcx
movq %rcx, 0x88(%rsp)
addq $0x5e8, %rax            # imm = 0x5E8
movq %rax, 0x80(%rsp)
leaq 0x50(%rsp), %r12
leaq 0x68(%rsp), %rbp
xorl %r14d, %r14d
movq 0x10(%rsp), %rax
cmpl 0x648(%rax), %r14d
jge 0xb5ba1
callq 0x579f0
movq %rax, 0x18(%rsp)
movq 0x88(%rsp), %rdi
movl %r14d, 0x20(%rsp)
movl %r14d, %esi
callq 0x6bb28
movq %rax, %r14
leaq 0x38(%rsp), %r15
movq %r15, %rdi
leaq 0x3193b(%rip), %rsi     # 0xe721e
callq 0x58c40
leaq 0xd8(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x591a0
movq %r15, %rdi
callq 0x5a588
pushq $-0x1
popq %rsi
movl 0xe0(%rsp), %eax
decl %eax
cmpl %eax, %esi
jge 0xb5b42
incl %esi
leaq 0xd8(%rsp), %rdi
movl %esi, 0x30(%rsp)
callq 0x64d9c
movq %rax, %r14
movq %r12, %rdi
leaq 0x63a7c(%rip), %rsi     # 0x1193b3
callq 0x58c40
movq %r14, %rdi
movq %r12, %rsi
callq 0x59d50
incl %eax
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0x59e40
movq %r12, %rdi
callq 0x5a588
movq %r14, %rdi
callq 0x58370
movl %eax, %r15d
leaq 0x90(%rsp), %r13
movq %r13, %rdi
leaq 0x63a36(%rip), %rsi     # 0x1193b3
callq 0x58c40
movq %r14, %rdi
movq %r13, %rsi
callq 0x59d50
notl %eax
addl %eax, %r15d
movq %rbp, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq 0x59220
movq %r12, %rdi
movq %rbp, %rsi
callq 0x59320
movq %rbp, %rdi
callq 0x5a588
leaq 0x90(%rsp), %rdi
callq 0x5a588
xorl %r14d, %r14d
movq %r12, %rdi
callq 0x58370
cmpl %eax, %r14d
jge 0xb5afd
movq %r12, %rdi
movl %r14d, %esi
callq 0x59cc0
cmpl $0x61, (%rax)
jl 0xb5acf
movq %r12, %rdi
movl %r14d, %esi
callq 0x59cc0
cmpl $0x7a, (%rax)
jg 0xb5acf
movq %rbp, %rdi
leaq 0x2d836(%rip), %rsi     # 0xe323c
callq 0x58c40
leaq 0x38(%rsp), %rdi
movq %rbp, %rsi
callq 0x573e0
movq %rax, %r15
leaq 0x90(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movl %r14d, %edx
pushq $0x1
popq %rcx
callq 0x5a2c0
movq %r15, %rdi
movq %r13, %rsi
callq 0x573e0
movq %rax, %r15
leaq 0xa8(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movl %r14d, %edx
pushq $0x1
popq %rcx
callq 0x5a2c0
leaq 0xc0(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x56e80
movq %r15, %rdi
movq %rbx, %rsi
callq 0x573e0
movq %rax, %r15
leaq 0x130(%rsp), %rbx
movq %rbx, %rdi
leaq 0x56e80(%rip), %rsi     # 0x10c90e
callq 0x58c40
movq %r15, %rdi
movq %rbx, %rsi
callq 0x573e0
movq %rbx, %rdi
callq 0x5a588
leaq 0xc0(%rsp), %rdi
callq 0x5a588
leaq 0xa8(%rsp), %rdi
callq 0x5a588
leaq 0x90(%rsp), %rdi
callq 0x5a588
jmp 0xb5aed
movq %rbp, %rdi
movq %r12, %rsi
movl %r14d, %edx
pushq $0x1
popq %rcx
callq 0x5a2c0
leaq 0x38(%rsp), %rdi
movq %rbp, %rsi
callq 0x573e0
movq %rbp, %rdi
callq 0x5a588
incl %r14d
jmp 0xb59c3
movq %rbp, %rdi
leaq 0x38(%rsp), %rsi
callq 0x5a200
movq %rbp, %rdi
callq 0x598d0
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x58470
movq %rbp, %rdi
callq 0x5a588
movq %r12, %rdi
callq 0x5a588
leaq 0x38(%rsp), %rdi
callq 0x5a588
movl 0x30(%rsp), %esi
jmp 0xb5906
movq 0x80(%rsp), %rdi
movl 0x20(%rsp), %esi
callq 0x6bb28
movq %rax, %rdi
callq 0x598d0
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x59650
callq 0x58a30
movq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x56450
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0x576e0
leaq 0xd8(%rsp), %rdi
callq 0x64988
movl 0x20(%rsp), %r14d
incl %r14d
jmp 0xb58a0
callq 0x58390
movq 0x28(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x56450
movq %rax, %rdi
callq 0x56ce0
cmpl $-0x3, %eax
jne 0xb5dbc
callq 0x58a30
movq %rbx, %rdi
movq %rax, %rsi
callq 0x56450
movq %rax, %rdi
callq 0x56250
movq %rax, %rcx
movq 0x10(%rsp), %rax
addq $0x698, %rax            # imm = 0x698
movq %rax, 0x18(%rsp)
leaq 0x38(%rsp), %r15
leaq 0xd8(%rsp), %rbx
movq %rcx, 0x20(%rsp)
movq %rcx, %r12
testq %r12, %r12
je 0xb5dca
movq (%r12), %rsi
movq %r15, %rdi
callq 0x58c40
leaq 0x50(%rsp), %rdi
leaq 0x4d0c2(%rip), %rsi     # 0x102cea
callq 0x58c40
leaq 0x68(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x5a180
movq %r15, %rdi
leaq 0x50(%rsp), %rsi
movq %r14, %rdx
callq 0x58800
movq %rbx, %rdi
movq %rax, %rsi
callq 0x58280
leaq 0x68(%rsp), %rdi
callq 0x5a588
leaq 0x50(%rsp), %rdi
callq 0x5a588
movq %r15, %rdi
callq 0x5a588
xorl %r14d, %r14d
movq %r12, 0x30(%rsp)
movq %rbx, %rdi
callq 0x58370
addl $-0x2, %eax
cmpl %eax, %r14d
jge 0xb5d73
movq %rbx, %rdi
movl %r14d, %esi
callq 0x59cc0
cmpl $0x25, (%rax)
jne 0xb5d6b
leal 0x1(%r14), %edx
movq %r15, %rdi
movq %rbx, %rsi
movl %edx, %ebp
pushq $0x2
popq %rcx
callq 0x5a2c0
leaq 0x50(%rsp), %r12
movq %r12, %rdi
movq %r15, %r13
movq %r15, %rsi
callq 0x56ab0
movq %r12, %rdi
callq 0x5a280
leaq 0xd8(%rsp), %rbx
movq %rax, %r12
movq %rbx, %rdi
movl %r14d, %esi
callq 0x59cc0
movl %r12d, (%rax)
leaq 0x50(%rsp), %r12
movq %r12, %rdi
callq 0x5a0b0
movq %r13, %rdi
callq 0x5a588
movq %r13, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x59e40
movq %rbx, %rdi
callq 0x58370
subl %r14d, %eax
addl $-0x3, %eax
movq %r12, %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0x59220
movq %r13, %rdi
movq %r12, %rsi
callq 0x573e0
leaq 0xd8(%rsp), %rdi
movq %rax, %rsi
callq 0x56630
movq %r12, %rdi
callq 0x5a588
movq %r13, %rdi
callq 0x5a588
movl %ebp, %r14d
movq 0x30(%rsp), %r12
movq %r13, %r15
leaq 0xd8(%rsp), %rbx
jmp 0xb5c7b
incl %r14d
jmp 0xb5c7b
movq %rbx, %rdi
leaq 0x4bdc4(%rip), %rsi     # 0x101b41
callq 0x58b90
movq %rbx, %rdi
leaq 0x4c43a(%rip), %rsi     # 0x1021c6
movq %rax, %rdx
callq 0x57ab0
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0x64dee
movq (%r12), %rdi
callq 0x56bc0
movq 0x8(%r12), %r12
movq %rbx, %rdi
callq 0x5a588
jmp 0xb5c07
movq 0x10(%rsp), %rax
orl $-0x1, 0x5e0(%rax)
jmp 0xb5dd9
movq 0x20(%rsp), %rdi
callq 0x58490
movq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x565c0
callq 0x597f0
testl %eax, %eax
je 0xb5df1
callq 0x56060
jmp 0xb5de1
movq 0x10(%rsp), %rax
addq $0x5d8, %rax            # imm = 0x5D8
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb5e2e
movq %rax, %rbx
jmp 0xb5e22
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x5a588
leaq 0x50(%rsp), %rdi
callq 0x5a588
jmp 0xb5e31
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
jmp 0xb5ea2
jmp 0xb5e97
jmp 0xb5e8f
jmp 0xb5e97
jmp 0xb5e60
jmp 0xb5e97
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x5a588
jmp 0xb5e63
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x5a0b0
jmp 0xb5e63
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x5a588
jmp 0xb5e9a
jmp 0xb5f28
jmp 0xb5e8f
jmp 0xb5e87
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x5a588
jmp 0xb5eb1
movq %rax, %rbx
jmp 0xb5f35
movq %rax, %rbx
jmp 0xb5f3f
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x5a588
jmp 0xb5f4c
jmp 0xb5f17
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
jmp 0xb5f30
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
jmp 0xb5f3a
jmp 0xb5f17
jmp 0xb5f28
jmp 0xb5f05
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0x5a588
jmp 0xb5ee9
jmp 0xb5ee6
jmp 0xb5f17
movq %rax, %rbx
jmp 0xb5ef6
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x5a588
leaq 0xa8(%rsp), %rdi
callq 0x5a588
jmp 0xb5f08
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x5a588
jmp 0xb5f1a
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x5a588
jmp 0xb5f2b
jmp 0xb5f28
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x5a588
leaq 0x38(%rsp), %rdi
callq 0x5a588
leaq 0xd8(%rsp), %rdi
callq 0x64988
movq %rbx, %rdi
callq 0x58260