void
nm_connection_list_create (NMConnectionList *self, GType ctype, const char *detail)
{
	ConnectionTypeData *types;
	char *error_msg;
	int i;

	g_return_if_fail (NM_IS_CONNECTION_LIST (self));

	types = get_connection_type_list ();
	for (i = 0; types[i].name; i++) {
		if (types[i].setting_type == ctype)
			break;
	}
	if (!types[i].name) {
		if (ctype == NM_TYPE_SETTING_VPN)
			error_msg = g_strdup (_("No VPN plugins are installed."));
		else
			error_msg = g_strdup_printf (_("Don't know how to create '%s' connections"), g_type_name (ctype));

		nm_connection_editor_error (NULL, _("Error creating connection"), error_msg);
		g_free (error_msg);
	} else {
		new_connection_of_type (GTK_WINDOW (self->dialog),
		                        detail,
		                        self->settings,
		                        types[i].new_connection_func,
		                        really_add_connection,
		                        self);
	}
}
Ejemplo n.º 2
0
static void
add_slave (CEPageMaster *master, NewConnectionResultFunc result_func)
{
	CEPageBond *self = CE_PAGE_BOND (master);
	CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);

	if (priv->slave_arptype == ARPHRD_INFINIBAND) {
		new_connection_of_type (priv->toplevel,
		                        NULL,
		                        CE_PAGE (self)->client,
		                        infiniband_connection_new,
		                        result_func,
		                        master);
	} else {
		new_connection_dialog (priv->toplevel,
		                       CE_PAGE (self)->client,
		                       connection_type_filter,
		                       result_func,
		                       master);
	}
}
static void
add_slave (CEPageMaster *master, NewConnectionResultFunc result_func)
{
	CEPageBond *self = CE_PAGE_BOND (master);
	CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);

	if (priv->new_slave_func) {
		new_connection_of_type (priv->toplevel,
		                        NULL,
		                        CE_PAGE (self)->settings,
		                        priv->new_slave_func,
		                        result_func,
		                        master);
	} else {
		new_connection_dialog (priv->toplevel,
		                       CE_PAGE (self)->settings,
		                       connection_type_filter,
		                       result_func,
		                       master);
	}
}