Repository: godotengine/godot
File: editor/docks/filesystem_dock.cpp (C++)

Code before:
	add_child(make_script_dialog);
	make_script_dialog->connect("script_created", callable_mp(this, &FileSystemDock::_script_or_shader_created));

	make_shader_dialog = memnew(ShaderCreateDialog);
	add_child(make_shader_dialog);
	make_shader_dialog->connect("shader_created", callable_mp(this, &FileSystemDock::_script_or_shader_created));
	make_shader_dialog->connect("shader_include_created", callable_mp(this, &FileSystemDock::_script_or_shader_created));

	new_resource_dialog = memnew(CreateDialog);
	add_child(new_resource_dialog);
	new_resource_dialog->set_base_type("Resource");
	new_resource_dialog->connect("create", callable_mp(this, &FileSystemDock::_resource_created));

	conversion_dialog = memnew(ConfirmationDialog);
	add_child(conversion_dialog);
	conversion_dialog->set_ok_button_text(TTRC("Convert"));
	conversion_dialog->connect(SceneStringName(confirmed), callable_mp(this, &FileSystemDock::_convert_dialog_action));

	move_confirm_dialog = memnew(ConfirmationDialog);
	add_child(move_confirm_dialog);
	move_confirm_dialog->connect(SceneStringName(confirmed), callable_mp(this, &FileSystemDock::_move_confirm));

	unrecognized_ext_dialog = memnew(AcceptDialog);
	add_child(unrecognized_ext_dialog);
	unrecognized_ext_dialog->set_text(TTRC("This file extension is not recognized by the editor.\nIf you want to rename it anyway, use your operating system's file manager.\nAfter renaming to an unknown extension, the file won't be shown in the editor anymore.\nTo make the editor recognize this file extension, add it to one of the lists of extensions in Editor Settings > Docks > FileSystem."));
	unrecognized_ext_dialog->add_button(TTRC("Open Editor Settings"), false, "open_editor_settings_docks_filesystem");
	unrecognized_ext_dialog->connect("custom_action", callable_mp(this, &FileSystemDock::_on_unrecognized_ext_dialog_button_pressed));

	uncollapsed_paths_before_search = Vector<String>();

	tree_update_id = 0;

	history_pos = 0;
	history_max_size = 20;
	history.push_back("res://");

	display_mode = DISPLAY_MODE_TREE_ONLY;
	old_display_mode = DISPLAY_MODE_TREE_ONLY;
	file_list_display_mode = FILE_LIST_DISPLAY_THUMBNAILS;

	ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &FileSystemDock::_project_settings_changed));
	EditorSettings::get_singleton()->connect("_favorites_changed", callable_mp(this, &FileSystemDock::update_all));
	main_scene_path = ResourceUID::ensure_path(GLOBAL_GET("application/run/main_scene"));

	add_resource_tooltip_plugin(memnew(EditorTextureTooltipPlugin));
	add_resource_tooltip_plugin(memnew(EditorAudioStreamTooltipPlugin));
}

FileSystemDock::~FileSystemDock() {
	singleton = nullptr;
}

Review comment (suggestion):
You can do
```suggestion
	Button *settings_button = unrecognized_ext_dialog->add_button(TTRC("Open Editor Settings"), false, "open_editor_settings_docks_filesystem");
```
and connect to its `pressed` signal instead.

Code after:
	make_script_dialog = memnew(ScriptCreateDialog);
	make_script_dialog->set_title(TTRC("Create Script"));
	add_child(make_script_dialog);
	make_script_dialog->connect("script_created", callable_mp(this, &FileSystemDock::_script_or_shader_created));

	make_shader_dialog = memnew(ShaderCreateDialog);
	add_child(make_shader_dialog);
	make_shader_dialog->connect("shader_created", callable_mp(this, &FileSystemDock::_script_or_shader_created));
	make_shader_dialog->connect("shader_include_created", callable_mp(this, &FileSystemDock::_script_or_shader_created));

	new_resource_dialog = memnew(CreateDialog);
	add_child(new_resource_dialog);
	new_resource_dialog->set_base_type("Resource");
	new_resource_dialog->connect("create", callable_mp(this, &FileSystemDock::_resource_created));

	conversion_dialog = memnew(ConfirmationDialog);
	add_child(conversion_dialog);
	conversion_dialog->set_ok_button_text(TTRC("Convert"));
	conversion_dialog->connect(SceneStringName(confirmed), callable_mp(this, &FileSystemDock::_convert_dialog_action));

	move_confirm_dialog = memnew(ConfirmationDialog);
	add_child(move_confirm_dialog);
	move_confirm_dialog->connect(SceneStringName(confirmed), callable_mp(this, &FileSystemDock::_move_confirm));

	unrecognized_ext_dialog = memnew(AcceptDialog);
	add_child(unrecognized_ext_dialog);
	unrecognized_ext_dialog->set_text(TTRC("This file extension is not recognized by the editor.\nIf you want to rename it anyway, use your operating system's file manager.\nAfter renaming to an unknown extension, the file won't be shown in the editor anymore.\nTo make the editor recognize this file extension, add it to one of the lists of extensions in Editor Settings > Docks > FileSystem."));
	Button *settings_button = unrecognized_ext_dialog->add_button(TTRC("Open Editor Settings"), false, "open_editor_settings_docks_filesystem");
	settings_button->connect("pressed", callable_mp(this, &FileSystemDock::_on_open_editor_settings_file_exts));

	uncollapsed_paths_before_search = Vector<String>();

	tree_update_id = 0;

	history_pos = 0;
	history_max_size = 20;
	history.push_back("res://");

	display_mode = DISPLAY_MODE_TREE_ONLY;
	old_display_mode = DISPLAY_MODE_TREE_ONLY;
	file_list_display_mode = FILE_LIST_DISPLAY_THUMBNAILS;

	ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &FileSystemDock::_project_settings_changed));
	EditorSettings::get_singleton()->connect("_favorites_changed", callable_mp(this, &FileSystemDock::update_all));
	main_scene_path = ResourceUID::ensure_path(GLOBAL_GET("application/run/main_scene"));

	add_resource_tooltip_plugin(memnew(EditorTextureTooltipPlugin));
	add_resource_tooltip_plugin(memnew(EditorAudioStreamTooltipPlugin));
}

FileSystemDock::~FileSystemDock() {