Repository: godotengine/godot
File: editor/scene/connections_dialog.cpp (C++)

Code before:
	undo_redo->add_do_method(SceneTreeDock::get_singleton()->get_tree_editor(), "update_tree");
	undo_redo->add_undo_method(SceneTreeDock::get_singleton()->get_tree_editor(), "update_tree");

	undo_redo->commit_action();
}

void ConnectionsDock::_tree_item_selected() {
	TreeItem *item = tree->get_selected();
	if (item && _get_item_type(*item) == TREE_ITEM_TYPE_SIGNAL) {
		connect_button->set_text(TTR("Connect..."));
		connect_button->set_button_icon(get_editor_theme_icon(SNAME("Instance")));
		connect_button->set_disabled(false);
	} else if (item && _get_item_type(*item) == TREE_ITEM_TYPE_CONNECTION) {
		connect_button->set_text(TTR("Disconnect"));
		connect_button->set_button_icon(get_editor_theme_icon(SNAME("Unlinked")));

		Object::Connection connection = item->get_metadata(0);
		connect_button->set_disabled(_is_connection_inherited(connection));
	} else {
		connect_button->set_text(TTR("Connect..."));
		connect_button->set_button_icon(get_editor_theme_icon(SNAME("Instance")));
		connect_button->set_disabled(true);
	}

	if (is_editing_resource) {
		connect_button->set_text(TTR("Connect..."));
		connect_button->set_button_icon(get_editor_theme_icon(SNAME("Unlinked")));
		connect_button->set_disabled(true);
	}
}

void ConnectionsDock::_tree_item_activated() { // "Activation" on double-click.
	TreeItem *item = tree->get_selected();
	if (!item) {
		return;
	}

	if (_get_item_type(*item) == TREE_ITEM_TYPE_SIGNAL) {
		_open_connection_dialog(*item);
	} else if (_get_item_type(*item) == TREE_ITEM_TYPE_CONNECTION) {
		_go_to_method(*item);
	}
}

ConnectionsDock::TreeItemType ConnectionsDock::_get_item_type(const TreeItem &p_item) const {
	if (&p_item == tree->get_root()) {
		return TREE_ITEM_TYPE_ROOT;
	} else if (p_item.get_parent() == tree->get_root()) {
		return TREE_ITEM_TYPE_CLASS;
	} else if (p_item.get_parent()->get_parent() == tree->get_root()) {
		return TREE_ITEM_TYPE_SIGNAL;

Review comment (suggestion):
```suggestion
		connect_button->set_text(TTRC("Connect..."));
```

Code after:
		Connection connection = child->get_metadata(0);
		if (!_is_connection_inherited(connection)) {
			ConnectDialog::ConnectionData cd = connection;
			undo_redo->add_do_method(selected_object, "disconnect", cd.signal, cd.get_callable());
			undo_redo->add_undo_method(selected_object, "connect", cd.signal, cd.get_callable(), cd.flags);
		}
		child = child->get_next();
	}

	undo_redo->add_do_method(this, "update_tree");
	undo_redo->add_undo_method(this, "update_tree");
	undo_redo->add_do_method(SceneTreeDock::get_singleton()->get_tree_editor(), "update_tree");
	undo_redo->add_undo_method(SceneTreeDock::get_singleton()->get_tree_editor(), "update_tree");

	undo_redo->commit_action();
}

void ConnectionsDock::_tree_item_selected() {
	TreeItem *item = tree->get_selected();
	if (item && _get_item_type(*item) == TREE_ITEM_TYPE_SIGNAL) {
		connect_button->set_text(TTR("Connect..."));
		connect_button->set_button_icon(get_editor_theme_icon(SNAME("Instance")));
		connect_button->set_disabled(is_editing_resource);
	} else if (item && _get_item_type(*item) == TREE_ITEM_TYPE_CONNECTION) {
		connect_button->set_text(TTR("Disconnect"));
		connect_button->set_button_icon(get_editor_theme_icon(SNAME("Unlinked")));

		Object::Connection connection = item->get_metadata(0);
		connect_button->set_disabled(_is_connection_inherited(connection));
	} else {
		connect_button->set_text(TTR("Connect..."));
		connect_button->set_button_icon(get_editor_theme_icon(SNAME("Instance")));
		connect_button->set_disabled(true);
	}
}

void ConnectionsDock::_tree_item_activated() { // "Activation" on double-click.
	TreeItem *item = tree->get_selected();
	if (!item) {
		return;
	}

	if (_get_item_type(*item) == TREE_ITEM_TYPE_SIGNAL) {
		_open_connection_dialog(*item);
	} else if (_get_item_type(*item) == TREE_ITEM_TYPE_CONNECTION) {
		_go_to_method(*item);
	}
}

ConnectionsDock::TreeItemType ConnectionsDock::_get_item_type(const TreeItem &p_item) const {
	if (&p_item == tree->get_root()) {